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
@@ -2,6 +2,7 @@ package validation
type Create struct {
CustomerId uint `json:"customer_id" validate:"required,gt=0"`
SalesPersonId uint `json:"sales_person_id" validate:"required,gt=0"`
Date string `json:"date" validate:"required,datetime=2006-01-02"`
Notes string `json:"notes" validate:"omitempty,max=500"`
MarketingProducts []CreateMarketingProduct `json:"marketing_products" validate:"required,min=1,dive"`
@@ -19,7 +20,11 @@ type CreateMarketingProduct struct {
}
type Update struct {
Name *string `json:"name,omitempty" validate:"omitempty"`
CustomerId uint `json:"customer_id" validate:"omitempty,gt=0"`
SalesPersonId uint `json:"sales_person_id" validate:"omitempty,gt=0"`
Date string `json:"date" validate:"omitempty,datetime=2006-01-02"`
Notes string `json:"notes" validate:"omitempty,max=500"`
MarketingProducts []CreateMarketingProduct `json:"marketing_products" validate:"omitempty,min=1,dive"`
}
type Query struct {
@@ -27,3 +32,9 @@ type Query struct {
Limit int `query:"limit" validate:"omitempty,number,min=1,max=100,gt=0"`
Search string `query:"search" validate:"omitempty,max=50"`
}
type Approve struct {
Action string `json:"action" validate:"required_strict"`
ApprovableIds []uint `json:"approvable_ids" validate:"required_strict,min=1,dive,gt=0"`
Notes *string `json:"notes,omitempty" validate:"omitempty,max=500"`
}