From f94aca8dead76a4c4c027d3c898e40b1bf276d2d Mon Sep 17 00:00:00 2001 From: bnonni Date: Sat, 7 May 2022 18:54:14 -0400 Subject: [PATCH] deployment --- .gitignore | 5 +- backend/.github/workflows/deploy.yml | 9 +- backend/API.md | 183 --------------------------- backend/dataModel.json | 37 ------ backend/package.json | 52 ++++---- backend/sensei/nodes.js | 19 +-- 6 files changed, 32 insertions(+), 273 deletions(-) delete mode 100644 backend/API.md delete mode 100644 backend/dataModel.json diff --git a/.gitignore b/.gitignore index bd70049..0ec3a7f 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,7 @@ logs **/*.backup.* **/*.back.* -**/node_modules +node_modules bower_components *.sublime* @@ -18,15 +18,12 @@ psd thumb sketch -<<<<<<< HEAD *.lock # End of https://www.toptal.com/developers/gitignore/api/react -======= # End of https://www.toptal.com/developers/gitignore/api/react **/service-account.json ->>>>>>> 18ffdb861cdf24a7ebaea8c6f91205ed97a03c98 # Misc. secrets (API keys, GCP credentials, etc.) .env diff --git a/backend/.github/workflows/deploy.yml b/backend/.github/workflows/deploy.yml index 864187b..e159376 100644 --- a/backend/.github/workflows/deploy.yml +++ b/backend/.github/workflows/deploy.yml @@ -1,15 +1,14 @@ -name: park-ln +name: family-btc on: push: branches: - - master - - devops/deploy/backend + - main env: - CLOUD_RUN_PROJECT_ID: park-lightning + CLOUD_RUN_PROJECT_ID: atl-bitdevs-hackathons CLOUD_RUN_REGION: us-east1 - REPO_NAME: park-lightning + REPO_NAME: familybtc jobs: deploy-backend: diff --git a/backend/API.md b/backend/API.md deleted file mode 100644 index 6fcf284..0000000 --- a/backend/API.md +++ /dev/null @@ -1,183 +0,0 @@ -# API Route Spec -Below is an outline of the API routes available to both users (parking and paying) and admins (enforcing parking rules). - -## Routes -User Types -1. Drivers -2. Parking Enforcement - -API Data Objects -1. [Spot](./api/spot/) -2. [Invoice](./api/invoice/) - -5 Routes -1. Route: `/api/v1/spot/details` - - Method: `GET` - - URL: https://park-lightning-foiudx76uq-ue.a.run.app/api/v1/spot/details?uuid=d8d05dce-dbae-421b-9bdd-ea3ce75b7a77 -```json -Body: None - -Returns: - { - "success": true, - "message": { - "address": "691 John Wesley Dobbs Ave, Atlanta, GA 30312", - "expirationTime": 1648319420, - "startTime": 1648317620, - "expired": false, - "licensePlate": "SC39133", - "occupied": true, - "duration": 1800 - } - } -``` -2. Route: `/api/v1/spot/reserve` - - Method: `POST` - - URL: https://park-lightning-foiudx76uq-ue.a.run.app/api/v1/spot/reserve -```json -Body: - { - "uuid": "da1c0d1b-1ecf-4fe0-9acd-dc3d49640f8f", - "licensePlate": "BOE8359", - "duration": 1800 - } - -Returns: - { - "success": true, - "message": { - "_writeTime": { - "_seconds": 1648324950, - "_nanoseconds": 756013000 - } - } - } -``` -3. Route: `/api/v1/invoice/create` - - Method: `POST` - - URL: https://park-lightning-foiudx76uq-ue.a.run.app/api/v1/invoice/create -```json -Body: - { - "amount": 1, - "memo": { - "licensePlate": "BOE8359", - "uuid": "da1c0d1b-1ecf-4fe0-9acd-dc3d49640f8f", - "duration": 1800 - } - } - -Returns: - { - "success": true, - "message": { - "id": "dd610b73-aed9-456f-9cd6-7d4aeff29407", - "description": "{\"licensePlate\":\"BOE8359\",\"uuid\":\"da1c0d1b-1ecf-4fe0-9acd-dc3d49640f8f\",\"duration\":1800}", - "amount": 2261, - "missing_amt": 2261, - "status": "unpaid", - "fiat_value": 1, - "source_fiat_value": 1, - "currency": "USD", - "created_at": 1648392719, - "order_id": null, - "address": "31zEqCfzvvT8kBr9fh4U3bZj1AZM5Q4vsb", - "metadata": {}, - "expires_at": "2022-03-27T15:01:59.758Z", - "auto_settle": false, - "lightning_invoice": { - "created_at": 1648392719, - "expires_at": 1648393318, - "payreq": "lnbc22610n1p3yq7s0pp5nfzpah463t9v25c5ja0gpy4uq5ga3lq96a6pe6adsw76dvqgv8zqdyq0v3xc6trv4h8xe2sd3shgefz8g3yyn698qen2wfz9s382atfvs3r5gnyvyckxvryx93z6vt9vdnz6drxv5cz6wtpvdjz6errxdjrgwfkxscxvwrxygkzyer4wfsjut3wcqzpgxqzjhsp58x3y8h4npmp9ws76qrrhgadsr2pa9ls6p7zxtd4k2k9p87cqjq6q9qyyssqp65meh539k2ungxpq7vw9j8s37slhg3gjcxvmnpe0fw67xuey2xpu7pcgxt5c8c5kecr4l9y5a4rd8dt0flrg98m5r2w9rkyqgc4mzsqhvm98w", - "settled_at": null - }, - "chain_invoice": { - "address": "31zEqCfzvvT8kBr9fh4U3bZj1AZM5Q4vsb" - }, - "transactions": [], - "uri": "bitcoin:31zEqCfzvvT8kBr9fh4U3bZj1AZM5Q4vsb?amount=0.00002261&label={\"licensePlate\":\"BOE8359\",\"uuid\":\"da1c0d1b-1ecf-4fe0-9acd-dc3d49640f8f\",\"duration\":1800}&lightning=LNBC22610N1P3YQ7S0PP5NFZPAH463T9V25C5JA0GPY4UQ5GA3LQ96A6PE6ADSW76DVQGV8ZQDYQ0V3XC6TRV4H8XE2SD3SHGEFZ8G3YYN698QEN2WFZ9S382ATFVS3R5GNYVYCKXVRYX93Z6VT9VDNZ6DRXV5CZ6WTPVDJZ6ERRXDJRGWFKXSCXVWRXYGKZYER4WFSJUT3WCQZPGXQZJHSP58X3Y8H4NPMP9WS76QRRHGADSR2PA9LS6P7ZXTD4K2K9P87CQJQ6Q9QYYSSQP65MEH539K2UNGXPQ7VW9J8S37SLHG3GJCXVMNPE0FW67XUEY2XPU7PCGXT5C8C5KECR4L9Y5A4RD8DT0FLRG98M5R2W9RKYQGC4MZSQHVM98W" - } - } - -``` -4. Route: `/api/v1/invoice/check` - - Method: `POST` - - URL: https://park-lightning-foiudx76uq-ue.a.run.app/api/v1/invoice/create -```json -Body: - { - "id": "dd610b73-aed9-456f-9cd6-7d4aeff29407" - } - -Returns: - { - "success": true, - "message": { - "id": "dd610b73-aed9-456f-9cd6-7d4aeff29407", - "description": "{\"licensePlate\":\"BOE8359\",\"uuid\":\"da1c0d1b-1ecf-4fe0-9acd-dc3d49640f8f\",\"duration\":1800}", - "amount": 2261, - "missing_amt": 2261, - "status": "unpaid", - "fiat_value": 1, - "source_fiat_value": 1, - "currency": "USD", - "created_at": 1648392719, - "order_id": null, - "address": "31zEqCfzvvT8kBr9fh4U3bZj1AZM5Q4vsb", - "metadata": {}, - "expires_at": "2022-03-27T15:01:59.758Z", - "auto_settle": false, - "lightning_invoice": { - "created_at": 1648392719, - "expires_at": 1648393318, - "payreq": "lnbc22610n1p3yq7s0pp5nfzpah463t9v25c5ja0gpy4uq5ga3lq96a6pe6adsw76dvqgv8zqdyq0v3xc6trv4h8xe2sd3shgefz8g3yyn698qen2wfz9s382atfvs3r5gnyvyckxvryx93z6vt9vdnz6drxv5cz6wtpvdjz6errxdjrgwfkxscxvwrxygkzyer4wfsjut3wcqzpgxqzjhsp58x3y8h4npmp9ws76qrrhgadsr2pa9ls6p7zxtd4k2k9p87cqjq6q9qyyssqp65meh539k2ungxpq7vw9j8s37slhg3gjcxvmnpe0fw67xuey2xpu7pcgxt5c8c5kecr4l9y5a4rd8dt0flrg98m5r2w9rkyqgc4mzsqhvm98w", - "settled_at": null - }, - "chain_invoice": { - "address": "31zEqCfzvvT8kBr9fh4U3bZj1AZM5Q4vsb" - }, - "transactions": [], - "uri": "bitcoin:31zEqCfzvvT8kBr9fh4U3bZj1AZM5Q4vsb?amount=0.00002261&label={\"licensePlate\":\"BOE8359\",\"uuid\":\"da1c0d1b-1ecf-4fe0-9acd-dc3d49640f8f\",\"duration\":1800}&lightning=LNBC22610N1P3YQ7S0PP5NFZPAH463T9V25C5JA0GPY4UQ5GA3LQ96A6PE6ADSW76DVQGV8ZQDYQ0V3XC6TRV4H8XE2SD3SHGEFZ8G3YYN698QEN2WFZ9S382ATFVS3R5GNYVYCKXVRYX93Z6VT9VDNZ6DRXV5CZ6WTPVDJZ6ERRXDJRGWFKXSCXVWRXYGKZYER4WFSJUT3WCQZPGXQZJHSP58X3Y8H4NPMP9WS76QRRHGADSR2PA9LS6P7ZXTD4K2K9P87CQJQ6Q9QYYSSQP65MEH539K2UNGXPQ7VW9J8S37SLHG3GJCXVMNPE0FW67XUEY2XPU7PCGXT5C8C5KECR4L9Y5A4RD8DT0FLRG98M5R2W9RKYQGC4MZSQHVM98W" - } - } -``` - -5. Route: `/api/v1/spot/empty` - - Method: `GET` - - URL: https://park-lightning-foiudx76uq-ue.a.run.app/api/v1/spot/empty - ```json - Body: None - - Returns: - { - "success": true, - "message": { - "unoccupiedSpots": [ - { - "address": "691 John Wesley Dobbs Ave, Atlanta, GA 30312", - "occupied": false - } - ], - "expiredSpots": [ - { - "expired": true, - "expirationTime": 1648319420, - "duration": 1800, - "address": "691 John Wesley Dobbs Ave, Atlanta, GA 30312", - "occupied": true, - "licensePlate": "SC39133", - "startTime": 1648317620 - }, - { - "occupied": true, - "address": "79 5th St NW, Atlanta, GA 30308", - "expirationTime": 1648327169, - "expired": true, - "duration": 1800, - "licensePlate": "BOE8359", - "startTime": 1648325369 - } - ] - } - } -``` diff --git a/backend/dataModel.json b/backend/dataModel.json deleted file mode 100644 index 8d228f9..0000000 --- a/backend/dataModel.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "d8d05dce-dbae-421b-9bdd-ea3ce75b7a77": { - "address": "691 John Wesley Dobbs Ave, Atlanta, GA 30312", - "occupied": true, - "licensePlate": "SC39133", - "start": 1648317620, - "expiration": 1648319420, - "duration": 1800, - "expired": true - }, - "da1c0d1b-1ecf-4fe0-9acd-dc3d49640f8f": { - "address": "79 5th St NW, Atlanta, GA 30308", - "occupied": false - }, - "e74d1791-1ef9-4a5a-b98f-0d7d67e533e1": { - "address": "817 W Peachtree St NE, Atlanta, GA 30308", - "occupied": true, - "licensePlate": "8BQN612", - "startTime": 1648321556, - "expiration": 1649014216, - "duration": 604800, - "expired": false - }, - "4420c88b-a0dd-470c-925c-c713a73b8f17": { - "address": "79 5th St NW, Atlanta, GA 30308", - "licensePlate": "7MSW817", - "occupied": true, - "startTime": 1648317607, - "expiration": 1648324807, - "duration": 7200, - "expired": true - }, - "f1056ff9-e0bd-47a0-adba-5e11670897e7": { - "address": "675 Ponce de Leon Ave NE, Atlanta, GA 30308", - "occupied": false - } -} diff --git a/backend/package.json b/backend/package.json index 5e076e2..89176b1 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,28 +1,28 @@ { - "name": "atlbitdevs-familybtc", - "version": "1.0.0", - "description": "A bitcoin solution for families", - "main": "server.js", - "repository": "git@github.com:atlantabitdevs/familybtc.git", - "author": "atlantabitdevs@gmail.com", - "license": "MIT", - "scripts": { - "start": "PORT=8080 node server.js", - "dev": "PORT=8081 nodemon server.js" - }, - "dependencies": { - "cors": "^2.8.5", - "debug": "^4.3.4", - "dotenv": "^16.0.0", - "express": "^4.17.3", - "firebase-admin": "^10.0.2", - "http-errors": "^2.0.0", - "mailgun-js": "^0.22.0", - "morgan": "^1.10.0", - "node-fetch": "2.6.6", - "nodemon": "^2.0.15", - "opennode": "^1.3.0", - "uuid": "^8.3.2", - "winston": "^3.6.0" - } + "name": "atlbitdevs-familybtc", + "version": "1.0.0", + "description": "A bitcoin solution for families", + "main": "server.js", + "repository": "git@github.com:atlantabitdevs/familybtc.git", + "author": "atlantabitdevs@gmail.com", + "license": "MIT", + "scripts": { + "start": "PORT=8080 node server.js", + "dev": "PORT=8081 nodemon server.js" + }, + "dependencies": { + "cors": "^2.8.5", + "debug": "^4.3.4", + "dotenv": "^16.0.0", + "express": "^4.17.3", + "firebase-admin": "^10.0.2", + "http-errors": "^2.0.0", + "mailgun-js": "^0.22.0", + "morgan": "^1.10.0", + "node-fetch": "2.6.6", + "nodemon": "^2.0.15", + "opennode": "^1.3.0", + "uuid": "^8.3.2", + "winston": "^3.6.0" + } } diff --git a/backend/sensei/nodes.js b/backend/sensei/nodes.js index b14c1a0..f7e2693 100644 --- a/backend/sensei/nodes.js +++ b/backend/sensei/nodes.js @@ -53,26 +53,9 @@ const payInvoice = async (invoice) => { return await res.json(); } -<<<<<<< HEAD -const keysend = async (destPubkey, amtMsat) => { +const keySend = async (destPubkey, amtMsat) => { const res = await apiCall('/v1/node/invoices/pay', 'POST', { dest_pubkey: destPubkey, amt_msat: amtMsat }); return await res.json(); -======= -const keySend = async (destPubkey, amtMsat) => { - const res = await fetch(`${BASE_URL}/v1/node/keysend`, - { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - credentials: 'include', - body: JSON.stringify({ - dest_pubkey: destPubkey, - amt_msat: amtMsat - }) - } - ); ->>>>>>> e295aada2015b250764e2aa5e1db0e8d8a7f6d24 }