Compare commits

..

25 Commits

Author SHA1 Message Date
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
7737b8b4d2 Added tablename for GC users 2025-10-23 16:01:34 +11:00
2f2388caab Added Calls to Participant via FK. Added User to Participant via FK. 2025-10-23 15:54:46 +11:00
ff0f873dd8 Added GCUser 2025-10-23 15:41:44 +11:00
7bf15cce48 Added UserId to participant model 2025-10-19 19:16:41 +11:00
643c5cc695 Changed breakdown to use a composite PK 2025-10-19 15:16:45 +11:00
8b2b31ef3f Added call breakdown model 2025-10-19 15:02:27 +11:00
423383a2f8 Update invoice_config rounding_function from bool -> str 2025-10-10 09:51:00 +11:00
00b946fc8d Fixed issue setting startTime as endTime 2025-09-18 15:07:09 +10:00
4e5f789671 Made conversation start/end optional 2025-09-18 10:19:07 +10:00
ee521aa378 Added conv start/end to call stats 2025-09-18 10:05:14 +10:00
c106209130 Added sub-status to callstats 2025-09-11 14:05:25 +10:00
4c6eed2e47 Split out interpreter_count in CallStats model 2025-09-11 09:23:03 +10:00
0f4223e873 Added status column to base_call 2025-09-10 10:41:59 +10:00
faca742f5f Made CallStat's SearchStartTime optional 2025-08-19 11:22:27 +10:00
3823096f4c Added SearchStartTime to CallStat model 2025-08-19 11:20:30 +10:00
c9a99faa54 Added 3 required fields for CallStat 2025-08-18 17:46:28 +10:00
e8aeb4d3b7 Removed DBAmendmentLog (not in use) and changed ParnterRate to PartnerRate (typo) 2025-08-07 16:09:23 +10:00
a457849977 Added all gcq_formatter models in 2025-08-01 10:49:27 +10:00
11 changed files with 182 additions and 24 deletions

View File

@@ -9,23 +9,9 @@ type DBAmendment struct {
AmendmentValue string AmendmentValue string
Requestor string Requestor string
RequestedAt time.Time RequestedAt time.Time
Sequence string
} }
func (DBAmendment) TableName() string { func (DBAmendment) TableName() string {
return "gc_amendments" return "gc_amendments"
} }
type DBAmendmentLog struct {
Id int `gorm:"primaryKey;autoIncrement"`
ConversationId string `gorm:"index"`
AmendmentColumn string
OldValue string
NewValue string
Requestor string
RequestedAt time.Time
AmendedAt time.Time
}
func (DBAmendmentLog) TableName() string {
return "gc_amendment_logs"
}

View File

@@ -1,5 +1,6 @@
package models package models
/*
import ( import (
"time" "time"
) )
@@ -26,3 +27,4 @@ type BaseCall struct {
func (BaseCall) TableName() string { func (BaseCall) TableName() string {
return "gc_base_calls" return "gc_base_calls"
} }
*/

View File

@@ -1,5 +1,6 @@
package models package models
/*
import ( import (
"time" "time"
) )
@@ -25,3 +26,4 @@ type CallStat struct {
func (CallStat) TableName() string { func (CallStat) TableName() string {
return "gc_call_stats" return "gc_call_stats"
} }
*/

View File

@@ -23,8 +23,8 @@ type CrmInvoiceConfig struct {
PartnerAudioBookingBH *string `gorm:"column:partner_audio_booking_bh" json:"partner_audio_booking_bh"` PartnerAudioBookingBH *string `gorm:"column:partner_audio_booking_bh" json:"partner_audio_booking_bh"`
PartnerVideoBookingAH *string `gorm:"column:partner_video_booking_ah" json:"partner_video_booking_ah"` PartnerVideoBookingAH *string `gorm:"column:partner_video_booking_ah" json:"partner_video_booking_ah"`
PartnerVideoBookingBH *string `gorm:"column:partner_video_booking_bh" json:"partner_video_booking_bh"` PartnerVideoBookingBH *string `gorm:"column:partner_video_booking_bh" json:"partner_video_booking_bh"`
RoundingFunction *string `gorm:"column:rounding_function" json:"rounding_function"`
RoundBookings *bool `gorm:"column:round_bookings" json:"round_bookings"` RoundBookings *bool `gorm:"column:round_bookings" json:"round_bookings"`
RoundingFunction *bool `gorm:"column:rounding_function" json:"rounding_function"`
SplitBookings *bool `gorm:"column:split_bookings" json:"split_bookings"` SplitBookings *bool `gorm:"column:split_bookings" json:"split_bookings"`
SplitOnDemand *bool `gorm:"column:split_on_demand" json:"split_on_demand"` SplitOnDemand *bool `gorm:"column:split_on_demand" json:"split_on_demand"`
} }

