Compare commits

..

8 Commits

Author SHA1 Message Date
79bea9002e Added index to requested_at amendments 2025-10-24 09:27:34 +11:00
0e72fa1355 Added Metrics model 2025-10-23 18:04:48 +11:00
db89056468 Added BeforeSave 2025-10-23 17:02:52 +11:00
567470372f askilhdfjasdgf 2025-10-23 16:59:06 +11:00
674f7dd5f5 asdnfujklsreghyiujlfhhsdrlgkif 2025-10-23 16:55:59 +11:00
f50333d223 Made user nullable in participant 2025-10-23 16:44:56 +11:00
a7f73eb96a Fixed typo 2025-10-23 16:32:18 +11:00
57b4791a4a Fixed typo 2025-10-23 16:30:35 +11:00
4 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 {
@@ -23,10 +25,18 @@ type DBParticipant struct {
WrapupRequired *bool
Sessions []DBSession `gorm:"foreignKey:ParticipantId;references:Id"`
Calls []DBCall `gorm:"foreignKey:ParticipantId;referencesId`
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
}