diff --git a/CHANGELOG.md b/CHANGELOG.md index b608b014..4e49f108 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,47 @@ +## [1.22.0-beta.6](https://github.com/LerianStudio/midaz/compare/v1.22.0-beta.5...v1.22.0-beta.6) (2024-10-21) + + +### Features + +* implements method to check if a ledger exists by name in an organization :sparkles: ([9737579](https://github.com/LerianStudio/midaz/commit/973757967817027815cc1a5497247af3e26ea587)) + + +### Bug Fixes + +* uses parsed UUID for organizationID on create ledger :bug: ([b506dc3](https://github.com/LerianStudio/midaz/commit/b506dc3dfe1e1ea8abdf251ca040ab3a6db163ef)) +* validates if a ledger with the same name already exists for the same organization :bug: ([08df20b](https://github.com/LerianStudio/midaz/commit/08df20bf4cdd99fc33ce3d273162addb0023afc6)) + +## [1.22.0-beta.5](https://github.com/LerianStudio/midaz/compare/v1.22.0-beta.4...v1.22.0-beta.5) (2024-10-21) + + +### Bug Fixes + +* rename to put on pattern :bug: ([ec8141a](https://github.com/LerianStudio/midaz/commit/ec8141ae8195d6e6f864ee766bca94bf6e90de03)) +* update some ports on .env :bug: ([b7c58ea](https://github.com/LerianStudio/midaz/commit/b7c58ea75e5c82b8728a785a4b233fa5351c478c)) + +## [1.22.0-beta.4](https://github.com/LerianStudio/midaz/compare/v1.22.0-beta.3...v1.22.0-beta.4) (2024-10-21) + + +### Bug Fixes + +* patch account doesnt return the right data :bug: ([a9c97c2](https://github.com/LerianStudio/midaz/commit/a9c97c2b48b16ae237195777fa8c77d23370e184)) + +## [1.22.0-beta.3](https://github.com/LerianStudio/midaz/compare/v1.22.0-beta.2...v1.22.0-beta.3) (2024-10-21) + + +### Bug Fixes + +* sets type as a required field for creating accounts :bug: ([a35044f](https://github.com/LerianStudio/midaz/commit/a35044f7d79b4eb3ecd1476d9ac5527e36617fb1)) + +## [1.22.0-beta.2](https://github.com/LerianStudio/midaz/compare/v1.22.0-beta.1...v1.22.0-beta.2) (2024-10-21) + +## [1.22.0-beta.1](https://github.com/LerianStudio/midaz/compare/v1.21.0...v1.22.0-beta.1) (2024-10-21) + + +### Bug Fixes + +* sets name as a required field for creating ledgers :bug: ([534cda5](https://github.com/LerianStudio/midaz/commit/534cda5d9203a6c478baf8980dea2e3fc2170eaf)) + ## [1.21.0](https://github.com/LerianStudio/midaz/compare/v1.20.0...v1.21.0) (2024-10-18) diff --git a/components/auth/.env.example b/components/auth/.env.example index 79c89ab6..0becff5e 100644 --- a/components/auth/.env.example +++ b/components/auth/.env.example @@ -1,26 +1,21 @@ # AUTH -#Env -ENV_NAME=production -#APP - Auth -APP_CONTEXT=/auth/v1 -SERVER_PORT=3004 -SERVER_ADDRESS=:${SERVER_PORT} - -# Casdoor -CASDOOR_PORT=8000 +# CASDOOR +CASDOOR_PORT=8080 RUNNING_IN_DOCKER=true -# Casdoor DB +# CADOOR DB DB_HOST=casdoor-db CASDOOR_DB_USER=midaz CASDOOR_DB_NAME=casdoor CASDOOR_DB_PASSWORD=leriand CASDOOR_DB_PORT=5436 USER_EXECUTE_COMMAND=postgres + +# LOG LOG_LEVEL=debug -# Casdoor Config +# CASDOOR CONFIG appname=casdoor httpport=${CASDOOR_PORT} runmode=dev diff --git a/components/ledger/.env.example b/components/ledger/.env.example index df7036bc..666e52cc 100644 --- a/components/ledger/.env.example +++ b/components/ledger/.env.example @@ -1,31 +1,50 @@ -#ENV_NAME=production #default local -VERSION=1.8.0 +# DEFAULT local +# ENV_NAME=production + +# APP VERSION +VERSION=1.21.0 + +# APP SERVER_PORT=3000 SERVER_ADDRESS=:${SERVER_PORT} + +# PROTOBUF PROTO_URL=localhost -PROTO_PORT=50051 +PROTO_PORT=3001 PROTO_ADDRESS=:${PROTO_PORT} + +# MONGO DB MONGO_HOST=mongodb MONGO_NAME=ledger MONGO_USER=midaz MONGO_PASSWORD=leriand MONGO_PORT=27017 + +# REDIS REDIS_PORT=6379 + +# DB POSTGRESQL PRIMARY AND REPLICA DB_HOST=primary-ledger DB_USER=midaz DB_NAME=ledger DB_PASSWORD=leriand DB_PORT=5432 + DB_REPLICA_HOST=replica-ledger DB_REPLICA_USER=midaz DB_REPLICA_NAME=ledger DB_REPLICA_PASSWORD=leriand DB_REPLICA_PORT=5433 + REPLICATION_USER=replicator REPLICATION_PASSWORD=replicator_password USER_EXECUTE_COMMAND=postgres + +# LOG LEVEL LOG_LEVEL=debug -CASDOOR_PORT=8000 + +# CASDOOR +CASDOOR_PORT=8080 CASDOOR_ADDRESS=http://casdoor:${CASDOOR_PORT} CASDOOR_CLIENT_ID=9670e0ca55a29a466d31 CASDOOR_CLIENT_SECRET=dd03f916cacf4a98c6a413d9c38ba102dce436a9 diff --git a/components/ledger/internal/adapters/database/postgres/ledger.postgresql.go b/components/ledger/internal/adapters/database/postgres/ledger.postgresql.go index 73c36b83..c6ef03b6 100644 --- a/components/ledger/internal/adapters/database/postgres/ledger.postgresql.go +++ b/components/ledger/internal/adapters/database/postgres/ledger.postgresql.go @@ -152,6 +152,29 @@ func (r *LedgerPostgreSQLRepository) FindAll(ctx context.Context, organizationID return ledgers, nil } +// FindByName returns error and a boolean indicating if Ledger entities exists by name +func (r *LedgerPostgreSQLRepository) FindByName(ctx context.Context, organizationID uuid.UUID, name string) (bool, error) { + db, err := r.connection.GetDB() + if err != nil { + return false, err + } + + rows, err := db.QueryContext(ctx, + "SELECT * FROM ledger WHERE organization_id = $1 AND LOWER(name) LIKE LOWER($2) AND deleted_at IS NULL", + organizationID, + name) + if err != nil { + return false, err + } + defer rows.Close() + + if rows.Next() { + return true, common.ValidateBusinessError(cn.ErrLedgerNameConflict, reflect.TypeOf(l.Ledger{}).Name(), name) + } + + return false, nil +} + // ListByIDs retrieves Ledgers entities from the database using the provided IDs. func (r *LedgerPostgreSQLRepository) ListByIDs(ctx context.Context, organizationID uuid.UUID, ids []uuid.UUID) ([]*l.Ledger, error) { db, err := r.connection.GetDB() diff --git a/components/ledger/internal/app/command/create-ledger.go b/components/ledger/internal/app/command/create-ledger.go index 7c6bcd72..8ca7ec18 100644 --- a/components/ledger/internal/app/command/create-ledger.go +++ b/components/ledger/internal/app/command/create-ledger.go @@ -2,6 +2,7 @@ package command import ( "context" + "github.com/google/uuid" "reflect" "time" @@ -12,7 +13,7 @@ import ( ) // CreateLedger creates a new ledger persists data in the repository. -func (uc *UseCase) CreateLedger(ctx context.Context, organizationID string, cli *l.CreateLedgerInput) (*l.Ledger, error) { +func (uc *UseCase) CreateLedger(ctx context.Context, organizationID uuid.UUID, cli *l.CreateLedgerInput) (*l.Ledger, error) { logger := mlog.NewLoggerFromContext(ctx) logger.Infof("Trying to create ledger: %v", cli) @@ -25,8 +26,14 @@ func (uc *UseCase) CreateLedger(ctx context.Context, organizationID string, cli status = cli.Status } + _, err := uc.LedgerRepo.FindByName(ctx, organizationID, cli.Name) + if err != nil { + logger.Errorf("Error creating ledger: %v", err) + return nil, err + } + ledger := &l.Ledger{ - OrganizationID: organizationID, + OrganizationID: organizationID.String(), Name: cli.Name, Status: status, CreatedAt: time.Now(), diff --git a/components/ledger/internal/domain/onboarding/ledger/ledger.go b/components/ledger/internal/domain/onboarding/ledger/ledger.go index e796332f..6add48d3 100644 --- a/components/ledger/internal/domain/onboarding/ledger/ledger.go +++ b/components/ledger/internal/domain/onboarding/ledger/ledger.go @@ -22,7 +22,7 @@ type LedgerPostgreSQLModel struct { // CreateLedgerInput is a struct design to encapsulate request create payload data. type CreateLedgerInput struct { - Name string `json:"name"` + Name string `json:"name" validate:"required"` Status Status `json:"status"` Metadata map[string]any `json:"metadata"` } diff --git a/components/ledger/internal/domain/onboarding/ledger/ledger_repository.go b/components/ledger/internal/domain/onboarding/ledger/ledger_repository.go index e50456b7..648a305e 100644 --- a/components/ledger/internal/domain/onboarding/ledger/ledger_repository.go +++ b/components/ledger/internal/domain/onboarding/ledger/ledger_repository.go @@ -13,6 +13,7 @@ type Repository interface { Create(ctx context.Context, ledger *Ledger) (*Ledger, error) Find(ctx context.Context, organizationID, id uuid.UUID) (*Ledger, error) FindAll(ctx context.Context, organizationID uuid.UUID, limit, page int) ([]*Ledger, error) + FindByName(ctx context.Context, organizationID uuid.UUID, name string) (bool, error) ListByIDs(ctx context.Context, organizationID uuid.UUID, ids []uuid.UUID) ([]*Ledger, error) Update(ctx context.Context, organizationID, id uuid.UUID, ledger *Ledger) (*Ledger, error) Delete(ctx context.Context, organizationID, id uuid.UUID) error diff --git a/components/ledger/internal/domain/portfolio/account/account.go b/components/ledger/internal/domain/portfolio/account/account.go index 0dea77e5..341fef63 100644 --- a/components/ledger/internal/domain/portfolio/account/account.go +++ b/components/ledger/internal/domain/portfolio/account/account.go @@ -39,7 +39,7 @@ type CreateAccountInput struct { AssetCode string `json:"assetCode" validate:"required"` Name string `json:"name"` Alias *string `json:"alias"` - Type string `json:"type"` + Type string `json:"type" validate:"required"` ParentAccountID *string `json:"parentAccountId" validate:"omitempty,uuid"` ProductID *string `json:"productId" validate:"omitempty,uuid"` EntityID *string `json:"entityId"` diff --git a/components/ledger/internal/gen/mock/ledger/ledger_mock.go b/components/ledger/internal/gen/mock/ledger/ledger_mock.go index 35b58c6b..0fd5d914 100644 --- a/components/ledger/internal/gen/mock/ledger/ledger_mock.go +++ b/components/ledger/internal/gen/mock/ledger/ledger_mock.go @@ -100,6 +100,21 @@ func (mr *MockRepositoryMockRecorder) FindAll(arg0, arg1, arg2, arg3 any) *gomoc return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindAll", reflect.TypeOf((*MockRepository)(nil).FindAll), arg0, arg1, arg2, arg3) } +// FindByName mocks base method. +func (m *MockRepository) FindByName(arg0 context.Context, arg1 uuid.UUID, arg2 string) (bool, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "FindByName", arg0, arg1, arg2) + ret0, _ := ret[0].(bool) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// FindByName indicates an expected call of FindByName. +func (mr *MockRepositoryMockRecorder) FindByName(arg0, arg1, arg2 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindByName", reflect.TypeOf((*MockRepository)(nil).FindByName), arg0, arg1, arg2) +} + // ListByIDs mocks base method. func (m *MockRepository) ListByIDs(arg0 context.Context, arg1 uuid.UUID, arg2 []uuid.UUID) ([]*ledger.Ledger, error) { m.ctrl.T.Helper() diff --git a/components/ledger/internal/ports/http/account.go b/components/ledger/internal/ports/http/account.go index 6de214d4..70da404c 100644 --- a/components/ledger/internal/ports/http/account.go +++ b/components/ledger/internal/ports/http/account.go @@ -132,12 +132,18 @@ func (handler *AccountHandler) UpdateAccount(i any, c *fiber.Ctx) error { payload := i.(*a.UpdateAccountInput) logger.Infof("Request to update an Account with details: %#v", payload) - account, err := handler.Command.UpdateAccount(ctx, organizationID, ledgerID, portfolioID, id, payload) + _, err := handler.Command.UpdateAccount(ctx, organizationID, ledgerID, portfolioID, id, payload) if err != nil { logger.Errorf("Failed to update Account with ID: %s, Error: %s", id.String(), err.Error()) return commonHTTP.WithError(c, err) } + account, err := handler.Query.GetAccountByID(c.Context(), organizationID, ledgerID, portfolioID, id) + if err != nil { + logger.Errorf("Failed to retrieve Account with ID: %s, Error: %s", id, err.Error()) + return commonHTTP.WithError(c, err) + } + logger.Infof("Successfully updated Account with Portfolio ID: %s and Account ID: %s", portfolioID.String(), id.String()) return commonHTTP.OK(c, account) diff --git a/components/ledger/internal/ports/http/ledger.go b/components/ledger/internal/ports/http/ledger.go index bd58c169..c6703d52 100644 --- a/components/ledger/internal/ports/http/ledger.go +++ b/components/ledger/internal/ports/http/ledger.go @@ -31,7 +31,7 @@ func (handler *LedgerHandler) CreateLedger(i any, c *fiber.Ctx) error { logger := mlog.NewLoggerFromContext(ctx) - organizationID := c.Params("organization_id") + organizationID := c.Locals("organization_id").(uuid.UUID) payload := i.(*l.CreateLedgerInput) logger.Infof("Request to create an ledger with details: %#v", payload) diff --git a/components/mdz/example.env b/components/mdz/.env.example similarity index 71% rename from components/mdz/example.env rename to components/mdz/.env.example index 6a4351c9..65f2ab4a 100644 --- a/components/mdz/example.env +++ b/components/mdz/.env.example @@ -1,3 +1,3 @@ CLIENT_ID=9670e0ca55a29a466d31 CLIENT_SECRET=dd03f916cacf4a98c6a413d9c38ba102dce436a9 -URL_API_AUTH=http://127.0.0.1:8000 +URL_API_AUTH=http://127.0.0.1:8080 diff --git a/components/transaction/.env.example b/components/transaction/.env.example index 8449e267..2c667dfb 100644 --- a/components/transaction/.env.example +++ b/components/transaction/.env.example @@ -1,55 +1,44 @@ -#Env -ENV_NAME=production +# DEFAULT local +# ENV_NAME=production -#APP - Transaction +# APP APP_CONTEXT=/transaction/v1 -SERVER_PORT=3003 +SERVER_PORT=3002 SERVER_ADDRESS=:${SERVER_PORT} -#Mongo DB - Transaction +# MONGO DB MONGO_HOST=mongodb MONGO_NAME=transaction MONGO_USER=midaz MONGO_PASSWORD=leriand MONGO_PORT=27018 +# DB POSTGRESQL PRIMARY AND REPLICA DB_HOST=primary-transaction DB_USER=midaz DB_NAME=transaction DB_PASSWORD=leriand DB_PORT=5434 + DB_REPLICA_HOST=replica-transaction DB_REPLICA_USER=midaz DB_REPLICA_NAME=transaction DB_REPLICA_PASSWORD=leriand DB_REPLICA_PORT=5435 + REPLICATION_USER=replicator REPLICATION_PASSWORD=replicator_password USER_EXECUTE_COMMAND=postgres -LOG_LEVEL=debug -## TRILLIAN -# MARIADB -DATABASE=transaction -ROOT_PASSWORD=midaz -TRILLIAN_PASSWORD=midaz -TRILLIAN_USER=transaction -MARIA_PORT=3306 - -# ADMINER -ADMINER_PORT=8080 - -# TRILLIAN LOG SERVER AND SIGNER -RPC_PORT=8090 -HTTP_PORT=8091 -SIGNER_PORT=8092 +# LOG LEVEL +LOG_LEVEL=debug # LEDGER gRPC LEDGER_GRPC_ADDR=midaz-ledger -LEDGER_GRPC_PORT=50051 +LEDGER_GRPC_PORT=3001 # CASSDOOR -CASDOOR_PORT=8000 +CASDOOR_PORT=8080 CASDOOR_ADDRESS=http://casdoor:${CASDOOR_PORT} CASDOOR_CLIENT_ID=9670e0ca55a29a466d31 CASDOOR_CLIENT_SECRET=dd03f916cacf4a98c6a413d9c38ba102dce436a9 diff --git a/components/transaction/db/init.sql b/components/transaction/db/init.sql deleted file mode 100644 index dcb86980..00000000 --- a/components/transaction/db/init.sql +++ /dev/null @@ -1,276 +0,0 @@ -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8mb4 */; -/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; -/*!40103 SET TIME_ZONE='+00:00' */; -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; - --- --- Table structure for table `LeafData` --- - -DROP TABLE IF EXISTS `LeafData`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `LeafData` ( - `TreeId` bigint(20) NOT NULL, - `LeafIdentityHash` varbinary(255) NOT NULL, - `LeafValue` longblob NOT NULL, - `ExtraData` longblob DEFAULT NULL, - `QueueTimestampNanos` bigint(20) NOT NULL, - PRIMARY KEY (`TreeId`,`LeafIdentityHash`), - CONSTRAINT `LeafData_ibfk_1` FOREIGN KEY (`TreeId`) REFERENCES `Trees` (`TreeId`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `LeafData` --- - -LOCK TABLES `LeafData` WRITE; -/*!40000 ALTER TABLE `LeafData` DISABLE KEYS */; -/*!40000 ALTER TABLE `LeafData` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `MapHead` --- - -DROP TABLE IF EXISTS `MapHead`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `MapHead` ( - `TreeId` bigint(20) NOT NULL, - `MapHeadTimestamp` bigint(20) NOT NULL, - `RootHash` varbinary(255) NOT NULL, - `MapRevision` bigint(20) DEFAULT NULL, - `RootSignature` varbinary(1024) NOT NULL, - `MapperData` mediumblob DEFAULT NULL, - PRIMARY KEY (`TreeId`,`MapHeadTimestamp`), - UNIQUE KEY `MapHeadRevisionIdx` (`TreeId`,`MapRevision`), - CONSTRAINT `MapHead_ibfk_1` FOREIGN KEY (`TreeId`) REFERENCES `Trees` (`TreeId`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `MapHead` --- - -LOCK TABLES `MapHead` WRITE; -/*!40000 ALTER TABLE `MapHead` DISABLE KEYS */; -/*!40000 ALTER TABLE `MapHead` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `MapLeaf` --- - -DROP TABLE IF EXISTS `MapLeaf`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `MapLeaf` ( - `TreeId` bigint(20) NOT NULL, - `KeyHash` varbinary(255) NOT NULL, - `MapRevision` bigint(20) NOT NULL, - `LeafValue` longblob NOT NULL, - PRIMARY KEY (`TreeId`,`KeyHash`,`MapRevision`), - CONSTRAINT `MapLeaf_ibfk_1` FOREIGN KEY (`TreeId`) REFERENCES `Trees` (`TreeId`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `MapLeaf` --- - -LOCK TABLES `MapLeaf` WRITE; -/*!40000 ALTER TABLE `MapLeaf` DISABLE KEYS */; -/*!40000 ALTER TABLE `MapLeaf` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `SequencedLeafData` --- - -DROP TABLE IF EXISTS `SequencedLeafData`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `SequencedLeafData` ( - `TreeId` bigint(20) NOT NULL, - `SequenceNumber` bigint(20) unsigned NOT NULL, - `LeafIdentityHash` varbinary(255) NOT NULL, - `MerkleLeafHash` varbinary(255) NOT NULL, - `IntegrateTimestampNanos` bigint(20) NOT NULL, - PRIMARY KEY (`TreeId`,`SequenceNumber`), - KEY `TreeId` (`TreeId`,`LeafIdentityHash`), - KEY `SequencedLeafMerkleIdx` (`TreeId`,`MerkleLeafHash`), - CONSTRAINT `SequencedLeafData_ibfk_1` FOREIGN KEY (`TreeId`) REFERENCES `Trees` (`TreeId`) ON DELETE CASCADE, - CONSTRAINT `SequencedLeafData_ibfk_2` FOREIGN KEY (`TreeId`, `LeafIdentityHash`) REFERENCES `LeafData` (`TreeId`, `LeafIdentityHash`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `SequencedLeafData` --- - -LOCK TABLES `SequencedLeafData` WRITE; -/*!40000 ALTER TABLE `SequencedLeafData` DISABLE KEYS */; -/*!40000 ALTER TABLE `SequencedLeafData` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `Subtree` --- - -DROP TABLE IF EXISTS `Subtree`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Subtree` ( - `TreeId` bigint(20) NOT NULL, - `SubtreeId` varbinary(255) NOT NULL, - `Nodes` mediumblob NOT NULL, - `SubtreeRevision` int(11) NOT NULL, - PRIMARY KEY (`TreeId`,`SubtreeId`,`SubtreeRevision`), - CONSTRAINT `Subtree_ibfk_1` FOREIGN KEY (`TreeId`) REFERENCES `Trees` (`TreeId`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `Subtree` --- - -LOCK TABLES `Subtree` WRITE; -/*!40000 ALTER TABLE `Subtree` DISABLE KEYS */; -/*!40000 ALTER TABLE `Subtree` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `TreeControl` --- - -DROP TABLE IF EXISTS `TreeControl`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `TreeControl` ( - `TreeId` bigint(20) NOT NULL, - `SigningEnabled` tinyint(1) NOT NULL, - `SequencingEnabled` tinyint(1) NOT NULL, - `SequenceIntervalSeconds` int(11) NOT NULL, - PRIMARY KEY (`TreeId`), - CONSTRAINT `TreeControl_ibfk_1` FOREIGN KEY (`TreeId`) REFERENCES `Trees` (`TreeId`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `TreeControl` --- - -LOCK TABLES `TreeControl` WRITE; -/*!40000 ALTER TABLE `TreeControl` DISABLE KEYS */; -/*!40000 ALTER TABLE `TreeControl` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `TreeHead` --- - -DROP TABLE IF EXISTS `TreeHead`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `TreeHead` ( - `TreeId` bigint(20) NOT NULL, - `TreeHeadTimestamp` bigint(20) NOT NULL, - `TreeSize` bigint(20) DEFAULT NULL, - `RootHash` varbinary(255) NOT NULL, - `RootSignature` varbinary(1024) NOT NULL, - `TreeRevision` bigint(20) DEFAULT NULL, - PRIMARY KEY (`TreeId`,`TreeHeadTimestamp`), - UNIQUE KEY `TreeHeadRevisionIdx` (`TreeId`,`TreeRevision`), - CONSTRAINT `TreeHead_ibfk_1` FOREIGN KEY (`TreeId`) REFERENCES `Trees` (`TreeId`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `TreeHead` --- - -LOCK TABLES `TreeHead` WRITE; -/*!40000 ALTER TABLE `TreeHead` DISABLE KEYS */; -/*!40000 ALTER TABLE `TreeHead` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `Trees` --- - -DROP TABLE IF EXISTS `Trees`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Trees` ( - `TreeId` bigint(20) NOT NULL, - `TreeState` enum('ACTIVE','FROZEN','DRAINING') NOT NULL, - `TreeType` enum('LOG','MAP','PREORDERED_LOG') NOT NULL, - `HashStrategy` enum('RFC6962_SHA256','TEST_MAP_HASHER','OBJECT_RFC6962_SHA256','CONIKS_SHA512_256','CONIKS_SHA256') NOT NULL, - `HashAlgorithm` enum('SHA256') NOT NULL, - `SignatureAlgorithm` enum('ECDSA','RSA') NOT NULL, - `DisplayName` varchar(20) DEFAULT NULL, - `Description` varchar(200) DEFAULT NULL, - `CreateTimeMillis` bigint(20) NOT NULL, - `UpdateTimeMillis` bigint(20) NOT NULL, - `MaxRootDurationMillis` bigint(20) NOT NULL, - `PrivateKey` mediumblob NOT NULL, - `PublicKey` mediumblob NOT NULL, - `Deleted` tinyint(1) DEFAULT NULL, - `DeleteTimeMillis` bigint(20) DEFAULT NULL, - PRIMARY KEY (`TreeId`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `Trees` --- - -LOCK TABLES `Trees` WRITE; -/*!40000 ALTER TABLE `Trees` DISABLE KEYS */; -/*!40000 ALTER TABLE `Trees` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `Unsequenced` --- - -DROP TABLE IF EXISTS `Unsequenced`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Unsequenced` ( - `TreeId` bigint(20) NOT NULL, - `Bucket` int(11) NOT NULL, - `LeafIdentityHash` varbinary(255) NOT NULL, - `MerkleLeafHash` varbinary(255) NOT NULL, - `QueueTimestampNanos` bigint(20) NOT NULL, - `QueueID` varbinary(32) DEFAULT NULL, - PRIMARY KEY (`TreeId`,`Bucket`,`QueueTimestampNanos`,`LeafIdentityHash`), - UNIQUE KEY `QueueID` (`QueueID`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `Unsequenced` --- - -LOCK TABLES `Unsequenced` WRITE; -/*!40000 ALTER TABLE `Unsequenced` DISABLE KEYS */; -/*!40000 ALTER TABLE `Unsequenced` ENABLE KEYS */; -UNLOCK TABLES; -/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; \ No newline at end of file diff --git a/components/transaction/docker-compose.yml b/components/transaction/docker-compose.yml index 9ac17010..e6ae5eeb 100644 --- a/components/transaction/docker-compose.yml +++ b/components/transaction/docker-compose.yml @@ -115,63 +115,7 @@ services: primary-transaction: condition: service_healthy - mariadb: - container_name: trillian-mariadb - image: mariadb:latest - environment: - - MYSQL_DATABASE=${DATABASE} - - MYSQL_ROOT_PASSWORD=${ROOT_PASSWORD} - - MYSQL_USER=${TRILLIAN_USER} - - MYSQL_PASSWORD=${TRILLIAN_PASSWORD} - volumes: - - "trillian-data:/var/lib/mysql" - - ./db:/docker-entrypoint-initdb.d/:ro - restart: always - - adminer: - container_name: trillian-adminer - image: adminer:latest - restart: always - ports: - - ${ADMINER_PORT}:${ADMINER_PORT} - - trillian-log-server: - container_name: trillian-log-server - depends_on: - - mariadb - image: gcr.io/trillian-opensource-ci/log_server@sha256:73180a17a00470f073948434d3594c181247678cb8003c7e5e22a2095f231e31 - command: [ - "--storage_system=mysql", - "--mysql_uri=${TRILLIAN_USER}:${TRILLIAN_PASSWORD}@tcp(mariadb:${MARIA_PORT})/${DATABASE}", - "--rpc_endpoint=0.0.0.0:${RPC_PORT}", - "--http_endpoint=0.0.0.0:${HTTP_PORT}", - "--alsologtostderr", - ] - restart: always - ports: - - ${RPC_PORT}:${RPC_PORT} - - ${HTTP_PORT}:${HTTP_PORT} - - trillian-log-signer: - container_name: trillian-log-signer - image: gcr.io/trillian-opensource-ci/log_signer@sha256:bb3f6f0e11329da904df2850198e4756056986b48036a8a6d0b120d3636e3c5d - depends_on: - - mariadb - command: [ - "--storage_system=mysql", - "--mysql_uri=${TRILLIAN_USER}:${TRILLIAN_PASSWORD}@tcp(mariadb:${MARIA_PORT})/${DATABASE}", - "--rpc_endpoint=0.0.0.0:${RPC_PORT}", - "--http_endpoint=0.0.0.0:${HTTP_PORT}", - "--force_master", - "--alsologtostderr", - ] - restart: always - ports: - - ${SIGNER_PORT}:${HTTP_PORT} - volumes: - trillian-data: - external: false mongodb_data_container: networks: diff --git a/postman/MIDAZ.postman_collection.json b/postman/MIDAZ.postman_collection.json index fd22513e..41306aa0 100644 --- a/postman/MIDAZ.postman_collection.json +++ b/postman/MIDAZ.postman_collection.json @@ -1529,7 +1529,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n \"assetCode\": \"BRL\",\n \"name\": \"{{$randomBankAccountName}}\",\n \"alias\": \"@wallet_{{$randomBankAccount}}\",\n \"type\": \"deposit\",\n //\"parentAccountId\": \"{{account_id}}\",\n //\"entityId\": \"{{$randomUUID}}\", //optional\n \"productId\": \"{{product_id}}\",\n \"status\": {\n \"code\": \"CREDIT\",\n \"description\": \"Teste Account\",\n \"allowSending\": true,\n \"allowReceiving\": true\n },\n \"metadata\": {\n \"chave\": \"metadata_chave\",\n \"bitcoinn\": \"{{$randomBitcoin}}\",\n \"boolean\": {{$randomBoolean}},\n \"double\": 10.5,\n \"int\": 1\n }\n}", + "raw": "{\n \"assetCode\": \"BRL\",\n \"name\": \"{{$randomBankAccountName}}\",\n \"alias\": \"@wallet_{{$randomBankAccount}}\",\n \"type\": \"credit\",\n //\"parentAccountId\": \"{{account_id}}\",\n //\"entityId\": \"{{$randomUUID}}\", //optional\n \"productId\": \"{{product_id}}\",\n \"status\": {\n \"code\": \"CREDIT\",\n \"description\": \"Teste Account\",\n \"allowSending\": true,\n \"allowReceiving\": true\n },\n \"metadata\": {\n \"chave\": \"metadata_chave\",\n \"bitcoinn\": \"{{$randomBitcoin}}\",\n \"boolean\": {{$randomBoolean}},\n \"double\": 10.5,\n \"int\": 1\n }\n}", "options": { "raw": { "language": "json" @@ -2402,7 +2402,7 @@ }, { "key": "url_auth", - "value": "http://127.0.0.1:8000", + "value": "http://127.0.0.1:8080", "type": "default" }, { @@ -2412,7 +2412,7 @@ }, { "key": "url_transaction", - "value": "http://127.0.0.1:3005", + "value": "http://127.0.0.1:3002", "type": "default" }, {