Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(csi-318): added externalParticipant table #1092

Merged
merged 11 commits into from
Sep 19, 2024
Merged
2 changes: 1 addition & 1 deletion .ncurc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ reject: [
# Issue is tracked here: https://github.com/mojaloop/project/issues/3616
"sinon",
# glob >= 11 requires node >= 20
"glob",
"glob"
]
2 changes: 2 additions & 0 deletions .nycrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ exclude: [
'src/handlers/transfers/FxFulfilService.js',
'src/models/position/batch.js',
'src/models/fxTransfer/**',
'src/models/participant/externalParticipantCached.js', # todo: figure out why it shows only 50% coverage in Branch
geka-evk marked this conversation as resolved.
Show resolved Hide resolved
'src/models/transfer/facade.js', ## add more test coverage
'src/shared/fspiopErrorFactory.js',
'src/lib/proxyCache.js' # todo: remove this line after adding test coverage
]
Expand Down
24 changes: 14 additions & 10 deletions audit-ci.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,19 @@
// Only use one of ["low": true, "moderate": true, "high": true, "critical": true]
"moderate": true,
"allowlist": [ // NOTE: Please add as much information as possible to any items added to the allowList
"GHSA-w5p7-h5w8-2hfq", // tap-spec>tap-out>trim; This has been analyzed and this is acceptable as it is used to run tests.
"GHSA-2mvq-xp48-4c77", // https://github.com/advisories/GHSA-2mvq-xp48-4c77
"GHSA-5854-jvxx-2cg9", // https://github.com/advisories/GHSA-5854-jvxx-2cg9
"GHSA-7hx8-2rxv-66xv", // https://github.com/advisories/GHSA-7hx8-2rxv-66xv
"GHSA-c429-5p7v-vgjp", // https://github.com/advisories/GHSA-c429-5p7v-vgjp
"GHSA-g64q-3vg8-8f93", // https://github.com/advisories/GHSA-g64q-3vg8-8f93
"GHSA-mg85-8mv5-ffjr", // https://github.com/advisories/GHSA-mg85-8mv5-ffjr
"GHSA-8hc4-vh64-cxmj", // https://github.com/advisories/GHSA-8hc4-vh64-cxmj
"GHSA-952p-6rrq-rcjv", // https://github.com/advisories/GHSA-952p-6rrq-rcjv
"GHSA-9wv6-86v2-598j" // https://github.com/advisories/GHSA-9wv6-86v2-598j
"GHSA-w5p7-h5w8-2hfq", // tap-spec>tap-out>trim; This has been analyzed and this is acceptable as it is used to run tests.
"GHSA-2mvq-xp48-4c77", // https://github.com/advisories/GHSA-2mvq-xp48-4c77
"GHSA-5854-jvxx-2cg9", // https://github.com/advisories/GHSA-5854-jvxx-2cg9
"GHSA-7hx8-2rxv-66xv", // https://github.com/advisories/GHSA-7hx8-2rxv-66xv
"GHSA-c429-5p7v-vgjp", // https://github.com/advisories/GHSA-c429-5p7v-vgjp
"GHSA-g64q-3vg8-8f93", // https://github.com/advisories/GHSA-g64q-3vg8-8f93
"GHSA-mg85-8mv5-ffjr", // https://github.com/advisories/GHSA-mg85-8mv5-ffjr
"GHSA-8hc4-vh64-cxmj", // https://github.com/advisories/GHSA-8hc4-vh64-cxmj
"GHSA-952p-6rrq-rcjv", // https://github.com/advisories/GHSA-952p-6rrq-rcjv
"GHSA-9wv6-86v2-598j", // https://github.com/advisories/GHSA-9wv6-86v2-598j
"GHSA-qwcr-r2fm-qrc7", // https://github.com/advisories/GHSA-qwcr-r2fm-qrc7
"GHSA-cm22-4g7w-348p", // https://github.com/advisories/GHSA-cm22-4g7w-348p
"GHSA-m6fv-jmcg-4jfg", // https://github.com/advisories/GHSA-m6fv-jmcg-4jfg
"GHSA-qw6h-vgh9-j6wx" // https://github.com/advisories/GHSA-qw6h-vgh9-j6wx
]
}
47 changes: 47 additions & 0 deletions migrations/960100_create_externalParticipant.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*****
License
--------------
Copyright © 2017 Bill & Melinda Gates Foundation
The Mojaloop files are made available by the Bill & Melinda Gates Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Contributors
--------------
This is the official list of the Mojaloop project contributors for this file.
Names of the original copyright holders (individuals or organizations)
should be listed with a '*' in the first column. People who have
contributed from an organization can be listed under the organization
that actually holds the copyright for their contributions (see the
Gates Foundation organization for an example). Those individuals should have
their names indented and be marked with a '-'. Email address can be added
optionally within square brackets <email>.
* Gates Foundation
- Name Surname <[email protected]>

