mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
feat(BE): finance (payment, initial_balance, injection). fix(BE): kandang capacity
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package entities
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type Initial struct {
|
||||
Id uint `gorm:"primaryKey;autoIncrement"`
|
||||
ReferenceNumber string `gorm:"type:varchar(100);not null"`
|
||||
TransactionType string `gorm:"type:varchar(50);not null"`
|
||||
InitialBalanceType string `gorm:"type:varchar(20);not null"`
|
||||
PartyType string `gorm:"type:varchar(50);not null;index:initials_party_polymorphic,priority:1"`
|
||||
PartyId uint `gorm:"not null;index:initials_party_polymorphic,priority:2"`
|
||||
BankId *uint `gorm:"index"`
|
||||
Direction string `gorm:"type:varchar(5);not null"`
|
||||
Nominal float64 `gorm:"type:numeric(15,3);not null"`
|
||||
Notes string `gorm:"type:text;not null"`
|
||||
CreatedBy uint `gorm:"index" json:"-"`
|
||||
CreatedAt time.Time `gorm:"autoCreateTime"`
|
||||
UpdatedAt time.Time `gorm:"autoUpdateTime"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
||||
|
||||
Bank 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:"-"`
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
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:"-"`
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package entities
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type Transaction struct {
|
||||
Id uint `gorm:"primaryKey"`
|
||||
Name string `gorm:"not null;uniqueIndex:idx_name,where:deleted_at IS NULL"`
|
||||
CreatedBy uint `gorm:"not null"`
|
||||
CreatedAt time.Time `gorm:"autoCreateTime"`
|
||||
UpdatedAt time.Time `gorm:"autoUpdateTime"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
||||
|
||||
CreatedUser User `gorm:"foreignKey:CreatedBy;references:Id"`
|
||||
}
|
||||
Reference in New Issue
Block a user