130
models/formatter.go Normal file
View File

@@ -0,0 +1,130 @@
package models
import "time"
type BaseCall struct {
ClientConversationId string `gorm:"primaryKey;index"`
CallType string `gorm:"index"`
GenderPreference string
ClientId int `gorm:"index"`
LanguageId int
CustomerDnis string
CustomerAni string
SearchStartTime *time.Time
P1ConnectTime time.Time `gorm:"index"`
P1DisconnectTime time.Time `gorm:"index"`
P3ConnectTime *time.Time
P3DisconnectTime *time.Time
BookingRequestNumber *int `gorm:"index"`
IvrData *int
UtsEntries int
InterpreterCount int
Status string
}
func (BaseCall) TableName() string {
return "gc_base_calls"
}
type InterpreterAttempt struct {
InterpreterConversationId string `gorm:"primaryKey;index"`
InterpreterResponseTime time.Time
InterpreterAccepted bool
InterpreterId int `gorm:"index"`
CallType string
CallConnected string
ClientConversationId string `gorm:"index"`
LanguageId int
InterpreterPhone string
ConversationStart time.Time
ConversationEnd time.Time
}
func (InterpreterAttempt) TableName() string {
return "gc_interpreter_attempts"
}
type InterpreterConnection struct {
InterpreterConversationId string `gorm:"primaryKey;index"`
InterpreterAccepted bool
InterpreterId int `gorm:"index"`
CallType string
CallConnected string
ClientConversationId string `gorm:"index"`
LanguageId int
InterpreterPhone string
ConferenceStart time.Time
ConferenceEnd time.Time
}
func (InterpreterConnection) TableName() string {
return "gc_interpreter_connections"
}
type CallStat struct {
ClientConversationId string `gorm:"primaryKey;index"`
CallType string `gorm:"index"`
ClientId int `gorm:"index"`
CustomerDnis string
CustomerAni string
ConversationStart *time.Time `gorm:"index"`
ConversationEnd *time.Time `gorm:"index"`
SearchStartTime *time.Time
P1ConnectTime time.Time `gorm:"index"`
P1DisconnectTime time.Time `gorm:"index"`
BookingRequestNumber *int `gorm:"index"`
UtsQueue bool
InterpreterAcceptedCount int
InterpreterAccepted bool
InterpreterConnectedCount int
InterpreterConnected bool
ClientDisconnected bool
UtsDuration int
UtsEntries int
Status string
SubStatus string
FirstLanguageId int
LastLanguageId int
FirstInterpreter string
}
func (CallStat) TableName() string {
return "gc_call_stats"
}
type Breakdown struct {
ClientConversationId string `gorm:"primaryKey;index"`
InterpreterConversationId string `gorm:"index"`
Timestamp time.Time `gorm:"primaryKey;index"`
Task string `gorm:"primaryKey"`
Duration int
Message string
Metadata *string `gorm:"type:json"`
}
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

