113 lines
4.5 KiB
Go
113 lines
4.5 KiB
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type Expense struct {
|
|
ID uuid.UUID `json:"id"`
|
|
OrganizationID uuid.UUID `json:"organization_id"`
|
|
OutletID uuid.UUID `json:"outlet_id"`
|
|
ExpenseName string `json:"expense_name"`
|
|
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 {
|
|
ID uuid.UUID `json:"id"`
|
|
ExpenseID uuid.UUID `json:"expense_id"`
|
|
ChartOfAccountID uuid.UUID `json:"chart_of_account_id"`
|
|
Description *string `json:"description"`
|
|
Amount float64 `json:"amount"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type ExpenseResponse struct {
|
|
ID uuid.UUID `json:"id"`
|
|
OrganizationID uuid.UUID `json:"organization_id"`
|
|
OutletID uuid.UUID `json:"outlet_id"`
|
|
ExpenseName string `json:"expense_name"`
|
|
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 {
|
|
ID uuid.UUID `json:"id"`
|
|
ExpenseID uuid.UUID `json:"expense_id"`
|
|
ChartOfAccountID uuid.UUID `json:"chart_of_account_id"`
|
|
ChartOfAccountName string `json:"chart_of_account_name,omitempty"`
|
|
Description *string `json:"description"`
|
|
Amount float64 `json:"amount"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type CreateExpenseRequest struct {
|
|
ExpenseName string `json:"expense_name"`
|
|
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 {
|
|
ChartOfAccountID string `json:"chart_of_account_id"`
|
|
Description *string `json:"description,omitempty"`
|
|
Amount float64 `json:"amount"`
|
|
}
|
|
|
|
type UpdateExpenseRequest struct {
|
|
ExpenseName *string `json:"expense_name,omitempty"`
|
|
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"`
|
|
}
|
|
|
|
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"`
|
|
}
|