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 Customer struct { ID int `gorm:"primaryKey;autoIncrement"` CNPJ string `gorm:"unique;not null"` Nome string `gorm:"not null"` NomeFantasia string `gorm:"not null"` Tipo string `gorm:"not null"` Porte string `gorm:"not null"` Situacao string `gorm:"not null"` Abertura string `gorm:"not null"` NaturezaJuridica string `gorm:"not null"` Logradouro string `gorm:"not null"` Numero string `gorm:"not null"` Complemento string `gorm:"not null"` Municipio string `gorm:"not null"` Bairro string `gorm:"not null"` UF string `gorm:"not null"` CEP string `gorm:"not null"` UserID int `gorm:"not null"` User SystemUser `gorm:"foreignKey:UserID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` } type Email struct { ID int Name string EmailText string } // Server represents the servers table in the database type Server struct { ID uint `gorm:"primaryKey;column:id;autoIncrement"` Name string `gorm:"column:name;type:text;not null"` IP string `gorm:"column:ip;type:text;not null"` Subdomain string `gorm:"column:subdomain;type:text;not null"` // Relationship (back-reference) Channels []Channel `gorm:"foreignKey:ServerID"` } // 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 Channel struct { ID uint `gorm:"primaryKey;column:id;autoIncrement"` Name string `gorm:"column:name;type:text;not null;uniqueIndex"` TransmissionKey string `gorm:"column:transmission_key;type:text;not null;uniqueIndex"` DateLimit time.Time `gorm:"column:date_limit;type:date;not null"` CustomerID uint `gorm:"column:customer_id;not null"` ServerID uint `gorm:"column:server_id;not null"` PlanID uint `gorm:"column:plan_id;not null"` Status string `gorm:"column:status;not null"` // Define relationships Customer Customer `gorm:"foreignKey:CustomerID;references:ID"` Server Server `gorm:"foreignKey:ServerID;references:ID"` Plan Plan `gorm:"foreignKey:PlanID;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" }