@@ -72,6 +72,7 @@ type AnalyticsConversationWithoutAttributes struct {
DivisionIds []string `json:"divisionIds"` DivisionIds []string `json:"divisionIds"`
Participants []struct { Participants []struct {
ParticipantId string `json:"participantId"` ParticipantId string `json:"participantId"`
UserId string `json:"userId"`
ParticipantName string `json:"participantName"` ParticipantName string `json:"participantName"`
Purpose string `json:"purpose"` Purpose string `json:"purpose"`
ExternalContactId string `json:"externalContactId"` ExternalContactId string `json:"externalContactId"`
@@ -183,3 +184,22 @@ type NotificationConversationWithAttributes struct {
SecurePause bool `json:"securePause"` SecurePause bool `json:"securePause"`
UtilizationLabelId string `json:"utilizationLabelId"` UtilizationLabelId string `json:"utilizationLabelId"`
} }
type UsersQuery struct {
Entities []GCUser `json:"entities"`
PageSize int `json:"pageSize"`
Total int `json:"total"`
}
type GCUser struct {
Id string `json:"id" gorm:"primaryKey"`
Name string `json:"name"`
Email string `json:"email"`
State string `json:"state"`
Username string `json:"username"`
AcdAutoAnswer bool `json:"acdAutoAnswer"`
}
func (GCUser) TableName() string {
return "gc_users"
}

View File

@@ -1,5 +1,6 @@
package models package models
/*
import ( import (
"time" "time"
) )
@@ -21,3 +22,4 @@ type InterpreterAttempt struct {
func (InterpreterAttempt) TableName() string { func (InterpreterAttempt) TableName() string {
return "gc_interpreter_attempts" return "gc_interpreter_attempts"
} }
*/

View File

@@ -1,5 +1,6 @@
package models package models
/*
import ( import (
"time" "time"
) )
@@ -20,3 +21,4 @@ type InterpreterConnection struct {
func (InterpreterConnection) TableName() string { func (InterpreterConnection) TableName() string {
return "gc_interpreter_connections" return "gc_interpreter_connections"
} }
*/

View File

@@ -2,6 +2,8 @@ package models
import ( import (
"time" "time"
"gorm.io/gorm"
) )
type DBParticipant struct { type DBParticipant struct {
@@ -17,13 +19,24 @@ type DBParticipant struct {
Name *string `gorm:"index"` Name *string `gorm:"index"`
Purpose *string `gorm:"index"` Purpose *string `gorm:"index"`
QueueId *string QueueId *string
UserId *string
Wrapup *string `gorm:"type:json"` Wrapup *string `gorm:"type:json"`
WrapupExpected *bool WrapupExpected *bool
WrapupRequired *bool WrapupRequired *bool
Sessions []DBSession `gorm:"foreignKey:ParticipantId;references:Id"` Sessions []DBSession `gorm:"foreignKey:ParticipantId;references:Id"`
Calls []DBCall `gorm:"foreignKey:ParticipantId;references:Id"`
User *GCUser `gorm:"foreignKey:UserId;references:Id"`
} }
func (DBParticipant) TableName() string { func (DBParticipant) TableName() string {
return "gc_participants" 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

@@ -20,7 +20,7 @@ type DBClientProcessed struct {
// --- // ---
BuggedCall bool BuggedCall bool
Amended bool Amended bool
CreatedAt time.Time CreatedAt time.Time `gorm:"autoCreateTime"`
ModifiedAt time.Time ModifiedAt time.Time
CustomData *string `gorm:"type:json"` CustomData *string `gorm:"type:json"`
InternalUse *string `gorm:"type:json"` InternalUse *string `gorm:"type:json"`
@@ -54,7 +54,7 @@ type DBClientProcessed struct {
// PARTNER DETAILS: // PARTNER DETAILS:
// --- // ---
PartnerBill float64 PartnerBill float64
ParnterRate float64 PartnerRate float64
// TIMESTAMP DETAILS: // TIMESTAMP DETAILS:
// --- // ---
@@ -85,7 +85,7 @@ type DBInterpreterProcessed struct {
// --- // ---
BuggedCall bool BuggedCall bool
Amended bool Amended bool
CreatedAt time.Time CreatedAt time.Time `gorm:"autoCreateTime"`
ModifiedAt time.Time ModifiedAt time.Time
CustomData *string `gorm:"type:json"` CustomData *string `gorm:"type:json"`
InternalUse *string `gorm:"type:json"` InternalUse *string `gorm:"type:json"`

View File

@@ -22,9 +22,9 @@ func ExtractWithoutAttributes(base models.AnalyticsConversationWithoutAttributes
var endTime *time.Time var endTime *time.Time
parsedEndTime, err := time.Parse(time.RFC3339, base.ConversationEnd) parsedEndTime, err := time.Parse(time.RFC3339, base.ConversationEnd)
if err != nil { if err != nil {
startTime = nil endTime = nil
} else { } else {
startTime = &parsedEndTime endTime = &parsedEndTime
} }
divisionIdsBytes, err := json.Marshal(base.DivisionIds) divisionIdsBytes, err := json.Marshal(base.DivisionIds)
@@ -49,13 +49,14 @@ func ExtractWithoutAttributes(base models.AnalyticsConversationWithoutAttributes
for _, p := range base.Participants { for _, p := range base.Participants {
participant := models.DBParticipant{ participant := models.DBParticipant{
ConnectedTime: nil, // ConnectedTime: nil,
ConversationId: base.ConversationId, ConversationId: base.ConversationId,
EndTime: nil, // EndTime: nil,
ExternalContactId: &p.ExternalContactId, ExternalContactId: &p.ExternalContactId,
Id: p.ParticipantId, Id: p.ParticipantId,
Name: &p.ParticipantName, Name: &p.ParticipantName,
Purpose: &p.Purpose, Purpose: &p.Purpose,
UserId: &p.UserId,
} }
participants = append(participants, participant) participants = append(participants, participant)