56 lines
2.5 KiB
Go
56 lines
2.5 KiB
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type AccountResponse struct {
|
|
ID uuid.UUID `json:"id"`
|
|
OrganizationID uuid.UUID `json:"organization_id"`
|
|
OutletID *uuid.UUID `json:"outlet_id"`
|
|
ChartOfAccountID uuid.UUID `json:"chart_of_account_id"`
|
|
Name string `json:"name"`
|
|
Number string `json:"number"`
|
|
AccountType string `json:"account_type"`
|
|
OpeningBalance float64 `json:"opening_balance"`
|
|
CurrentBalance float64 `json:"current_balance"`
|
|
Description *string `json:"description"`
|
|
IsActive bool `json:"is_active"`
|
|
IsSystem bool `json:"is_system"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
ChartOfAccount *ChartOfAccountResponse `json:"chart_of_account,omitempty"`
|
|
}
|
|
|
|
type CreateAccountRequest struct {
|
|
ChartOfAccountID uuid.UUID `json:"chart_of_account_id" validate:"required"`
|
|
Name string `json:"name" validate:"required,min=1,max=255"`
|
|
Number string `json:"number" validate:"required,min=1,max=50"`
|
|
AccountType string `json:"account_type" validate:"required,oneof=cash wallet bank credit debit asset liability equity revenue expense"`
|
|
OpeningBalance float64 `json:"opening_balance"`
|
|
Description *string `json:"description"`
|
|
}
|
|
|
|
type UpdateAccountRequest struct {
|
|
ChartOfAccountID *uuid.UUID `json:"chart_of_account_id"`
|
|
Name *string `json:"name" validate:"omitempty,min=1,max=255"`
|
|
Number *string `json:"number" validate:"omitempty,min=1,max=50"`
|
|
AccountType *string `json:"account_type" validate:"omitempty,oneof=cash wallet bank credit debit asset liability equity revenue expense"`
|
|
OpeningBalance *float64 `json:"opening_balance"`
|
|
Description *string `json:"description"`
|
|
IsActive *bool `json:"is_active"`
|
|
}
|
|
|
|
type ListAccountsRequest struct {
|
|
OrganizationID *uuid.UUID `form:"organization_id"`
|
|
OutletID *uuid.UUID `form:"outlet_id"`
|
|
ChartOfAccountID *uuid.UUID `form:"chart_of_account_id"`
|
|
AccountType *string `form:"account_type"`
|
|
IsActive *bool `form:"is_active"`
|
|
IsSystem *bool `form:"is_system"`
|
|
Page int `form:"page,default=1"`
|
|
Limit int `form:"limit,default=10"`
|
|
}
|