commit 34beb51c2c0da22f91772e69e41e22c7a8b0c66d Author: Frederick Holland Date: Mon Jun 16 17:49:27 2025 +1000 Initial commit diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..0e59bea --- /dev/null +++ b/go.mod @@ -0,0 +1,11 @@ +module huron.connectingnow.net/fholland/gorm_models + +go 1.24.4 + +require gorm.io/gorm v1.30.0 + +require ( + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/jinzhu/now v1.1.5 // indirect + golang.org/x/text v0.20.0 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..d972c08 --- /dev/null +++ b/go.sum @@ -0,0 +1,8 @@ +github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= +github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= +github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= +golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= +gorm.io/gorm v1.30.0 h1:qbT5aPv1UH8gI99OsRlvDToLxW5zR7FzS9acZDOZcgs= +gorm.io/gorm v1.30.0/go.mod h1:8Z33v652h4//uMA76KjeDH8mJXPm1QNCYrMeatR0DOE= diff --git a/models/call.go b/models/call.go new file mode 100644 index 0000000..1468dbe --- /dev/null +++ b/models/call.go @@ -0,0 +1,35 @@ +package models + +import ( + "time" + + "gorm.io/gorm" +) + +type DBCall struct { + gorm.Model + AfterCallWorkRequired bool + Confined bool + ConnectedTime *time.Time `gorm:"index"` + Direction string + DisconnectReasons string `gorm:"type:json"` + DisconnectType string + DisconnectedTime *time.Time `gorm:"index"` + Held bool + Id string `gorm:"primaryKey;index"` + InitialState string + Muted bool + Other string `gorm:"type:json"` + ParticipantId string `gorm:"foreignKey;index"` + PeerId string + Provider string + Recording bool + RecordingState string + SecurePause bool + Self string `gorm:"type:json"` + State string +} + +func (DBCall) TableName() string { + return "gc_calls" +} diff --git a/models/conversation.go b/models/conversation.go new file mode 100644 index 0000000..fcf5242 --- /dev/null +++ b/models/conversation.go @@ -0,0 +1,31 @@ +package models + +import ( + "time" + + "gorm.io/gorm" +) + +type DBConversation struct { + gorm.Model + 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 + SemiLiveUpdate *time.Time + JobUpdate *time.Time +} + +func (DBConversation) TableName() string { + return "gc_conversations" +} diff --git a/models/participant.go b/models/participant.go new file mode 100644 index 0000000..3fcf86f --- /dev/null +++ b/models/participant.go @@ -0,0 +1,30 @@ +package models + +import ( + "time" + + "gorm.io/gorm" +) + +type DBParticipant struct { + gorm.Model + 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 +} + +func (DBParticipant) TableName() string { + return "gc_participants" +} diff --git a/models/segment.go b/models/segment.go new file mode 100644 index 0000000..ee5aa2f --- /dev/null +++ b/models/segment.go @@ -0,0 +1,24 @@ +package models + +import ( + "time" + + "gorm.io/gorm" +) + +type DBSegment struct { + gorm.Model + 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 +} + +func (DBSegment) TableName() string { + return "gc_segments" +} diff --git a/models/session.go b/models/session.go new file mode 100644 index 0000000..2c30d13 --- /dev/null +++ b/models/session.go @@ -0,0 +1,25 @@ +package models + +import "gorm.io/gorm" + +type DBSession struct { + gorm.Model + 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 +} + +func (DBSession) TableName() string { + return "gc_sessions" +}