Skip to content

Commit

Permalink
Merge pull request #24 from LerianStudio/fix/MZ-487
Browse files Browse the repository at this point in the history
Fix/MZ-487
  • Loading branch information
MartinezAvellan authored Jun 4, 2024
2 parents 1fc2fe2 + c81e8e5 commit 8390ada
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 33 deletions.
2 changes: 2 additions & 0 deletions components/ledger/internal/app/command/create-ledger.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ func (uc *UseCase) CreateLedger(ctx context.Context, organizationID string, cli
OrganizationID: organizationID,
Name: cli.Name,
Status: status,
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
}

led, err := uc.LedgerRepo.Create(ctx, ledger)
Expand Down
2 changes: 1 addition & 1 deletion components/ledger/internal/domain/metadata/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

// MetadataMongoDBModel represents the metadata into mongodb context
type MetadataMongoDBModel struct {
ID primitive.ObjectID `bson:"_id"`
ID primitive.ObjectID `bson:"_id,omitempty"`
EntityID string `bson:"entity_id"`
EntityName string `bson:"entity_name"`
Data JSON `bson:"metadata"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ CREATE TABLE IF NOT EXISTS portfolio
(
id UUID PRIMARY KEY NOT NULL DEFAULT (uuid_generate_v4()),
name TEXT,
entity_id UUID NOT NULL,
entity_id TEXT NOT NULL,
ledger_id UUID NOT NULL,
organization_id UUID NOT NULL,
status TEXT NOT NULL,
Expand Down
77 changes: 46 additions & 31 deletions postman/MIDAZ.postman_collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
"exec": [
"const jsonData = JSON.parse(responseBody);",
"if (jsonData.hasOwnProperty('id')) {",
" console.log(\"organization_id antes: \" + postman.getEnvironmentVariable(\"organization_id\"));",
" console.log(\"organization_id before: \" + postman.getEnvironmentVariable(\"organization_id\"));",
" postman.setEnvironmentVariable(\"organization_id\", jsonData.id);",
" console.log(\"organization_id depois: \" + postman.getEnvironmentVariable(\"organization_id\"));",
" console.log(\"organization_id after: \" + postman.getEnvironmentVariable(\"organization_id\"));",
"}"
],
"type": "text/javascript",
Expand Down Expand Up @@ -139,17 +139,17 @@
{
"key": "metadata.chave",
"value": "teste",
"description": "com, pesquisa no mongodb, sem, pesquisa no postgresql."
"description": "Search on MongoDB"
},
{
"key": "limit",
"value": "6",
"description": "default 10"
"description": "Default 10"
},
{
"key": "page",
"value": "1",
"description": "default 1"
"description": "Default 1"
}
]
}
Expand Down Expand Up @@ -244,9 +244,9 @@
"exec": [
"const jsonData = JSON.parse(responseBody);",
"if (jsonData.hasOwnProperty('id')) {",
" console.log(\"ledger_id antes: \" + postman.getEnvironmentVariable(\"ledger_id\"));",
" console.log(\"ledger_id before: \" + postman.getEnvironmentVariable(\"ledger_id\"));",
" postman.setEnvironmentVariable(\"ledger_id\", jsonData.id);",
" console.log(\"ledger_id depois: \" + postman.getEnvironmentVariable(\"ledger_id\"));",
" console.log(\"ledger_id after: \" + postman.getEnvironmentVariable(\"ledger_id\"));",
"}"
],
"type": "text/javascript",
Expand Down Expand Up @@ -354,15 +354,18 @@
"query": [
{
"key": "metadata.chave",
"value": "teste"
"value": "teste",
"description": "Search on MongoDB"
},
{
"key": "limit",
"value": "5"
"value": "5",
"description": "Default 10"
},
{
"key": "page",
"value": "1"
"value": "1",
"description": "Default 1"
}
]
}
Expand Down Expand Up @@ -449,9 +452,9 @@
"exec": [
"const jsonData = JSON.parse(responseBody);",
"if (jsonData.hasOwnProperty('id')) {",
" console.log(\"instrument_id antes: \" + postman.getEnvironmentVariable(\"instrument_id\"));",
" console.log(\"instrument_id before: \" + postman.getEnvironmentVariable(\"instrument_id\"));",
" postman.setEnvironmentVariable(\"instrument_id\", jsonData.id);",
" console.log(\"instrument_id depois: \" + postman.getEnvironmentVariable(\"instrument_id\"));",
" console.log(\"instrument_id after: \" + postman.getEnvironmentVariable(\"instrument_id\"));",
"}"
],
"type": "text/javascript",
Expand Down Expand Up @@ -553,15 +556,18 @@
"query": [
{
"key": "metadata.chave",
"value": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlf"
"value": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlf",
"description": "Search on MongoDB"
},
{
"key": "limit",
"value": "2"
"value": "2",
"description": "Default 10"
},
{
"key": "page",
"value": "1"
"value": "1",
"description": "Default 1"
}
]
}
Expand Down Expand Up @@ -639,9 +645,9 @@
"exec": [
"const jsonData = JSON.parse(responseBody);",
"if (jsonData.hasOwnProperty('id')) {",
" console.log(\"portfolio_id antes: \" + postman.getEnvironmentVariable(\"portfolio_id\"));",
" console.log(\"portfolio_id before: \" + postman.getEnvironmentVariable(\"portfolio_id\"));",
" postman.setEnvironmentVariable(\"portfolio_id\", jsonData.id);",
" console.log(\"portfolio_id depois: \" + postman.getEnvironmentVariable(\"portfolio_id\"));",
" console.log(\"portfolio_id after: \" + postman.getEnvironmentVariable(\"portfolio_id\"));",
"}"
],
"type": "text/javascript",
Expand Down Expand Up @@ -743,15 +749,18 @@
"query": [
{
"key": "metadata.chave",
"value": "teste"
"value": "teste",
"description": "Search on MongoDB"
},
{
"key": "limit",
"value": "2"
"value": "2",
"description": "Default 10"
},
{
"key": "page",
"value": "1"
"value": "1",
"description": "Default 1"
}
]
}
Expand Down Expand Up @@ -829,9 +838,9 @@
"exec": [
"const jsonData = JSON.parse(responseBody);",
"if (jsonData.hasOwnProperty('id')) {",
" console.log(\"product_id antes: \" + postman.getEnvironmentVariable(\"product_id\"));",
" console.log(\"product_id before: \" + postman.getEnvironmentVariable(\"product_id\"));",
" postman.setEnvironmentVariable(\"product_id\", jsonData.id);",
" console.log(\"product_id depois: \" + postman.getEnvironmentVariable(\"product_id\"));",
" console.log(\"product_id after: \" + postman.getEnvironmentVariable(\"product_id\"));",
"}"
],
"type": "text/javascript",
Expand Down Expand Up @@ -925,7 +934,7 @@
"formdata": []
},
"url": {
"raw": "{{url}}/v1/organizations/{{organization_id}}/ledgers/{{ledger_id}}/products?metadata.chave=teste&limit=5&page=1",
"raw": "{{url}}/v1/organizations/{{organization_id}}/ledgers/{{ledger_id}}/products?metadata.chave=metadata_chave&limit=5&page=1",
"host": [
"{{url}}"
],
Expand All @@ -940,15 +949,18 @@
"query": [
{
"key": "metadata.chave",
"value": "teste"
"value": "metadata_chave",
"description": "Search on MongoDB"
},
{
"key": "limit",
"value": "5"
"value": "5",
"description": "Default 10"
},
{
"key": "page",
"value": "1"
"value": "1",
"description": "Default 1"
}
]
}
Expand Down Expand Up @@ -1026,9 +1038,9 @@
"exec": [
"const jsonData = JSON.parse(responseBody);",
"if (jsonData.hasOwnProperty('id')) {",
" console.log(\"account_id antes: \" + postman.getEnvironmentVariable(\"account_id\"));",
" console.log(\"account_id before: \" + postman.getEnvironmentVariable(\"account_id\"));",
" postman.setEnvironmentVariable(\"account_id\", jsonData.id);",
" console.log(\"account_id depois: \" + postman.getEnvironmentVariable(\"account_id\"));",
" console.log(\"account_id after: \" + postman.getEnvironmentVariable(\"account_id\"));",
"}"
],
"type": "text/javascript",
Expand Down Expand Up @@ -1136,15 +1148,18 @@
"query": [
{
"key": "metadata.chave",
"value": "xuxa"
"value": "xuxa",
"description": "Search on MongoDB"
},
{
"key": "limit",
"value": "2"
"value": "2",
"description": "Default 10"
},
{
"key": "page",
"value": "1"
"value": "1",
"description": "Default 1"
}
]
}
Expand Down

0 comments on commit 8390ada

Please sign in to comment.