Feat[BE-222,223,224]: creating So create delete patch update get getall approval API

This commit is contained in:
aguhh18
2025-11-12 11:28:18 +07:00
parent 762dfa9fb9
commit 0a0c3f869b
24 changed files with 1688 additions and 82 deletions
+23
View File
@@ -0,0 +1,23 @@
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"`
}
+5 -4
View File
@@ -19,8 +19,9 @@ type Marketing struct {
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"`
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"`
}
+3 -2
View File
@@ -19,6 +19,7 @@ type MarketingProduct struct {
UpdatedAt time.Time `gorm:"autoUpdateTime"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
Marketing Marketing `gorm:"foreignKey:MarketingId;references:Id"`
ProductWarehouse ProductWarehouse `gorm:"foreignKey:ProductWarehouseId;references:Id"`
Marketing Marketing `gorm:"foreignKey:MarketingId;references:Id"`
ProductWarehouse ProductWarehouse `gorm:"foreignKey:ProductWarehouseId;references:Id"`
DeliveryProducts []MarketingDeliveryProduct `gorm:"foreignKey:MarketingProductId;references:Id"`
}
+2 -1
View File
@@ -14,5 +14,6 @@ type SalesOrders struct {
UpdatedAt time.Time `gorm:"autoUpdateTime"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
CreatedUser User `gorm:"foreignKey:CreatedBy;references:Id"`
CreatedUser User `gorm:"foreignKey:CreatedBy;references:Id"`
LatestApproval *Approval `gorm:"-" json:"latest_approval,omitempty"`
}