Skip to content

Commit

Permalink
fix context issues
Browse files Browse the repository at this point in the history
  • Loading branch information
kirgene committed Feb 3, 2022
1 parent 55fda39 commit e3f25ef
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 32 deletions.
4 changes: 2 additions & 2 deletions server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "connection-manager-api",
"version": "1.7.20",
"version": "1.7.21",
"description": "ModusBox Connection Manager API",
"main": "index.js",
"scripts": {
Expand Down
14 changes: 7 additions & 7 deletions server/src/controllers/Pki.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const utils = require('../utils/writer.js');
const Pki = require('../service/PkiService');

exports.createDFSP = function createDFSP (req, res, next, body) {
Pki.createDFSP(body)
Pki.createDFSP(req.context, body)
.then(function (response) {
utils.writeJson(res, response);
})
Expand All @@ -31,7 +31,7 @@ exports.createDFSP = function createDFSP (req, res, next, body) {
};

exports.deleteDFSP = function createDFSP (req, res, next, dfspId) {
Pki.deleteDFSP(dfspId)
Pki.deleteDFSP(req.context, dfspId)
.then(function (response) {
utils.writeJson(res, response);
})
Expand All @@ -41,7 +41,7 @@ exports.deleteDFSP = function createDFSP (req, res, next, dfspId) {
};

exports.getDFSPs = function getDFSPs (req, res, next) {
Pki.getDFSPs()
Pki.getDFSPs(req.context)
.then(function (response) {
utils.writeJson(res, response);
})
Expand All @@ -51,7 +51,7 @@ exports.getDFSPs = function getDFSPs (req, res, next) {
};

exports.setDFSPca = function setDFSPca (req, res, next, body, dfspId) {
Pki.setDFSPca(dfspId, body)
Pki.setDFSPca(req.context, dfspId, body)
.then(function (response) {
utils.writeJson(res, response);
})
Expand All @@ -61,7 +61,7 @@ exports.setDFSPca = function setDFSPca (req, res, next, body, dfspId) {
};

exports.getDFSPca = function getDFSPca (req, res, next, dfspId) {
Pki.getDFSPca(dfspId)
Pki.getDFSPca(req.context, dfspId)
.then(function (response) {
utils.writeJson(res, response);
})
Expand All @@ -71,7 +71,7 @@ exports.getDFSPca = function getDFSPca (req, res, next, dfspId) {
};

exports.updateDFSP = (req, res, next, body, dfspId) => {
Pki.updateDFSP(dfspId, body)
Pki.updateDFSP(req.context, dfspId, body)
.then(function (response) {
utils.writeJson(res, response);
})
Expand All @@ -81,7 +81,7 @@ exports.updateDFSP = (req, res, next, body, dfspId) => {
};

exports.getDfspsByMonetaryZones = (req, res, next, monetaryZoneId) => {
Pki.getDfspsByMonetaryZones(monetaryZoneId)
Pki.getDfspsByMonetaryZones(req.context, monetaryZoneId)
.then(function (response) {
utils.writeJson(res, response);
})
Expand Down
22 changes: 9 additions & 13 deletions server/src/db/migrations/20190507080322_create_dfsps_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,13 @@
* limitations under the License. *
******************************************************************************/

exports.up = function (knex, Promise) {
return knex.schema.createTable('dfsps', (table) => {
table.increments('id').primary().unsigned().notNullable();
table.string('name', 512).notNullable();
table.string('identifier', 512).defaultTo(null);
table.index('id');
if (!process.env.TEST) table.engine('InnoDB');
if (!process.env.TEST) table.charset('utf8mb4');
});
};
exports.up = (knex) => knex.schema.createTable('dfsps', (table) => {
table.increments('id').primary().unsigned().notNullable();
table.string('name', 512).notNullable();
table.string('identifier', 512).defaultTo(null);
table.index('id');
table.engine('InnoDB');
table.charset('utf8mb4');
});

exports.down = function (knex, Promise) {
return knex.schema.dropTableIfExists('dfsps');
};
exports.down = knex => knex.schema.dropTableIfExists('dfsps');
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

exports.up = function (knex, Promise) {
return knex.schema.createTable('inbound_enrollments', (table) => {
table.increments('id', 11).primary();
table.integer('dfsp_id', 11).unsigned().notNullable();
table.increments('id').primary();
table.integer('dfsp_id').unsigned().notNullable();
table.text('cert');
table.text('csr');
table.json('cert_info').defaultTo(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

exports.up = function (knex, Promise) {
return knex.schema.createTable('outbound_enrollments', (table) => {
table.increments('id', 11).primary();
table.integer('dfsp_id', 11).unsigned().notNullable();
table.increments('id').primary();
table.integer('dfsp_id').unsigned().notNullable();
table.text('dfsp_ca_bundle');
table.text('csr');
table.text('cert');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
exports.up = function (knex, Promise) {
return knex.schema.createTable('dfsp_endpoint_items', (table) => {
table.increments('id').primary();
table.integer('dfsp_id', 11).unsigned().notNullable();
table.integer('dfsp_id').unsigned().notNullable();
table.string('state', 512).defaultTo(null);
table.string('direction', 512).defaultTo(null);
table.string('value', 1024).defaultTo(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
exports.up = function (knex, Promise) {
return knex.schema.createTable('dfsp_cas', (table) => {
table.increments('id').primary();
table.integer('dfsp_id', 11).unsigned().notNullable();
table.integer('dfsp_id').unsigned().notNullable();
table.text('root_certificate');
table.string('root_certificate_state', 512);
table.text('root_certificate_validation');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

exports.up = function (knex, Promise) {
return knex.schema.createTable('dfsp_server_certs', (table) => {
table.increments('id', 11).primary();
table.integer('dfsp_id', 11).unsigned().notNullable();
table.increments('id').primary();
table.integer('dfsp_id').unsigned().notNullable();
table.text('root_cert');
table.text('chain');
table.text('server_cert');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

exports.up = function (knex, Promise) {
return knex.schema.table('inbound_enrollments', function (table) {
table.integer('hub_issuer_ca_id', 11).unsigned();
table.integer('hub_issuer_ca_id').unsigned();
table.foreign('hub_issuer_ca_id', 'FK_HUB_ISSUER_CA_ID').references('hub_issuer_cas.id').onDelete('NO ACTION').onUpdate('NO ACTION');
});
};
Expand Down

0 comments on commit e3f25ef

Please sign in to comment.