Compare commits
36 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4c58351635 | |||
| 1bb7661f94 | |||
| 79bea9002e | |||
| 0e72fa1355 | |||
| db89056468 | |||
| 567470372f | |||
| 674f7dd5f5 | |||
| f50333d223 | |||
| a7f73eb96a | |||
| 57b4791a4a | |||
| 7737b8b4d2 | |||
| 2f2388caab | |||
| ff0f873dd8 | |||
| 7bf15cce48 | |||
| 643c5cc695 | |||
| 8b2b31ef3f | |||
| 423383a2f8 | |||
| 00b946fc8d | |||
| 4e5f789671 | |||
| ee521aa378 | |||
| c106209130 | |||
| 4c6eed2e47 | |||
| 0f4223e873 | |||
| faca742f5f | |||
| 3823096f4c | |||
| c9a99faa54 | |||
| e8aeb4d3b7 | |||
| a457849977 | |||
| bd807b3b1d | |||
| 1872e23ec1 | |||
| 24d4ab7bd0 | |||
| f5db0a0179 | |||
| c36c9eb809 | |||
| ed3f089736 | |||
| d862a79c0f | |||
| d5ba285a0c |
@@ -2,30 +2,29 @@ package models
|
|||||||
|
|
||||||
import "time"
|
import "time"
|
||||||
|
|
||||||
|
// DBAmendment is used to store any changes made to interpreter or client processed calls in the database, although theoretically it could be tailored to any table, as long as the amendments queue handles the application logic..
|
||||||
|
//
|
||||||
|
// - Id is an auto-incrementing integer, with no practical application.
|
||||||
|
// - ConversationId references the conversation ID of either the client or interpreter processed call.
|
||||||
|
// - AmendmentColumn is the name of the column to be amended.
|
||||||
|
// - AmendmentValue is the value to overwrite the amendment column's existing value with.
|
||||||
|
// - Requestor is a string reference as to who created the amendment.
|
||||||
|
// - RequestedAt is the creation time of the amendment.
|
||||||
|
//
|
||||||
|
// Table Schema:
|
||||||
|
//
|
||||||
|
// Primary Key: Id
|
||||||
|
// Indexes: Id, ConversationId, RequestedAt
|
||||||
type DBAmendment struct {
|
type DBAmendment struct {
|
||||||
Id int `gorm:"primaryKey;autoIncrement"`
|
Id int `gorm:"primaryKey;autoIncrement"`
|
||||||
ConversationId string `gorm:"index"`
|
ConversationId string `gorm:"index"`
|
||||||
AmendmentColumn string
|
AmendmentColumn string
|
||||||
AmendmentValue string
|
AmendmentValue string
|
||||||
Requestor string
|
Requestor string
|
||||||
RequestedAt time.Time
|
RequestedAt time.Time `gorm:"index"`
|
||||||
|
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"
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
package models
|
|
||||||
|
|
||||||
import (
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
type BaseCall struct {
|
|
||||||
ClientConversationId string `gorm:"primaryKey;index"`
|
|
||||||
CallType string `gorm:"index"`
|
|
||||||
GenderPreference string
|
|
||||||
ClientId int `gorm:"index"`
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
func (BaseCall) TableName() string {
|
|
||||||
return "gc_base_calls"
|
|
||||||
}
|
|
||||||
53
models/booking.go
Normal file
53
models/booking.go
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
// Booking is used to store data relating to any interpreter booking. It is the output of the bookings formatter, and contains re-maps of existing ticket data.
|
||||||
|
//
|
||||||
|
// - BookingReference is the reference number the client will use when they call in. It is also the numeric ticket ID from Zoho.
|
||||||
|
// - BookingTime is the nominated time for the booking in TODO: what timezone is BookingTime in?
|
||||||
|
// - Timezone is the customer specified timezone for the above booking time.
|
||||||
|
// - Language is the foreign language requirement from the customer.
|
||||||
|
// - CustomData contains any special customer data, typically from the cost code field in the ticket.
|
||||||
|
// - Method is the type of booking: audio, video, in-person, etc.
|
||||||
|
// - Duration is the currently specified length of the booking after any changes.
|
||||||
|
// - BookedDuration is the initially nominated length of the booking.
|
||||||
|
// - ConversationId is an optional field for a GenesysCloud conversation ID to be manually linked to the ticket.
|
||||||
|
// - CancellationTime is the optional timestamp at which the customer or agent cancelled the request for the booking.
|
||||||
|
// - InterpreterId is the 4-digit identifier of the interpreter selected for the prebooking.
|
||||||
|
// - ClientId is the 5-digit identifier of the client who placed the prebooking.
|
||||||
|
// - AgentName is the customer supplied name of the individual who requested the prebooking.
|
||||||
|
// - AgentEmail is the customer supplied email address of the individual who requested the prebooking.
|
||||||
|
// - AgentPhone is the customer supplied phone number of the individual who requested the prebooking.
|
||||||
|
// - Comments contains any additional information supplied by the individual who requested the prebooking.
|
||||||
|
// - BillingCode is an internal use field that indicates the current billing status and who should be paid/charged.
|
||||||
|
// - TicketId is the Zoho internal use ID (not to be confused with the BookingReference or ticket number).
|
||||||
|
//
|
||||||
|
// Table Schema:
|
||||||
|
//
|
||||||
|
// Primary Key: BookingReference
|
||||||
|
// Indexes: BookingReference, BookingTime, Method, ConversationId, InterpreterId, ClientId
|
||||||
|
type Booking struct {
|
||||||
|
BookingReference int `gorm:"primaryKey;index"`
|
||||||
|
BookingTime *time.Time `gorm:"index"`
|
||||||
|
Timezone *string
|
||||||
|
Language *string
|
||||||
|
CustomData *string
|
||||||
|
Method *string `gorm:"index"`
|
||||||
|
Duration *int
|
||||||
|
BookedDuration *int
|
||||||
|
ConversationId *string `gorm:"index"`
|
||||||
|
CancellationTime *time.Time
|
||||||
|
InterpreterId *int `gorm:"index"`
|
||||||
|
ClientId *int `gorm:"index"`
|
||||||
|
AgentName *string
|
||||||
|
AgentEmail *string
|
||||||
|
AgentPhone *string
|
||||||
|
Comments *string
|
||||||
|
BillingCode *string
|
||||||
|
TicketId string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (Booking) TableName() string {
|
||||||
|
return "gc_bookings"
|
||||||
|
}
|
||||||
@@ -4,6 +4,15 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// DBCall is a model that stores raw 'call' payloads from GenesysCloud websockets.
|
||||||
|
//
|
||||||
|
// - The ExtractLive function handles the conversion from JSON data (map) into formatted JSON string.
|
||||||
|
//
|
||||||
|
// Table Schema:
|
||||||
|
//
|
||||||
|
// Primary Key: Id
|
||||||
|
// Indexes: ConnectedTime, DisconnectedTime, Id, ParticipantId
|
||||||
|
// JSON Fields: DisconnectReasons, Other, Self
|
||||||
type DBCall struct {
|
type DBCall struct {
|
||||||
AfterCallWorkRequired bool
|
AfterCallWorkRequired bool
|
||||||
Confined bool
|
Confined bool
|
||||||
|
|||||||
@@ -4,6 +4,16 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// DBConversation is a model that stores raw 'conversation' payloads from GenesysCloud websockets and API requests.
|
||||||
|
//
|
||||||
|
// - The ExtractLive function handles the conversion from JSON data (map) into formatted JSON string for websocket payloads.
|
||||||
|
// - The ExtractWithoutAttributes function handles the conversion from JSON data (map) into formatted JSON string for gcq-details requests.
|
||||||
|
//
|
||||||
|
// Table Schema:
|
||||||
|
//
|
||||||
|
// Primary Key: Id
|
||||||
|
// Indexes: End, Id, Start
|
||||||
|
// JSON Fields: DivisionIds, RecentTransfers
|
||||||
type DBConversation struct {
|
type DBConversation struct {
|
||||||
Address *string
|
Address *string
|
||||||
DivisionIds *string `gorm:"type:json"`
|
DivisionIds *string `gorm:"type:json"`
|
||||||
|
|||||||
@@ -4,6 +4,16 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// CrmClient is a model that stores Client/Account records from CRM.
|
||||||
|
//
|
||||||
|
// - The intention of the model is to map JSON -> struct -> JSON
|
||||||
|
// - To improve usability, GORM 'column' tags have been used to map CRM API names into more descriptive names.
|
||||||
|
//
|
||||||
|
// Table Schema:
|
||||||
|
//
|
||||||
|
// Primary Key: ID
|
||||||
|
// Indexes: ID
|
||||||
|
// JSON Fields: Attributes, MediaRoles, Wrapup
|
||||||
type CrmClient struct {
|
type CrmClient struct {
|
||||||
ID int `gorm:"primaryKey;column:id" json:"id"`
|
ID int `gorm:"primaryKey;column:id" json:"id"`
|
||||||
BillingGroupNumber *int `gorm:"column:billing_group_number" json:"billing_group_number"`
|
BillingGroupNumber *int `gorm:"column:billing_group_number" json:"billing_group_number"`
|
||||||
|
|||||||
@@ -4,6 +4,15 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// CrmInterpreter is a model that stores Interpreter records from CRM.
|
||||||
|
//
|
||||||
|
// - The intention of the model is to map JSON -> struct -> JSON
|
||||||
|
// - To improve usability, GORM 'column' tags have been used to map CRM API names into more descriptive names.
|
||||||
|
//
|
||||||
|
// Table Schema:
|
||||||
|
//
|
||||||
|
// Primary Key: ID
|
||||||
|
// Indexes: ID
|
||||||
type CrmInterpreter struct {
|
type CrmInterpreter struct {
|
||||||
ID int `gorm:"primaryKey;column:id" json:"id"`
|
ID int `gorm:"primaryKey;column:id" json:"id"`
|
||||||
ABN *string `gorm:"column:abn" json:"abn"`
|
ABN *string `gorm:"column:abn" json:"abn"`
|
||||||
|
|||||||
@@ -2,6 +2,15 @@ package models
|
|||||||
|
|
||||||
import ()
|
import ()
|
||||||
|
|
||||||
|
// CrmInvoiceConfig is a model that stores Invoice Configuration records from CRM.
|
||||||
|
//
|
||||||
|
// - The intention of the model is to map JSON -> struct -> JSON
|
||||||
|
// - To improve usability, GORM 'column' tags have been used to map CRM API names into more descriptive names.
|
||||||
|
//
|
||||||
|
// Table Schema:
|
||||||
|
//
|
||||||
|
// Primary Key: ID
|
||||||
|
// Indexes: ID
|
||||||
type CrmInvoiceConfig struct {
|
type CrmInvoiceConfig struct {
|
||||||
ID string `gorm:"primaryKey;column:id" json:"id"`
|
ID string `gorm:"primaryKey;column:id" json:"id"`
|
||||||
Name string `gorm:"column:name;not null" json:"name"`
|
Name string `gorm:"column:name;not null" json:"name"`
|
||||||
@@ -23,8 +32,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"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,14 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
|
// CrmLanguage is a model that stores Language records from CRM.
|
||||||
|
//
|
||||||
|
// - The intention of the model is to map JSON -> struct -> JSON
|
||||||
|
// - To improve usability, GORM 'column' tags have been used to map CRM API names into more descriptive names.
|
||||||
|
//
|
||||||
|
// Table Schema:
|
||||||
|
//
|
||||||
|
// Primary Key: ID
|
||||||
|
// Indexes: ID
|
||||||
type CrmLanguage struct {
|
type CrmLanguage struct {
|
||||||
ID int `gorm:"primaryKey;column:id" json:"id"`
|
ID int `gorm:"primaryKey;column:id" json:"id"`
|
||||||
Name *string `gorm:"column:name" json:"name"`
|
Name *string `gorm:"column:name" json:"name"`
|
||||||
|
|||||||
@@ -2,6 +2,15 @@ package models
|
|||||||
|
|
||||||
import "time"
|
import "time"
|
||||||
|
|
||||||
|
// CrmLanguageLookup is a model that stores Language Lookup records from CRM.
|
||||||
|
//
|
||||||
|
// - The intention of the model is to map JSON -> struct -> JSON
|
||||||
|
// - To improve usability, GORM 'column' tags have been used to map CRM API names into more descriptive names.
|
||||||
|
//
|
||||||
|
// Table Schema:
|
||||||
|
//
|
||||||
|
// Primary Key: ID
|
||||||
|
// Indexes: ID
|
||||||
type CrmLanguageLookup struct {
|
type CrmLanguageLookup struct {
|
||||||
ID string `gorm:"primaryKey;column:id" json:"id"`
|
ID string `gorm:"primaryKey;column:id" json:"id"`
|
||||||
Language *string `gorm:"column:language" json:"language"`
|
Language *string `gorm:"column:language" json:"language"`
|
||||||
|
|||||||
@@ -1,5 +1,14 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
|
// CrmPaymentConfig is a model that stores Payment Configuration records from CRM.
|
||||||
|
//
|
||||||
|
// - The intention of the model is to map JSON -> struct -> JSON
|
||||||
|
// - To improve usability, GORM 'column' tags have been used to map CRM API names into more descriptive names.
|
||||||
|
//
|
||||||
|
// Table Schema:
|
||||||
|
//
|
||||||
|
// Primary Key: ID
|
||||||
|
// Indexes: ID
|
||||||
type CrmPaymentConfig struct {
|
type CrmPaymentConfig struct {
|
||||||
ID string `gorm:"primaryKey;column:id" json:"id"`
|
ID string `gorm:"primaryKey;column:id" json:"id"`
|
||||||
Name string `gorm:"column:name;not null" json:"name"`
|
Name string `gorm:"column:name;not null" json:"name"`
|
||||||
|
|||||||
207
models/formatter.go
Normal file
207
models/formatter.go
Normal file
@@ -0,0 +1,207 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
/*
|
||||||
|
All structs/models within this file are used by the gcq-formatter queue.
|
||||||
|
Specific definitions as to what each model is used for should be found in the gcq-formatter documentation.
|
||||||
|
The following file contains just a brief overview, and any documentation on gorm_models itself should reference that the specifics are also stored in gcq-formatter docs.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// BaseCall is used to store data on a client's attempt to create a billable record.
|
||||||
|
//
|
||||||
|
// This struct is part of the three primary components used for creating billable records:
|
||||||
|
// - BaseCall
|
||||||
|
// - InterpreterAttempt
|
||||||
|
// - InterpreterConnection
|
||||||
|
//
|
||||||
|
// It is eventually merged with the other two to create a 'full' billing record that we can derive a $ amount from.
|
||||||
|
//
|
||||||
|
// Table Schema:
|
||||||
|
//
|
||||||
|
// Primary Key: ClientConversationId
|
||||||
|
// Indexes: ClientConversationId, CallType, ClientId, P1ConnectTime, P1DisconnectTime, BookingRequestNumber
|
||||||
|
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"
|
||||||
|
}
|
||||||
|
|
||||||
|
// InterpreterAttempt is used to store data on the system's attempt to find an interpreter for a client's base call.
|
||||||
|
// An interpreter attempt call involves the system dialling an interpreter, and providing them with the option to 'respond' in which they specify if they are available to take the call or not.
|
||||||
|
// ClientConversationId is a reference to the client BaseCall which the system is attempting to connect the interpreter to.
|
||||||
|
//
|
||||||
|
// This struct is part of the three primary components used for creating billable records:
|
||||||
|
// - BaseCall
|
||||||
|
// - InterpreterAttempt
|
||||||
|
// - InterpreterConnection
|
||||||
|
//
|
||||||
|
// It is eventually merged with the other two to create a 'full' billing record that we can derive a $ amount from.
|
||||||
|
//
|
||||||
|
// Table Schema:
|
||||||
|
//
|
||||||
|
// Primary Key: InterpreterConversationId
|
||||||
|
// Indexes: InterpreterConversationId, InterpreterId, ClientConversationId
|
||||||
|
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"
|
||||||
|
}
|
||||||
|
|
||||||
|
// InterpreterConnection is used to store data on an interpreter's connection to a BaseCall.
|
||||||
|
// An interpreter connection is not its own call, it's a summation of data related to an interpreter's time spent on a base call.
|
||||||
|
// ClientConversationId is a reference to the client BaseCall, which is the call this data is derived from.
|
||||||
|
// InterpreterConversationId is a reference to the interpreter's acceptance call, which is a unique identifier for the interpreter's time on the call.
|
||||||
|
//
|
||||||
|
// This struct is part of the three primary components used for creating billable records:
|
||||||
|
// - BaseCall
|
||||||
|
// - InterpreterAttempt
|
||||||
|
// - InterpreterConnection
|
||||||
|
//
|
||||||
|
// It is eventually merged with the other two to create a 'full' billing record that we can derive a $ amount from.
|
||||||
|
//
|
||||||
|
// Table Schema:
|
||||||
|
//
|
||||||
|
// Primary Key: InterpreterConversationId
|
||||||
|
// Indexes: InterpreterConversationId, InterpreterId, ClientConversationId
|
||||||
|
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"
|
||||||
|
}
|
||||||
|
|
||||||
|
// CallStat stored statistics & metrics on a client's attempt to create a billable record by finding an interpreter (BaseCall).
|
||||||
|
// The stats collected are important for billing data as the CallStat object indicates whether or not the call was successfully serviced.
|
||||||
|
// The stats are also used extensively for reporting purposes, and measure the company's defined SLAs, including UTS (unable to service) duration and the time taken to find & connect to an interpreter..
|
||||||
|
//
|
||||||
|
// Table Schema:
|
||||||
|
//
|
||||||
|
// Primary Key: ClientConversationId
|
||||||
|
// Indexes: ClientConversationId, CallType, ClientId, ConversationStart, ConversationEnd, P1ConnectTime, P1DisconnectTime, BookingRequestNumber
|
||||||
|
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"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Breakdown is used to store data relating to the call in a segment-by-segment basis.
|
||||||
|
// The Breakdown is a translation of the technical data into domain specific language that non-technical members of the company can understand.
|
||||||
|
// Not every segment is translated into a breakdown, only key events.
|
||||||
|
// The breakdowns are also used extensively in terms of reporting, as they provide a very fine-grain overview of what happened on a given call.
|
||||||
|
//
|
||||||
|
// Table Schema:
|
||||||
|
//
|
||||||
|
// Primary Key: ClientConversationId, Timestamp, Task
|
||||||
|
// Indexes: ClientConversationId, InterpreterConversationId, Timestamp, Task
|
||||||
|
// JSON Fields: Metadata
|
||||||
|
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"
|
||||||
|
}
|
||||||
|
|
||||||
|
// CallMetrics store data relating to the call, specifically to do with duration/timing metadata.
|
||||||
|
// The CallMetrics give an overview as to how the duration of any given call was spent, in terms of non-technical domain specific language.
|
||||||
|
//
|
||||||
|
// Table Schema:
|
||||||
|
//
|
||||||
|
// Primary Key: ClientConversationId
|
||||||
|
// Indexes: ClientConversationId
|
||||||
|
// JSON Fields: Metadata
|
||||||
|
|
||||||
|
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"
|
||||||
|
}
|
||||||
@@ -1,10 +1,21 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
|
// AnalyticsConversationWithAttributesQuery is used to bind the results of a paginated GenesysCloud API request.
|
||||||
type AnalyticsConversationWithAttributesQuery struct {
|
type AnalyticsConversationWithAttributesQuery struct {
|
||||||
Conversations []AnalyticsConversationWithAttributes `json:"conversations"`
|
Conversations []AnalyticsConversationWithAttributes `json:"conversations"`
|
||||||
Cursor *string `json:"cursor"`
|
Cursor *string `json:"cursor"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AnalyticsConversationWithAttributes is used to bind the results of a GenesysCloud API request.
|
||||||
|
//
|
||||||
|
// It is a hierarchical structure (Participants has many Sessions has many Segments) and needs to be flattened into multiple tables prior to being saved in the database.
|
||||||
|
//
|
||||||
|
// The following payload JSON fields have an expected structure:
|
||||||
|
// - Participants
|
||||||
|
// - Participants.Sessions
|
||||||
|
// - Participants.Sessions.MediaEndpointStats
|
||||||
|
// - Participants.Sessions.Metrics
|
||||||
|
// - Participants.Sessions.Segments
|
||||||
type AnalyticsConversationWithAttributes struct {
|
type AnalyticsConversationWithAttributes struct {
|
||||||
ConversationEnd string `json:"conversationEnd"`
|
ConversationEnd string `json:"conversationEnd"`
|
||||||
ConversationId string `json:"conversationId"`
|
ConversationId string `json:"conversationId"`
|
||||||
@@ -16,7 +27,7 @@ type AnalyticsConversationWithAttributes struct {
|
|||||||
OriginatingDirection string `json:"originatingDirection"`
|
OriginatingDirection string `json:"originatingDirection"`
|
||||||
Participants []struct {
|
Participants []struct {
|
||||||
ExternalContactId string `json:"externalContactId"`
|
ExternalContactId string `json:"externalContactId"`
|
||||||
ParticipantId string `json:"participantId"`
|
ParticipantId string `json:"id"`
|
||||||
ParticipantName string `json:"participantName"`
|
ParticipantName string `json:"participantName"`
|
||||||
Purpose string `json:"purpose"`
|
Purpose string `json:"purpose"`
|
||||||
Sessions []struct {
|
Sessions []struct {
|
||||||
@@ -58,10 +69,23 @@ type AnalyticsConversationWithAttributes struct {
|
|||||||
} `json:"participants"`
|
} `json:"participants"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AnalyticsConversationWithoutAttributesQuery is used to bind the results of a paginated GenesysCloud API request.
|
||||||
type AnalyticsConversationWithoutAttributesQuery struct {
|
type AnalyticsConversationWithoutAttributesQuery struct {
|
||||||
Conversations []AnalyticsConversationWithoutAttributes `json:"conversations"`
|
Conversations []AnalyticsConversationWithoutAttributes `json:"conversations"`
|
||||||
TotalHits int `json:"totalHits"`
|
TotalHits int `json:"totalHits"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AnalyticsConversationWithoutAttributes is used to bind the results of a GenesysCloud API request.
|
||||||
|
//
|
||||||
|
// It is a hierarchical structure (Participants has many Sessions has many Segments) and needs to be flattened into multiple tables prior to being saved in the database.
|
||||||
|
//
|
||||||
|
// The following payload JSON fields have an expected structure:
|
||||||
|
// - Participants
|
||||||
|
// - Participants.Sessions
|
||||||
|
// - Participants.Sessions.Segments
|
||||||
|
// - Participants.Sessions.Flow
|
||||||
|
// - Participants.Sessions.Metrics
|
||||||
|
// - Participants.Sessions.MediaEndpointStats
|
||||||
type AnalyticsConversationWithoutAttributes struct {
|
type AnalyticsConversationWithoutAttributes struct {
|
||||||
ConversationId string `json:"conversationId"`
|
ConversationId string `json:"conversationId"`
|
||||||
ConversationStart string `json:"conversationStart"`
|
ConversationStart string `json:"conversationStart"`
|
||||||
@@ -72,6 +96,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"`
|
||||||
@@ -126,6 +151,16 @@ type AnalyticsConversationWithoutAttributes struct {
|
|||||||
} `json:"participants"`
|
} `json:"participants"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NotificationConversationWithAttributes is used to bind the results of a GenesysCloud websocket notification.
|
||||||
|
//
|
||||||
|
// It is a hierarchical structure (Participants has many Sessions has many Segments) and needs to be flattened into multiple tables prior to being saved in the database.
|
||||||
|
//
|
||||||
|
// The following payload JSON fields have an expected structure:
|
||||||
|
// - Divisions
|
||||||
|
// - Divisions.Division
|
||||||
|
// - Divisions.Entities
|
||||||
|
// - Participants
|
||||||
|
// - Participants.Calls
|
||||||
type NotificationConversationWithAttributes struct {
|
type NotificationConversationWithAttributes struct {
|
||||||
Address string `json:"address"`
|
Address string `json:"address"`
|
||||||
Divisions []struct {
|
Divisions []struct {
|
||||||
@@ -183,3 +218,26 @@ type NotificationConversationWithAttributes struct {
|
|||||||
SecurePause bool `json:"securePause"`
|
SecurePause bool `json:"securePause"`
|
||||||
UtilizationLabelId string `json:"utilizationLabelId"`
|
UtilizationLabelId string `json:"utilizationLabelId"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UsersQuery is used to bind the results of an GenesysCloud API request to get all users.
|
||||||
|
type UsersQuery struct {
|
||||||
|
Entities []GCUser `json:"entities"`
|
||||||
|
PageSize int `json:"pageSize"`
|
||||||
|
Total int `json:"total"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// GCUser is a model used to store the results of GenesysCloud users.
|
||||||
|
//
|
||||||
|
// Given the similarity between the API requests returned value and the desired database schema, the DB model is used in UsersQuery, and also to upload directly to the database. No additional formatting work is required.
|
||||||
|
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"
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
package models
|
|
||||||
|
|
||||||
import (
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
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"
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
package models
|
|
||||||
|
|
||||||
import (
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
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"
|
|
||||||
}
|
|
||||||
@@ -2,8 +2,26 @@ package models
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// DBParticipant is a model that stores raw 'participant' payloads from GenesysCloud websockets and API requests.
|
||||||
|
//
|
||||||
|
// - The ExtractLive function handles the conversion from JSON data (map) into formatted JSON string for websocket payloads.
|
||||||
|
// - The ExtractWithoutAttributes function handles the conversion from JSON data (map) into formatted JSON string for gcq-details requests.
|
||||||
|
//
|
||||||
|
// Table Schema:
|
||||||
|
//
|
||||||
|
// Primary Key: Id
|
||||||
|
// Indexes: ConnectedTime, ConversationId, EndTime, Id, Name, Purpose
|
||||||
|
// JSON Fields: Attributes, MediaRoles, Wrapup
|
||||||
|
//
|
||||||
|
// GORM Specifics:
|
||||||
|
// - Can be preloaded with Sessions []DBSession
|
||||||
|
// - Can be preloaded with Calls []DBCall
|
||||||
|
// - Can be preloaded with User *GCUser
|
||||||
|
// - BeforeSave function, converts UserId into 'nil' if an empty string is returned, this prevents foreign key violations.
|
||||||
type DBParticipant struct {
|
type DBParticipant struct {
|
||||||
Address *string
|
Address *string
|
||||||
Attributes *string `gorm:"type:json"`
|
Attributes *string `gorm:"type:json"`
|
||||||
@@ -17,13 +35,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
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,42 +4,139 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Processed struct {
|
type DBClientProcessed struct {
|
||||||
ClientConversationId string `gorm:"index"`
|
|
||||||
InterpreterConversationId string `gorm:"primaryKey;index"`
|
// CALL DETAILS
|
||||||
CallType string `gorm:"index"`
|
// ---
|
||||||
GenderPreference string
|
ClientConversationId string `gorm:"primaryKey"`
|
||||||
LanguageId int
|
CallType string
|
||||||
ClientId int `gorm:"index"`
|
GenderPreference string
|
||||||
CustomerDnis string
|
BookingReference *int
|
||||||
CustomerAni string
|
IvrData *int
|
||||||
InterpreterId int
|
BillableClient bool
|
||||||
SearchStartTime time.Time `gorm:"index"`
|
CallOutcome string
|
||||||
ClientIndex int
|
|
||||||
NesIndex int
|
// FLAGS / METADATA:
|
||||||
P2ConnectTimeUtc time.Time `gorm:"index"`
|
// ---
|
||||||
P2DisconnectTimeUtc time.Time `gorm:"index"`
|
BuggedCall bool
|
||||||
P1ConnectTimeUtc time.Time `gorm:"index"`
|
Amended bool
|
||||||
P1DisconnectTimeUtc time.Time `gorm:"index"`
|
CreatedAt time.Time `gorm:"autoCreateTime"`
|
||||||
P3ConnectTimeUtc *time.Time
|
ModifiedAt time.Time
|
||||||
P3DisconnectTimeUtc *time.Time
|
CustomData *string `gorm:"type:json"`
|
||||||
BookingRequestNumber *int `gorm:"index"`
|
InternalUse *string `gorm:"type:json"`
|
||||||
IvrData *int
|
|
||||||
UtsEntries int
|
// LANGUAGE DETAILS:
|
||||||
InterpreterCount int
|
// ---
|
||||||
Flags *string `gorm:"type:json"`
|
LanguageId int
|
||||||
Metadata *string `gorm:"type:json"`
|
LanguageCrmId string
|
||||||
// Client data
|
LanguageName string
|
||||||
ClientCrmData string `gorm:"type:json"`
|
|
||||||
InvoiceConfigCrmData string `gorm:"type:json"`
|
// CLIENT DETAILS:
|
||||||
LanguageCrmData string `gorm:"type:json"`
|
// ---
|
||||||
InterpreterCrmData string `gorm:"type:json"`
|
ClientId int
|
||||||
LanguageLookupCrmData string `gorm:"type:json"`
|
CustomerDnis string
|
||||||
VicTimezoneData string `gorm:"type:json"`
|
CustomerAni string
|
||||||
NzTimezoneData string `gorm:"type:json"`
|
ClientName string
|
||||||
LocalTimezoneData string `gorm:"type:json"`
|
ClientState string
|
||||||
|
ClientFunding bool
|
||||||
|
ClientGroupId int
|
||||||
|
ClientGroupName string
|
||||||
|
ClientPoReference string
|
||||||
|
InvoiceConfigCrmId string
|
||||||
|
InvoiceConfigName string
|
||||||
|
InvoiceConfigUsed string
|
||||||
|
ClientCallDuration int
|
||||||
|
ClientTimeOfDay string
|
||||||
|
ClientBill float64
|
||||||
|
ClientRate float64
|
||||||
|
ClientTaxStatus string
|
||||||
|
|
||||||
|
// PARTNER DETAILS:
|
||||||
|
// ---
|
||||||
|
PartnerBill float64
|
||||||
|
PartnerRate float64
|
||||||
|
|
||||||
|
// TIMESTAMP DETAILS:
|
||||||
|
// ---
|
||||||
|
P1SearchStartTime *time.Time
|
||||||
|
P1ConnectTime time.Time
|
||||||
|
P1DisconnectTime time.Time
|
||||||
|
P3ConnectTime *time.Time
|
||||||
|
P3DisconnectTime *time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Processed) TableName() string {
|
func (DBClientProcessed) TableName() string {
|
||||||
return "gc_processed"
|
return "gc_client_processed"
|
||||||
|
}
|
||||||
|
|
||||||
|
type DBInterpreterProcessed struct {
|
||||||
|
|
||||||
|
// CALL DETAILS
|
||||||
|
// ---
|
||||||
|
ClientConversationId string
|
||||||
|
InterpreterConversationId string `gorm:"primaryKey"`
|
||||||
|
CallType string
|
||||||
|
GenderPreference string
|
||||||
|
BookingReference *int
|
||||||
|
BillableInterpreter bool
|
||||||
|
BillableTpa bool
|
||||||
|
|
||||||
|
// FLAGS / METADATA:
|
||||||
|
// ---
|
||||||
|
BuggedCall bool
|
||||||
|
Amended bool
|
||||||
|
CreatedAt time.Time `gorm:"autoCreateTime"`
|
||||||
|
ModifiedAt time.Time
|
||||||
|
CustomData *string `gorm:"type:json"`
|
||||||
|
InternalUse *string `gorm:"type:json"`
|
||||||
|
|
||||||
|
// LANGUAGE DETAILS:
|
||||||
|
// ---
|
||||||
|
LanguageId int
|
||||||
|
LanguageCrmId string
|
||||||
|
LanguageName string
|
||||||
|
|
||||||
|
// CLIENT DETAILS:
|
||||||
|
// ---
|
||||||
|
ClientId int
|
||||||
|
ClientName string
|
||||||
|
ClientState string
|
||||||
|
|
||||||
|
// INTERPRETER DETAILS:
|
||||||
|
// ---
|
||||||
|
InterpreterId int
|
||||||
|
InterpreterCrmId string
|
||||||
|
InterpreterName string
|
||||||
|
InterpreterPhone string
|
||||||
|
InterpreterGst bool
|
||||||
|
InterpreterNaatiId string
|
||||||
|
InterpreterGender string
|
||||||
|
InterpreterState string
|
||||||
|
InterpreterPaymentState string
|
||||||
|
InterpreterEmployer string
|
||||||
|
InterpreterLanguagePriority int
|
||||||
|
InterpreterLanguageNaatiLevel int
|
||||||
|
InterpreterLanguageNaatiDescription string
|
||||||
|
InterpreterLanguageWtn bool
|
||||||
|
InterpreterCallDuration int
|
||||||
|
InterpreterTimeOfDay string
|
||||||
|
InterpreterPayment float64
|
||||||
|
InterpreterRate float64
|
||||||
|
PaymentConfigCrmId string
|
||||||
|
PaymentConfigName string
|
||||||
|
PaymentConfigUsed string
|
||||||
|
|
||||||
|
// TIMESTAMP DETAILS:
|
||||||
|
// ---
|
||||||
|
P1SearchStartTime *time.Time
|
||||||
|
P1ConnectTime time.Time
|
||||||
|
P1DisconnectTime time.Time
|
||||||
|
P2SearchStartTime *time.Time
|
||||||
|
P2AcceptanceTime time.Time
|
||||||
|
P2ConferenceTime time.Time
|
||||||
|
P2DisconnectTime time.Time
|
||||||
|
}
|
||||||
|
|
||||||
|
func (DBInterpreterProcessed) TableName() string {
|
||||||
|
return "gc_interpreter_processed"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,19 @@ package models
|
|||||||
|
|
||||||
import "time"
|
import "time"
|
||||||
|
|
||||||
|
// DBQueueLog is a model used to store metrics and information about a conversation's consumption within a queue.
|
||||||
|
// - Queue is the name of the queue that processed the conversation.
|
||||||
|
// - Start is the time that the queue consumer started processing the conversation.
|
||||||
|
// - End is the time that the queue consumer finished processing the conversation.
|
||||||
|
// - NextQueue is the name of the queue that the consumer attempted to forward the conversation ID into.
|
||||||
|
// - Result is a map of metadata about the conversation's time in the consumer, including any potential error messages.
|
||||||
type DBQueueLog struct {
|
type DBQueueLog struct {
|
||||||
Queue string `gorm:"primaryKey"`
|
Queue string `gorm:"primaryKey"`
|
||||||
ConversationId string `gorm:"primaryKey"`
|
ConversationId string `gorm:"primaryKey"`
|
||||||
Start time.Time `gorm:"index"`
|
Start time.Time `gorm:"index"`
|
||||||
End time.Time `gorm:"index"`
|
End time.Time `gorm:"index"`
|
||||||
Duration float64
|
Duration float64
|
||||||
|
NextQueue string
|
||||||
Result string `gorm:"type:json"`
|
Result string `gorm:"type:json"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package models
|
|||||||
|
|
||||||
import "time"
|
import "time"
|
||||||
|
|
||||||
|
// WARNING: This table is **deprecated** and is no longer used for anything.
|
||||||
type GCRaw struct {
|
type GCRaw struct {
|
||||||
ClientConversationId string
|
ClientConversationId string
|
||||||
InterpreterConversationId string
|
InterpreterConversationId string
|
||||||
|
|||||||
@@ -4,6 +4,15 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// DBSegment is a model that stores raw 'segment' payloads from GenesysCloud API requests.
|
||||||
|
//
|
||||||
|
// - The ExtractWithoutAttributes function handles the conversion from JSON data (map) into formatted JSON string for gcq-details requests.
|
||||||
|
//
|
||||||
|
// Table Schema:
|
||||||
|
//
|
||||||
|
// Primary Key: Id
|
||||||
|
// Indexes: Id, SegmentEnd, SegmentStart, SegmentType, SessionId
|
||||||
|
// JSON Fields: q950ResponseCodes
|
||||||
type DBSegment struct {
|
type DBSegment struct {
|
||||||
Id string `gorm:"primaryKey;index"`
|
Id string `gorm:"primaryKey;index"`
|
||||||
Conference bool
|
Conference bool
|
||||||
@@ -12,7 +21,7 @@ type DBSegment struct {
|
|||||||
SegmentEnd time.Time `gorm:"index"`
|
SegmentEnd time.Time `gorm:"index"`
|
||||||
SegmentStart time.Time `gorm:"index"`
|
SegmentStart time.Time `gorm:"index"`
|
||||||
SegmentType string `gorm:"index"`
|
SegmentType string `gorm:"index"`
|
||||||
SessionId string `gorm:"foreignKey"`
|
SessionId string `gorm:"index;foreignKey"`
|
||||||
WrapUpCode string
|
WrapUpCode string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,17 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
|
// DBSession is a model that stores raw 'session' payloads from GenesysCloud API requests.
|
||||||
|
//
|
||||||
|
// - The ExtractWithoutAttributes function handles the conversion from JSON data (map) into formatted JSON string for gcq-details requests.
|
||||||
|
//
|
||||||
|
// Table Schema:
|
||||||
|
//
|
||||||
|
// Primary Key: Id
|
||||||
|
// Indexes: Id, ParticipantId
|
||||||
|
// JSON Fields: MediaEndpointStats, Metrics, Flow
|
||||||
|
//
|
||||||
|
// GORM Specifics:
|
||||||
|
// - Can be preloaded with Segments []DBSegment
|
||||||
type DBSession struct {
|
type DBSession struct {
|
||||||
Ani string
|
Ani string
|
||||||
Direction string
|
Direction string
|
||||||
|
|||||||
134
models/ticket.go
134
models/ticket.go
@@ -2,66 +2,80 @@ package models
|
|||||||
|
|
||||||
import "time"
|
import "time"
|
||||||
|
|
||||||
type Ticket struct {
|
// DBTicket is a model that stores Ticket records from Zoho Desk.
|
||||||
TicketID string `gorm:"primaryKey;column:ticket_id" json:"ticket_id"`
|
//
|
||||||
TicketReferenceID *string `gorm:"column:ticket_reference_id" json:"ticket_reference_id"`
|
// - The intention of the model is to map JSON -> struct -> JSON
|
||||||
DepartmentID *string `gorm:"column:department_id" json:"department_id"`
|
//
|
||||||
AccountID *string `gorm:"column:account_id" json:"account_id"`
|
// Table Schema:
|
||||||
ContactID *string `gorm:"column:contact_id" json:"contact_id"`
|
//
|
||||||
Email *string `gorm:"column:email" json:"email"`
|
// Primary Key: Id
|
||||||
Phone *string `gorm:"column:phone" json:"phone"`
|
// Indexes: Id
|
||||||
Subject *string `gorm:"column:subject" json:"subject"`
|
// JSON Fields: Assignee, CF, Contact, DescAttachment, EntitySkills, FirstThread, LayoutDetails, SecondaryContacts, SharedDepartments, Source
|
||||||
Description *string `gorm:"column:description" json:"description"`
|
//
|
||||||
Status *string `gorm:"column:status" json:"status"`
|
// NOTE: CF stands for Custom Fields and stores all layout fields that are not in this struct (this struct contains only the defaults).
|
||||||
ProductID *string `gorm:"column:product_id" json:"product_id"`
|
type DBTicket struct {
|
||||||
TicketOwnerID *string `gorm:"column:ticket_owner_id" json:"ticket_owner_id"`
|
AccountId int
|
||||||
CreatedBy *string `gorm:"column:created_by" json:"created_by"`
|
ApprovalCount int
|
||||||
ModifiedBy *string `gorm:"column:modified_by" json:"modified_by"`
|
Assignee string `gorm:"type:json"`
|
||||||
CreatedTime *time.Time `gorm:"column:created_time" json:"created_time"`
|
AssigneeId int
|
||||||
OnHoldTime *time.Time `gorm:"column:on_hold_time" json:"on_hold_time"`
|
AttachmentCount int
|
||||||
ClosedTime *time.Time `gorm:"column:closed_time" json:"closed_time"`
|
Category string
|
||||||
ModifiedTime *time.Time `gorm:"column:modified_time" json:"modified_time"`
|
CF string `gorm:"type:json"`
|
||||||
TeamID *string `gorm:"column:team_id" json:"team_id"`
|
Channel string
|
||||||
DueDate *time.Time `gorm:"column:due_date" json:"due_date"`
|
ChannelCode string
|
||||||
Tags *string `gorm:"column:tags" json:"tags"`
|
ChannelRelatedInfo string
|
||||||
Priority *string `gorm:"column:priority" json:"priority"`
|
Classification string
|
||||||
IsOverdue *bool `gorm:"column:is_overdue" json:"is_overdue"`
|
ClosedTime *time.Time
|
||||||
IsEscalated *bool `gorm:"column:is_escalated" json:"is_escalated"`
|
CommentCount int
|
||||||
Classification *string `gorm:"column:classification" json:"classification"`
|
Contact string `gorm:"type:json"`
|
||||||
Resolution *string `gorm:"column:resolution" json:"resolution"`
|
ContactId int
|
||||||
TimeToRespond *int `gorm:"column:time_to_respond" json:"time_to_respond"`
|
CreatedBy int
|
||||||
Category *string `gorm:"column:category" json:"category"`
|
CreatedTime time.Time
|
||||||
Subcategory *string `gorm:"column:subcategory" json:"subcategory"`
|
CustomerResponseTime time.Time
|
||||||
Subclassification *string `gorm:"column:subclassification" json:"subclassification"`
|
DepartmentId int
|
||||||
BookingNumber *int `gorm:"column:booking_number" json:"booking_number"`
|
DescAttachments string `gorm:"type:json"`
|
||||||
CostCode *string `gorm:"column:cost_code" json:"cost_code"`
|
Description string
|
||||||
LanguageRequired *string `gorm:"column:language_required" json:"language_required"`
|
DueDate *time.Time
|
||||||
TimeZone *string `gorm:"column:time_zone" json:"time_zone"`
|
Email string
|
||||||
DeliveryMethod *string `gorm:"column:delivery_method" json:"delivery_method"`
|
EntitySkills string `gorm:"type:json"`
|
||||||
DurationInMinutes *int `gorm:"column:duration_in_minutes" json:"duration_in_minutes"`
|
FirstThread string `gorm:"type:json"`
|
||||||
InterpreterID *int `gorm:"column:interpreter_id" json:"interpreter_id"`
|
FollowerCount int
|
||||||
InterpreterEmail *string `gorm:"column:interpreter_email" json:"interpreter_email"`
|
Id string `gorm:"primaryKey"`
|
||||||
InterpreterName *string `gorm:"column:interpreter_name" json:"interpreter_name"`
|
IsArchived bool
|
||||||
ClientID *int `gorm:"column:client_id" json:"client_id"`
|
IsDeleted bool
|
||||||
ClientName *string `gorm:"column:client_name" json:"client_name"`
|
IsEscalated bool
|
||||||
InterpreterNaati *int `gorm:"column:interpreter_naati" json:"interpreter_naati"`
|
IsOverdue bool
|
||||||
SecondaryInterpreterID *int `gorm:"column:secondary_interpreter_id" json:"secondary_interpreter_id"`
|
IsResponseOverdue bool
|
||||||
PayCycle *int `gorm:"column:pay_cycle" json:"pay_cycle"`
|
IsSpam bool
|
||||||
BookingTime *time.Time `gorm:"column:booking_time" json:"booking_time"`
|
IsTrashed bool
|
||||||
BillingGroup *string `gorm:"column:billing_group" json:"billing_group"`
|
Language string
|
||||||
VideoLink *string `gorm:"column:video_link" json:"video_link"`
|
LayoutDetails string `gorm:"type:json"`
|
||||||
ConversationID *string `gorm:"column:conversation_id" json:"conversation_id"`
|
LayoutId int
|
||||||
DNIS *string `gorm:"column:dnis" json:"dnis"`
|
ModifiedBy int
|
||||||
ClientAgentName *string `gorm:"column:client_agent_name" json:"client_agent_name"`
|
ModifiedTime time.Time
|
||||||
ClientAgentPhone *string `gorm:"column:client_agent_phone" json:"client_agent_phone"`
|
OnHoldTime *time.Time
|
||||||
ClientAgentEmail *string `gorm:"column:client_agent_email" json:"client_agent_email"`
|
Phone string
|
||||||
BillingCode *string `gorm:"column:billing_code" json:"billing_code"`
|
Priority string
|
||||||
MBIEFeedback *string `gorm:"column:mbie_feedback" json:"mbie_feedback"`
|
ProductId string
|
||||||
BookingComments *string `gorm:"column:booking_comments" json:"booking_comments"`
|
Resolution string
|
||||||
AdditionalPrebookingInformation *string `gorm:"column:additional_prebooking_information" json:"additional_prebooking_information"`
|
ResponseDueDate *time.Time
|
||||||
ForceUpdate *bool `gorm:"column:force_update" json:"force_update"`
|
SecondaryContacts string `gorm:"type:json"`
|
||||||
|
Sentiment string
|
||||||
|
SharedDepartments string `gorm:"type:json"`
|
||||||
|
Source string `gorm:"type:json"`
|
||||||
|
Status string
|
||||||
|
StatusType string
|
||||||
|
SubCategory string
|
||||||
|
Subject string
|
||||||
|
TagCount int
|
||||||
|
TaskCount int
|
||||||
|
TeamId int
|
||||||
|
ThreadCount int
|
||||||
|
TicketNumber int
|
||||||
|
TimeEntryCount int
|
||||||
|
WebUrl string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Ticket) TableName() string {
|
func (DBTicket) TableName() string {
|
||||||
return "live_tickets"
|
return "zoho_live_tickets"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|
||||||
@@ -94,7 +95,7 @@ func ExtractWithoutAttributes(base models.AnalyticsConversationWithoutAttributes
|
|||||||
}
|
}
|
||||||
sessions = append(sessions, session)
|
sessions = append(sessions, session)
|
||||||
|
|
||||||
for _, seg := range sess.Segments {
|
for idx, seg := range sess.Segments {
|
||||||
|
|
||||||
segmentStart, err := time.Parse(time.RFC3339, seg.SegmentStart)
|
segmentStart, err := time.Parse(time.RFC3339, seg.SegmentStart)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -112,7 +113,7 @@ func ExtractWithoutAttributes(base models.AnalyticsConversationWithoutAttributes
|
|||||||
}
|
}
|
||||||
|
|
||||||
segment := models.DBSegment{
|
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,
|
Conference: seg.Conference,
|
||||||
DisconnectType: seg.DisconnectType,
|
DisconnectType: seg.DisconnectType,
|
||||||
Q850ResponseCodes: string(q850ResponseCodesBytes),
|
Q850ResponseCodes: string(q850ResponseCodesBytes),
|
||||||
|
|||||||
Reference in New Issue
Block a user