Compare commits

...

5 Commits

5 changed files with 37 additions and 4 deletions

View File

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

View File

@ -105,3 +105,26 @@ 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;foreignKey"`
Id string `json:"id" gorm:"primaryKey"`
Name string `json:"name"`
Email string `json:"email"`
State string `json:"state"`

View File

@ -2,6 +2,8 @@ package models
import (
"time"
"gorm.io/gorm"
)
type DBParticipant struct {
@ -30,3 +32,11 @@ type DBParticipant struct {
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 _, seg := range sess.Segments {
for idx, 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", session.Id, seg.SegmentType),
Id: fmt.Sprintf("%s_%s_%d", session.Id, seg.SegmentType, idx),
Conference: seg.Conference,
DisconnectType: seg.DisconnectType,
Q850ResponseCodes: string(q850ResponseCodesBytes),