Compare commits

..

No commits in common. "main" and "v1.0.49" have entirely different histories.

5 changed files with 6 additions and 39 deletions

View File

@ -8,7 +8,7 @@ type DBAmendment struct {
AmendmentColumn string
AmendmentValue string
Requestor string
RequestedAt time.Time `gorm:"index"`
RequestedAt time.Time
Sequence string
}

View File

@ -105,26 +105,3 @@ type Breakdown struct {
func (Breakdown) TableName() string {
return "gc_call_breakdown"
}
type CallMetrics struct {
ClientConversationId string `gorm:"primaryKey;index"`
//
TotalDuration int
TotalClientResponseDuration int
TotalSystemDuration int
TotalTalkDuration int
//
AgentAlertDuration int
AgentHoldDuration int
AgentTalkDuration int
//
SearchingDuration int
ConfigurationDuration int
QueueDuration int
//
Metadata *string `gorm:"type:json"`
}
func (CallMetrics) TableName() string {
return "gc_call_metrics"
}

View File

@ -192,7 +192,7 @@ type UsersQuery struct {
}
type GCUser struct {
Id string `json:"id" gorm:"primaryKey"`
Id string `json:"id" gorm:"primaryKey;foreignKey"`
Name string `json:"name"`
Email string `json:"email"`
State string `json:"state"`

View File

@ -2,8 +2,6 @@ package models
import (
"time"
"gorm.io/gorm"
)
type DBParticipant struct {
@ -25,18 +23,10 @@ type DBParticipant struct {
WrapupRequired *bool
Sessions []DBSession `gorm:"foreignKey:ParticipantId;references:Id"`
Calls []DBCall `gorm:"foreignKey:ParticipantId;references:Id"`
User *GCUser `gorm:"foreignKey:UserId;references:Id"`
Calls []DBCall `gorm:"foreignKey:ParticipantId;references:Id`
User GCUser `gorm:"foreignKey:UserId;references:Id`
}
func (DBParticipant) TableName() string {
return "gc_participants"
}
func (p *DBParticipant) BeforeSave(tx *gorm.DB) error {
// Convert empty string to nil
if p.UserId != nil && *p.UserId == "" {
p.UserId = nil
}
return nil
}

View File

@ -95,7 +95,7 @@ func ExtractWithoutAttributes(base models.AnalyticsConversationWithoutAttributes
}
sessions = append(sessions, session)
for idx, seg := range sess.Segments {
for _, seg := range sess.Segments {
segmentStart, err := time.Parse(time.RFC3339, seg.SegmentStart)
if err != nil {
@ -113,7 +113,7 @@ func ExtractWithoutAttributes(base models.AnalyticsConversationWithoutAttributes
}
segment := models.DBSegment{
Id: fmt.Sprintf("%s_%s_%d", session.Id, seg.SegmentType, idx),
Id: fmt.Sprintf("%s_%s", session.Id, seg.SegmentType),
Conference: seg.Conference,
DisconnectType: seg.DisconnectType,
Q850ResponseCodes: string(q850ResponseCodesBytes),