From 7050dad546adb7015b7aaff922a7a6a0712426d2 Mon Sep 17 00:00:00 2001 From: Sergen Uysal <0xsergen@gmail.com> Date: Wed, 4 Sep 2024 20:55:24 +0300 Subject: [PATCH 1/2] fix: using hyphen instead of underscore --- src/routes/provisioning.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/routes/provisioning.js b/src/routes/provisioning.js index ddcc911..0e8adde 100644 --- a/src/routes/provisioning.js +++ b/src/routes/provisioning.js @@ -34,8 +34,8 @@ router.post('/provision', basicAuth(authInfo), async (request, response) => { plan: request.body['plan'], chain: request.body['chain'], network: request.body['network'], - wss_url: request.body['wss_url'], - http_url: request.body['http_url'], + wss_url: request.body['wss-url'], + http_url: request.body['http-url'], } }); console.log("Upserted endpoint with id: " + endpoint.get('id')) @@ -86,8 +86,8 @@ router.put('/update', basicAuth(authInfo), async (request, response) => { endpoint.plan = request.body['plan'] endpoint.chain = request.body['chain'] endpoint.network = request.body['network'] - endpoint.wss_url = request.body['wss_url'] - endpoint.http_url = request.body['http_url'] + endpoint.wss_url = request.body['wss-url'] + endpoint.http_url = request.body['http-url'] endpoint.is_test = request.headers['X-QN-TESTING'] === 'true' await endpoint.save(); From 2e7ae86a02ffb07547cd959c3c4cf5a954f9802e Mon Sep 17 00:00:00 2001 From: Sergen Uysal <0xsergen@gmail.com> Date: Mon, 9 Sep 2024 13:41:20 +0300 Subject: [PATCH 2/2] fix: table names --- .../20230313124654-create-account.js | 4 +-- .../20230313124715-create-endpoint.js | 4 +-- src/seeders/20230313124606-demo-accounts.js | 18 ++++++------ src/seeders/20230313124607-demo-endpoints.js | 28 +++++++++++-------- 4 files changed, 30 insertions(+), 24 deletions(-) diff --git a/src/migrations/20230313124654-create-account.js b/src/migrations/20230313124654-create-account.js index 1d7d47f..a094561 100644 --- a/src/migrations/20230313124654-create-account.js +++ b/src/migrations/20230313124654-create-account.js @@ -2,7 +2,7 @@ /** @type {import('sequelize-cli').Migration} */ module.exports = { async up(queryInterface, Sequelize) { - await queryInterface.createTable('Accounts', { + await queryInterface.createTable('accounts', { id: { allowNull: false, autoIncrement: true, @@ -31,6 +31,6 @@ module.exports = { }); }, async down(queryInterface, Sequelize) { - await queryInterface.dropTable('Accounts'); + await queryInterface.dropTable("accounts"); } }; \ No newline at end of file diff --git a/src/migrations/20230313124715-create-endpoint.js b/src/migrations/20230313124715-create-endpoint.js index 8fd571d..50805c4 100644 --- a/src/migrations/20230313124715-create-endpoint.js +++ b/src/migrations/20230313124715-create-endpoint.js @@ -2,7 +2,7 @@ /** @type {import('sequelize-cli').Migration} */ module.exports = { async up(queryInterface, Sequelize) { - await queryInterface.createTable('Endpoints', { + await queryInterface.createTable('endpoints', { id: { allowNull: false, autoIncrement: true, @@ -44,6 +44,6 @@ module.exports = { }); }, async down(queryInterface, Sequelize) { - await queryInterface.dropTable('Endpoints'); + await queryInterface.dropTable("endpoints"); } }; \ No newline at end of file diff --git a/src/seeders/20230313124606-demo-accounts.js b/src/seeders/20230313124606-demo-accounts.js index 81b67ad..e7eba32 100644 --- a/src/seeders/20230313124606-demo-accounts.js +++ b/src/seeders/20230313124606-demo-accounts.js @@ -3,16 +3,18 @@ /** @type {import('sequelize-cli').Migration} */ module.exports = { async up (queryInterface, Sequelize) { - return queryInterface.bulkInsert('Accounts', [{ - quicknode_id: '1234567890', - plan: 'discover', - is_test: true, - createdAt: new Date(), - updatedAt: new Date() - }]); + return queryInterface.bulkInsert("accounts", [ + { + quicknode_id: "1234567890", + plan: "discover", + is_test: true, + createdAt: new Date(), + updatedAt: new Date(), + }, + ]); }, async down (queryInterface, Sequelize) { - return queryInterface.bulkDelete('Accounts', null, {}); + return queryInterface.bulkDelete("accounts", null, {}); } }; diff --git a/src/seeders/20230313124607-demo-endpoints.js b/src/seeders/20230313124607-demo-endpoints.js index 1bb9a24..bd0f563 100644 --- a/src/seeders/20230313124607-demo-endpoints.js +++ b/src/seeders/20230313124607-demo-endpoints.js @@ -3,20 +3,24 @@ /** @type {import('sequelize-cli').Migration} */ module.exports = { async up (queryInterface, Sequelize) { - return queryInterface.bulkInsert('Endpoints', [{ - quicknode_id: '1234567890', - account_id: 1, - chain: 'ethereum', - network: 'mainnet', - is_test: true, - wss_url: 'wss://long-late-firefly.quiknode.pro/4bb1e6b2dec8294938b6fdfdb7cf0cf70c4e97a2/', - http_url: 'https://long-late-firefly.quiknode.pro/4bb1e6b2dec8294938b6fdfdb7cf0cf70c4e97a2/', - createdAt: new Date(), - updatedAt: new Date() - }]); + return queryInterface.bulkInsert("endpoints", [ + { + quicknode_id: "1234567890", + account_id: 1, + chain: "ethereum", + network: "mainnet", + is_test: true, + wss_url: + "wss://long-late-firefly.quiknode.pro/4bb1e6b2dec8294938b6fdfdb7cf0cf70c4e97a2/", + http_url: + "https://long-late-firefly.quiknode.pro/4bb1e6b2dec8294938b6fdfdb7cf0cf70c4e97a2/", + createdAt: new Date(), + updatedAt: new Date(), + }, + ]); }, async down (queryInterface, Sequelize) { - return queryInterface.bulkDelete('Endpoints', null, {}); + return queryInterface.bulkDelete("endpoints", null, {}); } };