package models import "time" // ==================================================================== // Adianti tables type SystemGroup struct { ID int `gorm:"primaryKey"` Name string `gorm:"size:256"` } func (SystemGroup) TableName() string { return "system_group" } type SystemProgram struct { ID int `gorm:"primaryKey"` Name string `gorm:"size:256"` Controller string `gorm:"size:256"` } type SystemUnit struct { ID int `gorm:"primaryKey"` Name string `gorm:"size:256"` ConnectionName string `gorm:"size:256"` CustomCode string `gorm:"size:256"` } type SystemRole struct { ID int `gorm:"primaryKey"` Name string `gorm:"size:256"` CustomCode string `gorm:"size:256"` } type SystemPreference struct { ID string `gorm:"primaryKey;size:256"` Value string `gorm:"type:citext"` } type SystemUser struct { ID int `gorm:"primaryKey"` Name string `gorm:"size:256"` Login string `gorm:"size:256"` Password string `gorm:"size:256"` Email string `gorm:"size:256"` AcceptedTermPolicy string `gorm:"size:1"` Phone string `gorm:"size:256"` Address string `gorm:"size:256"` FunctionName string `gorm:"size:256"` About string `gorm:"type:citext"` AcceptedTermPolicyAt string `gorm:"size:20"` AcceptedTermPolicyData string `gorm:"type:citext"` FrontpageID int `gorm:"index"` SystemUnitID int `gorm:"index"` Active string `gorm:"size:1"` CustomCode string `gorm:"size:256"` OTPSecret string `gorm:"size:256"` SystemUnit SystemUnit `gorm:"foreignKey:SystemUnitID"` Frontpage SystemProgram `gorm:"foreignKey:FrontpageID"` } type SystemUserUnit struct { ID int `gorm:"primaryKey"` SystemUserID int SystemUnitID int SystemUser SystemUser `gorm:"foreignKey:SystemUserID"` SystemUnit SystemUnit `gorm:"foreignKey:SystemUnitID"` } type SystemUserGroup struct { ID int `gorm:"primaryKey"` SystemUserID int SystemGroupID int SystemUser SystemUser `gorm:"foreignKey:SystemUserID"` SystemGroup SystemGroup `gorm:"foreignKey:SystemGroupID"` } type SystemUserRole struct { ID int `gorm:"primaryKey"` SystemUserID int SystemRoleID int SystemUser SystemUser `gorm:"foreignKey:SystemUserID"` SystemRole SystemRole `gorm:"foreignKey:SystemRoleID"` } type SystemGroupProgram struct { ID int `gorm:"primaryKey"` SystemGroupID int SystemProgramID int SystemGroup SystemGroup `gorm:"foreignKey:SystemGroupID"` SystemProgram SystemProgram `gorm:"foreignKey:SystemProgramID"` } type SystemUserProgram struct { ID int `gorm:"primaryKey"` SystemUserID int SystemProgramID int SystemUser SystemUser `gorm:"foreignKey:SystemUserID"` SystemProgram SystemProgram `gorm:"foreignKey:SystemProgramID"` } type SystemUserOldPassword struct { ID int `gorm:"primaryKey"` SystemUserID int Password string `gorm:"size:256"` CreatedAt string `gorm:"size:20"` SystemUser SystemUser `gorm:"foreignKey:SystemUserID"` } type SystemProgramMethodRole struct { ID int `gorm:"primaryKey"` SystemProgramID int SystemRoleID int MethodName string `gorm:"size:256"` SystemProgram SystemProgram `gorm:"foreignKey:SystemProgramID"` SystemRole SystemRole `gorm:"foreignKey:SystemRoleID"` } // ==================================================================== // PCast tables type Cliente struct { ID int32 `gorm:"primaryKey;autoIncrement;column:id"` CNPJ string `gorm:"unique;column:cnpj"` Nome string `gorm:"not null;column:nome"` NomeFantasia string `gorm:"column:nome_fantasia"` Email string `gorm:"column:email"` TipoCliente string `gorm:"column:tipo_cliente"` TipoServico uint `gorm:"column:tipo_servico"` Tipo uint `gorm:"column:tipo"` Porte string `gorm:"column:porte"` Situacao string `gorm:"column:situacao"` Abertura string `gorm:"column:abertura"` NaturezaJuridica string `gorm:"column:natureza_juridica"` Logradouro string `gorm:"column:logradouro"` Numero string `gorm:"column:numero"` Complemento string `gorm:"column:complemento"` Municipio string `gorm:"column:municipio"` Bairro string `gorm:"column:bairro"` UF string `gorm:"column:uf"` CEP string `gorm:"column:cep"` CreatedAt time.Time CreatedBy int UpdatedAt time.Time UpdatedBy int } type Email struct { ID int Name string EmailText string } // Server represents the servers table in the database type Servidor struct { ID uint `gorm:"primaryKey;column:id;autoIncrement"` Nome string `gorm:"column:nome;type:text;not null"` IP string `gorm:"column:ip;type:text;not null"` Subdominio string `gorm:"column:subdominio;type:text;not null"` // Relationship (back-reference) Canais []Canal `gorm:"foreignKey:ServidorID"` } // // TableName overrides the table name // func (Server) TableName() string { // return "servers" // } // // Plan represents the plans table in the database // type Plan struct { // ID uint `gorm:"primaryKey;column:id;autoIncrement"` // Name string `gorm:"column:name;type:text;not null"` // DailyLimitTransmission int `gorm:"column:daily_limit_transmission;type:integer;not null"` // MonthValue float64 `gorm:"column:month_value;type:numeric(10,2);not null"` // YearValue float64 `gorm:"column:year_value;type:numeric(10,2);not null"` // // Relationship (back-reference) // Channels []Channel `gorm:"foreignKey:PlanID"` // } // // TableName overrides the table name // func (Plan) TableName() string { // return "plans" // } // // ChannelStat represents the channel_stats table in the database // type ChannelStat struct { // ID uint `gorm:"primaryKey;column:id;autoIncrement"` // Name string `gorm:"column:name;type:text;not null;uniqueIndex"` // Description string `gorm:"column:description;type:text;not null"` // // Relationship (back-reference) // Channels []Channel `gorm:"foreignKey:ChannelStatID"` // } // // TableName overrides the table name // func (ChannelStat) TableName() string { // return "channel_stats" // } type Canal struct { ID uint `gorm:"primaryKey;column:id;autoIncrement"` ClienteID uint `gorm:"column:cliente_id;not null"` ServidorID uint `gorm:"column:servidor_id;not null"` Nome string `gorm:"column:nome;type:text;not null;uniqueIndex"` Chave string `gorm:"column:chave;type:text;not null;uniqueIndex"` LimiteDiario int `gorm:"column:limite_diario;not null"` Validade time.Time `gorm:"column:validade;type:date;not null"` CreatedAt time.Time `gorm:"column:created_at;type:timestamp;not null"` CreatedBy int `gorm:"column:created_by;not null"` UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp;not null"` UpdatedBy int `gorm:"column:updated_by;not null"` // Define relationships Cliente Cliente `gorm:"foreignKey:ClienteID;references:ID"` Servidor Servidor `gorm:"foreignKey:ServidorID;references:ID"` } // // TableName overrides the table name // func (Channel) TableName() string { // return "channels" // } // // TransmissionLog represents the transmissionlog table in the database // type TransmissionLog struct { // ID uint `gorm:"primaryKey;column:id;autoIncrement"` // Datetime time.Time `gorm:"column:datetime;type:timestamp;not null"` // Channel string `gorm:"column:channel;type:text;not null"` // Message string `gorm:"column:message;type:text;not null"` // } // // TableName overrides the table name // func (TransmissionLog) TableName() string { // return "transmissionlog" // } // Available on RAM during the execution // CurrentTransmission represents the transmissions table in the database type CurrentTransmission struct { ID uint `gorm:"primaryKey;column:id;autoIncrement"` Canal string `gorm:"column:canal;type:text;not null"` Inicio time.Time `gorm:"column:inicio;type:timestamp;not null"` Duracao int `gorm:"column:duracao;not null"` Assistentes int `gorm:"column:assistentes;not null"` Desktop int `gorm:"column:desktop;not null"` Mobile int `gorm:"column:mobile;not null"` Mensagem string `gorm:"column:mensagem;type:text;not null"` Ativa string `gorm:"column:ativa;type:char(1);not null"` SessionID string `gorm:"-"` Chave string `gorm:"-"` Limite time.Time `gorm:"-"` LimiteDiario int `gorm:"-"` } // TableName overrides the table name func (CurrentTransmission) TableName() string { return "transmissao" }