feat(purchasae): added team with category parent and central

This commit is contained in:
efrilm
2026-08-11 21:00:39 +07:00
parent a230199ce0
commit 9ae5be2c33
18 changed files with 566 additions and 32 deletions
+30 -7
View File
@@ -18,10 +18,20 @@ type PurchaseOrder struct {
Status string `json:"status"`
Message *string `json:"message"`
TotalAmount float64 `json:"total_amount"`
TeamScope *string `json:"team_scope"`
TeamCategoryID *uuid.UUID `json:"team_category_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// PurchaseTeam is one entry of the team picker: either a parent category or Pusat.
// Pusat carries no CategoryID because it has no category of its own.
type PurchaseTeam struct {
Scope string `json:"scope"`
CategoryID *uuid.UUID `json:"category_id"`
Name string `json:"name"`
}
type PurchaseOrderItem struct {
ID uuid.UUID `json:"id"`
PurchaseOrderID uuid.UUID `json:"purchase_order_id"`
@@ -54,8 +64,11 @@ type PurchaseOrderResponse struct {
Status string `json:"status"`
Message *string `json:"message"`
TotalAmount float64 `json:"total_amount"`
TeamScope *string `json:"team_scope"`
TeamCategoryID *uuid.UUID `json:"team_category_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Team *PurchaseTeam `json:"team,omitempty"`
Vendor *VendorResponse `json:"vendor,omitempty"`
Items []PurchaseOrderItemResponse `json:"items,omitempty"`
Attachments []PurchaseOrderAttachmentResponse `json:"attachments,omitempty"`
@@ -94,6 +107,8 @@ type CreatePurchaseOrderRequest struct {
Reference *string `json:"reference,omitempty"`
Status *string `json:"status,omitempty"`
Message *string `json:"message,omitempty"`
TeamScope *string `json:"team_scope,omitempty"`
TeamCategoryID *uuid.UUID `json:"team_category_id,omitempty"`
Items []CreatePurchaseOrderItemRequest `json:"items"`
AttachmentFileIDs []uuid.UUID `json:"attachment_file_ids,omitempty"`
}
@@ -115,6 +130,8 @@ type UpdatePurchaseOrderRequest struct {
Reference *string `json:"reference,omitempty"`
Status *string `json:"status,omitempty"`
Message *string `json:"message,omitempty"`
TeamScope *string `json:"team_scope,omitempty"`
TeamCategoryID *uuid.UUID `json:"team_category_id,omitempty"`
Items []UpdatePurchaseOrderItemRequest `json:"items,omitempty"`
AttachmentFileIDs []uuid.UUID `json:"attachment_file_ids,omitempty"`
}
@@ -130,13 +147,19 @@ type UpdatePurchaseOrderItemRequest struct {
}
type ListPurchaseOrdersRequest struct {
Page int `json:"page" validate:"min=1"`
Limit int `json:"limit" validate:"min=1,max=100"`
Search string `json:"search,omitempty"`
Status string `json:"status,omitempty"`
VendorID *uuid.UUID `json:"vendor_id,omitempty"`
StartDate *time.Time `json:"start_date,omitempty"`
EndDate *time.Time `json:"end_date,omitempty"`
Page int `json:"page" validate:"min=1"`
Limit int `json:"limit" validate:"min=1,max=100"`
Search string `json:"search,omitempty"`
Status string `json:"status,omitempty"`
VendorID *uuid.UUID `json:"vendor_id,omitempty"`
TeamScope string `json:"team_scope,omitempty"`
TeamCategoryID *uuid.UUID `json:"team_category_id,omitempty"`
StartDate *time.Time `json:"start_date,omitempty"`
EndDate *time.Time `json:"end_date,omitempty"`
}
type ListPurchaseTeamsResponse struct {
Teams []PurchaseTeam `json:"teams"`
}
type ListPurchaseOrdersResponse struct {