From ba1188dd4b02f4f38ae99dc8ed70eb026e46f67d Mon Sep 17 00:00:00 2001 From: Kalin Krustev Date: Fri, 26 Jul 2024 15:54:52 +0300 Subject: [PATCH] fix: consider HUB_ID when seeding the hub (#1073) --- package-lock.json | 53 +++++++++++++++++++++++++---- package.json | 2 +- seeds/participant.js | 3 +- test/unit/seeds/participant.test.js | 2 +- 4 files changed, 51 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 588f35680..4c9cbb648 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ "@hapi/vision": "7.0.3", "@mojaloop/central-services-error-handling": "13.0.1", "@mojaloop/central-services-health": "15.0.0", - "@mojaloop/central-services-logger": "11.3.1", + "@mojaloop/central-services-logger": "11.5.0", "@mojaloop/central-services-metrics": "12.0.8", "@mojaloop/central-services-shared": "18.6.3", "@mojaloop/central-services-stream": "11.3.1", @@ -1578,15 +1578,56 @@ } }, "node_modules/@mojaloop/central-services-logger": { - "version": "11.3.1", - "resolved": "https://registry.npmjs.org/@mojaloop/central-services-logger/-/central-services-logger-11.3.1.tgz", - "integrity": "sha512-XVU2K5grE1ZcIyxUXeMlvoVkeIcs9y1/0EKxa2Bk5sEbqXUtHuR8jqbAGlwaUIi9T9YWZRJyVC77nOQe/X1teA==", + "version": "11.5.0", + "resolved": "https://registry.npmjs.org/@mojaloop/central-services-logger/-/central-services-logger-11.5.0.tgz", + "integrity": "sha512-pH73RiJ5fKTBTSdLocp1vPBad1D+Kh0HufdcfjLaBQj3dIBq72si0k+Z3L1MeOmMqMzpj+8M/he/izlgqJjVJA==", "dependencies": { - "@types/node": "^20.12.7", "parse-strings-in-object": "2.0.0", "rc": "1.2.8", "safe-stable-stringify": "^2.4.3", - "winston": "3.13.0" + "winston": "3.13.1" + } + }, + "node_modules/@mojaloop/central-services-logger/node_modules/@colors/colors": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.6.0.tgz", + "integrity": "sha512-Ir+AOibqzrIsL6ajt3Rz3LskB7OiMVHqltZmspbW/TJuTVuyOMirVqAkjfY6JISiLHgyNqicAC8AyHHGzNd/dA==", + "engines": { + "node": ">=0.1.90" + } + }, + "node_modules/@mojaloop/central-services-logger/node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/@mojaloop/central-services-logger/node_modules/winston": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/winston/-/winston-3.13.1.tgz", + "integrity": "sha512-SvZit7VFNvXRzbqGHsv5KSmgbEYR5EiQfDAL9gxYkRqa934Hnk++zze0wANKtMHcy/gI4W/3xmSDwlhf865WGw==", + "dependencies": { + "@colors/colors": "^1.6.0", + "@dabh/diagnostics": "^2.0.2", + "async": "^3.2.3", + "is-stream": "^2.0.0", + "logform": "^2.6.0", + "one-time": "^1.0.0", + "readable-stream": "^3.4.0", + "safe-stable-stringify": "^2.3.1", + "stack-trace": "0.0.x", + "triple-beam": "^1.3.0", + "winston-transport": "^4.7.0" + }, + "engines": { + "node": ">= 12.0.0" } }, "node_modules/@mojaloop/central-services-metrics": { diff --git a/package.json b/package.json index c5238d798..0fe4efdbf 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,7 @@ "@hapi/vision": "7.0.3", "@mojaloop/central-services-error-handling": "13.0.1", "@mojaloop/central-services-health": "15.0.0", - "@mojaloop/central-services-logger": "11.3.1", + "@mojaloop/central-services-logger": "11.5.0", "@mojaloop/central-services-metrics": "12.0.8", "@mojaloop/central-services-shared": "18.6.3", "@mojaloop/central-services-stream": "11.3.1", diff --git a/seeds/participant.js b/seeds/participant.js index 2eff87278..19885f24d 100644 --- a/seeds/participant.js +++ b/seeds/participant.js @@ -28,6 +28,7 @@ const Config = require('../src/lib/config') const participant = [ { + participantId: Config.HUB_ID, name: Config.HUB_NAME, description: 'Hub Operator', createdBy: 'seeds' @@ -36,7 +37,7 @@ const participant = [ exports.seed = async function (knex) { try { - return await knex('participant').insert(participant).onConflict('name').ignore() + return await knex('participant').insert(participant).onConflict('id').merge() } catch (err) { console.log(`Uploading seeds for participant has failed with the following error: ${err}`) return -1000 diff --git a/test/unit/seeds/participant.test.js b/test/unit/seeds/participant.test.js index 74e1dcc78..58a294615 100644 --- a/test/unit/seeds/participant.test.js +++ b/test/unit/seeds/participant.test.js @@ -47,7 +47,7 @@ Test('Participant ', async (participantTest) => { knexStub.returns({ insert: sandbox.stub().returns({ onConflict: sandbox.stub().returns({ - ignore: sandbox.stub().returns(true) + merge: sandbox.stub().returns(true) }) }) })