package entities import ( "time" "gorm.io/gorm" ) type Expense struct { Id uint64 `gorm:"primaryKey;autoIncrement"` ReferenceNumber string `gorm:"type:varchar(50);uniqueIndex"` SupplierId uint64 `gorm:""` Category string `gorm:"type:varchar(50);not null"` PoNumber string `gorm:"type:varchar(50)"` LocationId uint64 `gorm:"not null"` ProjectFlockId *string `gorm:"type:json"` RealizationDate time.Time `gorm:"type:date;column:realization_date"` TransactionDate time.Time `gorm:"type:date;not null"` Notes string `gorm:"type:text;column:notes"` IsPaid bool `gorm:"column:is_paid;not null;default:false"` CreatedBy uint64 `gorm:""` CreatedAt time.Time `gorm:"autoCreateTime"` UpdatedAt time.Time `gorm:"autoUpdateTime"` DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` Supplier *Supplier `gorm:"foreignKey:SupplierId;references:Id"` Location *Location `gorm:"foreignKey:LocationId;references:Id"` CreatedUser *User `gorm:"foreignKey:CreatedBy;references:Id"` Nonstocks []ExpenseNonstock `gorm:"foreignKey:ExpenseId;references:Id"` Documents []Document `gorm:"foreignKey:DocumentableId;references:Id"` RealizationDocuments []Document `gorm:"foreignKey:DocumentableId;references:Id"` LatestApproval *Approval `gorm:"-" json:"latest_approval,omitempty"` }