Feat[BE-261] : inisiate expense module

This commit is contained in:
aguhh18
2025-11-17 14:46:21 +07:00
parent d528096d56
commit 09d503f5be
15 changed files with 451 additions and 64 deletions
-23
View File
@@ -1,23 +0,0 @@
package entities
import (
"time"
"gorm.io/gorm"
)
type DeliveryOrders struct {
Id uint `gorm:"primaryKey" json:"id"`
DeliveryNumber string `gorm:"type:varchar(255);not null;uniqueIndex" json:"delivery_number"`
DeliveryDate time.Time `gorm:"not null" json:"delivery_date"`
MarketingId uint `gorm:"not null" json:"marketing_id"`
Notes string `gorm:"type:text" json:"notes"`
CreatedBy uint `gorm:"not null" json:"created_by"`
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
Marketing *Marketing `gorm:"foreignKey:MarketingId;references:Id" json:"marketing,omitempty"`
DeliveryProducts []MarketingDeliveryProduct `gorm:"-" json:"delivery_products,omitempty"`
CreatedUser *User `gorm:"foreignKey:CreatedBy;references:Id" json:"created_user,omitempty"`
}
@@ -6,7 +6,7 @@ import (
"gorm.io/gorm"
)
type SalesOrders struct {
type Expense struct {
Id uint `gorm:"primaryKey"`
Name string `gorm:"not null;uniqueIndex:idx_name,where:deleted_at IS NULL"`
CreatedBy uint `gorm:"not null"`
@@ -14,6 +14,5 @@ type SalesOrders struct {
UpdatedAt time.Time `gorm:"autoUpdateTime"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
CreatedUser User `gorm:"foreignKey:CreatedBy;references:Id"`
LatestApproval *Approval `gorm:"-" json:"latest_approval,omitempty"`
CreatedUser User `gorm:"foreignKey:CreatedBy;references:Id"`
}