mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
66 lines
2.8 KiB
Go
66 lines
2.8 KiB
Go
package validation
|
|
|
|
import (
|
|
"mime/multipart"
|
|
)
|
|
|
|
// ApprovalRequest is used for expense approval endpoints
|
|
type ApprovalRequest struct {
|
|
Action string `json:"action" validate:"required,oneof=APPROVED REJECTED"`
|
|
Notes *string `json:"notes"`
|
|
}
|
|
|
|
type Create struct {
|
|
PoNumber *string `form:"po_number" validate:"omitempty,max=50"`
|
|
TransactionDate string `form:"transaction_date" validate:"required,datetime=2006-01-02"`
|
|
SupplierID uint64 `form:"supplier_id" validate:"required,gt=0"`
|
|
Documents []*multipart.FileHeader `form:"documents" validate:"omitempty,dive"`
|
|
CostPerKandangs []CostPerKandang `form:"cost_per_kandangs" validate:"required,min=1,dive"`
|
|
}
|
|
|
|
type CostPerKandang struct {
|
|
KandangID uint64 `json:"kandang_id" form:"kandang_id" validate:"required,gt=0"`
|
|
CostItems []CostItem `json:"cost_items" form:"cost_items" validate:"required,min=1,dive"`
|
|
}
|
|
|
|
type CostItem struct {
|
|
NonstockID uint64 `json:"nonstock_id" form:"nonstock_id" validate:"required,gt=0"`
|
|
Quantity float64 `json:"quantity" form:"quantity" validate:"required,gt=0"`
|
|
TotalCost float64 `json:"total_cost" form:"total_cost" validate:"required,gt=0"`
|
|
Notes string `json:"notes" form:"notes" validate:"required,max=500"`
|
|
}
|
|
|
|
type Update struct {
|
|
PoNumber *string `json:"po_number,omitempty" validate:"omitempty,max=50"`
|
|
TransactionDate *string `json:"transaction_date,omitempty" validate:"omitempty,datetime=2006-01-02"`
|
|
SupplierID *uint64 `json:"supplier_id,omitempty" validate:"omitempty,gt=0"`
|
|
Documents *[]string `json:"documents,omitempty" validate:"omitempty,dive,max=255"`
|
|
CostPerKandang *[]CostPerKandang `json:"cost_per_kandang,omitempty" validate:"omitempty,min=1,dive"`
|
|
}
|
|
|
|
type Query struct {
|
|
Page int `query:"page" validate:"omitempty,number,min=1,gt=0"`
|
|
Limit int `query:"limit" validate:"omitempty,number,min=1,max=100,gt=0"`
|
|
Search string `query:"search" validate:"omitempty,max=50"`
|
|
}
|
|
|
|
type CreateRealization struct {
|
|
Documents []*multipart.FileHeader `form:"documents" validate:"omitempty,dive"`
|
|
Realizations []RealizationItem `json:"realizations" form:"realizations" validate:"required,min=1,dive"`
|
|
}
|
|
|
|
type RealizationItem struct {
|
|
ExpenseNonstockID uint64 `json:"expense_nonstock_id" form:"expense_nonstock_id" validate:"required,gt=0"`
|
|
Qty float64 `json:"qty" form:"qty" validate:"required,gt=0"`
|
|
UnitPrice float64 `json:"unit_price" form:"unit_price" validate:"required,gt=0"`
|
|
TotalPrice float64 `json:"total_price" form:"total_price" validate:"required,gt=0"`
|
|
Notes *string `json:"notes" form:"notes" validate:"omitempty,max=500"`
|
|
}
|
|
|
|
type CompleteExpense struct {
|
|
}
|
|
|
|
type UpdateRealization struct {
|
|
Realizations []RealizationItem `json:"realizations" validate:"required,min=1,dive"`
|
|
}
|