From 82dcef527dbba6b5358a03416dac7b368dd4a901 Mon Sep 17 00:00:00 2001 From: Dallas Richmond Date: Fri, 13 Dec 2024 15:24:19 -0800 Subject: [PATCH 01/28] Added prisma --- backend/.gitignore | 3 ++ backend/package-lock.json | 85 +++++++++++++++++++++++++++++++++++- backend/package.json | 2 + backend/prisma/schema.prisma | 19 ++++++++ backend/src/prismaClient.ts | 5 +++ 5 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 backend/.gitignore create mode 100644 backend/prisma/schema.prisma create mode 100644 backend/src/prismaClient.ts diff --git a/backend/.gitignore b/backend/.gitignore new file mode 100644 index 0000000..11ddd8d --- /dev/null +++ b/backend/.gitignore @@ -0,0 +1,3 @@ +node_modules +# Keep environment variables out of version control +.env diff --git a/backend/package-lock.json b/backend/package-lock.json index d881241..ff90b22 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -10,6 +10,7 @@ "license": "ISC", "dependencies": { "@bcgov/citz-imb-sso-express": "^1.0.2", + "@prisma/client": "^6.0.1", "compression": "^1.7.4", "cookie-parser": "^1.4.6", "cors": "^2.8.5", @@ -17,6 +18,7 @@ "express": "^4.19.2", "morgan": "^1.10.0", "pg": "^8.11.5", + "prisma": "^6.0.1", "supertest": "^7.0.0", "swagger-jsdoc": "^6.2.8", "swagger-ui-express": "^5.0.0" @@ -1484,6 +1486,69 @@ "node": ">= 8" } }, + "node_modules/@prisma/client": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@prisma/client/-/client-6.0.1.tgz", + "integrity": "sha512-60w7kL6bUxz7M6Gs/V+OWMhwy94FshpngVmOY05TmGD0Lhk+Ac0ZgtjlL6Wll9TD4G03t4Sq1wZekNVy+Xdlbg==", + "hasInstallScript": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "peerDependencies": { + "prisma": "*" + }, + "peerDependenciesMeta": { + "prisma": { + "optional": true + } + } + }, + "node_modules/@prisma/debug": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-6.0.1.tgz", + "integrity": "sha512-jQylgSOf7ibTVxqBacnAlVGvek6fQxJIYCQOeX2KexsfypNzXjJQSS2o5s+Mjj2Np93iSOQUaw6TvPj8syhG4w==", + "license": "Apache-2.0" + }, + "node_modules/@prisma/engines": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-6.0.1.tgz", + "integrity": "sha512-4hxzI+YQIR2uuDyVsDooFZGu5AtixbvM2psp+iayDZ4hRrAHo/YwgA17N23UWq7G6gRu18NvuNMb48qjP3DPQw==", + "hasInstallScript": true, + "license": "Apache-2.0", + "dependencies": { + "@prisma/debug": "6.0.1", + "@prisma/engines-version": "5.23.0-27.5dbef10bdbfb579e07d35cc85fb1518d357cb99e", + "@prisma/fetch-engine": "6.0.1", + "@prisma/get-platform": "6.0.1" + } + }, + "node_modules/@prisma/engines-version": { + "version": "5.23.0-27.5dbef10bdbfb579e07d35cc85fb1518d357cb99e", + "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-5.23.0-27.5dbef10bdbfb579e07d35cc85fb1518d357cb99e.tgz", + "integrity": "sha512-JmIds0Q2/vsOmnuTJYxY4LE+sajqjYKhLtdOT6y4imojqv5d/aeVEfbBGC74t8Be1uSp0OP8lxIj2OqoKbLsfQ==", + "license": "Apache-2.0" + }, + "node_modules/@prisma/fetch-engine": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-6.0.1.tgz", + "integrity": "sha512-T36bWFVGeGYYSyYOj9d+O9G3sBC+pAyMC+jc45iSL63/Haq1GrYjQPgPMxrEj9m739taXrupoysRedQ+VyvM/Q==", + "license": "Apache-2.0", + "dependencies": { + "@prisma/debug": "6.0.1", + "@prisma/engines-version": "5.23.0-27.5dbef10bdbfb579e07d35cc85fb1518d357cb99e", + "@prisma/get-platform": "6.0.1" + } + }, + "node_modules/@prisma/get-platform": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-6.0.1.tgz", + "integrity": "sha512-zspC9vlxAqx4E6epMPMLLBMED2VD8axDe8sPnquZ8GOsn6tiacWK0oxrGK4UAHYzYUVuMVUApJbdXB2dFpLhvg==", + "license": "Apache-2.0", + "dependencies": { + "@prisma/debug": "6.0.1" + } + }, "node_modules/@sinclair/typebox": { "version": "0.27.8", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", @@ -4774,7 +4839,6 @@ "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, "hasInstallScript": true, "license": "MIT", "optional": true, @@ -7812,6 +7876,25 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/prisma": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/prisma/-/prisma-6.0.1.tgz", + "integrity": "sha512-CaMNFHkf+DDq8zq3X/JJsQ4Koy7dyWwwtOKibkT/Am9j/tDxcfbg7+lB1Dzhx18G/+RQCMgjPYB61bhRqteNBQ==", + "hasInstallScript": true, + "license": "Apache-2.0", + "dependencies": { + "@prisma/engines": "6.0.1" + }, + "bin": { + "prisma": "build/index.js" + }, + "engines": { + "node": ">=18.18" + }, + "optionalDependencies": { + "fsevents": "2.3.3" + } + }, "node_modules/prompts": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", diff --git a/backend/package.json b/backend/package.json index 5ad02cb..98fbe48 100644 --- a/backend/package.json +++ b/backend/package.json @@ -43,6 +43,7 @@ }, "dependencies": { "@bcgov/citz-imb-sso-express": "^1.0.2", + "@prisma/client": "^6.0.1", "compression": "^1.7.4", "cookie-parser": "^1.4.6", "cors": "^2.8.5", @@ -50,6 +51,7 @@ "express": "^4.19.2", "morgan": "^1.10.0", "pg": "^8.11.5", + "prisma": "^6.0.1", "supertest": "^7.0.0", "swagger-jsdoc": "^6.2.8", "swagger-ui-express": "^5.0.0" diff --git a/backend/prisma/schema.prisma b/backend/prisma/schema.prisma new file mode 100644 index 0000000..2ce8cec --- /dev/null +++ b/backend/prisma/schema.prisma @@ -0,0 +1,19 @@ +// This is your Prisma schema file, +// learn more about it in the docs: https://pris.ly/d/prisma-schema + +// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions? +// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init + +generator client { + provider = "prisma-client-js" +} + +datasource db { + provider = "postgresql" + url = env("DATABASE_URL") +} + +model Region { +id Int @id @default(autoincrement()) +name String +} \ No newline at end of file diff --git a/backend/src/prismaClient.ts b/backend/src/prismaClient.ts new file mode 100644 index 0000000..4e54f7a --- /dev/null +++ b/backend/src/prismaClient.ts @@ -0,0 +1,5 @@ +import { PrismaClient } from '@prisma/client'; + +const prisma = new PrismaClient(); + +export default prisma; From 7d026b81bc8421359632128a5237da2af15a2495 Mon Sep 17 00:00:00 2001 From: Dallas Richmond Date: Fri, 13 Dec 2024 15:57:19 -0800 Subject: [PATCH 02/28] Added region router and controller --- backend/src/controllers/regionsControler.ts | 17 +++++++++++++++++ backend/src/routes/regionRouter.ts | 10 ++++++++++ 2 files changed, 27 insertions(+) create mode 100644 backend/src/controllers/regionsControler.ts create mode 100644 backend/src/routes/regionRouter.ts diff --git a/backend/src/controllers/regionsControler.ts b/backend/src/controllers/regionsControler.ts new file mode 100644 index 0000000..5fae642 --- /dev/null +++ b/backend/src/controllers/regionsControler.ts @@ -0,0 +1,17 @@ +import { Response, Request } from 'express'; +import prisma from '../prismaClient'; + +export const getRegions = async (req: Request, res: Response) => { + const regions = await prisma.region.findMany(); + res.status(200).send(regions); +}; + +export const CreateRegion = async (req: Request, res: Response) => { + const region = await prisma.region.create({ + data: { + name: req.body.name, + }, + }); + res.status(201).send(region); +// might be res.json(region) instead of res.send(region) +}; diff --git a/backend/src/routes/regionRouter.ts b/backend/src/routes/regionRouter.ts new file mode 100644 index 0000000..7c4bb4d --- /dev/null +++ b/backend/src/routes/regionRouter.ts @@ -0,0 +1,10 @@ +// Root|/api endpoint router +// Any routes in /api can be accessed through here +import express from 'express'; +import { getRegions, CreateRegion } from '../controllers/regionsControler'; + +const router = express.Router(); + +router.route('/regions').get(getRegions).post(CreateRegion); + +export default router; From cd344e9da33f38b4dcd92d708cf3944bc1e0f1ad Mon Sep 17 00:00:00 2001 From: Dallas Richmond Date: Mon, 16 Dec 2024 12:01:33 -0800 Subject: [PATCH 03/28] Prisma initialized and test region model defined --- backend/.husky/pre-push | 10 -- backend/package-lock.json | 94 ++++++++++----- backend/package.json | 9 +- backend/prisma/schema.prisma | 1 + .../src/controllers/developers-controller.ts | 14 --- ...gionsControler.ts => regionsController.ts} | 0 backend/src/express.ts | 4 +- backend/src/routes/developers-route.ts | 10 -- .../{health-router.ts => healthRouter.ts} | 6 +- backend/src/routes/index.ts | 7 +- backend/src/routes/regionRouter.ts | 8 +- docker-compose copy.yml | 109 ++++++++++++++++++ docker-compose.yml | 60 +++++----- package-lock.json | 6 - 14 files changed, 221 insertions(+), 117 deletions(-) delete mode 100644 backend/.husky/pre-push delete mode 100644 backend/src/controllers/developers-controller.ts rename backend/src/controllers/{regionsControler.ts => regionsController.ts} (100%) delete mode 100644 backend/src/routes/developers-route.ts rename backend/src/routes/{health-router.ts => healthRouter.ts} (52%) create mode 100644 docker-compose copy.yml delete mode 100644 package-lock.json diff --git a/backend/.husky/pre-push b/backend/.husky/pre-push deleted file mode 100644 index f2a604c..0000000 --- a/backend/.husky/pre-push +++ /dev/null @@ -1,10 +0,0 @@ -cd frontend -npm run test -npm run format -npm run lint -npm run build - -cd ../backend -npm run test -npm run format -npm run lint diff --git a/backend/package-lock.json b/backend/package-lock.json index ff90b22..dabb515 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -21,7 +21,8 @@ "prisma": "^6.0.1", "supertest": "^7.0.0", "swagger-jsdoc": "^6.2.8", - "swagger-ui-express": "^5.0.0" + "swagger-ui-express": "^5.0.0", + "tsc-alias": "^1.8.10" }, "devDependencies": { "@eslint/js": "^9.2.0", @@ -1452,7 +1453,6 @@ "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", - "dev": true, "license": "MIT", "dependencies": { "@nodelib/fs.stat": "2.0.5", @@ -1466,7 +1466,6 @@ "version": "2.0.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", - "dev": true, "license": "MIT", "engines": { "node": ">= 8" @@ -1476,7 +1475,6 @@ "version": "1.2.8", "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", - "dev": true, "license": "MIT", "dependencies": { "@nodelib/fs.scandir": "2.1.5", @@ -2376,7 +2374,6 @@ "version": "3.1.3", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dev": true, "license": "ISC", "dependencies": { "normalize-path": "^3.0.0", @@ -2460,7 +2457,6 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", - "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -2793,7 +2789,6 @@ "version": "2.3.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", - "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -2849,7 +2844,6 @@ "version": "3.0.3", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", - "dev": true, "license": "MIT", "dependencies": { "fill-range": "^7.1.1" @@ -3027,7 +3021,6 @@ "version": "3.6.0", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", - "dev": true, "license": "MIT", "dependencies": { "anymatch": "~3.1.2", @@ -3052,7 +3045,6 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, "license": "ISC", "dependencies": { "is-glob": "^4.0.1" @@ -3596,7 +3588,6 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "dev": true, "license": "MIT", "dependencies": { "path-type": "^4.0.0" @@ -4590,7 +4581,6 @@ "version": "3.3.2", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", - "dev": true, "license": "MIT", "dependencies": { "@nodelib/fs.stat": "^2.0.2", @@ -4607,7 +4597,6 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, "license": "ISC", "dependencies": { "is-glob": "^4.0.1" @@ -4640,7 +4629,6 @@ "version": "1.17.1", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz", "integrity": "sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==", - "dev": true, "license": "ISC", "dependencies": { "reusify": "^1.0.4" @@ -4706,7 +4694,6 @@ "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", - "dev": true, "license": "MIT", "dependencies": { "to-regex-range": "^5.0.1" @@ -5040,7 +5027,6 @@ "version": "11.1.0", "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", - "dev": true, "license": "MIT", "dependencies": { "array-union": "^2.1.0", @@ -5243,7 +5229,6 @@ "version": "5.3.1", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", "integrity": "sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==", - "dev": true, "license": "MIT", "engines": { "node": ">= 4" @@ -5423,7 +5408,6 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, "license": "MIT", "dependencies": { "binary-extensions": "^2.0.0" @@ -5518,7 +5502,6 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -5579,7 +5562,6 @@ "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, "license": "MIT", "dependencies": { "is-extglob": "^2.1.1" @@ -5620,7 +5602,6 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, "license": "MIT", "engines": { "node": ">=0.12.0" @@ -6873,7 +6854,6 @@ "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "dev": true, "license": "MIT", "engines": { "node": ">= 8" @@ -6892,7 +6872,6 @@ "version": "4.0.8", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", - "dev": true, "license": "MIT", "dependencies": { "braces": "^3.0.3", @@ -7011,6 +6990,19 @@ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", "license": "MIT" }, + "node_modules/mylas": { + "version": "2.1.13", + "resolved": "https://registry.npmjs.org/mylas/-/mylas-2.1.13.tgz", + "integrity": "sha512-+MrqnJRtxdF+xngFfUUkIMQrUUL0KsxbADUkn23Z/4ibGg192Q+z+CQyiYwvWTsYjJygmMR8+w3ZDa98Zh6ESg==", + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/raouldeheer" + } + }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -7135,7 +7127,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -7499,7 +7490,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -7673,7 +7663,6 @@ "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, "license": "MIT", "engines": { "node": ">=8.6" @@ -7761,6 +7750,18 @@ "node": ">=8" } }, + "node_modules/plimit-lit": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/plimit-lit/-/plimit-lit-1.6.1.tgz", + "integrity": "sha512-B7+VDyb8Tl6oMJT9oSO2CW8XC/T4UcJGrwOVoNGwOQsQYhlpfajmrMj5xeejqaASq3V/EqThyOeATEOMuSEXiA==", + "license": "MIT", + "dependencies": { + "queue-lit": "^1.5.1" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/possible-typed-array-names": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz", @@ -7992,11 +7993,19 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/queue-lit": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/queue-lit/-/queue-lit-1.5.2.tgz", + "integrity": "sha512-tLc36IOPeMAubu8BkW8YDBV+WyIgKlYU7zUNs0J5Vk9skSZ4JfGlPOqplP0aHdfv7HL0B2Pg6nwiq60Qc6M2Hw==", + "license": "MIT", + "engines": { + "node": ">=12" + } + }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "dev": true, "funding": [ { "type": "github", @@ -8057,7 +8066,6 @@ "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, "license": "MIT", "dependencies": { "picomatch": "^2.2.1" @@ -8184,7 +8192,6 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", - "dev": true, "license": "MIT", "engines": { "iojs": ">=1.0.0", @@ -8212,7 +8219,6 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", - "dev": true, "funding": [ { "type": "github", @@ -8463,7 +8469,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -8952,7 +8957,6 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, "license": "MIT", "dependencies": { "is-number": "^7.0.0" @@ -9099,6 +9103,32 @@ } } }, + "node_modules/tsc-alias": { + "version": "1.8.10", + "resolved": "https://registry.npmjs.org/tsc-alias/-/tsc-alias-1.8.10.tgz", + "integrity": "sha512-Ibv4KAWfFkFdKJxnWfVtdOmB0Zi1RJVxcbPGiCDsFpCQSsmpWyuzHG3rQyI5YkobWwxFPEyQfu1hdo4qLG2zPw==", + "license": "MIT", + "dependencies": { + "chokidar": "^3.5.3", + "commander": "^9.0.0", + "globby": "^11.0.4", + "mylas": "^2.1.9", + "normalize-path": "^3.0.0", + "plimit-lit": "^1.2.6" + }, + "bin": { + "tsc-alias": "dist/bin/index.js" + } + }, + "node_modules/tsc-alias/node_modules/commander": { + "version": "9.5.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz", + "integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==", + "license": "MIT", + "engines": { + "node": "^12.20.0 || >=14" + } + }, "node_modules/tsconfig-paths": { "version": "3.15.0", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", diff --git a/backend/package.json b/backend/package.json index 98fbe48..e1bc17a 100644 --- a/backend/package.json +++ b/backend/package.json @@ -6,12 +6,11 @@ "scripts": { "test": "jest --setupFiles dotenv/config", "start": "ts-node src/server.ts", - "build": "tsc", "serve": "node dist/server.js", - "dev": "nodemon src/server.ts", "lint": "eslint", "format": "prettier . --write", - "prepare": "cd .. && husky backend/.husky" + "dev": "nodemon src/server.ts", + "build": "tsc" }, "author": "", "license": "ISC", @@ -32,7 +31,6 @@ "eslint-config-airbnb": "^19.0.4", "eslint-config-prettier": "^9.1.0", "globals": "^15.2.0", - "husky": "^9.0.11", "jest": "^29.7.0", "nodemon": "^3.1.0", "prettier": "3.3.3", @@ -54,6 +52,7 @@ "prisma": "^6.0.1", "supertest": "^7.0.0", "swagger-jsdoc": "^6.2.8", - "swagger-ui-express": "^5.0.0" + "swagger-ui-express": "^5.0.0", + "tsc-alias": "^1.8.10" } } diff --git a/backend/prisma/schema.prisma b/backend/prisma/schema.prisma index 2ce8cec..9e64661 100644 --- a/backend/prisma/schema.prisma +++ b/backend/prisma/schema.prisma @@ -6,6 +6,7 @@ generator client { provider = "prisma-client-js" + binaryTargets = ["native", "linux-arm64-openssl-1.1.x"] } datasource db { diff --git a/backend/src/controllers/developers-controller.ts b/backend/src/controllers/developers-controller.ts deleted file mode 100644 index 5363d69..0000000 --- a/backend/src/controllers/developers-controller.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * @desc Simple database test endpoint to check API to db connection status - * @author GDamaso - */ -import { Response, Request } from 'express'; -import query from '../db'; - -const getDevelopers = async (req: Request, res: Response) => { - const developers = await query('SELECT first_name, last_name FROM developers'); - const body = developers.rows.map((row: any) => row); - res.status(200).send(body); -}; - -export default getDevelopers; diff --git a/backend/src/controllers/regionsControler.ts b/backend/src/controllers/regionsController.ts similarity index 100% rename from backend/src/controllers/regionsControler.ts rename to backend/src/controllers/regionsController.ts diff --git a/backend/src/express.ts b/backend/src/express.ts index 2a66750..1533a8b 100644 --- a/backend/src/express.ts +++ b/backend/src/express.ts @@ -3,9 +3,7 @@ * Any processing of Requests is done here before routing * to their target endpoints * @summary The file where middleware and routes are activated - * @author GDamaso */ -import './db'; import express from 'express'; import cookieParser from 'cookie-parser'; import compression from 'compression'; @@ -34,7 +32,7 @@ app.use('/api/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerJSDoc(swaggerCo // Add the protectedRoute function to any endpoint routes in the Admin Portal // Routes -app.use('/api', [routers.healthRouter, routers.developersRouter]); +app.use('/api', [routers.healthRouter, routers.regionRouter]); // Integrate global error handler after routes to cover all ends. app.use(middleware.globalErrorHandler); diff --git a/backend/src/routes/developers-route.ts b/backend/src/routes/developers-route.ts deleted file mode 100644 index d672386..0000000 --- a/backend/src/routes/developers-route.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Root|/api endpoint router -// Any routes in /api can be accessed through here -import express from 'express'; -import getDevelopers from '../controllers/developers-controller'; - -const router = express.Router(); - -router.route('/developers').get(getDevelopers); - -export default router; diff --git a/backend/src/routes/health-router.ts b/backend/src/routes/healthRouter.ts similarity index 52% rename from backend/src/routes/health-router.ts rename to backend/src/routes/healthRouter.ts index d5db264..e345231 100644 --- a/backend/src/routes/health-router.ts +++ b/backend/src/routes/healthRouter.ts @@ -3,8 +3,8 @@ import express from 'express'; import checkHealth from '../controllers/health-api-controller'; -const router = express.Router(); +const healthRouter = express.Router(); -router.route('/health').get(checkHealth); // Simple health endpoint to check API status +healthRouter.route('/health').get(checkHealth); // Simple health endpoint to check API status -export default router; +export default healthRouter; diff --git a/backend/src/routes/index.ts b/backend/src/routes/index.ts index 23eaa43..9046c10 100644 --- a/backend/src/routes/index.ts +++ b/backend/src/routes/index.ts @@ -1,3 +1,4 @@ -// eslint-disable-next-line import/prefer-default-export -export { default as healthRouter } from './health-router'; -export { default as developersRouter } from './developers-route'; +import healthRouter from './healthRouter'; +import regionRouter from './regionRouter'; + +export { healthRouter, regionRouter }; diff --git a/backend/src/routes/regionRouter.ts b/backend/src/routes/regionRouter.ts index 7c4bb4d..b05f443 100644 --- a/backend/src/routes/regionRouter.ts +++ b/backend/src/routes/regionRouter.ts @@ -1,10 +1,10 @@ // Root|/api endpoint router // Any routes in /api can be accessed through here import express from 'express'; -import { getRegions, CreateRegion } from '../controllers/regionsControler'; +import { getRegions, CreateRegion } from '../controllers/regionsController'; -const router = express.Router(); +const regionRouter = express.Router(); -router.route('/regions').get(getRegions).post(CreateRegion); +regionRouter.route('/regions').get(getRegions).post(CreateRegion); -export default router; +export default regionRouter; diff --git a/docker-compose copy.yml b/docker-compose copy.yml new file mode 100644 index 0000000..2991871 --- /dev/null +++ b/docker-compose copy.yml @@ -0,0 +1,109 @@ +# Reusable vars +x-var: + - &POSTGRES_USER + postgres + +# Postgres envars +x-postgres-vars: &postgres-vars + POSTGRES_DATABASE: 'postgres' + POSTGRES_HOST: 'nr-nmp-db' + POSTGRES_PASSWORD: 'default' + POSTGRES_USER: *POSTGRES_USER + +name: nr-nmp +services: + # DB + # database: + # build: + # context: ./database + # dockerfile: Dockerfile + # container_name: nr-nmp-db + # environment: + # <<: *postgres-vars + # ports: [5432:5432] + # healthcheck: + # test: ["CMD", "pg_isready", "-U", *POSTGRES_USER] + database: + image: postgres:13 + container_name: nr-nmp-db + environment: + POSTGRES_DB: ${POSTGRES_DATABASE} + POSTGRES_USER: ${POSTGRES_USER} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + ports: [5432:5432] + healthcheck: + test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"] + volumes: + - postgres-data:/var/lib/postgresql/data + + # PGAdmin + pgadmin: + container_name: nr-nmp-pgadmin + environment: + PGADMIN_DEFAULT_EMAIL: admin@qs.com + PGADMIN_DEFAULT_PASSWORD: admin + image: dpage/pgadmin4 + ports: [5050:80] + profiles: ["pgadmin"] + + # Backend + backend: + build: + context: ./backend + dockerfile: Dockerfile + # command: npm run ${CMD:-dev} + container_name: nr-nmp-api + depends_on: + database: + condition: service_healthy + develop: + watch: + - action: sync + path: ./backend/ + target: app + ignore: [node_modules] + env_file: .env + environment: + DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@nr-nmp-db:5432/${POSTGRES_DATABASE} + NODE_ENV: development + LOG_LEVEL: info + PORT: 3000 + <<: *postgres-vars + healthcheck: + test: curl localhost:3000/api/health | grep 'NMP API is healthy and ready!' + ports: [3000:3000] + + # Frontend + frontend: + image: node:20.17.0 + command: /bin/bash -c "cd ./app && npm install && npm run ${CMD:-dev}" + container_name: nr-nmp-frontend + depends_on: + backend: + condition: service_healthy + env_file: .env + environment: + VITE_BACKEND_URL: http://localhost:3000 + healthcheck: + test: curl --fail http://localhost:5173 || exit 1 + ports: ["5173:5173"] + volumes: ["./frontend:/app", "/app/node_modules"] + + caddy: + container_name: caddy + profiles: ["caddy"] + build: ./frontend + environment: + NODE_ENV: development + PORT: 3000 + BACKEND_URL: http://backend:3000 + LOG_LEVEL: info + ports: ["3005:3000"] + volumes: ["./frontend/Caddyfile:/etc/caddy/Caddyfile"] + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:3005"] + depends_on: + backend: + condition: service_healthy +volumes: + postgres-data: diff --git a/docker-compose.yml b/docker-compose.yml index 4310367..af03350 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,41 +5,38 @@ x-var: # Postgres envars x-postgres-vars: &postgres-vars - POSTGRES_DATABASE: postgres - POSTGRES_HOST: nr-nmp-db - POSTGRES_PASSWORD: default + POSTGRES_DATABASE: 'postgres' + POSTGRES_HOST: 'nr-nmp-db' + POSTGRES_PASSWORD: 'default' POSTGRES_USER: *POSTGRES_USER name: nr-nmp services: - # DB database: - build: - context: ./database - dockerfile: Dockerfile container_name: nr-nmp-db + image: postgres:15.7 + restart: unless-stopped environment: - <<: *postgres-vars - ports: [5432:5432] + - POSTGRES_USER=${POSTGRES_USER} + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} + - POSTGRES_DB=${POSTGRES_DATABASE} + volumes: + - ./database/postgres/data/db:/data/db + ports: + - '${POSTGRES_PORT:-5432}:5432' healthcheck: - test: ["CMD", "pg_isready", "-U", *POSTGRES_USER] - - # PGAdmin - pgadmin: - container_name: nr-nmp-pgadmin - environment: - PGADMIN_DEFAULT_EMAIL: admin@qs.com - PGADMIN_DEFAULT_PASSWORD: admin - image: dpage/pgadmin4 - ports: [5050:80] - profiles: ["pgadmin"] + test: ['CMD-SHELL', 'pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER} || exit 1'] + interval: 5s + timeout: 3s + networks: + - nmp # Backend backend: build: context: ./backend dockerfile: Dockerfile - command: npm run ${CMD:-dev} + # command: npm run ${CMD:-dev} container_name: nr-nmp-api depends_on: database: @@ -52,12 +49,16 @@ services: ignore: [node_modules] env_file: .env environment: + DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@nr-nmp-db:5432/${POSTGRES_DATABASE} + NODE_ENV: development LOG_LEVEL: info PORT: 3000 <<: *postgres-vars healthcheck: test: curl localhost:3000/api/health | grep 'NMP API is healthy and ready!' ports: [3000:3000] + networks: + - nmp # Frontend frontend: @@ -67,12 +68,6 @@ services: depends_on: backend: condition: service_healthy - # develop: - # watch: - # - action: sync - # path: ./frontend - # target: /app - # ignore: [node_modules] env_file: .env environment: VITE_BACKEND_URL: http://localhost:3000 @@ -80,6 +75,8 @@ services: test: curl --fail http://localhost:5173 || exit 1 ports: ["5173:5173"] volumes: ["./frontend:/app", "/app/node_modules"] + networks: + - nmp caddy: container_name: caddy @@ -97,3 +94,12 @@ services: depends_on: backend: condition: service_healthy + networks: + - nmp +volumes: + postgres-data: + +networks: + nmp: + name: nmp-net + driver: bridge diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 6dfb47e..0000000 --- a/package-lock.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "nmp", - "lockfileVersion": 3, - "requires": true, - "packages": {} -} From d4cc2f7735cefcba4d91f821b2ca767aeb47be6e Mon Sep 17 00:00:00 2001 From: Dallas Richmond Date: Mon, 16 Dec 2024 12:07:10 -0800 Subject: [PATCH 04/28] Deleted compied docker compose --- backend/prisma/schema.prisma | 6 +- backend/src/controllers/regionsController.ts | 1 - docker-compose copy.yml | 109 ------------------- 3 files changed, 3 insertions(+), 113 deletions(-) delete mode 100644 docker-compose copy.yml diff --git a/backend/prisma/schema.prisma b/backend/prisma/schema.prisma index 9e64661..7a30b6a 100644 --- a/backend/prisma/schema.prisma +++ b/backend/prisma/schema.prisma @@ -15,6 +15,6 @@ datasource db { } model Region { -id Int @id @default(autoincrement()) -name String -} \ No newline at end of file + id Int @id @default(autoincrement()) + name String +} diff --git a/backend/src/controllers/regionsController.ts b/backend/src/controllers/regionsController.ts index 5fae642..f23fbd3 100644 --- a/backend/src/controllers/regionsController.ts +++ b/backend/src/controllers/regionsController.ts @@ -13,5 +13,4 @@ export const CreateRegion = async (req: Request, res: Response) => { }, }); res.status(201).send(region); -// might be res.json(region) instead of res.send(region) }; diff --git a/docker-compose copy.yml b/docker-compose copy.yml deleted file mode 100644 index 2991871..0000000 --- a/docker-compose copy.yml +++ /dev/null @@ -1,109 +0,0 @@ -# Reusable vars -x-var: - - &POSTGRES_USER - postgres - -# Postgres envars -x-postgres-vars: &postgres-vars - POSTGRES_DATABASE: 'postgres' - POSTGRES_HOST: 'nr-nmp-db' - POSTGRES_PASSWORD: 'default' - POSTGRES_USER: *POSTGRES_USER - -name: nr-nmp -services: - # DB - # database: - # build: - # context: ./database - # dockerfile: Dockerfile - # container_name: nr-nmp-db - # environment: - # <<: *postgres-vars - # ports: [5432:5432] - # healthcheck: - # test: ["CMD", "pg_isready", "-U", *POSTGRES_USER] - database: - image: postgres:13 - container_name: nr-nmp-db - environment: - POSTGRES_DB: ${POSTGRES_DATABASE} - POSTGRES_USER: ${POSTGRES_USER} - POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} - ports: [5432:5432] - healthcheck: - test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"] - volumes: - - postgres-data:/var/lib/postgresql/data - - # PGAdmin - pgadmin: - container_name: nr-nmp-pgadmin - environment: - PGADMIN_DEFAULT_EMAIL: admin@qs.com - PGADMIN_DEFAULT_PASSWORD: admin - image: dpage/pgadmin4 - ports: [5050:80] - profiles: ["pgadmin"] - - # Backend - backend: - build: - context: ./backend - dockerfile: Dockerfile - # command: npm run ${CMD:-dev} - container_name: nr-nmp-api - depends_on: - database: - condition: service_healthy - develop: - watch: - - action: sync - path: ./backend/ - target: app - ignore: [node_modules] - env_file: .env - environment: - DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@nr-nmp-db:5432/${POSTGRES_DATABASE} - NODE_ENV: development - LOG_LEVEL: info - PORT: 3000 - <<: *postgres-vars - healthcheck: - test: curl localhost:3000/api/health | grep 'NMP API is healthy and ready!' - ports: [3000:3000] - - # Frontend - frontend: - image: node:20.17.0 - command: /bin/bash -c "cd ./app && npm install && npm run ${CMD:-dev}" - container_name: nr-nmp-frontend - depends_on: - backend: - condition: service_healthy - env_file: .env - environment: - VITE_BACKEND_URL: http://localhost:3000 - healthcheck: - test: curl --fail http://localhost:5173 || exit 1 - ports: ["5173:5173"] - volumes: ["./frontend:/app", "/app/node_modules"] - - caddy: - container_name: caddy - profiles: ["caddy"] - build: ./frontend - environment: - NODE_ENV: development - PORT: 3000 - BACKEND_URL: http://backend:3000 - LOG_LEVEL: info - ports: ["3005:3000"] - volumes: ["./frontend/Caddyfile:/etc/caddy/Caddyfile"] - healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:3005"] - depends_on: - backend: - condition: service_healthy -volumes: - postgres-data: From afd1782d30a3c6655ab98bea27b686d92cab4d75 Mon Sep 17 00:00:00 2001 From: Dallas Richmond Date: Mon, 16 Dec 2024 14:35:02 -0800 Subject: [PATCH 05/28] Updated volumes --- backend/Dockerfile | 16 +++++++++++-- backend/package.json | 3 ++- .../20241216223231_init/migration.sql | 7 ++++++ backend/prisma/migrations/migration_lock.toml | 3 +++ backend/start.sh | 6 +++++ docker-compose.yml | 2 ++ migrations/.dockerignore | 6 ----- migrations/Dockerfile | 12 ---------- migrations/sql/V1.0.0__init.sql | 24 ------------------- migrations/sql/V1.0.1__alter_user_seq.sql | 1 - 10 files changed, 34 insertions(+), 46 deletions(-) create mode 100644 backend/prisma/migrations/20241216223231_init/migration.sql create mode 100644 backend/prisma/migrations/migration_lock.toml create mode 100644 backend/start.sh delete mode 100644 migrations/.dockerignore delete mode 100644 migrations/Dockerfile delete mode 100644 migrations/sql/V1.0.0__init.sql delete mode 100644 migrations/sql/V1.0.1__alter_user_seq.sql diff --git a/backend/Dockerfile b/backend/Dockerfile index bfdf474..9c85959 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -4,8 +4,20 @@ FROM node:20.17.0 # Copy files and install dependencies WORKDIR /app/ COPY . ./ -RUN npm ci && \ - npm run build + +RUN npx prisma generate + +#For debugging: create and write the contents of start.sh in the container +RUN rm start.sh +RUN echo "#!/bin/bash" >> start.sh && \ + echo "# push the schema to the database and sync the client" >> start.sh && \ + echo "npx prisma db push --schema='/usr/src/app/prisma/schema.prisma' --skip-generate " >> start.sh && \ + echo "" >> start.sh + +# Set execute permissions for the start.sh script. +RUN chmod +x ./start.sh + +RUN npm run build # Run in dev mode, `npm run serve` for production CMD ["npm", "run", "serve", "--no-update-notifier", "--max-old-space-size=50"] diff --git a/backend/package.json b/backend/package.json index e1bc17a..80a9478 100644 --- a/backend/package.json +++ b/backend/package.json @@ -10,7 +10,8 @@ "lint": "eslint", "format": "prettier . --write", "dev": "nodemon src/server.ts", - "build": "tsc" + "build": "tsc", + "migrate": "" }, "author": "", "license": "ISC", diff --git a/backend/prisma/migrations/20241216223231_init/migration.sql b/backend/prisma/migrations/20241216223231_init/migration.sql new file mode 100644 index 0000000..1d96a03 --- /dev/null +++ b/backend/prisma/migrations/20241216223231_init/migration.sql @@ -0,0 +1,7 @@ +-- CreateTable +CREATE TABLE "Region" ( + "id" SERIAL NOT NULL, + "name" TEXT NOT NULL, + + CONSTRAINT "Region_pkey" PRIMARY KEY ("id") +); diff --git a/backend/prisma/migrations/migration_lock.toml b/backend/prisma/migrations/migration_lock.toml new file mode 100644 index 0000000..fbffa92 --- /dev/null +++ b/backend/prisma/migrations/migration_lock.toml @@ -0,0 +1,3 @@ +# Please do not edit this file manually +# It should be added in your version-control system (i.e. Git) +provider = "postgresql" \ No newline at end of file diff --git a/backend/start.sh b/backend/start.sh new file mode 100644 index 0000000..7a0f6dd --- /dev/null +++ b/backend/start.sh @@ -0,0 +1,6 @@ +#!/bin/sh +pwd +# Run migrations +npx prisma db push --schema='prisma/schema.prisma' --skip-generate +# Seed data +# npx prisma db seed diff --git a/docker-compose.yml b/docker-compose.yml index af03350..4d543ad 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -57,6 +57,8 @@ services: healthcheck: test: curl localhost:3000/api/health | grep 'NMP API is healthy and ready!' ports: [3000:3000] + volumes: + - ./backend:/app networks: - nmp diff --git a/migrations/.dockerignore b/migrations/.dockerignore deleted file mode 100644 index 4f05d31..0000000 --- a/migrations/.dockerignore +++ /dev/null @@ -1,6 +0,0 @@ -.idea -.vscode -coverage -cypress -dist -node_modules diff --git a/migrations/Dockerfile b/migrations/Dockerfile deleted file mode 100644 index 0a192e4..0000000 --- a/migrations/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM flyway/flyway:10-alpine - -# Copy migrations -COPY ./sql /flyway/sql - -# Non-root user -RUN adduser -D app -USER app - -# Health check and startup -HEALTHCHECK CMD info -CMD ["info", "migrate", "info"] diff --git a/migrations/sql/V1.0.0__init.sql b/migrations/sql/V1.0.0__init.sql deleted file mode 100644 index 2be1685..0000000 --- a/migrations/sql/V1.0.0__init.sql +++ /dev/null @@ -1,24 +0,0 @@ -CREATE SCHEMA IF NOT EXISTS USERS; - -CREATE SEQUENCE IF NOT EXISTS USERS."USER_SEQ" - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 100; - -CREATE TABLE IF NOT EXISTS USERS.USERS -( - ID numeric not null - constraint "USER_PK" - primary key DEFAULT nextval('USERS."USER_SEQ"'), - NAME varchar(200) not null, - EMAIL varchar(200) not null -); -INSERT INTO USERS.USERS (NAME, EMAIL) -VALUES ('John', 'John.ipsum@test.com'), - ('Jane', 'Jane.ipsum@test.com'), - ('Jack', 'Jack.ipsum@test.com'), - ('Jill', 'Jill.ipsum@test.com'), - ('Joe', 'Joe.ipsum@test.com'); - diff --git a/migrations/sql/V1.0.1__alter_user_seq.sql b/migrations/sql/V1.0.1__alter_user_seq.sql deleted file mode 100644 index 6be8cd5..0000000 --- a/migrations/sql/V1.0.1__alter_user_seq.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER SEQUENCE USERS."USER_SEQ" RESTART WITH 6 CACHE 1; From 0ec8d8e079dff522f56d6bd983939f589b2d0755 Mon Sep 17 00:00:00 2001 From: Dallas Richmond Date: Mon, 16 Dec 2024 14:53:25 -0800 Subject: [PATCH 06/28] DATABASE URL added --- .github/workflows/.deploy.yml | 1 + backend/openshift.deploy.yml | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/.deploy.yml b/.github/workflows/.deploy.yml index c1dd375..ae9b50c 100644 --- a/.github/workflows/.deploy.yml +++ b/.github/workflows/.deploy.yml @@ -77,6 +77,7 @@ jobs: -p IMAGE_TAG=${{ inputs.tag }} -p TARGET=${{ inputs.target }} -p SSOAUTH=${{ vars.SSO_AUTH_SERVER_URL }} + -p DB_URL=${{ secrets.DB_URL }} verification_path: /api/health verification_retry_attempts: "5" verification_retry_seconds: "15" diff --git a/backend/openshift.deploy.yml b/backend/openshift.deploy.yml index 4e1038c..dd074ef 100644 --- a/backend/openshift.deploy.yml +++ b/backend/openshift.deploy.yml @@ -23,6 +23,9 @@ parameters: - name: SSOAUTH description: SSO Auth Server URL required: true + - name: DB_URL + description: Database URL + required: true objects: - kind: Service apiVersion: v1 @@ -70,6 +73,8 @@ objects: value: nr-nmp-database-${TARGET} - name: SSO_AUTH_SERVER_URL value: ${SSOAUTH} + - name: DATABASE_URL + value: ${DB_URL} - name: POSTGRES_DB valueFrom: secretKeyRef: From 51e7c6f828ea7c5604c5acc64f4a72c7e8de291a Mon Sep 17 00:00:00 2001 From: Dallas Richmond Date: Mon, 16 Dec 2024 14:56:53 -0800 Subject: [PATCH 07/28] Updated deploy --- .github/workflows/.deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/.deploy.yml b/.github/workflows/.deploy.yml index ae9b50c..a287cbf 100644 --- a/.github/workflows/.deploy.yml +++ b/.github/workflows/.deploy.yml @@ -77,7 +77,7 @@ jobs: -p IMAGE_TAG=${{ inputs.tag }} -p TARGET=${{ inputs.target }} -p SSOAUTH=${{ vars.SSO_AUTH_SERVER_URL }} - -p DB_URL=${{ secrets.DB_URL }} + -p DB_URL=${{ secrets.DATABASWE_URL }} verification_path: /api/health verification_retry_attempts: "5" verification_retry_seconds: "15" From 26bca6b08fef1a78208aafaacd8694105bac5181 Mon Sep 17 00:00:00 2001 From: Dallas Richmond Date: Mon, 16 Dec 2024 14:57:09 -0800 Subject: [PATCH 08/28] Updated --- .github/workflows/.deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/.deploy.yml b/.github/workflows/.deploy.yml index a287cbf..7d7bd94 100644 --- a/.github/workflows/.deploy.yml +++ b/.github/workflows/.deploy.yml @@ -77,7 +77,7 @@ jobs: -p IMAGE_TAG=${{ inputs.tag }} -p TARGET=${{ inputs.target }} -p SSOAUTH=${{ vars.SSO_AUTH_SERVER_URL }} - -p DB_URL=${{ secrets.DATABASWE_URL }} + -p DB_URL=${{ secrets.DATABASE_URL }} verification_path: /api/health verification_retry_attempts: "5" verification_retry_seconds: "15" From 1dac732cd8d96adcfe8138d419a0cc68fc95bd39 Mon Sep 17 00:00:00 2001 From: Dallas Richmond Date: Mon, 16 Dec 2024 15:14:34 -0800 Subject: [PATCH 09/28] Change database url --- .github/workflows/.deploy.yml | 1 - backend/openshift.deploy.yml | 7 ++----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/.deploy.yml b/.github/workflows/.deploy.yml index 7d7bd94..c1dd375 100644 --- a/.github/workflows/.deploy.yml +++ b/.github/workflows/.deploy.yml @@ -77,7 +77,6 @@ jobs: -p IMAGE_TAG=${{ inputs.tag }} -p TARGET=${{ inputs.target }} -p SSOAUTH=${{ vars.SSO_AUTH_SERVER_URL }} - -p DB_URL=${{ secrets.DATABASE_URL }} verification_path: /api/health verification_retry_attempts: "5" verification_retry_seconds: "15" diff --git a/backend/openshift.deploy.yml b/backend/openshift.deploy.yml index dd074ef..acde0e7 100644 --- a/backend/openshift.deploy.yml +++ b/backend/openshift.deploy.yml @@ -23,9 +23,6 @@ parameters: - name: SSOAUTH description: SSO Auth Server URL required: true - - name: DB_URL - description: Database URL - required: true objects: - kind: Service apiVersion: v1 @@ -73,8 +70,6 @@ objects: value: nr-nmp-database-${TARGET} - name: SSO_AUTH_SERVER_URL value: ${SSOAUTH} - - name: DATABASE_URL - value: ${DB_URL} - name: POSTGRES_DB valueFrom: secretKeyRef: @@ -100,6 +95,8 @@ objects: secretKeyRef: name: nr-nmp-keycloak key: SSO_CLIENT_SECRET + - name: DATABASE_URL + value: ${POSTGRES_HOST}://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:5432/${POSTGRES_DB}?schema=public - name: SSO_REDIRECT_URL value: https://${APP}-${TARGET}-${COMPONENT}.apps.silver.devops.gov.bc.ca/auth/callback - name: FRONTEND_URL From 72a84780044e09734292e7f7f8f0defd5cb0e041 Mon Sep 17 00:00:00 2001 From: Dallas Richmond Date: Mon, 16 Dec 2024 15:47:54 -0800 Subject: [PATCH 10/28] Added database url --- .github/workflows/.deploy.yml | 2 ++ backend/openshift.deploy.yml | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/.deploy.yml b/.github/workflows/.deploy.yml index c1dd375..67d74c5 100644 --- a/.github/workflows/.deploy.yml +++ b/.github/workflows/.deploy.yml @@ -64,6 +64,8 @@ jobs: needs: [init, database] environment: ${{ inputs.environment }} runs-on: ubuntu-22.04 + env: + DATABASE_URL: postgres://${{ secrets.DB_USER }}:${{ secrets.DB_PASSWORD }}@${{ vars.OC_SERVER }}:${{ secrets.DB_PORT }}/${{ secrets.DB_NAME }} steps: - name: Deploy Backend uses: bcgov-nr/action-deployer-openshift@v3.0.1 diff --git a/backend/openshift.deploy.yml b/backend/openshift.deploy.yml index acde0e7..4e1038c 100644 --- a/backend/openshift.deploy.yml +++ b/backend/openshift.deploy.yml @@ -95,8 +95,6 @@ objects: secretKeyRef: name: nr-nmp-keycloak key: SSO_CLIENT_SECRET - - name: DATABASE_URL - value: ${POSTGRES_HOST}://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:5432/${POSTGRES_DB}?schema=public - name: SSO_REDIRECT_URL value: https://${APP}-${TARGET}-${COMPONENT}.apps.silver.devops.gov.bc.ca/auth/callback - name: FRONTEND_URL From 1d3c5aaf7d94253ef6b8a831853fe2699ea65c50 Mon Sep 17 00:00:00 2001 From: Dallas Richmond Date: Mon, 16 Dec 2024 16:04:56 -0800 Subject: [PATCH 11/28] Updated url --- .github/workflows/.deploy.yml | 6 ++++-- backend/openshift.deploy.yml | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/.deploy.yml b/.github/workflows/.deploy.yml index 67d74c5..8c74bd3 100644 --- a/.github/workflows/.deploy.yml +++ b/.github/workflows/.deploy.yml @@ -64,8 +64,6 @@ jobs: needs: [init, database] environment: ${{ inputs.environment }} runs-on: ubuntu-22.04 - env: - DATABASE_URL: postgres://${{ secrets.DB_USER }}:${{ secrets.DB_PASSWORD }}@${{ vars.OC_SERVER }}:${{ secrets.DB_PORT }}/${{ secrets.DB_NAME }} steps: - name: Deploy Backend uses: bcgov-nr/action-deployer-openshift@v3.0.1 @@ -79,6 +77,10 @@ jobs: -p IMAGE_TAG=${{ inputs.tag }} -p TARGET=${{ inputs.target }} -p SSOAUTH=${{ vars.SSO_AUTH_SERVER_URL }} + -p DB_PASSWORD=${{ secrets.DB_PASSWORD }} + -p DB_USER=${{ secrets.DB_USER }} + -p DB_NAME=${{ secrets.DB_NAME }} + -p DB_PORT=${{ secrets.DB_PORT }} verification_path: /api/health verification_retry_attempts: "5" verification_retry_seconds: "15" diff --git a/backend/openshift.deploy.yml b/backend/openshift.deploy.yml index 4e1038c..7244fa5 100644 --- a/backend/openshift.deploy.yml +++ b/backend/openshift.deploy.yml @@ -101,6 +101,8 @@ objects: value: https://${APP}-${TARGET}.apps.silver.devops.gov.bc.ca - name: BACKEND_URL value: https://${APP}-${TARGET}-${COMPONENT}.apps.silver.devops.gov.bc.ca + - name: DATABASE_URL + value: postgresql://postgres:${DB_PASSWORD}@postgres:5432/postgres ports: - containerPort: 3000 protocol: TCP From 9ce168221f57733d2b484fb917ded5aea64844a5 Mon Sep 17 00:00:00 2001 From: Dallas Richmond Date: Mon, 16 Dec 2024 16:07:40 -0800 Subject: [PATCH 12/28] update --- .github/workflows/.deploy.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/.deploy.yml b/.github/workflows/.deploy.yml index 8c74bd3..c1dd375 100644 --- a/.github/workflows/.deploy.yml +++ b/.github/workflows/.deploy.yml @@ -77,10 +77,6 @@ jobs: -p IMAGE_TAG=${{ inputs.tag }} -p TARGET=${{ inputs.target }} -p SSOAUTH=${{ vars.SSO_AUTH_SERVER_URL }} - -p DB_PASSWORD=${{ secrets.DB_PASSWORD }} - -p DB_USER=${{ secrets.DB_USER }} - -p DB_NAME=${{ secrets.DB_NAME }} - -p DB_PORT=${{ secrets.DB_PORT }} verification_path: /api/health verification_retry_attempts: "5" verification_retry_seconds: "15" From c0343466f0e524e9a78562772c22ab674db8bf10 Mon Sep 17 00:00:00 2001 From: Dallas Richmond Date: Mon, 16 Dec 2024 16:20:26 -0800 Subject: [PATCH 13/28] Updated url --- .github/workflows/.deploy.yml | 1 + backend/openshift.deploy.yml | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/.deploy.yml b/.github/workflows/.deploy.yml index c1dd375..09f6f8f 100644 --- a/.github/workflows/.deploy.yml +++ b/.github/workflows/.deploy.yml @@ -77,6 +77,7 @@ jobs: -p IMAGE_TAG=${{ inputs.tag }} -p TARGET=${{ inputs.target }} -p SSOAUTH=${{ vars.SSO_AUTH_SERVER_URL }} + -p DB_PASSWORD=${{ secrets.DB_PASSWORD }} verification_path: /api/health verification_retry_attempts: "5" verification_retry_seconds: "15" diff --git a/backend/openshift.deploy.yml b/backend/openshift.deploy.yml index 7244fa5..58d10dd 100644 --- a/backend/openshift.deploy.yml +++ b/backend/openshift.deploy.yml @@ -18,8 +18,7 @@ parameters: required: true - name: DB_PASSWORD description: Password for the PostgreSQL connection user. - from: '[a-zA-Z0-9]{16}' - generate: expression + required: true - name: SSOAUTH description: SSO Auth Server URL required: true @@ -102,7 +101,7 @@ objects: - name: BACKEND_URL value: https://${APP}-${TARGET}-${COMPONENT}.apps.silver.devops.gov.bc.ca - name: DATABASE_URL - value: postgresql://postgres:${DB_PASSWORD}@postgres:5432/postgres + value: nr-nmp-database-${TARGET}://postgres:${DB_PASSWORD}@nr-nmp-database-${TARGET}:5432/postgres ports: - containerPort: 3000 protocol: TCP From 643e3678d50efb53daacbc65f8f0fdb3b09974b0 Mon Sep 17 00:00:00 2001 From: Dallas Richmond Date: Mon, 16 Dec 2024 16:46:15 -0800 Subject: [PATCH 14/28] Added migrate command to package --- backend/package.json | 2 +- .../{20241216223231_init => 20241217004533_init}/migration.sql | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename backend/prisma/migrations/{20241216223231_init => 20241217004533_init}/migration.sql (100%) diff --git a/backend/package.json b/backend/package.json index 80a9478..686dfec 100644 --- a/backend/package.json +++ b/backend/package.json @@ -11,7 +11,7 @@ "format": "prettier . --write", "dev": "nodemon src/server.ts", "build": "tsc", - "migrate": "" + "migrate": "npm run build && cd .. && docker compose down -v && docker compose build && docker compose run backend npx prisma migrate dev --name init" }, "author": "", "license": "ISC", diff --git a/backend/prisma/migrations/20241216223231_init/migration.sql b/backend/prisma/migrations/20241217004533_init/migration.sql similarity index 100% rename from backend/prisma/migrations/20241216223231_init/migration.sql rename to backend/prisma/migrations/20241217004533_init/migration.sql From 9e0e4c7feb9a396dd9f59d2b3992930dd11e75cc Mon Sep 17 00:00:00 2001 From: Dallas Richmond Date: Tue, 17 Dec 2024 11:31:55 -0800 Subject: [PATCH 15/28] Files added --- backend/prisma/data.mjs | 8 ++++++++ backend/prisma/seed.mjs | 42 +++++++++++++++++++++++++++++++++++++++++ backend/start.sh | 4 +++- backend/startDev.sh | 8 ++++++++ 4 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 backend/prisma/data.mjs create mode 100644 backend/prisma/seed.mjs create mode 100644 backend/startDev.sh diff --git a/backend/prisma/data.mjs b/backend/prisma/data.mjs new file mode 100644 index 0000000..86f6e3c --- /dev/null +++ b/backend/prisma/data.mjs @@ -0,0 +1,8 @@ +/** + * @summary All seed data for dev + */ +const regions = [ + { id: 1, name: 'Cariboo' }, +]; + +export default regions; diff --git a/backend/prisma/seed.mjs b/backend/prisma/seed.mjs new file mode 100644 index 0000000..1c67b55 --- /dev/null +++ b/backend/prisma/seed.mjs @@ -0,0 +1,42 @@ +import { PrismaClient } from '@prisma/client'; +import dotenv from 'dotenv'; +import regions from './data.mjs'; + +const prisma = new PrismaClient(); + +dotenv.config(); + +// const environment = process.env.NODE_ENV || 'production'; + +/** + * @summary Seeds all the necessary base data in both dev and prod. + * Checks for any changes to existing tables and updates accordingly + */ +async function seedBase() { + const seedingPromises = []; + + seedingPromises.push( + ...regions.map((range) => prisma.salaryRange.upsert({ + where: { id: range.id }, + create: range, + update: range, + })), + ); + + await Promise.all(seedingPromises); +} + +(async () => { + try { + await seedBase(); + // if (environment === 'development') { + // await seedUsers(); + // await seedInquiries(); + // } + } catch (error) { + // eslint-disable-next-line no-console + console.error('Error during seeding:', error); + } finally { + await prisma.$disconnect(); + } +})(); diff --git a/backend/start.sh b/backend/start.sh index 7a0f6dd..0c1087a 100644 --- a/backend/start.sh +++ b/backend/start.sh @@ -3,4 +3,6 @@ pwd # Run migrations npx prisma db push --schema='prisma/schema.prisma' --skip-generate # Seed data -# npx prisma db seed +npx prisma db seed +# Start the application +npm run dev diff --git a/backend/startDev.sh b/backend/startDev.sh new file mode 100644 index 0000000..0c1087a --- /dev/null +++ b/backend/startDev.sh @@ -0,0 +1,8 @@ +#!/bin/sh +pwd +# Run migrations +npx prisma db push --schema='prisma/schema.prisma' --skip-generate +# Seed data +npx prisma db seed +# Start the application +npm run dev From c61b29447b165bd8b62ea79b0be16a08be5408c8 Mon Sep 17 00:00:00 2001 From: Dallas Richmond Date: Tue, 17 Dec 2024 15:16:32 -0800 Subject: [PATCH 16/28] Updated package --- backend/package-lock.json | 87 +++++++++++++++++---------------------- backend/package.json | 4 +- docker-compose.yml | 23 ++--------- 3 files changed, 43 insertions(+), 71 deletions(-) diff --git a/backend/package-lock.json b/backend/package-lock.json index dabb515..20eed05 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -10,7 +10,7 @@ "license": "ISC", "dependencies": { "@bcgov/citz-imb-sso-express": "^1.0.2", - "@prisma/client": "^6.0.1", + "@prisma/client": "^6.1.0", "compression": "^1.7.4", "cookie-parser": "^1.4.6", "cors": "^2.8.5", @@ -18,7 +18,6 @@ "express": "^4.19.2", "morgan": "^1.10.0", "pg": "^8.11.5", - "prisma": "^6.0.1", "supertest": "^7.0.0", "swagger-jsdoc": "^6.2.8", "swagger-ui-express": "^5.0.0", @@ -41,10 +40,10 @@ "eslint-config-airbnb": "^19.0.4", "eslint-config-prettier": "^9.1.0", "globals": "^15.2.0", - "husky": "^9.0.11", "jest": "^29.7.0", "nodemon": "^3.1.0", "prettier": "3.3.3", + "prisma": "^6.1.0", "ts-jest": "^29.1.3", "ts-node": "^10.9.2", "typescript": "^5.4.5", @@ -1485,9 +1484,9 @@ } }, "node_modules/@prisma/client": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/@prisma/client/-/client-6.0.1.tgz", - "integrity": "sha512-60w7kL6bUxz7M6Gs/V+OWMhwy94FshpngVmOY05TmGD0Lhk+Ac0ZgtjlL6Wll9TD4G03t4Sq1wZekNVy+Xdlbg==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@prisma/client/-/client-6.1.0.tgz", + "integrity": "sha512-AbQYc5+EJKm1Ydfq3KxwcGiy7wIbm4/QbjCKWWoNROtvy7d6a3gmAGkKjK0iUCzh+rHV8xDhD5Cge8ke/kiy5Q==", "hasInstallScript": true, "license": "Apache-2.0", "engines": { @@ -1503,48 +1502,53 @@ } }, "node_modules/@prisma/debug": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-6.0.1.tgz", - "integrity": "sha512-jQylgSOf7ibTVxqBacnAlVGvek6fQxJIYCQOeX2KexsfypNzXjJQSS2o5s+Mjj2Np93iSOQUaw6TvPj8syhG4w==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-6.1.0.tgz", + "integrity": "sha512-0himsvcM4DGBTtvXkd2Tggv6sl2JyUYLzEGXXleFY+7Kp6rZeSS3hiTW9mwtUlXrwYbJP6pwlVNB7jYElrjWUg==", + "devOptional": true, "license": "Apache-2.0" }, "node_modules/@prisma/engines": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-6.0.1.tgz", - "integrity": "sha512-4hxzI+YQIR2uuDyVsDooFZGu5AtixbvM2psp+iayDZ4hRrAHo/YwgA17N23UWq7G6gRu18NvuNMb48qjP3DPQw==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-6.1.0.tgz", + "integrity": "sha512-GnYJbCiep3Vyr1P/415ReYrgJUjP79fBNc1wCo7NP6Eia0CzL2Ot9vK7Infczv3oK7JLrCcawOSAxFxNFsAERQ==", + "devOptional": true, "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "@prisma/debug": "6.0.1", - "@prisma/engines-version": "5.23.0-27.5dbef10bdbfb579e07d35cc85fb1518d357cb99e", - "@prisma/fetch-engine": "6.0.1", - "@prisma/get-platform": "6.0.1" + "@prisma/debug": "6.1.0", + "@prisma/engines-version": "6.1.0-21.11f085a2012c0f4778414c8db2651556ee0ef959", + "@prisma/fetch-engine": "6.1.0", + "@prisma/get-platform": "6.1.0" } }, "node_modules/@prisma/engines-version": { - "version": "5.23.0-27.5dbef10bdbfb579e07d35cc85fb1518d357cb99e", - "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-5.23.0-27.5dbef10bdbfb579e07d35cc85fb1518d357cb99e.tgz", - "integrity": "sha512-JmIds0Q2/vsOmnuTJYxY4LE+sajqjYKhLtdOT6y4imojqv5d/aeVEfbBGC74t8Be1uSp0OP8lxIj2OqoKbLsfQ==", + "version": "6.1.0-21.11f085a2012c0f4778414c8db2651556ee0ef959", + "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-6.1.0-21.11f085a2012c0f4778414c8db2651556ee0ef959.tgz", + "integrity": "sha512-PdJqmYM2Fd8K0weOOtQThWylwjsDlTig+8Pcg47/jszMuLL9iLIaygC3cjWJLda69siRW4STlCTMSgOjZzvKPQ==", + "devOptional": true, "license": "Apache-2.0" }, "node_modules/@prisma/fetch-engine": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-6.0.1.tgz", - "integrity": "sha512-T36bWFVGeGYYSyYOj9d+O9G3sBC+pAyMC+jc45iSL63/Haq1GrYjQPgPMxrEj9m739taXrupoysRedQ+VyvM/Q==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-6.1.0.tgz", + "integrity": "sha512-asdFi7TvPlEZ8CzSZ/+Du5wZ27q6OJbRSXh+S8ISZguu+S9KtS/gP7NeXceZyb1Jv1SM1S5YfiCv+STDsG6rrg==", + "devOptional": true, "license": "Apache-2.0", "dependencies": { - "@prisma/debug": "6.0.1", - "@prisma/engines-version": "5.23.0-27.5dbef10bdbfb579e07d35cc85fb1518d357cb99e", - "@prisma/get-platform": "6.0.1" + "@prisma/debug": "6.1.0", + "@prisma/engines-version": "6.1.0-21.11f085a2012c0f4778414c8db2651556ee0ef959", + "@prisma/get-platform": "6.1.0" } }, "node_modules/@prisma/get-platform": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-6.0.1.tgz", - "integrity": "sha512-zspC9vlxAqx4E6epMPMLLBMED2VD8axDe8sPnquZ8GOsn6tiacWK0oxrGK4UAHYzYUVuMVUApJbdXB2dFpLhvg==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-6.1.0.tgz", + "integrity": "sha512-ia8bNjboBoHkmKGGaWtqtlgQOhCi7+f85aOkPJKgNwWvYrT6l78KgojLekE8zMhVk0R9lWcifV0Pf8l3/15V0Q==", + "devOptional": true, "license": "Apache-2.0", "dependencies": { - "@prisma/debug": "6.0.1" + "@prisma/debug": "6.1.0" } }, "node_modules/@sinclair/typebox": { @@ -5197,22 +5201,6 @@ "node": ">=10.17.0" } }, - "node_modules/husky": { - "version": "9.1.1", - "resolved": "https://registry.npmjs.org/husky/-/husky-9.1.1.tgz", - "integrity": "sha512-fCqlqLXcBnXa/TJXmT93/A36tJsjdJkibQ1MuIiFyCCYUlpYpIaj2mv1w+3KR6Rzu1IC3slFTje5f6DUp2A2rg==", - "dev": true, - "license": "MIT", - "bin": { - "husky": "bin.js" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/typicode" - } - }, "node_modules/iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -7878,13 +7866,14 @@ } }, "node_modules/prisma": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/prisma/-/prisma-6.0.1.tgz", - "integrity": "sha512-CaMNFHkf+DDq8zq3X/JJsQ4Koy7dyWwwtOKibkT/Am9j/tDxcfbg7+lB1Dzhx18G/+RQCMgjPYB61bhRqteNBQ==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/prisma/-/prisma-6.1.0.tgz", + "integrity": "sha512-aFI3Yi+ApUxkwCJJwyQSwpyzUX7YX3ihzuHNHOyv4GJg3X5tQsmRaJEnZ+ZyfHpMtnyahhmXVfbTZ+lS8ZtfKw==", + "devOptional": true, "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "@prisma/engines": "6.0.1" + "@prisma/engines": "6.1.0" }, "bin": { "prisma": "build/index.js" diff --git a/backend/package.json b/backend/package.json index 686dfec..d3f11f0 100644 --- a/backend/package.json +++ b/backend/package.json @@ -35,6 +35,7 @@ "jest": "^29.7.0", "nodemon": "^3.1.0", "prettier": "3.3.3", + "prisma": "^6.1.0", "ts-jest": "^29.1.3", "ts-node": "^10.9.2", "typescript": "^5.4.5", @@ -42,7 +43,7 @@ }, "dependencies": { "@bcgov/citz-imb-sso-express": "^1.0.2", - "@prisma/client": "^6.0.1", + "@prisma/client": "^6.1.0", "compression": "^1.7.4", "cookie-parser": "^1.4.6", "cors": "^2.8.5", @@ -50,7 +51,6 @@ "express": "^4.19.2", "morgan": "^1.10.0", "pg": "^8.11.5", - "prisma": "^6.0.1", "supertest": "^7.0.0", "swagger-jsdoc": "^6.2.8", "swagger-ui-express": "^5.0.0", diff --git a/docker-compose.yml b/docker-compose.yml index 4d543ad..775224c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,15 +1,3 @@ -# Reusable vars -x-var: - - &POSTGRES_USER - postgres - -# Postgres envars -x-postgres-vars: &postgres-vars - POSTGRES_DATABASE: 'postgres' - POSTGRES_HOST: 'nr-nmp-db' - POSTGRES_PASSWORD: 'default' - POSTGRES_USER: *POSTGRES_USER - name: nr-nmp services: database: @@ -19,7 +7,7 @@ services: environment: - POSTGRES_USER=${POSTGRES_USER} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} - - POSTGRES_DB=${POSTGRES_DATABASE} + - POSTGRES_DB=${POSTGRES_DB} volumes: - ./database/postgres/data/db:/data/db ports: @@ -47,13 +35,8 @@ services: path: ./backend/ target: app ignore: [node_modules] - env_file: .env - environment: - DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@nr-nmp-db:5432/${POSTGRES_DATABASE} - NODE_ENV: development - LOG_LEVEL: info - PORT: 3000 - <<: *postgres-vars + env_file: + - .env healthcheck: test: curl localhost:3000/api/health | grep 'NMP API is healthy and ready!' ports: [3000:3000] From 65b0436c759ab933874131229ce52caead9641c7 Mon Sep 17 00:00:00 2001 From: Dallas Richmond Date: Tue, 17 Dec 2024 15:32:13 -0800 Subject: [PATCH 17/28] Test --- .github/workflows/.deploy.yml | 1 + backend/openshift.deploy.yml | 6 ++++-- database/Dockerfile | 2 +- database/db/entrypoint/01-initseed.sql | 11 ----------- 4 files changed, 6 insertions(+), 14 deletions(-) delete mode 100644 database/db/entrypoint/01-initseed.sql diff --git a/.github/workflows/.deploy.yml b/.github/workflows/.deploy.yml index 09f6f8f..e912c2d 100644 --- a/.github/workflows/.deploy.yml +++ b/.github/workflows/.deploy.yml @@ -78,6 +78,7 @@ jobs: -p TARGET=${{ inputs.target }} -p SSOAUTH=${{ vars.SSO_AUTH_SERVER_URL }} -p DB_PASSWORD=${{ secrets.DB_PASSWORD }} + -P DATABASE_URL=postgresql://${{ secrets.DB_USER }}:${{ secrets.DB_PASSWORD }}@nr-nmp-database-${{ inputs.target }}:${{ secrets.DB_PORT }}/${{ secrets.DB_NAME }}?schema=public verification_path: /api/health verification_retry_attempts: "5" verification_retry_seconds: "15" diff --git a/backend/openshift.deploy.yml b/backend/openshift.deploy.yml index 58d10dd..56936aa 100644 --- a/backend/openshift.deploy.yml +++ b/backend/openshift.deploy.yml @@ -22,6 +22,9 @@ parameters: - name: SSOAUTH description: SSO Auth Server URL required: true + - name: DATABASE_URL + description: Database URL + required: true objects: - kind: Service apiVersion: v1 @@ -101,8 +104,7 @@ objects: - name: BACKEND_URL value: https://${APP}-${TARGET}-${COMPONENT}.apps.silver.devops.gov.bc.ca - name: DATABASE_URL - value: nr-nmp-database-${TARGET}://postgres:${DB_PASSWORD}@nr-nmp-database-${TARGET}:5432/postgres - ports: + value: ${DATABASE_URL} - containerPort: 3000 protocol: TCP readinessProbe: diff --git a/database/Dockerfile b/database/Dockerfile index 15b2b29..696cf79 100644 --- a/database/Dockerfile +++ b/database/Dockerfile @@ -1,7 +1,7 @@ FROM postgis/postgis:15-master # Copy startup scripts -COPY db/entrypoint/* /docker-entrypoint-initdb.d/ +# COPY db/entrypoint/* /docker-entrypoint-initdb.d/ # User, port and Healthcheck USER postgres diff --git a/database/db/entrypoint/01-initseed.sql b/database/db/entrypoint/01-initseed.sql deleted file mode 100644 index 45f8f49..0000000 --- a/database/db/entrypoint/01-initseed.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE IF NOT EXISTS developers ( - ID INT PRIMARY KEY NOT NULL, - FIRST_NAME VARCHAR(30) NOT NULL, - LAST_NAME VARCHAR(30) NOT NULL -); -INSERT INTO - developers (ID, FIRST_NAME, LAST_NAME) -VALUES - (1, 'G', 'Damaso'), - (2, 'K', 'Caparas'), - (3, 'S', 'Spy') From 8359573169b11171a701d3d3bfc43079567f079d Mon Sep 17 00:00:00 2001 From: Dallas Richmond Date: Tue, 17 Dec 2024 15:37:57 -0800 Subject: [PATCH 18/28] Updated deploy --- .github/workflows/.deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/.deploy.yml b/.github/workflows/.deploy.yml index e912c2d..59be154 100644 --- a/.github/workflows/.deploy.yml +++ b/.github/workflows/.deploy.yml @@ -78,7 +78,7 @@ jobs: -p TARGET=${{ inputs.target }} -p SSOAUTH=${{ vars.SSO_AUTH_SERVER_URL }} -p DB_PASSWORD=${{ secrets.DB_PASSWORD }} - -P DATABASE_URL=postgresql://${{ secrets.DB_USER }}:${{ secrets.DB_PASSWORD }}@nr-nmp-database-${{ inputs.target }}:${{ secrets.DB_PORT }}/${{ secrets.DB_NAME }}?schema=public + -p DATABASE_URL=postgresql://${{ secrets.DB_USER }}:${{ secrets.DB_PASSWORD }}@nr-nmp-database-${{ inputs.target }}:${{ secrets.DB_PORT }}/${{ secrets.DB_NAME }}?schema=public verification_path: /api/health verification_retry_attempts: "5" verification_retry_seconds: "15" From ea39da502a0bd5be130ee30b95bcb5350e991e08 Mon Sep 17 00:00:00 2001 From: Dallas Richmond Date: Tue, 17 Dec 2024 15:43:07 -0800 Subject: [PATCH 19/28] Fix --- .github/workflows/.deploy.yml | 2 +- backend/openshift.deploy.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/.deploy.yml b/.github/workflows/.deploy.yml index 59be154..6490571 100644 --- a/.github/workflows/.deploy.yml +++ b/.github/workflows/.deploy.yml @@ -78,7 +78,7 @@ jobs: -p TARGET=${{ inputs.target }} -p SSOAUTH=${{ vars.SSO_AUTH_SERVER_URL }} -p DB_PASSWORD=${{ secrets.DB_PASSWORD }} - -p DATABASE_URL=postgresql://${{ secrets.DB_USER }}:${{ secrets.DB_PASSWORD }}@nr-nmp-database-${{ inputs.target }}:${{ secrets.DB_PORT }}/${{ secrets.DB_NAME }}?schema=public + -p DATABASE_URL="postgresql://${{ secrets.DB_USER }}:${{ secrets.DB_PASSWORD }}@nr-nmp-database-${{ inputs.target }}:${{ secrets.DB_PORT }}/${{ secrets.DB_NAME }}?schema=public" verification_path: /api/health verification_retry_attempts: "5" verification_retry_seconds: "15" diff --git a/backend/openshift.deploy.yml b/backend/openshift.deploy.yml index 56936aa..821d91b 100644 --- a/backend/openshift.deploy.yml +++ b/backend/openshift.deploy.yml @@ -105,6 +105,7 @@ objects: value: https://${APP}-${TARGET}-${COMPONENT}.apps.silver.devops.gov.bc.ca - name: DATABASE_URL value: ${DATABASE_URL} + ports: - containerPort: 3000 protocol: TCP readinessProbe: From e0d0d7a8d66ad5d04c07c08b57cf08702293308a Mon Sep 17 00:00:00 2001 From: Dallas Richmond Date: Tue, 17 Dec 2024 16:00:17 -0800 Subject: [PATCH 20/28] Added new workflow --- .github/workflows/prisma-migrations.yml | 35 +++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/prisma-migrations.yml diff --git a/.github/workflows/prisma-migrations.yml b/.github/workflows/prisma-migrations.yml new file mode 100644 index 0000000..e1d81c6 --- /dev/null +++ b/.github/workflows/prisma-migrations.yml @@ -0,0 +1,35 @@ +name: Prisma Migrations + +on: + push: + paths: + - 'backend/prisma/**' + pull_request: + paths: + - 'backend/prisma/**' + +jobs: + run-migrations: + name: Run Prisma Migrations + runs-on: ubuntu-22.04 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install dependencies + run: | + cd backend + npm ci + + - name: Run Prisma Migrations + env: + DATABASE_URL: "postgresql://${{ secrets.DB_USER }}:${{ secrets.DB_PASSWORD }}@nr-nmp-database-${{ github.event.number }}:${{ secrets.DB_PORT }}/${{ secrets.DB_NAME }}?schema=public" + run: | + cd backend + npx prisma migrate deploy From ee3da46bdfc4084533ba237ce3ce0c58ed88f892 Mon Sep 17 00:00:00 2001 From: Dallas Richmond Date: Tue, 17 Dec 2024 16:04:22 -0800 Subject: [PATCH 21/28] Updated --- .github/workflows/prisma-migrations.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/prisma-migrations.yml b/.github/workflows/prisma-migrations.yml index e1d81c6..e29e56c 100644 --- a/.github/workflows/prisma-migrations.yml +++ b/.github/workflows/prisma-migrations.yml @@ -1,17 +1,16 @@ name: Prisma Migrations on: - push: - paths: - - 'backend/prisma/**' - pull_request: - paths: - - 'backend/prisma/**' + workflow_run: + workflows: [".deploy", "merge", "pr-open", "pr-close"] # Add the names of all the workflows that should run before this one + types: + - completed jobs: run-migrations: name: Run Prisma Migrations runs-on: ubuntu-22.04 + if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - name: Checkout code From 6eaa4575fb5712ece3fbff809026d5de5bc3ad97 Mon Sep 17 00:00:00 2001 From: Dallas Richmond Date: Tue, 17 Dec 2024 16:09:26 -0800 Subject: [PATCH 22/28] Updated deploy --- .github/workflows/.deploy.yml | 8 ++++++ .github/workflows/prisma-migrations.yml | 34 ------------------------- 2 files changed, 8 insertions(+), 34 deletions(-) delete mode 100644 .github/workflows/prisma-migrations.yml diff --git a/.github/workflows/.deploy.yml b/.github/workflows/.deploy.yml index 6490571..0ce3ae6 100644 --- a/.github/workflows/.deploy.yml +++ b/.github/workflows/.deploy.yml @@ -82,6 +82,14 @@ jobs: verification_path: /api/health verification_retry_attempts: "5" verification_retry_seconds: "15" + - name: Install dependencies + run: | + cd backend + npm ci + - name: Run Prisma Migrations + run: | + cd backend + npx prisma migrate deploy frontend: name: Frontend diff --git a/.github/workflows/prisma-migrations.yml b/.github/workflows/prisma-migrations.yml deleted file mode 100644 index e29e56c..0000000 --- a/.github/workflows/prisma-migrations.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Prisma Migrations - -on: - workflow_run: - workflows: [".deploy", "merge", "pr-open", "pr-close"] # Add the names of all the workflows that should run before this one - types: - - completed - -jobs: - run-migrations: - name: Run Prisma Migrations - runs-on: ubuntu-22.04 - if: ${{ github.event.workflow_run.conclusion == 'success' }} - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: '20' - - - name: Install dependencies - run: | - cd backend - npm ci - - - name: Run Prisma Migrations - env: - DATABASE_URL: "postgresql://${{ secrets.DB_USER }}:${{ secrets.DB_PASSWORD }}@nr-nmp-database-${{ github.event.number }}:${{ secrets.DB_PORT }}/${{ secrets.DB_NAME }}?schema=public" - run: | - cd backend - npx prisma migrate deploy From 775565dbda81f529c874086f5bb5dc8d523a30c3 Mon Sep 17 00:00:00 2001 From: Dallas Richmond Date: Tue, 17 Dec 2024 16:12:30 -0800 Subject: [PATCH 23/28] Test --- .github/workflows/.deploy.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/.deploy.yml b/.github/workflows/.deploy.yml index 0ce3ae6..29f3d75 100644 --- a/.github/workflows/.deploy.yml +++ b/.github/workflows/.deploy.yml @@ -87,6 +87,8 @@ jobs: cd backend npm ci - name: Run Prisma Migrations + env: + DATABASE_URL: "postgresql://${{ secrets.DB_USER }}:${{ secrets.DB_PASSWORD }}@nr-nmp-database-${{ github.event.number }}:${{ secrets.DB_PORT }}/${{ secrets.DB_NAME }}?schema=public" run: | cd backend npx prisma migrate deploy From 812a42412209a67eb846698d91b0e968ee2a0bcb Mon Sep 17 00:00:00 2001 From: Ariel Rotter-Aboyoun Date: Thu, 19 Dec 2024 15:33:54 -0800 Subject: [PATCH 24/28] Temporarily removing migrations --- .github/workflows/.deploy.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/.deploy.yml b/.github/workflows/.deploy.yml index 29f3d75..ebcf1b7 100644 --- a/.github/workflows/.deploy.yml +++ b/.github/workflows/.deploy.yml @@ -82,16 +82,16 @@ jobs: verification_path: /api/health verification_retry_attempts: "5" verification_retry_seconds: "15" - - name: Install dependencies - run: | - cd backend - npm ci - - name: Run Prisma Migrations - env: - DATABASE_URL: "postgresql://${{ secrets.DB_USER }}:${{ secrets.DB_PASSWORD }}@nr-nmp-database-${{ github.event.number }}:${{ secrets.DB_PORT }}/${{ secrets.DB_NAME }}?schema=public" - run: | - cd backend - npx prisma migrate deploy + #- name: Install dependencies + # run: | + # cd backend + # npm ci + #- name: Run Prisma Migrations + # env: + # DATABASE_URL: "postgresql://${{ secrets.DB_USER }}:${{ secrets.DB_PASSWORD }}@nr-nmp-database-${{ github.event.number }}:${{ secrets.DB_PORT }}/${{ secrets.DB_NAME }}?schema=public" + # run: | + # cd backend + # npx prisma migrate deploy frontend: name: Frontend From 17aa6996f9f69f3402dd152aef3fc59f34754282 Mon Sep 17 00:00:00 2001 From: Ariel Rotter-Aboyoun Date: Thu, 19 Dec 2024 21:46:24 -0800 Subject: [PATCH 25/28] Longer wait before database timeout --- .github/workflows/.deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/.deploy.yml b/.github/workflows/.deploy.yml index ebcf1b7..0eba134 100644 --- a/.github/workflows/.deploy.yml +++ b/.github/workflows/.deploy.yml @@ -78,7 +78,7 @@ jobs: -p TARGET=${{ inputs.target }} -p SSOAUTH=${{ vars.SSO_AUTH_SERVER_URL }} -p DB_PASSWORD=${{ secrets.DB_PASSWORD }} - -p DATABASE_URL="postgresql://${{ secrets.DB_USER }}:${{ secrets.DB_PASSWORD }}@nr-nmp-database-${{ inputs.target }}:${{ secrets.DB_PORT }}/${{ secrets.DB_NAME }}?schema=public" + -p DATABASE_URL="postgresql://${{ secrets.DB_USER }}:${{ secrets.DB_PASSWORD }}@nr-nmp-database-${{ inputs.target }}:${{ secrets.DB_PORT }}/${{ secrets.DB_NAME }}?schema=public&connect_timeout=300" verification_path: /api/health verification_retry_attempts: "5" verification_retry_seconds: "15" From d41295271d6bda78589cd36a918393de248925a6 Mon Sep 17 00:00:00 2001 From: Ariel Rotter-Aboyoun Date: Thu, 19 Dec 2024 21:57:40 -0800 Subject: [PATCH 26/28] Reverting. Didn't fix the issue --- .github/workflows/.deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/.deploy.yml b/.github/workflows/.deploy.yml index 0eba134..ebcf1b7 100644 --- a/.github/workflows/.deploy.yml +++ b/.github/workflows/.deploy.yml @@ -78,7 +78,7 @@ jobs: -p TARGET=${{ inputs.target }} -p SSOAUTH=${{ vars.SSO_AUTH_SERVER_URL }} -p DB_PASSWORD=${{ secrets.DB_PASSWORD }} - -p DATABASE_URL="postgresql://${{ secrets.DB_USER }}:${{ secrets.DB_PASSWORD }}@nr-nmp-database-${{ inputs.target }}:${{ secrets.DB_PORT }}/${{ secrets.DB_NAME }}?schema=public&connect_timeout=300" + -p DATABASE_URL="postgresql://${{ secrets.DB_USER }}:${{ secrets.DB_PASSWORD }}@nr-nmp-database-${{ inputs.target }}:${{ secrets.DB_PORT }}/${{ secrets.DB_NAME }}?schema=public" verification_path: /api/health verification_retry_attempts: "5" verification_retry_seconds: "15" From 31fa8b94f7e6993469e54f4f499dea09a86aee4d Mon Sep 17 00:00:00 2001 From: Ariel Rotter-Aboyoun Date: Fri, 20 Dec 2024 10:15:54 -0800 Subject: [PATCH 27/28] One more attempt with IP --- .github/workflows/.deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/.deploy.yml b/.github/workflows/.deploy.yml index ebcf1b7..a8a3776 100644 --- a/.github/workflows/.deploy.yml +++ b/.github/workflows/.deploy.yml @@ -78,7 +78,7 @@ jobs: -p TARGET=${{ inputs.target }} -p SSOAUTH=${{ vars.SSO_AUTH_SERVER_URL }} -p DB_PASSWORD=${{ secrets.DB_PASSWORD }} - -p DATABASE_URL="postgresql://${{ secrets.DB_USER }}:${{ secrets.DB_PASSWORD }}@nr-nmp-database-${{ inputs.target }}:${{ secrets.DB_PORT }}/${{ secrets.DB_NAME }}?schema=public" + -p DATABASE_URL="postgresql://${{ secrets.DB_USER }}:${{ secrets.DB_PASSWORD }}@10.98.51.10:${{ secrets.DB_PORT }}/${{ secrets.DB_NAME }}?schema=public" verification_path: /api/health verification_retry_attempts: "5" verification_retry_seconds: "15" @@ -88,7 +88,7 @@ jobs: # npm ci #- name: Run Prisma Migrations # env: - # DATABASE_URL: "postgresql://${{ secrets.DB_USER }}:${{ secrets.DB_PASSWORD }}@nr-nmp-database-${{ github.event.number }}:${{ secrets.DB_PORT }}/${{ secrets.DB_NAME }}?schema=public" + # DATABASE_URL: "postgresql://${{ secrets.DB_USER }}:${{ secrets.DB_PASSWORD }}@10.98.51.10:${{ secrets.DB_PORT }}/${{ secrets.DB_NAME }}?schema=public" # run: | # cd backend # npx prisma migrate deploy From ba44d59e274f65036c9933560c4111b4fc03c0f4 Mon Sep 17 00:00:00 2001 From: Dallas Richmond Date: Mon, 30 Dec 2024 14:24:13 -0800 Subject: [PATCH 28/28] Test --- frontend/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/README.md b/frontend/README.md index 74872fd..58ebeb1 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -30,7 +30,7 @@ export default tseslint.config({ - Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config: ```js -// eslint.config.js +// eslint.config.js Test import react from 'eslint-plugin-react' export default tseslint.config({