Skip to content

Commit

Permalink
Merge pull request #146 from LerianStudio/feature/MZ-256
Browse files Browse the repository at this point in the history
Feature/MZ-256
  • Loading branch information
qnen authored Oct 22, 2024
2 parents ce14623 + 4df336d commit 6b42ce6
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 43 deletions.
2 changes: 1 addition & 1 deletion common/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ func ValidateBusinessError(err error, entityType string, args ...any) error {
EntityType: entityType,
Code: cn.ErrInvalidAccountType.Error(),
Title: "Invalid Account Type",
Message: "The provided 'type' is not valid. Accepted types are: deposit, savings, loans, marketplace, cerditCard or external. Please provide a valid type.",
Message: "The provided 'type' is not valid. Accepted types are: deposit, savings, loans, marketplace, creditCard or external. Please provide a valid type.",
},
}

Expand Down
8 changes: 4 additions & 4 deletions components/ledger/internal/domain/onboarding/ledger/ledger.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ type LedgerPostgreSQLModel struct {

// CreateLedgerInput is a struct design to encapsulate request create payload data.
type CreateLedgerInput struct {
Name string `json:"name" validate:"required"`
Name string `json:"name" validate:"required,max=256"`
Status Status `json:"status"`
Metadata map[string]any `json:"metadata"`
}

// UpdateLedgerInput is a struct design to encapsulate request update payload data.
type UpdateLedgerInput struct {
Name string `json:"name"`
Name string `json:"name" validate:"max=256"`
Status Status `json:"status"`
Metadata map[string]any `json:"metadata"`
}
Expand All @@ -48,8 +48,8 @@ type Ledger struct {

// Status structure for marshaling/unmarshalling JSON.
type Status struct {
Code string `json:"code"`
Description *string `json:"description"`
Code string `json:"code" validate:"max=100"`
Description *string `json:"description" validate:"max=256"`
}

// IsEmpty method that set empty or nil in fields
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@ type OrganizationPostgreSQLModel struct {

// CreateOrganizationInput is a struct design to encapsulate request create payload data.
type CreateOrganizationInput struct {
LegalName string `json:"legalName" validate:"required"`
LegalName string `json:"legalName" validate:"required,max=256"`
ParentOrganizationID *string `json:"parentOrganizationId" validate:"omitempty,uuid"`
DoingBusinessAs *string `json:"doingBusinessAs"`
LegalDocument string `json:"legalDocument" validate:"required"`
DoingBusinessAs *string `json:"doingBusinessAs" validate:"max=256"`
LegalDocument string `json:"legalDocument" validate:"required,max=256"`
Address Address `json:"address"`
Status Status `json:"status"`
Metadata map[string]any `json:"metadata"`
}

// UpdateOrganizationInput is a struct design to encapsulate request update payload data.
type UpdateOrganizationInput struct {
LegalName string `json:"legalName" validate:"required"`
LegalName string `json:"legalName" validate:"required,max=256"`
ParentOrganizationID *string `json:"parentOrganizationId" validate:"omitempty,uuid"`
DoingBusinessAs *string `json:"doingBusinessAs"`
DoingBusinessAs *string `json:"doingBusinessAs" validate:"max=256"`
Address Address `json:"address"`
Status Status `json:"status"`
Metadata map[string]any `json:"metadata"`
Expand All @@ -61,8 +61,8 @@ type Organization struct {

// Status structure for marshaling/unmarshalling JSON.
type Status struct {
Code string `json:"code"`
Description *string `json:"description"`
Code string `json:"code" validate:"max=100"`
Description *string `json:"description" validate:"max=256"`
}

// IsEmpty method that set empty or nil in fields
Expand Down
16 changes: 8 additions & 8 deletions components/ledger/internal/domain/portfolio/account/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,22 @@ type AccountPostgreSQLModel struct {

// CreateAccountInput is a struct design to encapsulate request create payload data.
type CreateAccountInput struct {
AssetCode string `json:"assetCode" validate:"required"`
Name string `json:"name"`
Alias *string `json:"alias"`
AssetCode string `json:"assetCode" validate:"required,max=100"`
Name string `json:"name" validate:"max=256"`
Alias *string `json:"alias" validate:"max=100"`
Type string `json:"type" validate:"required"`
ParentAccountID *string `json:"parentAccountId" validate:"omitempty,uuid"`
ProductID *string `json:"productId" validate:"omitempty,uuid"`
EntityID *string `json:"entityId"`
EntityID *string `json:"entityId" validate:"omitempty,max=256"`
Status Status `json:"status"`
Metadata map[string]any `json:"metadata"`
}

// UpdateAccountInput is a struct design to encapsulate request update payload data.
type UpdateAccountInput struct {
Name string `json:"name"`
Name string `json:"name" validate:"max=256"`
Status Status `json:"status"`
Alias *string `json:"alias"`
Alias *string `json:"alias" validate:"max=100"`
ProductID *string `json:"productId" validate:"uuid"`
Metadata map[string]any `json:"metadata"`
}
Expand Down Expand Up @@ -79,8 +79,8 @@ type Account struct {

// Status structure for marshaling/unmarshalling JSON.
type Status struct {
Code string `json:"code"`
Description *string `json:"description"`
Code string `json:"code" validate:"max=100"`
Description *string `json:"description" validate:"max=256"`
AllowSending bool `json:"allowSending"`
AllowReceiving bool `json:"allowReceiving"`
}
Expand Down
10 changes: 5 additions & 5 deletions components/ledger/internal/domain/portfolio/asset/asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ type AssetPostgreSQLModel struct {

// CreateAssetInput is a struct design to encapsulate request create payload data.
type CreateAssetInput struct {
Name string `json:"name"`
Name string `json:"name" validate:"max=256"`
Type string `json:"type"`
Code string `json:"code" validate:"required"`
Code string `json:"code" validate:"required,max=100"`
Status Status `json:"status"`
Metadata map[string]any `json:"metadata"`
}

// UpdateAssetInput is a struct design to encapsulate request update payload data.
type UpdateAssetInput struct {
Name string `json:"name"`
Name string `json:"name" validate:"max=256"`
Status Status `json:"status"`
Metadata map[string]any `json:"metadata"`
}
Expand All @@ -56,8 +56,8 @@ type Asset struct {

// Status structure for marshaling/unmarshalling JSON.
type Status struct {
Code string `json:"code"`
Description *string `json:"description"`
Code string `json:"code" validate:"max=100"`
Description *string `json:"description" validate:"max=256"`
}

// IsEmpty method that set empty or nil in fields
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ type PortfolioPostgreSQLModel struct {

// CreatePortfolioInput is a struct design to encapsulate request create payload data.
type CreatePortfolioInput struct {
EntityID string `json:"entityId" validate:"required"`
Name string `json:"name" validate:"required"`
EntityID string `json:"entityId" validate:"required,max=256"`
Name string `json:"name" validate:"required,max=256"`
Status Status `json:"status"`
Metadata map[string]any `json:"metadata"`
}

// UpdatePortfolioInput is a struct design to encapsulate payload data.
type UpdatePortfolioInput struct {
Name string `json:"name"`
Name string `json:"name" validate:"max=256"`
Status Status `json:"status"`
Metadata map[string]any `json:"metadata"`
}
Expand All @@ -55,8 +55,8 @@ type Portfolio struct {

// Status structure for marshaling/unmarshalling JSON.
type Status struct {
Code string `json:"code"`
Description *string `json:"description"`
Code string `json:"code" validate:"max=100"`
Description *string `json:"description" validate:"max=256"`
AllowSending bool `json:"allowSending"`
AllowReceiving bool `json:"allowReceiving"`
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ type ProductPostgreSQLModel struct {

// CreateProductInput is a struct design to encapsulate request create payload data.
type CreateProductInput struct {
Name string `json:"name" validate:"required"`
Name string `json:"name" validate:"required,max=256"`
Status Status `json:"status"`
Metadata map[string]any `json:"metadata"`
}

// UpdateProductInput is a struct design to encapsulate request update payload data.
type UpdateProductInput struct {
Name string `json:"name"`
Name string `json:"name" validate:"max=256"`
Status Status `json:"status"`
Metadata map[string]any `json:"metadata"`
}
Expand All @@ -50,8 +50,8 @@ type Product struct {

// Status structure for marshaling/unmarshalling JSON.
type Status struct {
Code string `json:"code"`
Description *string `json:"description"`
Code string `json:"code" validate:"max=100"`
Description *string `json:"description" validate:"max=256"`
}

// IsEmpty method that set empty or nil in fields
Expand Down
6 changes: 3 additions & 3 deletions components/transaction/internal/domain/operation/operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ type OperationPostgreSQLModel struct {

// Status structure for marshaling/unmarshalling JSON.
type Status struct {
Code string `json:"code"`
Description *string `json:"description"`
Code string `json:"code" validate:"max=100"`
Description *string `json:"description" validate:"max=256"`
}

// IsEmpty method that set empty or nil in fields
Expand Down Expand Up @@ -182,6 +182,6 @@ func (t *OperationPostgreSQLModel) FromEntity(operation *Operation) {

// UpdateOperationInput is a struct design to encapsulate payload data.
type UpdateOperationInput struct {
Description string `json:"description"`
Description string `json:"description" validate:"max=256"`
Metadata map[string]any `json:"metadata,omitempty"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ type TransactionPostgreSQLModel struct {

// Status structure for marshaling/unmarshalling JSON.
type Status struct {
Code string `json:"code"`
Description *string `json:"description"`
Code string `json:"code" validate:"max=100"`
Description *string `json:"description" validate:"max=256"`
}

// IsEmpty method that set empty or nil in fields
Expand All @@ -42,9 +42,9 @@ func (s Status) IsEmpty() bool {

// CreateTransactionInput is a struct design to encapsulate payload data.
type CreateTransactionInput struct {
ChartOfAccountsGroupName string `json:"chartOfAccountsGroupName"`
Description string `json:"description,omitempty"`
Code string `json:"code,omitempty"`
ChartOfAccountsGroupName string `json:"chartOfAccountsGroupName" validate:"max=256"`
Description string `json:"description,omitempty" validate:"max=256"`
Code string `json:"code,omitempty" validate:"max=100"`
Pending bool `json:"pending,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
Send gold.Send `json:"send,omitempty"`
Expand All @@ -60,7 +60,7 @@ type InputDSL struct {

// UpdateTransactionInput is a struct design to encapsulate payload data.
type UpdateTransactionInput struct {
Description string `json:"description"`
Description string `json:"description" validate:"max=256"`
Metadata map[string]any `json:"metadata,omitempty"`
}

Expand Down

0 comments on commit 6b42ce6

Please sign in to comment.