Files
apskel-pos-backend/internal/models/expense.go
T

113 lines
4.5 KiB
Go
Raw Normal View History

2026-05-25 14:59:40 +07:00
package models
import (
"time"
"github.com/google/uuid"
)
type Expense struct {
2026-05-25 16:19:36 +07:00
ID uuid.UUID `json:"id"`
OrganizationID uuid.UUID `json:"organization_id"`
OutletID uuid.UUID `json:"outlet_id"`
2026-05-26 15:25:47 +07:00
ExpenseName string `json:"expense_name"`
2026-05-25 16:19:36 +07:00
Receiver string `json:"receiver"`
TransactionDate time.Time `json:"transaction_date"`
CodeNumber string `json:"code_number"`
Description *string `json:"description"`
Tax float64 `json:"tax"`
Total float64 `json:"total"`
Reserved1 *string `json:"reserved1"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type ExpenseItem struct {
2026-05-25 14:59:40 +07:00
ID uuid.UUID `json:"id"`
2026-05-25 16:19:36 +07:00
ExpenseID uuid.UUID `json:"expense_id"`
2026-05-25 14:59:40 +07:00
ChartOfAccountID uuid.UUID `json:"chart_of_account_id"`
Description *string `json:"description"`
2026-05-25 16:19:36 +07:00
Amount float64 `json:"amount"`
2026-05-25 14:59:40 +07:00
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type ExpenseResponse struct {
2026-05-25 16:19:36 +07:00
ID uuid.UUID `json:"id"`
OrganizationID uuid.UUID `json:"organization_id"`
OutletID uuid.UUID `json:"outlet_id"`
2026-05-26 15:25:47 +07:00
ExpenseName string `json:"expense_name"`
2026-05-25 16:19:36 +07:00
Receiver string `json:"receiver"`
TransactionDate time.Time `json:"transaction_date"`
CodeNumber string `json:"code_number"`
Description *string `json:"description"`
Tax float64 `json:"tax"`
Total float64 `json:"total"`
Reserved1 *string `json:"reserved1"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Items []ExpenseItemResponse `json:"items,omitempty"`
}
type ExpenseItemResponse struct {
2026-05-25 14:59:40 +07:00
ID uuid.UUID `json:"id"`
2026-05-25 16:19:36 +07:00
ExpenseID uuid.UUID `json:"expense_id"`
2026-05-25 14:59:40 +07:00
ChartOfAccountID uuid.UUID `json:"chart_of_account_id"`
ChartOfAccountName string `json:"chart_of_account_name,omitempty"`
Description *string `json:"description"`
2026-05-25 16:19:36 +07:00
Amount float64 `json:"amount"`
2026-05-25 14:59:40 +07:00
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type CreateExpenseRequest struct {
2026-05-26 15:25:47 +07:00
ExpenseName string `json:"expense_name"`
2026-05-25 16:19:36 +07:00
Receiver string `json:"receiver"`
TransactionDate string `json:"transaction_date"`
CodeNumber string `json:"code_number"`
OutletID string `json:"outlet_id"`
Description *string `json:"description"`
Tax float64 `json:"tax"`
Total float64 `json:"total"`
Items []CreateExpenseItemRequest `json:"items"`
}
type CreateExpenseItemRequest struct {
2026-05-25 14:59:40 +07:00
ChartOfAccountID string `json:"chart_of_account_id"`
2026-05-25 16:19:36 +07:00
Description *string `json:"description,omitempty"`
Amount float64 `json:"amount"`
2026-05-25 14:59:40 +07:00
}
type UpdateExpenseRequest struct {
2026-05-26 15:25:47 +07:00
ExpenseName *string `json:"expense_name,omitempty"`
2026-05-25 16:19:36 +07:00
Receiver *string `json:"receiver,omitempty"`
TransactionDate *string `json:"transaction_date,omitempty"`
CodeNumber *string `json:"code_number,omitempty"`
OutletID *string `json:"outlet_id,omitempty"`
Description *string `json:"description,omitempty"`
Tax *float64 `json:"tax,omitempty"`
Total *float64 `json:"total,omitempty"`
Reserved1 *string `json:"reserved1,omitempty"`
Items []UpdateExpenseItemRequest `json:"items,omitempty"`
}
type UpdateExpenseItemRequest struct {
ChartOfAccountID *string `json:"chart_of_account_id,omitempty"`
Description *string `json:"description,omitempty"`
Amount *float64 `json:"amount,omitempty"`
2026-05-25 14:59:40 +07:00
}
type ListExpenseRequest struct {
Page int `json:"page"`
Limit int `json:"limit"`
Search string `json:"search,omitempty"`
}
type ListExpenseResponse struct {
Expenses []*ExpenseResponse `json:"expenses"`
TotalCount int `json:"total_count"`
Page int `json:"page"`
Limit int `json:"limit"`
TotalPages int `json:"total_pages"`
}