From ede01209361338c9514e1cb88345840edeadafcd Mon Sep 17 00:00:00 2001 From: "d.malygin" Date: Fri, 16 Aug 2024 16:10:58 +0500 Subject: [PATCH 1/5] migrated from sequelize to prisma --- .env | 8 +- .gitignore | 1 + .prettierrc | 8 + README.md | 16 +- controllers/homeController.js | 64 +- db.js | 12 - index.js | 137 +-- models/index.js | 31 - package-lock.json | 934 ++++++++++++++++++ package.json | 9 +- .../20240816084805_tags_model/migration.sql | 40 + prisma/migrations/migration_lock.toml | 3 + prisma/schema.prisma | 44 + services/homeService.js | 126 +-- tsconfig.json | 108 ++ yarn.lock | 397 ++------ 16 files changed, 1400 insertions(+), 538 deletions(-) create mode 100644 .prettierrc delete mode 100644 db.js delete mode 100644 models/index.js create mode 100644 package-lock.json create mode 100644 prisma/migrations/20240816084805_tags_model/migration.sql create mode 100644 prisma/migrations/migration_lock.toml create mode 100644 prisma/schema.prisma create mode 100644 tsconfig.json diff --git a/.env b/.env index c74bfeb..bc8963d 100644 --- a/.env +++ b/.env @@ -3,4 +3,10 @@ DB_NAME=Shelf_note DB_USER=postgres DB_PASSWORD=xoxo2002! DB_HOST=localhost -DB_PORT=5432 \ No newline at end of file +DB_PORT=5432 + +# Connect to Supabase via connection pooling with Supavisor. +DATABASE_URL="postgresql://postgres.wrwwvdgppriodcdoyohp:Xoxo2002!qwe@aws-0-eu-central-1.pooler.supabase.com:6543/postgres?pgbouncer=true" + +# Direct connection to the database. Used for migrations. +DIRECT_URL="postgresql://postgres.wrwwvdgppriodcdoyohp:Xoxo2002!qwe@aws-0-eu-central-1.pooler.supabase.com:5432/postgres" \ No newline at end of file diff --git a/.gitignore b/.gitignore index 8ee54e8..9d78a2b 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ dist dist-ssr coverage *.local +.env /cypress/videos/ /cypress/screenshots/ diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..5eb97e4 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,8 @@ +{ + "$schema": "https://json.schemastore.org/prettierrc", + "semi": true, + "tabWidth": 2, + "singleQuote": true, + "printWidth": 100, + "trailingComma": "none" +} \ No newline at end of file diff --git a/README.md b/README.md index 60ef5ce..c698862 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # ShelfNote_Backend - - ## Getting started To make it easy for you to get started with GitLab, here's a list of recommended next steps. @@ -42,7 +40,7 @@ Use the built-in continuous integration in GitLab. - [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/) - [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html) -*** +--- # Editing this README @@ -53,30 +51,39 @@ When you're ready to make this README your own, just edit this file and use the Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information. ## Name + Choose a self-explaining name for your project. ## Description + Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors. ## Badges + On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge. ## Visuals + Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method. ## Installation + Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection. ## Usage + Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README. ## Support + Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc. ## Roadmap + If you have ideas for releases in the future, it is a good idea to list them in the README. ## Contributing + State if you are open to contributions and what your requirements are for accepting them. For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self. @@ -84,10 +91,13 @@ For people who want to make changes to your project, it's helpful to have some d You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser. ## Authors and acknowledgment + Show your appreciation to those who have contributed to the project. ## License + For open source projects, say how it is licensed. ## Project status + If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers. diff --git a/controllers/homeController.js b/controllers/homeController.js index 6d10ed4..71166cd 100644 --- a/controllers/homeController.js +++ b/controllers/homeController.js @@ -1,42 +1,42 @@ import HomeService from "../services/homeService.js"; class HomeController { - async getEntities() { - try { - return await HomeService.getEntities(); - } catch (error) { - console.log(error); - return error; - } + async getEntities() { + try { + return await HomeService.getEntities(); + } catch (error) { + console.log(error); + return error; } - async createEntity(req) { - try { - return await HomeService.createEntity(req.body); - } catch (error) { - console.log(error); - } + } + async createEntity(req) { + try { + return await HomeService.createEntity(req.body); + } catch (error) { + console.log(error); } - async editEntity(req) { - try { - return await HomeService.editEntity(req.body); - } catch (error) { - console.log(error); - } + } + async editEntity(req) { + try { + return await HomeService.editEntity(req.body); + } catch (error) { + console.log(error); } - async deleteEntity(req) { - try { - return await HomeService.deleteEntity(req.body); - } catch (error) { - console.log(error); - } + } + async deleteEntity(req) { + try { + return await HomeService.deleteEntity(req.body); + } catch (error) { + console.log(error); } - async changeOrderEntity(req) { - try { - return await HomeService.changeOrderEntity(req.body); - } catch (error) { - console.log(error); - } + } + async changeOrderEntity(req) { + try { + return await HomeService.changeOrderEntity(req.body); + } catch (error) { + console.log(error); } + } } -export default new HomeController; \ No newline at end of file +export default new HomeController(); diff --git a/db.js b/db.js deleted file mode 100644 index e6221b1..0000000 --- a/db.js +++ /dev/null @@ -1,12 +0,0 @@ -import { Sequelize } from 'sequelize'; - -export const sequelize = new Sequelize( - process.env.DB_NAME, - process.env.DB_USER, - process.env.DB_PASSWORD, - { - dialect: 'postgres', - host: process.env.DB_HOST, - port: process.env.DB_PORT, - } -) \ No newline at end of file diff --git a/index.js b/index.js index 0999f38..5f01224 100644 --- a/index.js +++ b/index.js @@ -1,76 +1,79 @@ import 'dotenv/config'; -import {WebSocketServer} from "ws"; -import HomeController from "./controllers/homeController.js"; -import {sequelize} from "./db.js"; -import { Home_entity, User } from "./models/index.js"; +import { WebSocketServer } from 'ws'; +import HomeController from './controllers/homeController.js'; -const PORT = process.env.PORT || 5000; +const PORT = process.env.PORT || 5432; const users = new Set(); -const wss = new WebSocketServer({ +const wss = new WebSocketServer( + { port: PORT -}, () => console.log(`Started listen on port ${PORT}`)) + }, + () => console.log(`Started listen on port ${PORT}`) +); wss.on('connection', (ws) => { - users.add(ws); - ws.id = Date.now(); - ws.on('message', async (req) => { - req = JSON.parse(req); - switch (req.event) { - case 'getHomeEntities': - const getHomeEntitiesData = await HomeController.getEntities(); - wss.clients.forEach((client) => { - client.send(JSON.stringify({event: 'getHomeEntities', data: getHomeEntitiesData})) - }); - break; - case 'createHomeEntity': - const createdHomeEntity = await HomeController.createEntity(req); - wss.clients.forEach((client) => { - client.send(JSON.stringify({ - event: 'createHomeEntity', - data: createdHomeEntity - })); - }); - break; - case 'editHomeEntity': - const editedHomeEntity = await HomeController.editEntity(req); - wss.clients.forEach((client) => { - client.send(JSON.stringify({ - event: 'editHomeEntity', - data: editedHomeEntity - })); - }); - break; - case 'deleteHomeEntity': - const deletedHomeEntity = await HomeController.deleteEntity(req); - wss.clients.forEach((client) => { - client.send(JSON.stringify({ - event: 'deleteHomeEntity', - data: deletedHomeEntity - })); - }); - break; - case 'changeOrderHomeEntity': - await HomeController.changeOrderEntity(req); - wss.clients.forEach((client) => { - client.send(JSON.stringify({ - event: 'changeOrderHomeEntity', - data: {...req.body} - })); - }); - break; - } - }) -}) - -const start = async () => { - try { - await sequelize.authenticate(); - await sequelize.sync(); - } catch (error) { - console.log(error) + users.add(ws); + ws.id = Date.now(); + ws.on('message', async (req) => { + req = JSON.parse(req); + switch (req.event) { + case 'getHomeEntities': + const getHomeEntitiesData = await HomeController.getEntities(); + wss.clients.forEach((client) => { + client.send( + JSON.stringify({ + event: 'getHomeEntities', + data: getHomeEntitiesData + }) + ); + }); + break; + case 'createHomeEntity': + const createdHomeEntity = await HomeController.createEntity(req); + wss.clients.forEach((client) => { + client.send( + JSON.stringify({ + event: 'createHomeEntity', + data: createdHomeEntity + }) + ); + }); + break; + case 'editHomeEntity': + const editedHomeEntity = await HomeController.editEntity(req); + wss.clients.forEach((client) => { + client.send( + JSON.stringify({ + event: 'editHomeEntity', + data: editedHomeEntity + }) + ); + }); + break; + case 'deleteHomeEntity': + const deletedHomeEntity = await HomeController.deleteEntity(req); + wss.clients.forEach((client) => { + client.send( + JSON.stringify({ + event: 'deleteHomeEntity', + data: deletedHomeEntity + }) + ); + }); + break; + case 'changeOrderHomeEntity': + await HomeController.changeOrderEntity(req); + wss.clients.forEach((client) => { + client.send( + JSON.stringify({ + event: 'changeOrderHomeEntity', + data: { ...req.body } + }) + ); + }); + break; } -} - -await start(); \ No newline at end of file + }); +}); diff --git a/models/index.js b/models/index.js deleted file mode 100644 index c1c9a89..0000000 --- a/models/index.js +++ /dev/null @@ -1,31 +0,0 @@ -import {sequelize} from "../db.js"; -import {DataTypes} from "sequelize"; - -const User = sequelize.define('user', { - user_uuid: { type: DataTypes.UUID, allowNull: false }, - nick_name: { type: DataTypes.STRING, primaryKey: true }, - first_name: { type: DataTypes.STRING }, - middle_name: { type: DataTypes.STRING }, - last_name: { type: DataTypes.STRING }, - email: { type: DataTypes.STRING }, - phone_number: { type: DataTypes.STRING }, - settings: { type: DataTypes.JSON } -}) - -const Home_entity = sequelize.define('homeEntity', { - entity_uuid: { type: DataTypes.UUID, primaryKey: true }, - entity_order: { type: DataTypes.INTEGER, allowNull: false, autoIncrement: true }, - entity_type: { type: DataTypes.STRING, allowNull: false }, - title: { type: DataTypes.STRING }, - text: { type: DataTypes.TEXT }, - image_data: { type: DataTypes.TEXT }, - image_width: { type: DataTypes.INTEGER }, - image_height: { type: DataTypes.INTEGER }, - image_position: { type: DataTypes.STRING }, - table_columns: { type: DataTypes.JSON }, - table_data: { type: DataTypes.JSON }, -}) - -Home_entity.belongsTo(User, { foreignKey: 'nick_name' }); - -export { User, Home_entity }; \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..b230f57 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,934 @@ +{ + "name": "ShelfNote_backend", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "ShelfNote_backend", + "version": "1.0.0", + "license": "MIT", + "dependencies": { + "@prisma/client": "^5.18.0", + "cors": "^2.8.5", + "dotenv": "^16.4.5", + "pg": "^8.12.0", + "pg-hstore": "^2.3.4", + "ws": "^8.18.0" + }, + "devDependencies": { + "@types/node": "^22.3.0", + "nodemon": "^3.1.4", + "prettier": "^3.3.3", + "prisma": "^5.18.0", + "ts-node": "^10.9.2", + "typescript": "^5.5.4" + } + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "node_modules/@prisma/client": { + "version": "5.18.0", + "resolved": "https://registry.npmjs.org/@prisma/client/-/client-5.18.0.tgz", + "integrity": "sha512-BWivkLh+af1kqC89zCJYkHsRcyWsM8/JHpsDMM76DjP3ZdEquJhXa4IeX+HkWPnwJ5FanxEJFZZDTWiDs/Kvyw==", + "hasInstallScript": true, + "license": "Apache-2.0", + "engines": { + "node": ">=16.13" + }, + "peerDependencies": { + "prisma": "*" + }, + "peerDependenciesMeta": { + "prisma": { + "optional": true + } + } + }, + "node_modules/@prisma/debug": { + "version": "5.18.0", + "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-5.18.0.tgz", + "integrity": "sha512-f+ZvpTLidSo3LMJxQPVgAxdAjzv5OpzAo/eF8qZqbwvgi2F5cTOI9XCpdRzJYA0iGfajjwjOKKrVq64vkxEfUw==", + "devOptional": true, + "license": "Apache-2.0" + }, + "node_modules/@prisma/engines": { + "version": "5.18.0", + "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-5.18.0.tgz", + "integrity": "sha512-ofmpGLeJ2q2P0wa/XaEgTnX/IsLnvSp/gZts0zjgLNdBhfuj2lowOOPmDcfKljLQUXMvAek3lw5T01kHmCG8rg==", + "devOptional": true, + "hasInstallScript": true, + "license": "Apache-2.0", + "dependencies": { + "@prisma/debug": "5.18.0", + "@prisma/engines-version": "5.18.0-25.4c784e32044a8a016d99474bd02a3b6123742169", + "@prisma/fetch-engine": "5.18.0", + "@prisma/get-platform": "5.18.0" + } + }, + "node_modules/@prisma/engines-version": { + "version": "5.18.0-25.4c784e32044a8a016d99474bd02a3b6123742169", + "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-5.18.0-25.4c784e32044a8a016d99474bd02a3b6123742169.tgz", + "integrity": "sha512-a/+LpJj8vYU3nmtkg+N3X51ddbt35yYrRe8wqHTJtYQt7l1f8kjIBcCs6sHJvodW/EK5XGvboOiwm47fmNrbgg==", + "devOptional": true, + "license": "Apache-2.0" + }, + "node_modules/@prisma/fetch-engine": { + "version": "5.18.0", + "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-5.18.0.tgz", + "integrity": "sha512-I/3u0x2n31rGaAuBRx2YK4eB7R/1zCuayo2DGwSpGyrJWsZesrV7QVw7ND0/Suxeo/vLkJ5OwuBqHoCxvTHpOg==", + "devOptional": true, + "license": "Apache-2.0", + "dependencies": { + "@prisma/debug": "5.18.0", + "@prisma/engines-version": "5.18.0-25.4c784e32044a8a016d99474bd02a3b6123742169", + "@prisma/get-platform": "5.18.0" + } + }, + "node_modules/@prisma/get-platform": { + "version": "5.18.0", + "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-5.18.0.tgz", + "integrity": "sha512-Tk+m7+uhqcKDgnMnFN0lRiH7Ewea0OEsZZs9pqXa7i3+7svS3FSCqDBCaM9x5fmhhkufiG0BtunJVDka+46DlA==", + "devOptional": true, + "license": "Apache-2.0", + "dependencies": { + "@prisma/debug": "5.18.0" + } + }, + "node_modules/@tsconfig/node10": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", + "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true, + "license": "MIT" + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dev": true, + "license": "MIT" + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "22.3.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.3.0.tgz", + "integrity": "sha512-nrWpWVaDZuaVc5X84xJ0vNrLvomM205oQyLsRt7OHNZbSHslcWsvgFR7O7hire2ZonjLrWBbedmotmIlJDVd6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.18.2" + } + }, + "node_modules/acorn": { + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", + "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.3.3", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.3.tgz", + "integrity": "sha512-MxXdReSRhGO7VlFe1bRG/oI7/mdLV9B9JJT0N8vZOhF7gFRR5l3M8W9G8JxmKV+JC5mGqJ0QvqfSOLsCPa4nUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "acorn": "^8.11.0" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/anymatch": { + "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", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true, + "license": "MIT" + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/binary-extensions": { + "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" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "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" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chokidar": { + "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", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, + "license": "MIT" + }, + "node_modules/cors": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "license": "MIT", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/debug": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz", + "integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/dotenv": { + "version": "16.4.5", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", + "integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/fill-range": { + "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" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/glob-parent": { + "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" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "dev": true, + "license": "ISC" + }, + "node_modules/is-binary-path": { + "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" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-extglob": { + "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" + } + }, + "node_modules/is-glob": { + "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" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "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" + } + }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true, + "license": "ISC" + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true, + "license": "MIT" + }, + "node_modules/nodemon": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.4.tgz", + "integrity": "sha512-wjPBbFhtpJwmIeY2yP7QF+UKzPfltVGtfce1g/bB15/8vCGZj8uxD62b/b9M9/WVgme0NZudpownKN+c0plXlQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^4", + "ignore-by-default": "^1.0.1", + "minimatch": "^3.1.2", + "pstree.remy": "^1.1.8", + "semver": "^7.5.3", + "simple-update-notifier": "^2.0.0", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/normalize-path": { + "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" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pg": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/pg/-/pg-8.12.0.tgz", + "integrity": "sha512-A+LHUSnwnxrnL/tZ+OLfqR1SxLN3c/pgDztZ47Rpbsd4jUytsTtwQo/TLPRzPJMp/1pbhYVhH9cuSZLAajNfjQ==", + "license": "MIT", + "dependencies": { + "pg-connection-string": "^2.6.4", + "pg-pool": "^3.6.2", + "pg-protocol": "^1.6.1", + "pg-types": "^2.1.0", + "pgpass": "1.x" + }, + "engines": { + "node": ">= 8.0.0" + }, + "optionalDependencies": { + "pg-cloudflare": "^1.1.1" + }, + "peerDependencies": { + "pg-native": ">=3.0.1" + }, + "peerDependenciesMeta": { + "pg-native": { + "optional": true + } + } + }, + "node_modules/pg-cloudflare": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pg-cloudflare/-/pg-cloudflare-1.1.1.tgz", + "integrity": "sha512-xWPagP/4B6BgFO+EKz3JONXv3YDgvkbVrGw2mTo3D6tVDQRh1e7cqVGvyR3BE+eQgAvx1XhW/iEASj4/jCWl3Q==", + "license": "MIT", + "optional": true + }, + "node_modules/pg-connection-string": { + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.6.4.tgz", + "integrity": "sha512-v+Z7W/0EO707aNMaAEfiGnGL9sxxumwLl2fJvCQtMn9Fxsg+lPpPkdcyBSv/KFgpGdYkMfn+EI1Or2EHjpgLCA==", + "license": "MIT" + }, + "node_modules/pg-hstore": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/pg-hstore/-/pg-hstore-2.3.4.tgz", + "integrity": "sha512-N3SGs/Rf+xA1M2/n0JBiXFDVMzdekwLZLAO0g7mpDY9ouX+fDI7jS6kTq3JujmYbtNSJ53TJ0q4G98KVZSM4EA==", + "license": "MIT", + "dependencies": { + "underscore": "^1.13.1" + }, + "engines": { + "node": ">= 0.8.x" + } + }, + "node_modules/pg-int8": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz", + "integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==", + "license": "ISC", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/pg-pool": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.6.2.tgz", + "integrity": "sha512-Htjbg8BlwXqSBQ9V8Vjtc+vzf/6fVUuak/3/XXKA9oxZprwW3IMDQTGHP+KDmVL7rtd+R1QjbnCFPuTHm3G4hg==", + "license": "MIT", + "peerDependencies": { + "pg": ">=8.0" + } + }, + "node_modules/pg-protocol": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.6.1.tgz", + "integrity": "sha512-jPIlvgoD63hrEuihvIg+tJhoGjUsLPn6poJY9N5CnlPd91c2T18T/9zBtLxZSb1EhYxBRoZJtzScCaWlYLtktg==", + "license": "MIT" + }, + "node_modules/pg-types": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz", + "integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==", + "license": "MIT", + "dependencies": { + "pg-int8": "1.0.1", + "postgres-array": "~2.0.0", + "postgres-bytea": "~1.0.0", + "postgres-date": "~1.0.4", + "postgres-interval": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/pgpass": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.5.tgz", + "integrity": "sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==", + "license": "MIT", + "dependencies": { + "split2": "^4.1.0" + } + }, + "node_modules/picomatch": { + "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" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/postgres-array": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz", + "integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/postgres-bytea": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.0.tgz", + "integrity": "sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/postgres-date": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz", + "integrity": "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/postgres-interval": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz", + "integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==", + "license": "MIT", + "dependencies": { + "xtend": "^4.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/prettier": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", + "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/prisma": { + "version": "5.18.0", + "resolved": "https://registry.npmjs.org/prisma/-/prisma-5.18.0.tgz", + "integrity": "sha512-+TrSIxZsh64OPOmaSgVPH7ALL9dfU0jceYaMJXsNrTkFHO7/3RANi5K2ZiPB1De9+KDxCWn7jvRq8y8pvk+o9g==", + "devOptional": true, + "hasInstallScript": true, + "license": "Apache-2.0", + "dependencies": { + "@prisma/engines": "5.18.0" + }, + "bin": { + "prisma": "build/index.js" + }, + "engines": { + "node": ">=16.13" + } + }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true, + "license": "MIT" + }, + "node_modules/readdirp": { + "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" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/semver": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/simple-update-notifier": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", + "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/split2": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", + "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", + "license": "ISC", + "engines": { + "node": ">= 10.x" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "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" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/touch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", + "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", + "dev": true, + "license": "ISC", + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, + "node_modules/ts-node": { + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/typescript": { + "version": "5.5.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz", + "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true, + "license": "MIT" + }, + "node_modules/underscore": { + "version": "1.13.7", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.7.tgz", + "integrity": "sha512-GMXzWtsc57XAtguZgaQViUOzs0KTkk8ojr3/xAxXLITqf/3EMwxC0inyETfDFjH/Krbhuep0HNbbjI9i/q3F3g==", + "license": "MIT" + }, + "node_modules/undici-types": { + "version": "6.18.2", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.18.2.tgz", + "integrity": "sha512-5ruQbENj95yDYJNS3TvcaxPMshV7aizdv/hWYjGIKoANWKjhWNBsr2YEuYZKodQulB1b8l7ILOuDQep3afowQQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dev": true, + "license": "MIT" + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/ws": { + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", + "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "license": "MIT", + "engines": { + "node": ">=0.4" + } + }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + } + } +} diff --git a/package.json b/package.json index 2080d8c..af67d9c 100644 --- a/package.json +++ b/package.json @@ -10,14 +10,19 @@ "start": "nodemon index.js" }, "dependencies": { + "@prisma/client": "^5.18.0", "cors": "^2.8.5", "dotenv": "^16.4.5", "pg": "^8.12.0", "pg-hstore": "^2.3.4", - "sequelize": "^6.37.3", "ws": "^8.18.0" }, "devDependencies": { - "nodemon": "^3.1.4" + "@types/node": "^22.3.0", + "nodemon": "^3.1.4", + "prettier": "^3.3.3", + "prisma": "^5.18.0", + "ts-node": "^10.9.2", + "typescript": "^5.5.4" } } diff --git a/prisma/migrations/20240816084805_tags_model/migration.sql b/prisma/migrations/20240816084805_tags_model/migration.sql new file mode 100644 index 0000000..060af0c --- /dev/null +++ b/prisma/migrations/20240816084805_tags_model/migration.sql @@ -0,0 +1,40 @@ +-- CreateTable +CREATE TABLE "User" ( + "user_uuid" TEXT NOT NULL, + "nick_name" TEXT NOT NULL, + "first_name" TEXT NOT NULL, + "middle_name" TEXT NOT NULL, + "last_name" TEXT NOT NULL, + "email" TEXT NOT NULL, + "phone_number" TEXT NOT NULL, + "settings" JSONB NOT NULL, + + CONSTRAINT "User_pkey" PRIMARY KEY ("user_uuid") +); + +-- CreateTable +CREATE TABLE "Home_entity" ( + "entity_uuid" TEXT NOT NULL, + "user_nick_name" TEXT NOT NULL, + "entity_order" SERIAL NOT NULL, + "entity_type" TEXT NOT NULL, + "title" TEXT NOT NULL, + "text" TEXT NOT NULL, + "image_data" TEXT NOT NULL, + "image_width" INTEGER NOT NULL, + "image_height" INTEGER NOT NULL, + "image_position" TEXT NOT NULL, + "table_columns" JSONB NOT NULL, + "table_data" JSONB NOT NULL, + + CONSTRAINT "Home_entity_pkey" PRIMARY KEY ("entity_uuid") +); + +-- CreateIndex +CREATE UNIQUE INDEX "User_nick_name_key" ON "User"("nick_name"); + +-- CreateIndex +CREATE UNIQUE INDEX "Home_entity_user_nick_name_key" ON "Home_entity"("user_nick_name"); + +-- AddForeignKey +ALTER TABLE "Home_entity" ADD CONSTRAINT "Home_entity_user_nick_name_fkey" FOREIGN KEY ("user_nick_name") REFERENCES "User"("nick_name") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/migration_lock.toml b/prisma/migrations/migration_lock.toml new file mode 100644 index 0000000..fbffa92 --- /dev/null +++ b/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/prisma/schema.prisma b/prisma/schema.prisma new file mode 100644 index 0000000..6d0b2b5 --- /dev/null +++ b/prisma/schema.prisma @@ -0,0 +1,44 @@ +// 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 + +// prisma db push +generator client { + provider = "prisma-client-js" +} + +datasource db { + provider = "postgresql" + url = env("DATABASE_URL") + directUrl = env("DIRECT_URL") +} + +model User { + user_uuid String @id @default(uuid()) + nick_name String @unique + first_name String? + middle_name String? + last_name String? + email String? + phone_number String? + settings Json? + home_entities Home_entity[] +} + +model Home_entity { + entity_uuid String @id @default(uuid()) + entity_user User? @relation(fields: [user_nick_name], references: [nick_name]) + user_nick_name String? @unique + entity_order Int @default(autoincrement()) + entity_type String + title String? + text String? @db.Text + image_data String? @db.Text + image_width Int? + image_height Int? + image_position String? + table_columns Json? + table_data Json? +} diff --git a/services/homeService.js b/services/homeService.js index 244aeff..e0c2298 100644 --- a/services/homeService.js +++ b/services/homeService.js @@ -1,65 +1,69 @@ -import {Home_entity} from "../models/index.js"; +import { PrismaClient } from '@prisma/client'; + +const prisma = new PrismaClient(); class HomeService { - async getEntities() { - return await Home_entity.findAll({ - order: [ - ['entity_order', 'ASC'] - ] - }); - } - async createEntity(body) { - return Home_entity.create(body); - } - async editEntity(body) { - return Home_entity.upsert({...body}); - } - async deleteEntity(body) { - const deletedEntity = await Home_entity.findOne({ - where: { - entity_uuid: body.entity_uuid - } - }) - await Home_entity.destroy({ - where: { - entity_uuid: body.entity_uuid - } - }); - return deletedEntity; - } - async changeOrderEntity(body) { - const allEntities = await Home_entity.findAll({ - order: [ - ['entity_order', 'ASC'] - ] - }); - const currentEntity = allEntities.find(entity => entity.entity_uuid === body.entity_uuid); - console.log('currentEntity: ', currentEntity); - const nextEntity = body.direction === 'up' - ? allEntities - .reverse() - .find(entity => entity.entity_order < currentEntity.entity_order) - : allEntities - .find(entity => entity.entity_order > currentEntity.entity_order); - console.log('nextEntity: ', nextEntity); - await Home_entity.update({ - entity_order: nextEntity.entity_order, - }, { - where: { - entity_uuid: currentEntity.entity_uuid - } - }); - // await Home_entity.upsert({...currentEntity, entity_order: nextEntity.entity_order}); - await Home_entity.update({ - entity_order: currentEntity.entity_order, - }, { - where: { - entity_uuid: nextEntity.entity_uuid - } - }); - // await Home_entity.upsert({...nextEntity, entity_order: currentEntity.entity_order}); - return body; - } + async getEntities() { + return prisma.home_entity.findMany({ + orderBy: [{ entity_order: 'asc' }] + }); + } + async createEntity(body) { + console.log('body: ', body); + return prisma.home_entity.create({ data: body }); + } + async editEntity(body) { + return prisma.home_entity.update({ + where: { + entity_uuid: body.entity_uuid + }, + data: { ...body } + }); + } + async deleteEntity(body) { + const deletedEntity = await prisma.home_entity.findFirst({ + where: { + entity_uuid: body.entity_uuid + } + }); + await prisma.home_entity.delete({ + where: { + entity_uuid: body.entity_uuid + } + }); + return deletedEntity; + } + async changeOrderEntity(body) { + const allEntities = await prisma.home_entity.findMany({ + orderBy: [{ entity_order: 'asc' }] + }); + const currentEntity = allEntities.find((entity) => entity.entity_uuid === body.entity_uuid); + console.log('currentEntity: ', currentEntity); + const nextEntity = + body.direction === 'up' + ? allEntities.reverse().find((entity) => entity.entity_order < currentEntity.entity_order) + : allEntities.find((entity) => entity.entity_order > currentEntity.entity_order); + console.log('nextEntity: ', nextEntity); + await prisma.home_entity.update({ + where: { + entity_uuid: currentEntity.entity_uuid + }, + data: { + entity_order: nextEntity.entity_order + } + }); + // await Home_entity.upsert({...currentEntity, entity_order: nextEntity.entity_order}); + await prisma.home_entity.update({ + where: { + entity_uuid: nextEntity.entity_uuid + }, + data: { + entity_order: currentEntity.entity_order + } + }); + // await Home_entity.upsert({...nextEntity, entity_order: currentEntity.entity_order}); + return body; + } } -export default new HomeService; \ No newline at end of file +export default new HomeService(); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..b7bcdc0 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,108 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + + /* Language and Environment */ + "target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "jsx": "preserve", /* Specify what JSX code is generated. */ + // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ + // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "commonjs" /* Specify what module code is generated. */, + // "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ + // "types": [], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ + // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ + // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ + // "resolveJsonModule": true, /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + // "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ + // "outDir": "./", /* Specify an output folder for all emitted files. */ + // "removeComments": true, /* Disable emitting comments. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ + // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ + // "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */, + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, + + /* Type Checking */ + "strict": true /* Enable all strict type-checking options. */, + // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + } +} diff --git a/yarn.lock b/yarn.lock index 5a3bf31..3346599 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,256 +2,100 @@ # yarn lockfile v1 -"@types/debug@^4.1.8": - version "4.1.12" - resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.12.tgz#a155f21690871953410df4b6b6f53187f0500917" - integrity sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ== - dependencies: - "@types/ms" "*" - -"@types/ms@*": - version "0.7.34" - resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.34.tgz#10964ba0dee6ac4cd462e2795b6bebd407303433" - integrity sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g== - -"@types/node@*": - version "22.2.0" - resolved "https://registry.yarnpkg.com/@types/node/-/node-22.2.0.tgz#7cf046a99f0ba4d628ad3088cb21f790df9b0c5b" - integrity sha512-bm6EG6/pCpkxDf/0gDNDdtDILMOHgaQBVOJGdwsqClnxA3xL6jtMv76rLBc006RVMWbmaf0xbmom4Z/5o2nRkQ== - dependencies: - undici-types "~6.13.0" - -"@types/validator@^13.7.17": - version "13.12.0" - resolved "https://registry.yarnpkg.com/@types/validator/-/validator-13.12.0.tgz#1fe4c3ae9de5cf5193ce64717c99ef2fa7d8756f" - integrity sha512-nH45Lk7oPIJ1RVOF6JgFI6Dy0QpHEzq4QecZhvguxYPDwT8c93prCMqAtiIttm39voZ+DDR+qkNnMpJmMBRqag== - -anymatch@~3.1.2: - version "3.1.3" - resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" - integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== - dependencies: - normalize-path "^3.0.0" - picomatch "^2.0.4" - -balanced-match@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" - integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== - -binary-extensions@^2.0.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.3.0.tgz#f6e14a97858d327252200242d4ccfe522c445522" - integrity sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw== - -brace-expansion@^1.1.7: - version "1.1.11" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" - integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== - dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" - -braces@~3.0.2: - version "3.0.3" - resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" - integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== - dependencies: - fill-range "^7.1.1" - -chokidar@^3.5.2: - version "3.6.0" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.6.0.tgz#197c6cc669ef2a8dc5e7b4d97ee4e092c3eb0d5b" - integrity sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw== - dependencies: - anymatch "~3.1.2" - braces "~3.0.2" - glob-parent "~5.1.2" - is-binary-path "~2.1.0" - is-glob "~4.0.1" - normalize-path "~3.0.0" - readdirp "~3.6.0" - optionalDependencies: - fsevents "~2.3.2" - -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== +"@prisma/client@^5.18.0": + version "5.18.0" + resolved "https://registry.npmjs.org/@prisma/client/-/client-5.18.0.tgz" + integrity sha512-BWivkLh+af1kqC89zCJYkHsRcyWsM8/JHpsDMM76DjP3ZdEquJhXa4IeX+HkWPnwJ5FanxEJFZZDTWiDs/Kvyw== + +"@prisma/debug@5.18.0": + version "5.18.0" + resolved "https://registry.npmjs.org/@prisma/debug/-/debug-5.18.0.tgz" + integrity sha512-f+ZvpTLidSo3LMJxQPVgAxdAjzv5OpzAo/eF8qZqbwvgi2F5cTOI9XCpdRzJYA0iGfajjwjOKKrVq64vkxEfUw== + +"@prisma/engines-version@5.18.0-25.4c784e32044a8a016d99474bd02a3b6123742169": + version "5.18.0-25.4c784e32044a8a016d99474bd02a3b6123742169" + resolved "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-5.18.0-25.4c784e32044a8a016d99474bd02a3b6123742169.tgz" + integrity sha512-a/+LpJj8vYU3nmtkg+N3X51ddbt35yYrRe8wqHTJtYQt7l1f8kjIBcCs6sHJvodW/EK5XGvboOiwm47fmNrbgg== + +"@prisma/engines@5.18.0": + version "5.18.0" + resolved "https://registry.npmjs.org/@prisma/engines/-/engines-5.18.0.tgz" + integrity sha512-ofmpGLeJ2q2P0wa/XaEgTnX/IsLnvSp/gZts0zjgLNdBhfuj2lowOOPmDcfKljLQUXMvAek3lw5T01kHmCG8rg== + dependencies: + "@prisma/debug" "5.18.0" + "@prisma/engines-version" "5.18.0-25.4c784e32044a8a016d99474bd02a3b6123742169" + "@prisma/fetch-engine" "5.18.0" + "@prisma/get-platform" "5.18.0" + +"@prisma/fetch-engine@5.18.0": + version "5.18.0" + resolved "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-5.18.0.tgz" + integrity sha512-I/3u0x2n31rGaAuBRx2YK4eB7R/1zCuayo2DGwSpGyrJWsZesrV7QVw7ND0/Suxeo/vLkJ5OwuBqHoCxvTHpOg== + dependencies: + "@prisma/debug" "5.18.0" + "@prisma/engines-version" "5.18.0-25.4c784e32044a8a016d99474bd02a3b6123742169" + "@prisma/get-platform" "5.18.0" + +"@prisma/get-platform@5.18.0": + version "5.18.0" + resolved "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-5.18.0.tgz" + integrity sha512-Tk+m7+uhqcKDgnMnFN0lRiH7Ewea0OEsZZs9pqXa7i3+7svS3FSCqDBCaM9x5fmhhkufiG0BtunJVDka+46DlA== + dependencies: + "@prisma/debug" "5.18.0" cors@^2.8.5: version "2.8.5" - resolved "https://registry.yarnpkg.com/cors/-/cors-2.8.5.tgz#eac11da51592dd86b9f06f6e7ac293b3df875d29" + resolved "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz" integrity sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g== dependencies: object-assign "^4" vary "^1" -debug@^4, debug@^4.3.4: - version "4.3.6" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.6.tgz#2ab2c38fbaffebf8aa95fdfe6d88438c7a13c52b" - integrity sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg== - dependencies: - ms "2.1.2" - dotenv@^16.4.5: version "16.4.5" - resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.4.5.tgz#cdd3b3b604cb327e286b4762e13502f717cb099f" + resolved "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz" integrity sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg== -dottie@^2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/dottie/-/dottie-2.0.6.tgz#34564ebfc6ec5e5772272d466424ad5b696484d4" - integrity sha512-iGCHkfUc5kFekGiqhe8B/mdaurD+lakO9txNnTvKtA6PISrw86LgqHvRzWYPyoE2Ph5aMIrCw9/uko6XHTKCwA== - -fill-range@^7.1.1: - version "7.1.1" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" - integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg== - dependencies: - to-regex-range "^5.0.1" - -fsevents@~2.3.2: - version "2.3.3" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" - integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== - -glob-parent@~5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" - integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== - dependencies: - is-glob "^4.0.1" - -has-flag@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" - integrity sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw== - -ignore-by-default@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/ignore-by-default/-/ignore-by-default-1.0.1.tgz#48ca6d72f6c6a3af00a9ad4ae6876be3889e2b09" - integrity sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA== - -inflection@^1.13.4: - version "1.13.4" - resolved "https://registry.yarnpkg.com/inflection/-/inflection-1.13.4.tgz#65aa696c4e2da6225b148d7a154c449366633a32" - integrity sha512-6I/HUDeYFfuNCVS3td055BaXBwKYuzw7K3ExVMStBowKo9oOAMJIXIHvdyR3iboTCp1b+1i5DSkIZTcwIktuDw== - -is-binary-path@~2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" - integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== - dependencies: - binary-extensions "^2.0.0" - -is-extglob@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" - integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== - -is-glob@^4.0.1, is-glob@~4.0.1: - version "4.0.3" - resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" - integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== - dependencies: - is-extglob "^2.1.1" - -is-number@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" - integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== - -lodash@^4.17.21: - version "4.17.21" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" - integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== - -minimatch@^3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" - integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== - dependencies: - brace-expansion "^1.1.7" - -moment-timezone@^0.5.43: - version "0.5.45" - resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.45.tgz#cb685acd56bac10e69d93c536366eb65aa6bcf5c" - integrity sha512-HIWmqA86KcmCAhnMAN0wuDOARV/525R2+lOLotuGFzn4HO+FH+/645z2wx0Dt3iDv6/p61SIvKnDstISainhLQ== - dependencies: - moment "^2.29.4" - -moment@^2.29.4: - version "2.30.1" - resolved "https://registry.yarnpkg.com/moment/-/moment-2.30.1.tgz#f8c91c07b7a786e30c59926df530b4eac96974ae" - integrity sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how== - -ms@2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" - integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== - -nodemon@^3.1.4: - version "3.1.4" - resolved "https://registry.yarnpkg.com/nodemon/-/nodemon-3.1.4.tgz#c34dcd8eb46a05723ccde60cbdd25addcc8725e4" - integrity sha512-wjPBbFhtpJwmIeY2yP7QF+UKzPfltVGtfce1g/bB15/8vCGZj8uxD62b/b9M9/WVgme0NZudpownKN+c0plXlQ== - dependencies: - chokidar "^3.5.2" - debug "^4" - ignore-by-default "^1.0.1" - minimatch "^3.1.2" - pstree.remy "^1.1.8" - semver "^7.5.3" - simple-update-notifier "^2.0.0" - supports-color "^5.5.0" - touch "^3.1.0" - undefsafe "^2.0.5" - -normalize-path@^3.0.0, normalize-path@~3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" - integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== - object-assign@^4: version "4.1.1" - resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + resolved "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz" integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== pg-cloudflare@^1.1.1: version "1.1.1" - resolved "https://registry.yarnpkg.com/pg-cloudflare/-/pg-cloudflare-1.1.1.tgz#e6d5833015b170e23ae819e8c5d7eaedb472ca98" + resolved "https://registry.npmjs.org/pg-cloudflare/-/pg-cloudflare-1.1.1.tgz" integrity sha512-xWPagP/4B6BgFO+EKz3JONXv3YDgvkbVrGw2mTo3D6tVDQRh1e7cqVGvyR3BE+eQgAvx1XhW/iEASj4/jCWl3Q== -pg-connection-string@^2.6.1, pg-connection-string@^2.6.4: +pg-connection-string@^2.6.4: version "2.6.4" - resolved "https://registry.yarnpkg.com/pg-connection-string/-/pg-connection-string-2.6.4.tgz#f543862adfa49fa4e14bc8a8892d2a84d754246d" + resolved "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.6.4.tgz" integrity sha512-v+Z7W/0EO707aNMaAEfiGnGL9sxxumwLl2fJvCQtMn9Fxsg+lPpPkdcyBSv/KFgpGdYkMfn+EI1Or2EHjpgLCA== pg-hstore@^2.3.4: version "2.3.4" - resolved "https://registry.yarnpkg.com/pg-hstore/-/pg-hstore-2.3.4.tgz#4425e3e2a3e15d2a334c35581186c27cf2e9b8dd" + resolved "https://registry.npmjs.org/pg-hstore/-/pg-hstore-2.3.4.tgz" integrity sha512-N3SGs/Rf+xA1M2/n0JBiXFDVMzdekwLZLAO0g7mpDY9ouX+fDI7jS6kTq3JujmYbtNSJ53TJ0q4G98KVZSM4EA== dependencies: underscore "^1.13.1" pg-int8@1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/pg-int8/-/pg-int8-1.0.1.tgz#943bd463bf5b71b4170115f80f8efc9a0c0eb78c" + resolved "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz" integrity sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw== pg-pool@^3.6.2: version "3.6.2" - resolved "https://registry.yarnpkg.com/pg-pool/-/pg-pool-3.6.2.tgz#3a592370b8ae3f02a7c8130d245bc02fa2c5f3f2" + resolved "https://registry.npmjs.org/pg-pool/-/pg-pool-3.6.2.tgz" integrity sha512-Htjbg8BlwXqSBQ9V8Vjtc+vzf/6fVUuak/3/XXKA9oxZprwW3IMDQTGHP+KDmVL7rtd+R1QjbnCFPuTHm3G4hg== pg-protocol@^1.6.1: version "1.6.1" - resolved "https://registry.yarnpkg.com/pg-protocol/-/pg-protocol-1.6.1.tgz#21333e6d83b01faaebfe7a33a7ad6bfd9ed38cb3" + resolved "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.6.1.tgz" integrity sha512-jPIlvgoD63hrEuihvIg+tJhoGjUsLPn6poJY9N5CnlPd91c2T18T/9zBtLxZSb1EhYxBRoZJtzScCaWlYLtktg== pg-types@^2.1.0: version "2.2.0" - resolved "https://registry.yarnpkg.com/pg-types/-/pg-types-2.2.0.tgz#2d0250d636454f7cfa3b6ae0382fdfa8063254a3" + resolved "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz" integrity sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA== dependencies: pg-int8 "1.0.1" @@ -260,9 +104,9 @@ pg-types@^2.1.0: postgres-date "~1.0.4" postgres-interval "^1.1.0" -pg@^8.12.0: +pg@^8.12.0, pg@>=8.0: version "8.12.0" - resolved "https://registry.yarnpkg.com/pg/-/pg-8.12.0.tgz#9341724db571022490b657908f65aee8db91df79" + resolved "https://registry.npmjs.org/pg/-/pg-8.12.0.tgz" integrity sha512-A+LHUSnwnxrnL/tZ+OLfqR1SxLN3c/pgDztZ47Rpbsd4jUytsTtwQo/TLPRzPJMp/1pbhYVhH9cuSZLAajNfjQ== dependencies: pg-connection-string "^2.6.4" @@ -275,166 +119,61 @@ pg@^8.12.0: pgpass@1.x: version "1.0.5" - resolved "https://registry.yarnpkg.com/pgpass/-/pgpass-1.0.5.tgz#9b873e4a564bb10fa7a7dbd55312728d422a223d" + resolved "https://registry.npmjs.org/pgpass/-/pgpass-1.0.5.tgz" integrity sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug== dependencies: split2 "^4.1.0" -picomatch@^2.0.4, picomatch@^2.2.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" - integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== - postgres-array@~2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/postgres-array/-/postgres-array-2.0.0.tgz#48f8fce054fbc69671999329b8834b772652d82e" + resolved "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz" integrity sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA== postgres-bytea@~1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/postgres-bytea/-/postgres-bytea-1.0.0.tgz#027b533c0aa890e26d172d47cf9ccecc521acd35" + resolved "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.0.tgz" integrity sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w== postgres-date@~1.0.4: version "1.0.7" - resolved "https://registry.yarnpkg.com/postgres-date/-/postgres-date-1.0.7.tgz#51bc086006005e5061c591cee727f2531bf641a8" + resolved "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz" integrity sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q== postgres-interval@^1.1.0: version "1.2.0" - resolved "https://registry.yarnpkg.com/postgres-interval/-/postgres-interval-1.2.0.tgz#b460c82cb1587507788819a06aa0fffdb3544695" + resolved "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz" integrity sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ== dependencies: xtend "^4.0.0" -pstree.remy@^1.1.8: - version "1.1.8" - resolved "https://registry.yarnpkg.com/pstree.remy/-/pstree.remy-1.1.8.tgz#c242224f4a67c21f686839bbdb4ac282b8373d3a" - integrity sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w== - -readdirp@~3.6.0: - version "3.6.0" - resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" - integrity sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA== - dependencies: - picomatch "^2.2.1" - -retry-as-promised@^7.0.4: - version "7.0.4" - resolved "https://registry.yarnpkg.com/retry-as-promised/-/retry-as-promised-7.0.4.tgz#9df73adaeea08cb2948b9d34990549dc13d800a2" - integrity sha512-XgmCoxKWkDofwH8WddD0w85ZfqYz+ZHlr5yo+3YUCfycWawU56T5ckWXsScsj5B8tqUcIG67DxXByo3VUgiAdA== - -semver@^7.5.3, semver@^7.5.4: - version "7.6.3" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143" - integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A== - -sequelize-pool@^7.1.0: - version "7.1.0" - resolved "https://registry.yarnpkg.com/sequelize-pool/-/sequelize-pool-7.1.0.tgz#210b391af4002762f823188fd6ecfc7413020768" - integrity sha512-G9c0qlIWQSK29pR/5U2JF5dDQeqqHRragoyahj/Nx4KOOQ3CPPfzxnfqFPCSB7x5UgjOgnZ61nSxz+fjDpRlJg== - -sequelize@^6.37.3: - version "6.37.3" - resolved "https://registry.yarnpkg.com/sequelize/-/sequelize-6.37.3.tgz#ed6212029a52c59a18638d2a703da84bc2f81311" - integrity sha512-V2FTqYpdZjPy3VQrZvjTPnOoLm0KudCRXfGWp48QwhyPPp2yW8z0p0sCYZd/em847Tl2dVxJJ1DR+hF+O77T7A== +prisma@*, prisma@^5.18.0: + version "5.18.0" + resolved "https://registry.npmjs.org/prisma/-/prisma-5.18.0.tgz" + integrity sha512-+TrSIxZsh64OPOmaSgVPH7ALL9dfU0jceYaMJXsNrTkFHO7/3RANi5K2ZiPB1De9+KDxCWn7jvRq8y8pvk+o9g== dependencies: - "@types/debug" "^4.1.8" - "@types/validator" "^13.7.17" - debug "^4.3.4" - dottie "^2.0.6" - inflection "^1.13.4" - lodash "^4.17.21" - moment "^2.29.4" - moment-timezone "^0.5.43" - pg-connection-string "^2.6.1" - retry-as-promised "^7.0.4" - semver "^7.5.4" - sequelize-pool "^7.1.0" - toposort-class "^1.0.1" - uuid "^8.3.2" - validator "^13.9.0" - wkx "^0.5.0" - -simple-update-notifier@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz#d70b92bdab7d6d90dfd73931195a30b6e3d7cebb" - integrity sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w== - dependencies: - semver "^7.5.3" + "@prisma/engines" "5.18.0" split2@^4.1.0: version "4.2.0" - resolved "https://registry.yarnpkg.com/split2/-/split2-4.2.0.tgz#c9c5920904d148bab0b9f67145f245a86aadbfa4" + resolved "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz" integrity sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg== -supports-color@^5.5.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" - integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== - dependencies: - has-flag "^3.0.0" - -to-regex-range@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" - integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== - dependencies: - is-number "^7.0.0" - -toposort-class@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/toposort-class/-/toposort-class-1.0.1.tgz#7ffd1f78c8be28c3ba45cd4e1a3f5ee193bd9988" - integrity sha512-OsLcGGbYF3rMjPUf8oKktyvCiUxSbqMMS39m33MAjLTC1DVIH6x3WSt63/M77ihI09+Sdfk1AXvfhCEeUmC7mg== - -touch@^3.1.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/touch/-/touch-3.1.1.tgz#097a23d7b161476435e5c1344a95c0f75b4a5694" - integrity sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA== - -undefsafe@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/undefsafe/-/undefsafe-2.0.5.tgz#38733b9327bdcd226db889fb723a6efd162e6e2c" - integrity sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA== - underscore@^1.13.1: version "1.13.7" - resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.13.7.tgz#970e33963af9a7dda228f17ebe8399e5fbe63a10" + resolved "https://registry.npmjs.org/underscore/-/underscore-1.13.7.tgz" integrity sha512-GMXzWtsc57XAtguZgaQViUOzs0KTkk8ojr3/xAxXLITqf/3EMwxC0inyETfDFjH/Krbhuep0HNbbjI9i/q3F3g== -undici-types@~6.13.0: - version "6.13.0" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.13.0.tgz#e3e79220ab8c81ed1496b5812471afd7cf075ea5" - integrity sha512-xtFJHudx8S2DSoujjMd1WeWvn7KKWFRESZTMeL1RptAYERu29D6jphMjjY+vn96jvN3kVPDNxU/E13VTaXj6jg== - -uuid@^8.3.2: - version "8.3.2" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" - integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== - -validator@^13.9.0: - version "13.12.0" - resolved "https://registry.yarnpkg.com/validator/-/validator-13.12.0.tgz#7d78e76ba85504da3fee4fd1922b385914d4b35f" - integrity sha512-c1Q0mCiPlgdTVVVIJIrBuxNicYE+t/7oKeI9MWLj3fh/uq2Pxh/3eeWbVZ4OcGW1TUf53At0njHw5SMdA3tmMg== - vary@^1: version "1.1.2" - resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" + resolved "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz" integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg== -wkx@^0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/wkx/-/wkx-0.5.0.tgz#c6c37019acf40e517cc6b94657a25a3d4aa33e8c" - integrity sha512-Xng/d4Ichh8uN4l0FToV/258EjMGU9MGcA0HV2d9B/ZpZB3lqQm7nkOdZdm5GhKtLLhAE7PiVQwN4eN+2YJJUg== - dependencies: - "@types/node" "*" - ws@^8.18.0: version "8.18.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.0.tgz#0d7505a6eafe2b0e712d232b42279f53bc289bbc" + resolved "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz" integrity sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw== xtend@^4.0.0: version "4.0.2" - resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" + resolved "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz" integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== -- GitLab From 467d1db0f4148cb0ce8e38002e56b3c337af4b53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9=20=D0=9C=D0=B0?= =?UTF-8?q?=D0=BB=D1=8E=D0=B3=D0=B8=D0=BD?= Date: Tue, 20 Aug 2024 22:25:20 +0500 Subject: [PATCH 2/5] Add methods for change of background in home page --- .env | 5 +---- controllers/homeController.js | 17 ++++++++++++++++- index.js | 22 ++++++++++++++++++++++ prisma/schema.prisma | 12 ++++++++++-- services/homeService.js | 28 +++++++++++++++++++++++----- 5 files changed, 72 insertions(+), 12 deletions(-) diff --git a/.env b/.env index bc8963d..7385ade 100644 --- a/.env +++ b/.env @@ -5,8 +5,5 @@ DB_PASSWORD=xoxo2002! DB_HOST=localhost DB_PORT=5432 -# Connect to Supabase via connection pooling with Supavisor. -DATABASE_URL="postgresql://postgres.wrwwvdgppriodcdoyohp:Xoxo2002!qwe@aws-0-eu-central-1.pooler.supabase.com:6543/postgres?pgbouncer=true" +DATABASE_URL="postgresql://postgres:xoxo2002!@localhost:5432/Shelf_note" -# Direct connection to the database. Used for migrations. -DIRECT_URL="postgresql://postgres.wrwwvdgppriodcdoyohp:Xoxo2002!qwe@aws-0-eu-central-1.pooler.supabase.com:5432/postgres" \ No newline at end of file diff --git a/controllers/homeController.js b/controllers/homeController.js index 71166cd..ff8c524 100644 --- a/controllers/homeController.js +++ b/controllers/homeController.js @@ -1,4 +1,4 @@ -import HomeService from "../services/homeService.js"; +import HomeService from '../services/homeService.js'; class HomeController { async getEntities() { @@ -9,6 +9,14 @@ class HomeController { return error; } } + async getHomeBackgroundUrl() { + try { + return await HomeService.getHomeBackgroundUrl(); + } catch (error) { + console.log(error); + return error; + } + } async createEntity(req) { try { return await HomeService.createEntity(req.body); @@ -37,6 +45,13 @@ class HomeController { console.log(error); } } + async changeHomeBackgroundUrl(req) { + try { + return await HomeService.changeHomeBackgroundUrl(req.body); + } catch (error) { + console.log(error); + } + } } export default new HomeController(); diff --git a/index.js b/index.js index 5f01224..023c6ea 100644 --- a/index.js +++ b/index.js @@ -30,6 +30,17 @@ wss.on('connection', (ws) => { ); }); break; + case 'getHomeBackgroundUrl': + const homeBackgroundUrl = await HomeController.getHomeBackgroundUrl(); + wss.clients.forEach((client) => { + client.send( + JSON.stringify({ + event: 'getHomeBackgroundUrl', + data: homeBackgroundUrl + }) + ); + }); + break; case 'createHomeEntity': const createdHomeEntity = await HomeController.createEntity(req); wss.clients.forEach((client) => { @@ -74,6 +85,17 @@ wss.on('connection', (ws) => { ); }); break; + case 'changeHomeBackgroundUrl': + await HomeController.changeHomeBackgroundUrl(req); + wss.clients.forEach((client) => { + client.send( + JSON.stringify({ + event: 'changeHomeBackgroundUrl', + data: { ...req.body } + }) + ); + }); + break; } }); }); diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 6d0b2b5..7d9d943 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -12,7 +12,6 @@ generator client { datasource db { provider = "postgresql" url = env("DATABASE_URL") - directUrl = env("DIRECT_URL") } model User { @@ -35,10 +34,19 @@ model Home_entity { entity_type String title String? text String? @db.Text - image_data String? @db.Text + text_size String? + paragraph_size String? + text_position String? + image_url String? @db.Text image_width Int? image_height Int? image_position String? + image_scale String? table_columns Json? table_data Json? } + +model Setting { + setting_name String @unique + setting_value String +} diff --git a/services/homeService.js b/services/homeService.js index e0c2298..af767e0 100644 --- a/services/homeService.js +++ b/services/homeService.js @@ -8,8 +8,14 @@ class HomeService { orderBy: [{ entity_order: 'asc' }] }); } + async getHomeBackgroundUrl() { + return prisma.setting.findFirst({ + where: { + setting_name: 'homeBackgroundUrl' + } + }); + } async createEntity(body) { - console.log('body: ', body); return prisma.home_entity.create({ data: body }); } async editEntity(body) { @@ -38,12 +44,10 @@ class HomeService { orderBy: [{ entity_order: 'asc' }] }); const currentEntity = allEntities.find((entity) => entity.entity_uuid === body.entity_uuid); - console.log('currentEntity: ', currentEntity); const nextEntity = body.direction === 'up' ? allEntities.reverse().find((entity) => entity.entity_order < currentEntity.entity_order) : allEntities.find((entity) => entity.entity_order > currentEntity.entity_order); - console.log('nextEntity: ', nextEntity); await prisma.home_entity.update({ where: { entity_uuid: currentEntity.entity_uuid @@ -52,7 +56,6 @@ class HomeService { entity_order: nextEntity.entity_order } }); - // await Home_entity.upsert({...currentEntity, entity_order: nextEntity.entity_order}); await prisma.home_entity.update({ where: { entity_uuid: nextEntity.entity_uuid @@ -61,9 +64,24 @@ class HomeService { entity_order: currentEntity.entity_order } }); - // await Home_entity.upsert({...nextEntity, entity_order: currentEntity.entity_order}); return body; } + async changeHomeBackgroundUrl(body) { + const homeBackgroundUrl = await prisma.setting.findFirst({ + where: { + setting_name: 'homeBackgroundUrl' + } + }); + if (homeBackgroundUrl) { + return prisma.setting.update({ + where: { + setting_name: 'homeBackgroundUrl' + }, + data: { ...body } + }); + } + return prisma.setting.create({ data: { ...body } }); + } } export default new HomeService(); -- GitLab From fe37ed50e6677233e2b0b4446b3d804c4409bdc8 Mon Sep 17 00:00:00 2001 From: "d.malygin" Date: Fri, 23 Aug 2024 13:12:07 +0500 Subject: [PATCH 3/5] started trying to fix url size --- .env | 8 ++++++-- prisma/schema.prisma | 8 +++++--- services/homeService.js | 16 +++++++++++++++- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/.env b/.env index 7385ade..b44961f 100644 --- a/.env +++ b/.env @@ -4,6 +4,10 @@ DB_USER=postgres DB_PASSWORD=xoxo2002! DB_HOST=localhost DB_PORT=5432 +// prisma db push +; при запуске с родного ноутбука +; DATABASE_URL="postgresql://postgres:xoxo2002!@localhost:5432/Shelf_note" -DATABASE_URL="postgresql://postgres:xoxo2002!@localhost:5432/Shelf_note" - +; при запуске с рабочего ноутбука +DATABASE_URL="postgresql://postgres.wrwwvdgppriodcdoyohp:Xoxo2002!qwe@aws-0-eu-central-1.pooler.supabase.com:6543/postgres?pgbouncer=true" +DIRECT_URL="postgresql://postgres.wrwwvdgppriodcdoyohp:Xoxo2002!qwe@aws-0-eu-central-1.pooler.supabase.com:5432/postgres" diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 7d9d943..14e2031 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -4,7 +4,6 @@ // 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 -// prisma db push generator client { provider = "prisma-client-js" } @@ -12,6 +11,8 @@ generator client { datasource db { provider = "postgresql" url = env("DATABASE_URL") + // при запуске с рабочего ноутбука + directUrl = env("DIRECT_URL") } model User { @@ -34,13 +35,14 @@ model Home_entity { entity_type String title String? text String? @db.Text - text_size String? + font_size String? paragraph_size String? text_position String? image_url String? @db.Text image_width Int? image_height Int? - image_position String? + entity_position String? + entity_title_position String? image_scale String? table_columns Json? table_data Json? diff --git a/services/homeService.js b/services/homeService.js index af767e0..2862ea2 100644 --- a/services/homeService.js +++ b/services/homeService.js @@ -1,4 +1,6 @@ import { PrismaClient } from '@prisma/client'; +import * as fs from 'node:fs'; +import path from 'node:path'; const prisma = new PrismaClient(); @@ -16,7 +18,19 @@ class HomeService { }); } async createEntity(body) { - return prisma.home_entity.create({ data: body }); + let pathOfImage = ''; + if (body.image_url) { + console.log('body.image_url', body.image_url); + // const response = await fetch(body.image_url); + // const blob = await body.image_url.blob(); + const arrayBuffer = new ArrayBuffer(body.image_url); + // const arrayBuffer = await body.image_url.arrayBuffer(); + const buffer = Buffer.from(arrayBuffer); + pathOfImage = path.join(path.resolve(), `/public/images/${body.entity_uuid}`); + console.log('pathOfImage', pathOfImage); + fs.writeFile(pathOfImage, buffer, () => console.log('Written!')); + } + return prisma.home_entity.create({ data: { ...body, image_url: pathOfImage } }); } async editEntity(body) { return prisma.home_entity.update({ -- GitLab From db04abb922cd2dfebd2da4cff76880598cf7a4a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9=20=D0=9C=D0=B0?= =?UTF-8?q?=D0=BB=D1=8E=D0=B3=D0=B8=D0=BD?= Date: Sun, 25 Aug 2024 19:50:34 +0500 Subject: [PATCH 4/5] trying and trying... --- .env | 9 +-- controllers/homeController.js | 7 +++ index.js | 104 ++++++++++++++++------------------ prisma/schema.prisma | 2 +- services/homeService.js | 51 ++++++++++++----- 5 files changed, 99 insertions(+), 74 deletions(-) diff --git a/.env b/.env index b44961f..329b101 100644 --- a/.env +++ b/.env @@ -1,13 +1,14 @@ PORT=5000 +FILES_PORT=5001 DB_NAME=Shelf_note DB_USER=postgres DB_PASSWORD=xoxo2002! DB_HOST=localhost DB_PORT=5432 -// prisma db push -; при запуске с родного ноутбука -; DATABASE_URL="postgresql://postgres:xoxo2002!@localhost:5432/Shelf_note" +# prisma db push +# при запуске с родного ноутбука +# DATABASE_URL="postgresql://postgres:xoxo2002!@localhost:5432/Shelf_note" -; при запуске с рабочего ноутбука +# при запуске с рабочего ноутбука DATABASE_URL="postgresql://postgres.wrwwvdgppriodcdoyohp:Xoxo2002!qwe@aws-0-eu-central-1.pooler.supabase.com:6543/postgres?pgbouncer=true" DIRECT_URL="postgresql://postgres.wrwwvdgppriodcdoyohp:Xoxo2002!qwe@aws-0-eu-central-1.pooler.supabase.com:5432/postgres" diff --git a/controllers/homeController.js b/controllers/homeController.js index ff8c524..1f2a697 100644 --- a/controllers/homeController.js +++ b/controllers/homeController.js @@ -24,6 +24,13 @@ class HomeController { console.log(error); } } + async createImageEntity(req) { + try { + return await HomeService.createImageEntity(req); + } catch (error) { + console.log(error); + } + } async editEntity(req) { try { return await HomeService.editEntity(req.body); diff --git a/index.js b/index.js index 023c6ea..2dd18a3 100644 --- a/index.js +++ b/index.js @@ -2,7 +2,8 @@ import 'dotenv/config'; import { WebSocketServer } from 'ws'; import HomeController from './controllers/homeController.js'; -const PORT = process.env.PORT || 5432; +const PORT = process.env.PORT || 5000; +const FILES_PORT = process.env.FILES_PORT || 5001; const users = new Set(); @@ -13,89 +14,80 @@ const wss = new WebSocketServer( () => console.log(`Started listen on port ${PORT}`) ); +const filesWss = new WebSocketServer( + { + port: FILES_PORT + }, + () => console.log(`Started listen on port ${FILES_PORT}`) +); + wss.on('connection', (ws) => { users.add(ws); ws.id = Date.now(); ws.on('message', async (req) => { req = JSON.parse(req); + console.log('req: ', req); switch (req.event) { case 'getHomeEntities': const getHomeEntitiesData = await HomeController.getEntities(); - wss.clients.forEach((client) => { - client.send( - JSON.stringify({ - event: 'getHomeEntities', - data: getHomeEntitiesData - }) - ); + getHomeEntitiesData.entitiesImages.forEach((entityBlob) => { + submitFilesToUsers(entityBlob); }); + submitToUsers('getHomeEntities', getHomeEntitiesData.entities); break; case 'getHomeBackgroundUrl': const homeBackgroundUrl = await HomeController.getHomeBackgroundUrl(); - wss.clients.forEach((client) => { - client.send( - JSON.stringify({ - event: 'getHomeBackgroundUrl', - data: homeBackgroundUrl - }) - ); - }); + submitToUsers('getHomeBackgroundUrl', homeBackgroundUrl); break; case 'createHomeEntity': const createdHomeEntity = await HomeController.createEntity(req); - wss.clients.forEach((client) => { - client.send( - JSON.stringify({ - event: 'createHomeEntity', - data: createdHomeEntity - }) - ); - }); + submitToUsers('createHomeEntity', createdHomeEntity); break; case 'editHomeEntity': const editedHomeEntity = await HomeController.editEntity(req); - wss.clients.forEach((client) => { - client.send( - JSON.stringify({ - event: 'editHomeEntity', - data: editedHomeEntity - }) - ); - }); + submitToUsers('editHomeEntity', editedHomeEntity); break; case 'deleteHomeEntity': const deletedHomeEntity = await HomeController.deleteEntity(req); - wss.clients.forEach((client) => { - client.send( - JSON.stringify({ - event: 'deleteHomeEntity', - data: deletedHomeEntity - }) - ); - }); + submitToUsers('deleteHomeEntity', deletedHomeEntity); break; case 'changeOrderHomeEntity': await HomeController.changeOrderEntity(req); - wss.clients.forEach((client) => { - client.send( - JSON.stringify({ - event: 'changeOrderHomeEntity', - data: { ...req.body } - }) - ); - }); + submitToUsers('changeOrderHomeEntity', { ...req.body }); break; case 'changeHomeBackgroundUrl': await HomeController.changeHomeBackgroundUrl(req); - wss.clients.forEach((client) => { - client.send( - JSON.stringify({ - event: 'changeHomeBackgroundUrl', - data: { ...req.body } - }) - ); - }); + submitToUsers('changeHomeBackgroundUrl', { ...req.body }); break; } }); }); + +filesWss.on('connection', (ws) => { + users.add(ws); + console.log('users: ', users.size); + ws.on('message', async (req) => { + console.log('req', req); + await HomeController.createImageEntity(req); + submitToUsers('createImageHomeEntity', 'Post data of image, please'); + }); +}); + +function submitToUsers(event, data) { + console.log('data in submitToUsers:', data); + wss.clients.forEach((client) => { + client.send( + JSON.stringify({ + event: event, + data: data + }) + ); + }); +} + +function submitFilesToUsers(data) { + console.log('submitFilesToUsers', data); + filesWss.clients.forEach((client) => { + client.send(data); + }); +} diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 14e2031..1c09602 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -38,7 +38,7 @@ model Home_entity { font_size String? paragraph_size String? text_position String? - image_url String? @db.Text + image_path String? @db.Text image_width Int? image_height Int? entity_position String? diff --git a/services/homeService.js b/services/homeService.js index 2862ea2..e8a9fd8 100644 --- a/services/homeService.js +++ b/services/homeService.js @@ -6,9 +6,26 @@ const prisma = new PrismaClient(); class HomeService { async getEntities() { - return prisma.home_entity.findMany({ + const entitiesDB = await prisma.home_entity.findMany({ orderBy: [{ entity_order: 'asc' }] }); + const entitiesImages = []; + const entitiesToReturn = entitiesDB.map((entity) => { + if (!entity.image_width) return entity; + const imagePath = path.join(path.resolve(), `/public/images/${entity.entity_uuid}.jpg`); + const file = fs.readFileSync(imagePath); + console.log('file in readFile: ', file); + // const blob = new Blob([file], { type: 'image/jpeg' }); + // console.log('blob: ', blob); + const buffer = Buffer.from(file, 'base64'); + entitiesImages.push(buffer); + console.log('entitiesImages', entitiesImages); + return entity; + }); + return { + entities: entitiesToReturn, + entitiesImages: entitiesImages + }; } async getHomeBackgroundUrl() { return prisma.setting.findFirst({ @@ -18,19 +35,27 @@ class HomeService { }); } async createEntity(body) { - let pathOfImage = ''; - if (body.image_url) { - console.log('body.image_url', body.image_url); - // const response = await fetch(body.image_url); - // const blob = await body.image_url.blob(); - const arrayBuffer = new ArrayBuffer(body.image_url); - // const arrayBuffer = await body.image_url.arrayBuffer(); - const buffer = Buffer.from(arrayBuffer); - pathOfImage = path.join(path.resolve(), `/public/images/${body.entity_uuid}`); - console.log('pathOfImage', pathOfImage); - fs.writeFile(pathOfImage, buffer, () => console.log('Written!')); + if (body.image_blob) { + const imagePath = path.join(path.resolve(), `/public/images/image.jpg`); + let newImagePath = imagePath.split('\\'); + newImagePath.splice(-1); + console.log('1 newImagePath', newImagePath); + newImagePath.push(`${body.entity_uuid}.jpg`); + console.log('2 newImagePath', newImagePath); + newImagePath = newImagePath.join('\\'); + console.log('3 newImagePath', newImagePath); + fs.rename(imagePath, newImagePath, function (err) { + if (err) console.log('ERROR in fs.rename: ' + err); + }); + delete body.image_blob; + body.image_path = newImagePath; + console.log('body image: ', body); } - return prisma.home_entity.create({ data: { ...body, image_url: pathOfImage } }); + return prisma.home_entity.create({ data: { ...body } }); + } + async createImageEntity(body) { + const imagePath = path.join(path.resolve(), `/public/images/image.jpg`); + fs.writeFileSync(imagePath, body); } async editEntity(body) { return prisma.home_entity.update({ -- GitLab From 6db15a6a5d127d5b9e0ad65160af260b886dd32a Mon Sep 17 00:00:00 2001 From: malyusgun Date: Wed, 28 Aug 2024 17:28:53 +0500 Subject: [PATCH 5/5] fix issue with images --- .env | 4 +- .gitignore | 1 + controllers/homeController.js | 38 ++-- index.js | 44 +++-- prisma/schema.prisma | 7 +- services/homeService.js | 112 ++++++++---- yarn.lock | 331 +++++++++++++++++++++++++++++++++- 7 files changed, 467 insertions(+), 70 deletions(-) diff --git a/.env b/.env index 329b101..8133a82 100644 --- a/.env +++ b/.env @@ -7,8 +7,8 @@ DB_HOST=localhost DB_PORT=5432 # prisma db push # при запуске с родного ноутбука -# DATABASE_URL="postgresql://postgres:xoxo2002!@localhost:5432/Shelf_note" + DATABASE_URL="postgresql://postgres:xoxo2002!@localhost:5432/Shelf_note" # при запуске с рабочего ноутбука -DATABASE_URL="postgresql://postgres.wrwwvdgppriodcdoyohp:Xoxo2002!qwe@aws-0-eu-central-1.pooler.supabase.com:6543/postgres?pgbouncer=true" +# DATABASE_URL="postgresql://postgres.wrwwvdgppriodcdoyohp:Xoxo2002!qwe@aws-0-eu-central-1.pooler.supabase.com:6543/postgres?pgbouncer=true" DIRECT_URL="postgresql://postgres.wrwwvdgppriodcdoyohp:Xoxo2002!qwe@aws-0-eu-central-1.pooler.supabase.com:5432/postgres" diff --git a/.gitignore b/.gitignore index 9d78a2b..5288bc4 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ yarn-error.log* pnpm-debug.log* lerna-debug.log* +public node_modules .DS_Store dist diff --git a/controllers/homeController.js b/controllers/homeController.js index 1f2a697..0250e88 100644 --- a/controllers/homeController.js +++ b/controllers/homeController.js @@ -1,17 +1,31 @@ import HomeService from '../services/homeService.js'; class HomeController { - async getEntities() { + async getHomeBackground() { try { - return await HomeService.getEntities(); + return await HomeService.getHomeBackground(); } catch (error) { console.log(error); return error; } } - async getHomeBackgroundUrl() { + async changeHomeBackground(req) { + try { + return await HomeService.changeHomeBackground(req.body); + } catch (error) { + console.log(error); + } + } + async removeHomeBackground() { + try { + await HomeService.removeHomeBackground(); + } catch (error) { + console.log(error); + } + } + async getEntities() { try { - return await HomeService.getHomeBackgroundUrl(); + return await HomeService.getEntities(); } catch (error) { console.log(error); return error; @@ -24,9 +38,9 @@ class HomeController { console.log(error); } } - async createImageEntity(req) { + async createImage(req) { try { - return await HomeService.createImageEntity(req); + return await HomeService.createImage(req); } catch (error) { console.log(error); } @@ -38,23 +52,23 @@ class HomeController { console.log(error); } } - async deleteEntity(req) { + async cropImage(req) { try { - return await HomeService.deleteEntity(req.body); + return await HomeService.cropImage(req.body); } catch (error) { console.log(error); } } - async changeOrderEntity(req) { + async deleteEntity(req) { try { - return await HomeService.changeOrderEntity(req.body); + return await HomeService.deleteEntity(req.body); } catch (error) { console.log(error); } } - async changeHomeBackgroundUrl(req) { + async changeOrderEntity(req) { try { - return await HomeService.changeHomeBackgroundUrl(req.body); + return await HomeService.changeOrderEntity(req.body); } catch (error) { console.log(error); } diff --git a/index.js b/index.js index 2dd18a3..3b9e5ba 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,8 @@ import 'dotenv/config'; import { WebSocketServer } from 'ws'; import HomeController from './controllers/homeController.js'; +import path from 'node:path'; +import fs from 'node:fs'; const PORT = process.env.PORT || 5000; const FILES_PORT = process.env.FILES_PORT || 5001; @@ -26,27 +28,40 @@ wss.on('connection', (ws) => { ws.id = Date.now(); ws.on('message', async (req) => { req = JSON.parse(req); - console.log('req: ', req); + // console.log('req: ', req); switch (req.event) { + case 'getHomeBackground': + const homeBackground = await HomeController.getHomeBackground(); + submitFilesToUsers(homeBackground); + break; + case 'changeHomeBackground': + await HomeController.changeHomeBackground(req); + submitToUsers('changeHomeBackground', { ...req.body }); + break; + case 'removeHomeBackground': + await HomeController.removeHomeBackground(); + break; case 'getHomeEntities': const getHomeEntitiesData = await HomeController.getEntities(); - getHomeEntitiesData.entitiesImages.forEach((entityBlob) => { - submitFilesToUsers(entityBlob); + getHomeEntitiesData.entitiesImages.forEach((entityBuffer) => { + submitFilesToUsers(entityBuffer); }); submitToUsers('getHomeEntities', getHomeEntitiesData.entities); break; - case 'getHomeBackgroundUrl': - const homeBackgroundUrl = await HomeController.getHomeBackgroundUrl(); - submitToUsers('getHomeBackgroundUrl', homeBackgroundUrl); - break; case 'createHomeEntity': const createdHomeEntity = await HomeController.createEntity(req); submitToUsers('createHomeEntity', createdHomeEntity); break; - case 'editHomeEntity': + case 'editHomeEntity': { const editedHomeEntity = await HomeController.editEntity(req); submitToUsers('editHomeEntity', editedHomeEntity); break; + } + case 'cropImage': { + const editedHomeEntity = await HomeController.cropImage(req); + submitToUsers('editHomeEntity', editedHomeEntity); + break; + } case 'deleteHomeEntity': const deletedHomeEntity = await HomeController.deleteEntity(req); submitToUsers('deleteHomeEntity', deletedHomeEntity); @@ -55,10 +70,6 @@ wss.on('connection', (ws) => { await HomeController.changeOrderEntity(req); submitToUsers('changeOrderHomeEntity', { ...req.body }); break; - case 'changeHomeBackgroundUrl': - await HomeController.changeHomeBackgroundUrl(req); - submitToUsers('changeHomeBackgroundUrl', { ...req.body }); - break; } }); }); @@ -67,14 +78,14 @@ filesWss.on('connection', (ws) => { users.add(ws); console.log('users: ', users.size); ws.on('message', async (req) => { - console.log('req', req); - await HomeController.createImageEntity(req); - submitToUsers('createImageHomeEntity', 'Post data of image, please'); + console.log('req: ', req); + await HomeController.createImage(req); + submitToUsers('createImageHomeEntity', ''); }); }); function submitToUsers(event, data) { - console.log('data in submitToUsers:', data); + // console.log('data in submitToUsers:', data); wss.clients.forEach((client) => { client.send( JSON.stringify({ @@ -86,7 +97,6 @@ function submitToUsers(event, data) { } function submitFilesToUsers(data) { - console.log('submitFilesToUsers', data); filesWss.clients.forEach((client) => { client.send(data); }); diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 1c09602..5d5d201 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -12,7 +12,7 @@ datasource db { provider = "postgresql" url = env("DATABASE_URL") // при запуске с рабочего ноутбука - directUrl = env("DIRECT_URL") + // directUrl = env("DIRECT_URL") } model User { @@ -24,13 +24,11 @@ model User { email String? phone_number String? settings Json? - home_entities Home_entity[] + home_entities Json? } model Home_entity { entity_uuid String @id @default(uuid()) - entity_user User? @relation(fields: [user_nick_name], references: [nick_name]) - user_nick_name String? @unique entity_order Int @default(autoincrement()) entity_type String title String? @@ -49,6 +47,7 @@ model Home_entity { } model Setting { + setting_uuid String @id @default(uuid()) setting_name String @unique setting_value String } diff --git a/services/homeService.js b/services/homeService.js index e8a9fd8..e66810c 100644 --- a/services/homeService.js +++ b/services/homeService.js @@ -5,6 +5,55 @@ import path from 'node:path'; const prisma = new PrismaClient(); class HomeService { + async getHomeBackground() { + const backgroundInfo = await prisma.setting.findFirst({ + where: { + setting_name: 'homeBackground' + } + }); + if (backgroundInfo?.setting_value) { + const file = fs.readFileSync(backgroundInfo.setting_value); + return Buffer.from(file, 'base64'); + } + } + async changeHomeBackground(body) { + console.log('body in changeHomeBackground: ', body); + const response = await fetch(body.setting_value); + const blob = await response.blob(); + const arrayBuffer = await blob.arrayBuffer(); + const buffer = Buffer.from(arrayBuffer); + const extension = body.extension.split('/')[1]; + const imagePath = path.join(path.resolve(), `/public/images/backgrounds/homeBackground.jpg`); + fs.writeFileSync(imagePath, buffer); + + delete body.extension; + body.setting_value = imagePath; + const homeBackground = await prisma.setting.findFirst({ + where: { + setting_name: 'homeBackground' + } + }); + if (homeBackground) { + return prisma.setting.update({ + where: { + setting_name: 'homeBackground' + }, + data: { ...body } + }); + } + return prisma.setting.create({ data: { ...body } }); + } + async removeHomeBackground() { + const imagePath = path.join(path.resolve(), `/public/images/backgrounds/homeBackground.jpg`); + fs.unlink(imagePath, (err) => { + if (err) throw err; + }); + await prisma.setting.delete({ + where: { + setting_name: 'homeBackground' + } + }); + } async getEntities() { const entitiesDB = await prisma.home_entity.findMany({ orderBy: [{ entity_order: 'asc' }] @@ -14,12 +63,12 @@ class HomeService { if (!entity.image_width) return entity; const imagePath = path.join(path.resolve(), `/public/images/${entity.entity_uuid}.jpg`); const file = fs.readFileSync(imagePath); - console.log('file in readFile: ', file); + // console.log('file in readFile: ', file); // const blob = new Blob([file], { type: 'image/jpeg' }); // console.log('blob: ', blob); const buffer = Buffer.from(file, 'base64'); entitiesImages.push(buffer); - console.log('entitiesImages', entitiesImages); + // console.log('entitiesImages', entitiesImages); return entity; }); return { @@ -27,36 +76,45 @@ class HomeService { entitiesImages: entitiesImages }; } - async getHomeBackgroundUrl() { - return prisma.setting.findFirst({ - where: { - setting_name: 'homeBackgroundUrl' - } - }); - } async createEntity(body) { - if (body.image_blob) { + if (body.image_buffer) { const imagePath = path.join(path.resolve(), `/public/images/image.jpg`); - let newImagePath = imagePath.split('\\'); + let newImagePath = imagePath.split('/'); newImagePath.splice(-1); - console.log('1 newImagePath', newImagePath); newImagePath.push(`${body.entity_uuid}.jpg`); - console.log('2 newImagePath', newImagePath); - newImagePath = newImagePath.join('\\'); - console.log('3 newImagePath', newImagePath); + newImagePath = newImagePath.join('/'); + console.log('imagePath', imagePath); + console.log('newImagePath', newImagePath); fs.rename(imagePath, newImagePath, function (err) { if (err) console.log('ERROR in fs.rename: ' + err); }); - delete body.image_blob; + delete body.image_buffer; body.image_path = newImagePath; console.log('body image: ', body); } return prisma.home_entity.create({ data: { ...body } }); } - async createImageEntity(body) { + // единственная функция, срабатывающая по сокету для файлов + async createImage(body) { const imagePath = path.join(path.resolve(), `/public/images/image.jpg`); fs.writeFileSync(imagePath, body); } + async cropImage(body) { + const imagePath = path.join(path.resolve(), `/public/images/image.jpg`); + fs.unlink(body.image_path, (err) => { + if (err) throw err; + }); + fs.rename(imagePath, body.image_path, function (err) { + if (err) throw err; + }); + delete body.imageUrl; + return prisma.home_entity.update({ + where: { + entity_uuid: body.entity_uuid + }, + data: { ...body } + }); + } async editEntity(body) { return prisma.home_entity.update({ where: { @@ -76,6 +134,10 @@ class HomeService { entity_uuid: body.entity_uuid } }); + if (body.image_width) + fs.unlink(body.image_path, (err) => { + if (err) throw err; + }); return deletedEntity; } async changeOrderEntity(body) { @@ -105,22 +167,6 @@ class HomeService { }); return body; } - async changeHomeBackgroundUrl(body) { - const homeBackgroundUrl = await prisma.setting.findFirst({ - where: { - setting_name: 'homeBackgroundUrl' - } - }); - if (homeBackgroundUrl) { - return prisma.setting.update({ - where: { - setting_name: 'homeBackgroundUrl' - }, - data: { ...body } - }); - } - return prisma.setting.create({ data: { ...body } }); - } } export default new HomeService(); diff --git a/yarn.lock b/yarn.lock index 3346599..41a4664 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,31 @@ # yarn lockfile v1 +"@cspotcode/source-map-support@^0.8.0": + version "0.8.1" + resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" + integrity sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw== + dependencies: + "@jridgewell/trace-mapping" "0.3.9" + +"@jridgewell/resolve-uri@^3.0.3": + version "3.1.2" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz#7a0ee601f60f99a20c7c7c5ff0c80388c1189bd6" + integrity sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw== + +"@jridgewell/sourcemap-codec@^1.4.10": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz#3188bcb273a414b0d215fd22a58540b989b9409a" + integrity sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ== + +"@jridgewell/trace-mapping@0.3.9": + version "0.3.9" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz#6534fd5933a53ba7cbf3a17615e273a0d1273ff9" + integrity sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ== + dependencies: + "@jridgewell/resolve-uri" "^3.0.3" + "@jridgewell/sourcemap-codec" "^1.4.10" + "@prisma/client@^5.18.0": version "5.18.0" resolved "https://registry.npmjs.org/@prisma/client/-/client-5.18.0.tgz" @@ -43,6 +68,103 @@ dependencies: "@prisma/debug" "5.18.0" +"@tsconfig/node10@^1.0.7": + version "1.0.11" + resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.11.tgz#6ee46400685f130e278128c7b38b7e031ff5b2f2" + integrity sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw== + +"@tsconfig/node12@^1.0.7": + version "1.0.11" + resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.11.tgz#ee3def1f27d9ed66dac6e46a295cffb0152e058d" + integrity sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag== + +"@tsconfig/node14@^1.0.0": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.3.tgz#e4386316284f00b98435bf40f72f75a09dabf6c1" + integrity sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow== + +"@tsconfig/node16@^1.0.2": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.4.tgz#0b92dcc0cc1c81f6f306a381f28e31b1a56536e9" + integrity sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA== + +"@types/node@^22.3.0": + version "22.5.0" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.5.0.tgz#10f01fe9465166b4cab72e75f60d8b99d019f958" + integrity sha512-DkFrJOe+rfdHTqqMg0bSNlGlQ85hSoh2TPzZyhHsXnMtligRWpxUySiyw8FY14ITt24HVCiQPWxS3KO/QlGmWg== + dependencies: + undici-types "~6.19.2" + +acorn-walk@^8.1.1: + version "8.3.3" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.3.tgz#9caeac29eefaa0c41e3d4c65137de4d6f34df43e" + integrity sha512-MxXdReSRhGO7VlFe1bRG/oI7/mdLV9B9JJT0N8vZOhF7gFRR5l3M8W9G8JxmKV+JC5mGqJ0QvqfSOLsCPa4nUw== + dependencies: + acorn "^8.11.0" + +acorn@^8.11.0, acorn@^8.4.1: + version "8.12.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.12.1.tgz#71616bdccbe25e27a54439e0046e89ca76df2248" + integrity sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg== + +anymatch@~3.1.2: + version "3.1.3" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" + integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== + dependencies: + normalize-path "^3.0.0" + picomatch "^2.0.4" + +arg@^4.1.0: + version "4.1.3" + resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" + integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== + +balanced-match@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" + integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== + +binary-extensions@^2.0.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.3.0.tgz#f6e14a97858d327252200242d4ccfe522c445522" + integrity sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw== + +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +braces@~3.0.2: + version "3.0.3" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" + integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== + dependencies: + fill-range "^7.1.1" + +chokidar@^3.5.2: + version "3.6.0" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.6.0.tgz#197c6cc669ef2a8dc5e7b4d97ee4e092c3eb0d5b" + integrity sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw== + dependencies: + anymatch "~3.1.2" + braces "~3.0.2" + glob-parent "~5.1.2" + is-binary-path "~2.1.0" + is-glob "~4.0.1" + normalize-path "~3.0.0" + readdirp "~3.6.0" + optionalDependencies: + fsevents "~2.3.2" + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== + cors@^2.8.5: version "2.8.5" resolved "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz" @@ -51,11 +173,119 @@ cors@^2.8.5: object-assign "^4" vary "^1" +create-require@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" + integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== + +debug@^4: + version "4.3.6" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.6.tgz#2ab2c38fbaffebf8aa95fdfe6d88438c7a13c52b" + integrity sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg== + dependencies: + ms "2.1.2" + +diff@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" + integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== + dotenv@^16.4.5: version "16.4.5" resolved "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz" integrity sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg== +fill-range@^7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" + integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg== + dependencies: + to-regex-range "^5.0.1" + +fsevents@~2.3.2: + version "2.3.3" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" + integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== + +glob-parent@~5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" + integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== + dependencies: + is-glob "^4.0.1" + +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw== + +ignore-by-default@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/ignore-by-default/-/ignore-by-default-1.0.1.tgz#48ca6d72f6c6a3af00a9ad4ae6876be3889e2b09" + integrity sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA== + +is-binary-path@~2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" + integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== + dependencies: + binary-extensions "^2.0.0" + +is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== + +is-glob@^4.0.1, is-glob@~4.0.1: + version "4.0.3" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" + integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== + dependencies: + is-extglob "^2.1.1" + +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + +make-error@^1.1.1: + version "1.3.6" + resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" + integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== + +minimatch@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" + integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== + dependencies: + brace-expansion "^1.1.7" + +ms@2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + +nodemon@^3.1.4: + version "3.1.4" + resolved "https://registry.yarnpkg.com/nodemon/-/nodemon-3.1.4.tgz#c34dcd8eb46a05723ccde60cbdd25addcc8725e4" + integrity sha512-wjPBbFhtpJwmIeY2yP7QF+UKzPfltVGtfce1g/bB15/8vCGZj8uxD62b/b9M9/WVgme0NZudpownKN+c0plXlQ== + dependencies: + chokidar "^3.5.2" + debug "^4" + ignore-by-default "^1.0.1" + minimatch "^3.1.2" + pstree.remy "^1.1.8" + semver "^7.5.3" + simple-update-notifier "^2.0.0" + supports-color "^5.5.0" + touch "^3.1.0" + undefsafe "^2.0.5" + +normalize-path@^3.0.0, normalize-path@~3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" + integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== + object-assign@^4: version "4.1.1" resolved "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz" @@ -104,7 +334,7 @@ pg-types@^2.1.0: postgres-date "~1.0.4" postgres-interval "^1.1.0" -pg@^8.12.0, pg@>=8.0: +pg@^8.12.0: version "8.12.0" resolved "https://registry.npmjs.org/pg/-/pg-8.12.0.tgz" integrity sha512-A+LHUSnwnxrnL/tZ+OLfqR1SxLN3c/pgDztZ47Rpbsd4jUytsTtwQo/TLPRzPJMp/1pbhYVhH9cuSZLAajNfjQ== @@ -124,6 +354,11 @@ pgpass@1.x: dependencies: split2 "^4.1.0" +picomatch@^2.0.4, picomatch@^2.2.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" + integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== + postgres-array@~2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz" @@ -146,23 +381,110 @@ postgres-interval@^1.1.0: dependencies: xtend "^4.0.0" -prisma@*, prisma@^5.18.0: +prettier@^3.3.3: + version "3.3.3" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.3.3.tgz#30c54fe0be0d8d12e6ae61dbb10109ea00d53105" + integrity sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew== + +prisma@^5.18.0: version "5.18.0" resolved "https://registry.npmjs.org/prisma/-/prisma-5.18.0.tgz" integrity sha512-+TrSIxZsh64OPOmaSgVPH7ALL9dfU0jceYaMJXsNrTkFHO7/3RANi5K2ZiPB1De9+KDxCWn7jvRq8y8pvk+o9g== dependencies: "@prisma/engines" "5.18.0" +pstree.remy@^1.1.8: + version "1.1.8" + resolved "https://registry.yarnpkg.com/pstree.remy/-/pstree.remy-1.1.8.tgz#c242224f4a67c21f686839bbdb4ac282b8373d3a" + integrity sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w== + +readdirp@~3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" + integrity sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA== + dependencies: + picomatch "^2.2.1" + +semver@^7.5.3: + version "7.6.3" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143" + integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A== + +simple-update-notifier@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz#d70b92bdab7d6d90dfd73931195a30b6e3d7cebb" + integrity sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w== + dependencies: + semver "^7.5.3" + split2@^4.1.0: version "4.2.0" resolved "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz" integrity sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg== +supports-color@^5.5.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== + dependencies: + has-flag "^3.0.0" + +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + +touch@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/touch/-/touch-3.1.1.tgz#097a23d7b161476435e5c1344a95c0f75b4a5694" + integrity sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA== + +ts-node@^10.9.2: + version "10.9.2" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.2.tgz#70f021c9e185bccdca820e26dc413805c101c71f" + integrity sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ== + dependencies: + "@cspotcode/source-map-support" "^0.8.0" + "@tsconfig/node10" "^1.0.7" + "@tsconfig/node12" "^1.0.7" + "@tsconfig/node14" "^1.0.0" + "@tsconfig/node16" "^1.0.2" + acorn "^8.4.1" + acorn-walk "^8.1.1" + arg "^4.1.0" + create-require "^1.1.0" + diff "^4.0.1" + make-error "^1.1.1" + v8-compile-cache-lib "^3.0.1" + yn "3.1.1" + +typescript@^5.5.4: + version "5.5.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.5.4.tgz#d9852d6c82bad2d2eda4fd74a5762a8f5909e9ba" + integrity sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q== + +undefsafe@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/undefsafe/-/undefsafe-2.0.5.tgz#38733b9327bdcd226db889fb723a6efd162e6e2c" + integrity sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA== + underscore@^1.13.1: version "1.13.7" resolved "https://registry.npmjs.org/underscore/-/underscore-1.13.7.tgz" integrity sha512-GMXzWtsc57XAtguZgaQViUOzs0KTkk8ojr3/xAxXLITqf/3EMwxC0inyETfDFjH/Krbhuep0HNbbjI9i/q3F3g== +undici-types@~6.19.2: + version "6.19.8" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02" + integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw== + +v8-compile-cache-lib@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" + integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg== + vary@^1: version "1.1.2" resolved "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz" @@ -177,3 +499,8 @@ xtend@^4.0.0: version "4.0.2" resolved "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz" integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== + +yn@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" + integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== -- GitLab