package entities import ( "time" "gorm.io/gorm" ) type Payment struct { Id uint `gorm:"primaryKey;autoIncrement"` PaymentCode string `gorm:"type:varchar(50);not null"` ReferenceNumber *string `gorm:"type:varchar(100)"` TransactionType string `gorm:"type:varchar(50)"` PartyType string `gorm:"type:varchar(50);not null;index:payments_party_polymorphic,priority:1"` PartyId uint `gorm:"not null;index:payments_party_polymorphic,priority:2"` PaymentDate time.Time `gorm:"not null"` PaymentMethod string `gorm:"type:varchar(20);not null"` BankId *uint `gorm:"not null;index:idx_payments_bank_id"` Direction string `gorm:"type:varchar(5);not null"` Nominal float64 `gorm:"type:numeric(15,3);not null"` Notes string `gorm:"type:text;not null"` CreatedAt time.Time `gorm:"autoCreateTime"` UpdatedAt time.Time `gorm:"autoUpdateTime"` DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` CreatedBy uint `gorm:"index" json:"-"` BankWarehouse Bank `gorm:"foreignKey:BankId;references:Id"` CreatedUser User `gorm:"foreignKey:CreatedBy;references:Id"` Customer *Customer `gorm:"foreignKey:PartyId;references:Id"` Supplier *Supplier `gorm:"foreignKey:PartyId;references:Id"` LatestApproval *Approval `gorm:"-" json:"-"` }