Skip to content

Commit

Permalink
Merge pull request #147 from LerianStudio/fix/MZ-575
Browse files Browse the repository at this point in the history
Fix/MZ-575
  • Loading branch information
MartinezAvellan authored Oct 23, 2024
2 parents ec7ae2a + e74ce4b commit c063648
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
6 changes: 6 additions & 0 deletions common/constant/operation.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package constant

const (
DEBIT = "DEBIT"
CREDIT = "CREDIT"
)
2 changes: 1 addition & 1 deletion common/mcasdoor/casdoor.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (cc *CasdoorConnection) Connect() error {
if client == nil || !cc.healthCheck() {
cc.Connected = false
err := errors.New("can't connect casdoor")
cc.Logger.Fatalf("CasdoorConnection.Ping %v", zap.Error(err))
cc.Logger.Fatalf("Casdoor.HealthCheck %v", zap.Error(err))

return err
}
Expand Down
10 changes: 9 additions & 1 deletion components/transaction/internal/app/command/create-operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package command

import (
"context"
"github.com/LerianStudio/midaz/common/constant"
"reflect"
"time"

Expand Down Expand Up @@ -47,11 +48,18 @@ func (uc *UseCase) CreateOperation(ctx context.Context, accounts []*account.Acco
description = dsl.Description
}

var typeOperation string
if fromTo[i].IsFrom {
typeOperation = constant.DEBIT
} else {
typeOperation = constant.CREDIT
}

save := &o.Operation{
ID: uuid.New().String(),
TransactionID: transactionID,
Description: description,
Type: acc.Type,
Type: typeOperation,
AssetCode: dsl.Send.Asset,
ChartOfAccounts: fromTo[i].ChartOfAccounts,
Amount: amount,
Expand Down

0 comments on commit c063648

Please sign in to comment.