* Eugen Klymniuk <[email protected]>
--------------
**********/

exports.up = async (knex) => {
return knex.schema.hasTable('externalParticipant').then(function(exists) {
if (!exists) {
return knex.schema.createTable('externalParticipant', (t) => {
t.bigIncrements('externalParticipantId').primary().notNullable()
t.string('name', 30).notNullable()
t.unique('name')
t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable()
t.integer('proxyId').unsigned().notNullable()
t.foreign('proxyId').references('participantId').inTable('participant')
})
}
})
}

exports.down = function (knex) {
return knex.schema.hasTable('externalParticipant').then(function(exists) {
if (!exists) {
return knex.schema.dropTableIfExists('externalParticipant')
}
})
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*****
License
--------------
Copyright © 2017 Bill & Melinda Gates Foundation
The Mojaloop files are made available by the Bill & Melinda Gates Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Contributors
--------------
This is the official list of the Mojaloop project contributors for this file.
Names of the original copyright holders (individuals or organizations)
should be listed with a '*' in the first column. People who have
contributed from an organization can be listed under the organization
that actually holds the copyright for their contributions (see the
Gates Foundation organization for an example). Those individuals should have
their names indented and be marked with a '-'. Email address can be added
optionally within square brackets <email>.
* Gates Foundation
- Name Surname <[email protected]>

* Eugen Klymniuk <[email protected]>
--------------
**********/

const EP_ID_FIELD = 'externalParticipantId'

exports.up = async (knex) => {
return knex.schema.hasTable('transferParticipant').then(function(exists) {
if (exists) {
return knex.schema.alterTable('transferParticipant', (t) => {
t.bigint(EP_ID_FIELD).unsigned().nullable()
t.foreign(EP_ID_FIELD).references(EP_ID_FIELD).inTable('externalParticipant')
t.index(EP_ID_FIELD)
})
}
})
}

exports.down = async (knex) => {
return knex.schema.hasTable('transferParticipant').then(function(exists) {
if (exists) {
return knex.schema.alterTable('transferParticipant', (t) => {
t.dropIndex(EP_ID_FIELD)
t.dropForeign(EP_ID_FIELD)
t.dropColumn(EP_ID_FIELD)
})
}
})
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*****
License
--------------
Copyright © 2017 Bill & Melinda Gates Foundation
The Mojaloop files are made available by the Bill & Melinda Gates Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Contributors
--------------
This is the official list of the Mojaloop project contributors for this file.
Names of the original copyright holders (individuals or organizations)
should be listed with a '*' in the first column. People who have
contributed from an organization can be listed under the organization
that actually holds the copyright for their contributions (see the
Gates Foundation organization for an example). Those individuals should have
their names indented and be marked with a '-'. Email address can be added
optionally within square brackets <email>.
* Gates Foundation
- Name Surname <[email protected]>

* Eugen Klymniuk <[email protected]>
--------------
**********/

const EP_ID_FIELD = 'externalParticipantId'

exports.up = async (knex) => {
return knex.schema.hasTable('fxTransferParticipant').then((exists) => {
if (exists) {
return knex.schema.alterTable('fxTransferParticipant', (t) => {
t.bigint(EP_ID_FIELD).unsigned().nullable()
t.foreign(EP_ID_FIELD).references(EP_ID_FIELD).inTable('externalParticipant')
t.index(EP_ID_FIELD)
})
}
})
}

exports.down = async (knex) => {
return knex.schema.hasTable('fxTransferParticipant').then((exists) => {
if (exists) {
return knex.schema.alterTable('fxTransferParticipant', (t) => {
t.dropIndex(EP_ID_FIELD)
t.dropForeign(EP_ID_FIELD)
t.dropColumn(EP_ID_FIELD)
})
}
})
}
Loading