package entities import ( "time" "gorm.io/gorm" ) type Marketing struct { Id uint `gorm:"primaryKey;autoIncrement"` SoNumber string `gorm:"uniqueIndex;not null"` CustomerId uint `gorm:"not null"` SoDocs string `gorm:"type:varchar(20)"` SoDate time.Time `gorm:"type:date;not null"` SalesPersonId uint `gorm:"not null"` Notes string `gorm:"type:text"` MarketingType string `gorm:"type:varchar(50)"` CreatedBy uint `gorm:"not null"` CreatedAt time.Time `gorm:"autoCreateTime"` UpdatedAt time.Time `gorm:"autoUpdateTime"` DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` Customer Customer `gorm:"foreignKey:CustomerId;references:Id"` SalesPerson User `gorm:"foreignKey:SalesPersonId;references:Id"` CreatedUser User `gorm:"foreignKey:CreatedBy;references:Id"` Products []MarketingProduct `gorm:"foreignKey:MarketingId;references:Id"` LatestApproval *Approval `gorm:"-" json:"latest_approval,omitempty"` }