From 862c58523cc21a069b231e35be6daba3cadd88e3 Mon Sep 17 00:00:00 2001 From: Gbadebo Bello Date: Wed, 5 Nov 2025 16:06:26 +0100 Subject: [PATCH] reset --- .husky/pre-commit | 56 ++--- .postman/config.json | 12 - ...rgalactic Bank API.postman_collection.json | 235 ------------------ .../globals/workspace.postman_globals.json | 7 - src/routes/accounts.js | 48 ++-- 5 files changed, 52 insertions(+), 306 deletions(-) delete mode 100644 .postman/config.json delete mode 100644 postman/collections/Intergalactic Bank API.postman_collection.json delete mode 100644 postman/globals/workspace.postman_globals.json diff --git a/.husky/pre-commit b/.husky/pre-commit index 5c48f8c..4ab7a70 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -7,39 +7,39 @@ npx lint-staged echo "๐Ÿงช Running tests..." npm test -# Run Spectral linting on Postman collections if they changed -if git diff --cached --name-only | grep -qE "postman/collections/"; then - echo "๐Ÿ“‹ Linting Postman collections with Spectral..." - node .spectral/lint-with-names.js +# # Run Spectral linting on Postman collections if they changed +# if git diff --cached --name-only | grep -qE "postman/collections/"; then +# echo "๐Ÿ“‹ Linting Postman collections with Spectral..." +# node .spectral/lint-with-names.js - if [ $? -ne 0 ]; then - echo "โŒ Spectral linting failed for Postman collections" - exit 1 - fi +# if [ $? -ne 0 ]; then +# echo "โŒ Spectral linting failed for Postman collections" +# exit 1 +# fi - echo "โœ… Postman collection linting passed!" -fi +# echo "โœ… Postman collection linting passed!" +# fi -# Run Postman tests only if Postman collection files changed -if git diff --cached --name-only | grep -qE "postman/"; then - echo "๐Ÿ“ฌ Postman collection changed - Running Postman tests..." +# # Run Postman tests only if Postman collection files changed +# if git diff --cached --name-only | grep -qE "postman/"; then +# echo "๐Ÿ“ฌ Postman collection changed - Running Postman tests..." - # Run all collections in postman/collections/ - for collection in postman/collections/*.postman_collection.json; do - if [ -f "$collection" ]; then - echo " โ†’ Running: $(basename "$collection")" - postman collection run "$collection" +# # Run all collections in postman/collections/ +# for collection in postman/collections/*.postman_collection.json; do +# if [ -f "$collection" ]; then +# echo " โ†’ Running: $(basename "$collection")" +# postman collection run "$collection" - if [ $? -ne 0 ]; then - echo "โŒ Postman collection failed: $collection" - exit 1 - fi - fi - done +# if [ $? -ne 0 ]; then +# echo "โŒ Postman collection failed: $collection" +# exit 1 +# fi +# fi +# done - echo "โœ… All Postman collections passed!" -else - echo "โญ๏ธ No Postman collection changes detected, skipping Postman tests" -fi +# echo "โœ… All Postman collections passed!" +# else +# echo "โญ๏ธ No Postman collection changes detected, skipping Postman tests" +# fi echo "โœ… All pre-commit checks passed!" diff --git a/.postman/config.json b/.postman/config.json deleted file mode 100644 index 5132fca..0000000 --- a/.postman/config.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "workspace": { - "id": "dc52c5c3-a708-487e-891e-3f0d62737b8c" - }, - "entities": { - "collections": ["../postman/collections/Intergalactic Bank API.postman_collection.json"], - "environments": [], - "specs": [], - "flows": [], - "globals": [] - } -} \ No newline at end of file diff --git a/postman/collections/Intergalactic Bank API.postman_collection.json b/postman/collections/Intergalactic Bank API.postman_collection.json deleted file mode 100644 index cb8cc51..0000000 --- a/postman/collections/Intergalactic Bank API.postman_collection.json +++ /dev/null @@ -1,235 +0,0 @@ -{ - "info": { - "_postman_id": "e435e6cd-fc60-4154-96db-7f876c3a45bb", - "name": "Intergalactic Bank API", - "description": "The Intergalactic Bank API makes it easy to manage transaction and account data. Features include Account Management, Transaction Processing, Multiple Currencies, API Key Authentication, and Rate Limiting.", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" - }, - "item": [ - { - "name": "Admin", - "item": [ - { - "name": "Generate API key", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Extract and store API key\", function () {", - " var jsonData = pm.response.json();", - " pm.expect(jsonData).to.have.property('apiKey');", - " pm.collectionVariables.set('apiKey', jsonData.apiKey);", - "});" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "url": { - "raw": "http://localhost:3000/api/v1/auth", - "protocol": "http", - "host": [ - "localhost" - ], - "port": "3000", - "path": [ - "api", - "v1", - "auth" - ] - }, - "description": "Generates a new API key for accessing the Intergalactic Bank API. This endpoint does not require authentication." - } - } - ] - }, - { - "name": "Accounts", - "item": [ - { - "name": "List all accounts", - "request": { - "method": "GET", - "url": { - "raw": "http://localhost:3000/api/v1/accounts?owner=Nova Newman&createdAt=2023-04-10", - "protocol": "http", - "host": [ - "localhost" - ], - "port": "3000", - "path": [ - "api", - "v1", - "accounts" - ], - "query": [ - { - "key": "owner", - "value": "Nova Newman" - }, - { - "key": "createdAt", - "value": "2023-04-10" - } - ] - }, - "description": "Retrieves a list of all accounts at the Intergalactic Bank. Optionally filter by owner name or creation date." - } - }, - { - "name": "Create new account", - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"owner\": \"Nova Newman\",\n \"balance\": 500,\n \"currency\": \"COSMIC_COINS\"\n}" - }, - "url": { - "raw": "http://localhost:3000/api/v1/accounts", - "protocol": "http", - "host": [ - "localhost" - ], - "port": "3000", - "path": [ - "api", - "v1", - "accounts" - ] - }, - "description": "Creates a new account at the Intergalactic Bank. The account will be assigned a unique ID. The currency cannot be changed once the account is created." - } - } - ] - }, - { - "name": "Transactions", - "item": [ - { - "name": "List all transactions", - "request": { - "method": "GET", - "url": { - "raw": "http://localhost:3000/api/v1/transactions?fromAccountId=11111111&toAccountId=18974440&createdAt=2024-01-10", - "protocol": "http", - "host": [ - "localhost" - ], - "port": "3000", - "path": [ - "api", - "v1", - "transactions" - ], - "query": [ - { - "key": "fromAccountId", - "value": "11111111" - }, - { - "key": "toAccountId", - "value": "18974440" - }, - { - "key": "createdAt", - "value": "2024-01-10" - } - ] - }, - "description": "Retrieves a list of transactions. Optionally filter by source account, destination account, or creation date." - } - }, - { - "name": "Create new transaction", - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"fromAccountId\": \"12345678\",\n \"toAccountId\": \"87654321\",\n \"amount\": 10000,\n \"currency\": \"COSMIC_COINS\"\n}" - }, - "url": { - "raw": "http://localhost:3000/api/v1/transactions", - "protocol": "http", - "host": [ - "localhost" - ], - "port": "3000", - "path": [ - "api", - "v1", - "transactions" - ] - }, - "description": "Creates a new transaction. There are two types of transactions: Transfer and Deposit. Transactions cannot be edited or deleted once created." - } - }, - { - "name": "Get transaction by ID", - "request": { - "method": "GET", - "url": { - "raw": "http://localhost:3000/api/v1/transactions/{transactionId}", - "protocol": "http", - "host": [ - "localhost" - ], - "port": "3000", - "path": [ - "api", - "v1", - "transactions", - "{transactionId}" - ] - }, - "description": "Retrieves detailed information about a specific transaction by its ID." - } - } - ] - } - ], - "auth": { - "type": "apikey", - "apikey": [ - { - "key": "value", - "value": "{{apiKey}}", - "type": "string" - }, - { - "key": "key", - "value": "x-api-key", - "type": "string" - } - ] - }, - "variable": [ - { - "key": "apiKey", - "value": "" - } - ] -} \ No newline at end of file diff --git a/postman/globals/workspace.postman_globals.json b/postman/globals/workspace.postman_globals.json deleted file mode 100644 index c11f27c..0000000 --- a/postman/globals/workspace.postman_globals.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "id": "1fa9efaf-f1eb-4d4e-8fe4-94937789787a", - "name": "Globals", - "values": [], - "_postman_variable_scope": "globals", - "_postman_exported_at": "2025-11-04T22:21:28.930Z" -} \ No newline at end of file diff --git a/src/routes/accounts.js b/src/routes/accounts.js index e29f1c2..6165297 100644 --- a/src/routes/accounts.js +++ b/src/routes/accounts.js @@ -40,33 +40,33 @@ router.get('/', validateApiKey, (req, res) => { * GET /api/v1/accounts/:accountId * Get a specific account by ID */ -router.get('/:accountId', validateApiKey, (req, res) => { - try { - const { accountId } = req.params; +// router.get('/:accountId', validateApiKey, (req, res) => { +// try { +// const { accountId } = req.params; - const account = db.getAccountById(accountId); +// const account = db.getAccountById(accountId); - if (!account) { - return res.status(404).json({ - error: { - name: 'instanceNotFoundError', - message: 'The specified account does not exist.' - } - }); - } +// if (!account) { +// return res.status(404).json({ +// error: { +// name: 'instanceNotFoundError', +// message: 'The specified account does not exist.' +// } +// }); +// } - res.status(200).json({ - account: account.toJSON() - }); - } catch (error) { - res.status(500).json({ - error: { - name: 'serverError', - message: 'Failed to retrieve account' - } - }); - } -}); +// res.status(200).json({ +// account: account.toJSON() +// }); +// } catch (error) { +// res.status(500).json({ +// error: { +// name: 'serverError', +// message: 'Failed to retrieve account' +// } +// }); +// } +// }); /** * POST /api/v1/accounts