Skip to content

Commit

Permalink
fix(ledger): when string ParentOrganizationID is empty set nil
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinezAvellan committed May 20, 2024
1 parent dacca62 commit 6f6c044
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions components/ledger/internal/app/command/create-organization.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ func (uc *UseCase) CreateOrganization(ctx context.Context, coi *o.CreateOrganiza
status = coi.Status
}

if coi.ParentOrganizationID != nil && len(*coi.ParentOrganizationID) == 0 {
coi.ParentOrganizationID = nil
}

organization := &o.Organization{
ParentOrganizationID: coi.ParentOrganizationID,
LegalName: coi.LegalName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type OrganizationPostgreSQLModel struct {
// CreateOrganizationInput is a struct design to encapsulate request create payload data.
type CreateOrganizationInput struct {
LegalName string `json:"legalName"`
ParentOrganizationID *string `json:"parentOrganizationId,omitempty"`
ParentOrganizationID *string `json:"parentOrganizationId"`
DoingBusinessAs *string `json:"doingBusinessAs,omitempty"`
LegalDocument string `json:"legalDocument"`
Address Address `json:"address"`
Expand Down

0 comments on commit 6f6c044

Please sign in to comment.