diff --git a/models/conversation.go b/models/conversation.go index d70bd8c..0baa0a2 100644 --- a/models/conversation.go +++ b/models/conversation.go @@ -22,6 +22,8 @@ type DBConversation struct { DetailsUpdate *time.Time SemiLiveUpdate *time.Time JobUpdate *time.Time + + Participants []DBParticipant `gorm:"foreignKey:ConversationId;references:Id"` } func (DBConversation) TableName() string { diff --git a/models/full_conversation.go b/models/full_conversation.go new file mode 100644 index 0000000..48f1f80 --- /dev/null +++ b/models/full_conversation.go @@ -0,0 +1,67 @@ +package models + +import "time" + +type Conversation struct { + Address *string + DivisionIds *string `gorm:"type:json"` + End *time.Time `gorm:"index"` + ExternalTag *string + Id string `gorm:"primaryKey;index"` + MinMos *float32 + MinRFactor *float32 + OriginatingDirection *string + RecentTransfers *string `gorm:"type:json"` + RecordingState *string + SecurePause *bool + Start *time.Time `gorm:"index"` + UtilizationLabelId *string + LiveUpdate *time.Time + DetailsUpdate *time.Time + SemiLiveUpdate *time.Time + JobUpdate *time.Time + Participants []struct { + Address *string + Attributes *string `gorm:"type:json"` + ConnectedTime *time.Time `gorm:"index"` + ConversationId string `gorm:"foreignKey;index"` + EndTime *time.Time `gorm:"index"` + ExternalContactId *string + ExternalContactInitialDivisionId *string + Id string `gorm:"primaryKey;index"` + MediaRoles *string `gorm:"type:json"` + Name *string `gorm:"index"` + Purpose *string `gorm:"index"` + QueueId *string + Wrapup *string `gorm:"type:json"` + WrapupExpected *bool + WrapupRequired *bool + Sessions []struct { + Ani string + Direction string + Dnis string + EdgeId string + Id string `gorm:"primaryKey;index"` + MediaEndpointStats string `gorm:"type:json"` + MediaType string + Metrics string `gorm:"type:json"` + ParticipantId string `gorm:"foreignKey;index"` + ProtocolCallId string + Provider string + Recording bool + RemoteNameDisplayable string + SessionDnis string + Segments []struct { + Id string `gorm:"primaryKey;index"` + Conference bool + DisconnectType string + Q850ResponseCodes string `gorm:"type:json"` + SegmentEnd time.Time `gorm:"index"` + SegmentStart time.Time `gorm:"index"` + SegmentType string `gorm:"index"` + SessionId string `gorm:"foreignKey"` + WrapUpCode string + } + } + } +} diff --git a/models/participant.go b/models/participant.go index e34b074..2da5aee 100644 --- a/models/participant.go +++ b/models/participant.go @@ -20,6 +20,8 @@ type DBParticipant struct { Wrapup *string `gorm:"type:json"` WrapupExpected *bool WrapupRequired *bool + + Sessions []DBSession `gorm:"foreignKey:ParticipantId;references:Id"` } func (DBParticipant) TableName() string { diff --git a/models/session.go b/models/session.go index 00d86d2..39ae059 100644 --- a/models/session.go +++ b/models/session.go @@ -15,6 +15,8 @@ type DBSession struct { Recording bool RemoteNameDisplayable string SessionDnis string + + Segments []DBSegment `gorm:"foreignKey:SessionId;references:Id"` } func (DBSession) TableName() string {