From e8ee74d0d7a0eb487df768a75e3fc0f76a4afa83 Mon Sep 17 00:00:00 2001 From: Abdalhamid Alhamad Date: Mon, 11 Aug 2025 15:15:41 +0300 Subject: [PATCH] refactor: remove unsed code --- client/.gitignore | 24 - client/README.md | 50 - client/eslint.config.js | 28 - client/index.html | 13 - client/package-lock.json | 4115 ----------------- client/package.json | 38 - client/public/vite.svg | 1 - client/src/App.css | 42 - client/src/App.tsx | 127 - client/src/api/client.ts | 140 - client/src/assets/react.svg | 1 - client/src/components/auth/AppleLogin.tsx | 69 - client/src/components/auth/GoogleLogin.tsx | 40 - client/src/components/auth/LoginForm.tsx | 149 - client/src/components/auth/RegisterForm.tsx | 254 - client/src/components/dashboard/Dashboard.tsx | 151 - .../components/document/DocumentUpload.tsx | 86 - .../src/components/juniors/AddJuniorForm.tsx | 266 -- client/src/components/juniors/JuniorsList.tsx | 121 - client/src/components/layout/AuthLayout.tsx | 175 - client/src/components/tasks/AddTask.tsx | 245 - client/src/components/tasks/TaskDetails.tsx | 87 - client/src/components/tasks/TasksList.tsx | 200 - client/src/contexts/AuthContext.tsx | 119 - client/src/enums/grantType.enum.ts | 6 - client/src/enums/index.ts | 1 - client/src/index.css | 52 - client/src/main.tsx | 13 - client/src/types/api.ts | 14 - client/src/types/auth.ts | 27 - client/src/types/document.ts | 9 - client/src/types/junior.ts | 41 - client/src/types/task.ts | 42 - client/src/vite-env.d.ts | 1 - client/tsconfig.app.json | 26 - client/tsconfig.json | 7 - client/tsconfig.node.json | 24 - client/vite.config.ts | 16 - src/allowance/allowance.module.ts | 20 - .../allowance-change-request.controller.ts | 81 - .../controllers/allowances.controller.ts | 73 - src/allowance/controllers/index.ts | 2 - .../create-allowance-change.request.dto.ts | 28 - .../request/create-allowance.request.dto.ts | 52 - src/allowance/dtos/request/index.ts | 2 - .../allowance-change-request.response.dto.ts | 45 - .../dtos/response/allowance.response.dto.ts | 53 - src/allowance/dtos/response/index.ts | 2 - .../allowance-change-request.entity.ts | 45 - src/allowance/entities/allowance.entity.ts | 107 - src/allowance/entities/index.ts | 2 - .../allowance-change-request-status.enum.ts | 5 - .../enums/allowance-frequency.enum.ts | 5 - src/allowance/enums/allowance-type.enum.ts | 4 - src/allowance/enums/index.ts | 3 - .../allowance-change-request.repository.ts | 50 - .../repositories/allowances.repository.ts | 64 - src/allowance/repositories/index.ts | 2 - .../allowance-change-requests.service.ts | 132 - src/allowance/services/allowances.service.ts | 110 - src/allowance/services/index.ts | 2 - src/app.module.ts | 18 +- src/cron/cron.module.ts | 7 +- src/cron/tasks/allowance.task.ts | 54 - src/cron/tasks/index.ts | 2 - src/cron/tasks/money-request.task.ts | 54 - .../internal.customer-details.response.dto.ts | 2 - src/customer/entities/customer.entity.ts | 14 - .../repositories/customer.repository.ts | 6 - src/customer/services/customer.service.ts | 43 - .../1733750228289-initial-migration.ts | 249 - .../1733990253208-seeds-default-tasks-logo.ts | 41 - .../1734247702310-seeds-goals-categories.ts | 57 - .../1754913378460-initial-migration.ts | 105 + ...s => 1754913378461-seed-default-avatar.ts} | 2 +- src/db/migrations/index.ts | 6 +- src/document/entities/document.entity.ts | 26 +- src/gift/controllers/gifts.controller.ts | 82 - src/gift/controllers/index.ts | 1 - .../dtos/request/create-gift.request.dto.ts | 32 - .../dtos/request/gift-filters.request.dto.ts | 10 - .../dtos/request/gift-reply.request.dto.ts | 9 - src/gift/dtos/request/index.ts | 3 - .../response/gift-details.response.dto.ts | 54 - .../dtos/response/gift-list.response.dto.ts | 32 - src/gift/dtos/response/index.ts | 2 - src/gift/entities/gift-redemption.entity.ts | 30 - src/gift/entities/gift-reply.entity.ts | 25 - src/gift/entities/gift.entity.ts | 83 - src/gift/entities/index.ts | 3 - src/gift/enums/gift-color.enum.ts | 6 - src/gift/enums/gift-reply-status.enum.ts | 4 - src/gift/enums/gift-status.enum.ts | 4 - src/gift/enums/index.ts | 3 - src/gift/gift.module.ts | 14 - src/gift/repositories/gifts.repository.ts | 76 - src/gift/repositories/index.ts | 1 - src/gift/services/gifts.service.ts | 139 - src/gift/services/index.ts | 1 - src/guardian/entities/guradian.entity.ts | 20 +- src/junior/entities/junior.entity.ts | 32 +- src/junior/services/junior.service.ts | 2 +- src/money-request/controllers/index.ts | 1 - .../controllers/money-requests.controller.ts | 82 - .../create-money-request.request.dto.ts | 55 - src/money-request/dtos/request/index.ts | 2 - .../money-requests-filters.request.dto.ts | 12 - .../response/money-request.response.dto.ts | 53 - src/money-request/entities/index.ts | 1 - .../entities/money-request.entity.ts | 97 - src/money-request/enums/index.ts | 2 - .../enums/money-request-frequency.enum.ts | 6 - .../enums/money-request-status.enum.ts | 5 - src/money-request/money-request.module.ts | 15 - src/money-request/repositories/index.ts | 1 - .../repositories/money-requests.repository.ts | 79 - src/money-request/services/index.ts | 1 - .../services/money-requests.service.ts | 137 - src/saving-goals/controllers/index.ts | 1 - .../controllers/saving-goals.controller.ts | 96 - .../request/create-category.request.dto.ts | 9 - .../dtos/request/create-goal.request.dto.ts | 35 - .../dtos/request/fund-goal.request.dto.ts | 10 - src/saving-goals/dtos/request/index.ts | 3 - .../response/categories-list.response.dto.ts | 16 - .../dtos/response/category-response.dto.ts | 19 - .../dtos/response/goals-stats.response.dto.ts | 15 - src/saving-goals/dtos/response/index.ts | 4 - .../saving-goal-details.response.dto.ts | 49 - src/saving-goals/entities/category.entity.ts | 41 - src/saving-goals/entities/index.ts | 2 - .../entities/saving-goal.entity.ts | 76 - src/saving-goals/enums/category-type.enum.ts | 4 - src/saving-goals/enums/index.ts | 1 - .../interfaces/goal-stats.interface.ts | 4 - src/saving-goals/interfaces/index.ts | 1 - .../repositories/category.repository.ts | 36 - src/saving-goals/repositories/index.ts | 2 - .../repositories/saving-goals.repository.ts | 54 - src/saving-goals/saving-goals.module.ts | 14 - src/saving-goals/services/category.service.ts | 43 - src/saving-goals/services/index.ts | 1 - .../services/saving-goals.service.ts | 98 - src/task/controllers/index.ts | 1 - src/task/controllers/task.controller.ts | 85 - .../dtos/request/create-task.request.dto.ts | 67 - src/task/dtos/request/index.ts | 3 - .../request/task-submission.request.dto.ts | 9 - .../tasks-filter-options.request.dto.ts | 17 - src/task/dtos/response/index.ts | 2 - .../task-submission-details.response.dto.ts | 18 - src/task/dtos/response/task.response.dto.ts | 58 - src/task/entities/index.ts | 1 - src/task/entities/task-submissions.entity.ts | 46 - src/task/entities/task.entity.ts | 90 - src/task/enums/index.ts | 2 - src/task/enums/submission-status.enum.ts | 5 - src/task/enums/task-status.enum.ts | 5 - src/task/enums/task.frequency.enum.ts | 6 - src/task/repositories/index.ts | 1 - src/task/repositories/task.repository.ts | 116 - src/task/services/index.ts | 1 - src/task/services/task.service.ts | 167 - src/task/task.module.ts | 14 - src/user/entities/index.ts | 2 +- src/user/entities/user-auth-token.entity.ts | 41 + .../user-registration-token.entity.ts | 53 - src/user/entities/user.entity.ts | 6 +- .../repositories/user-token-repository.ts | 14 +- src/user/services/user-token.service.ts | 6 +- src/user/services/user.service.ts | 2 +- src/user/user.module.ts | 4 +- 172 files changed, 177 insertions(+), 10911 deletions(-) delete mode 100644 client/.gitignore delete mode 100644 client/README.md delete mode 100644 client/eslint.config.js delete mode 100644 client/index.html delete mode 100644 client/package-lock.json delete mode 100644 client/package.json delete mode 100644 client/public/vite.svg delete mode 100644 client/src/App.css delete mode 100644 client/src/App.tsx delete mode 100644 client/src/api/client.ts delete mode 100644 client/src/assets/react.svg delete mode 100644 client/src/components/auth/AppleLogin.tsx delete mode 100644 client/src/components/auth/GoogleLogin.tsx delete mode 100644 client/src/components/auth/LoginForm.tsx delete mode 100644 client/src/components/auth/RegisterForm.tsx delete mode 100644 client/src/components/dashboard/Dashboard.tsx delete mode 100644 client/src/components/document/DocumentUpload.tsx delete mode 100644 client/src/components/juniors/AddJuniorForm.tsx delete mode 100644 client/src/components/juniors/JuniorsList.tsx delete mode 100644 client/src/components/layout/AuthLayout.tsx delete mode 100644 client/src/components/tasks/AddTask.tsx delete mode 100644 client/src/components/tasks/TaskDetails.tsx delete mode 100644 client/src/components/tasks/TasksList.tsx delete mode 100644 client/src/contexts/AuthContext.tsx delete mode 100644 client/src/enums/grantType.enum.ts delete mode 100644 client/src/enums/index.ts delete mode 100644 client/src/index.css delete mode 100644 client/src/main.tsx delete mode 100644 client/src/types/api.ts delete mode 100644 client/src/types/auth.ts delete mode 100644 client/src/types/document.ts delete mode 100644 client/src/types/junior.ts delete mode 100644 client/src/types/task.ts delete mode 100644 client/src/vite-env.d.ts delete mode 100644 client/tsconfig.app.json delete mode 100644 client/tsconfig.json delete mode 100644 client/tsconfig.node.json delete mode 100644 client/vite.config.ts delete mode 100644 src/allowance/allowance.module.ts delete mode 100644 src/allowance/controllers/allowance-change-request.controller.ts delete mode 100644 src/allowance/controllers/allowances.controller.ts delete mode 100644 src/allowance/controllers/index.ts delete mode 100644 src/allowance/dtos/request/create-allowance-change.request.dto.ts delete mode 100644 src/allowance/dtos/request/create-allowance.request.dto.ts delete mode 100644 src/allowance/dtos/request/index.ts delete mode 100644 src/allowance/dtos/response/allowance-change-request.response.dto.ts delete mode 100644 src/allowance/dtos/response/allowance.response.dto.ts delete mode 100644 src/allowance/dtos/response/index.ts delete mode 100644 src/allowance/entities/allowance-change-request.entity.ts delete mode 100644 src/allowance/entities/allowance.entity.ts delete mode 100644 src/allowance/entities/index.ts delete mode 100644 src/allowance/enums/allowance-change-request-status.enum.ts delete mode 100644 src/allowance/enums/allowance-frequency.enum.ts delete mode 100644 src/allowance/enums/allowance-type.enum.ts delete mode 100644 src/allowance/enums/index.ts delete mode 100644 src/allowance/repositories/allowance-change-request.repository.ts delete mode 100644 src/allowance/repositories/allowances.repository.ts delete mode 100644 src/allowance/repositories/index.ts delete mode 100644 src/allowance/services/allowance-change-requests.service.ts delete mode 100644 src/allowance/services/allowances.service.ts delete mode 100644 src/allowance/services/index.ts delete mode 100644 src/cron/tasks/allowance.task.ts delete mode 100644 src/cron/tasks/money-request.task.ts delete mode 100644 src/db/migrations/1733750228289-initial-migration.ts delete mode 100644 src/db/migrations/1733990253208-seeds-default-tasks-logo.ts delete mode 100644 src/db/migrations/1734247702310-seeds-goals-categories.ts create mode 100644 src/db/migrations/1754913378460-initial-migration.ts rename src/db/migrations/{1753869637732-seed-default-avatar.ts => 1754913378461-seed-default-avatar.ts} (96%) delete mode 100644 src/gift/controllers/gifts.controller.ts delete mode 100644 src/gift/controllers/index.ts delete mode 100644 src/gift/dtos/request/create-gift.request.dto.ts delete mode 100644 src/gift/dtos/request/gift-filters.request.dto.ts delete mode 100644 src/gift/dtos/request/gift-reply.request.dto.ts delete mode 100644 src/gift/dtos/request/index.ts delete mode 100644 src/gift/dtos/response/gift-details.response.dto.ts delete mode 100644 src/gift/dtos/response/gift-list.response.dto.ts delete mode 100644 src/gift/dtos/response/index.ts delete mode 100644 src/gift/entities/gift-redemption.entity.ts delete mode 100644 src/gift/entities/gift-reply.entity.ts delete mode 100644 src/gift/entities/gift.entity.ts delete mode 100644 src/gift/entities/index.ts delete mode 100644 src/gift/enums/gift-color.enum.ts delete mode 100644 src/gift/enums/gift-reply-status.enum.ts delete mode 100644 src/gift/enums/gift-status.enum.ts delete mode 100644 src/gift/enums/index.ts delete mode 100644 src/gift/gift.module.ts delete mode 100644 src/gift/repositories/gifts.repository.ts delete mode 100644 src/gift/repositories/index.ts delete mode 100644 src/gift/services/gifts.service.ts delete mode 100644 src/gift/services/index.ts delete mode 100644 src/money-request/controllers/index.ts delete mode 100644 src/money-request/controllers/money-requests.controller.ts delete mode 100644 src/money-request/dtos/request/create-money-request.request.dto.ts delete mode 100644 src/money-request/dtos/request/index.ts delete mode 100644 src/money-request/dtos/request/money-requests-filters.request.dto.ts delete mode 100644 src/money-request/dtos/response/money-request.response.dto.ts delete mode 100644 src/money-request/entities/index.ts delete mode 100644 src/money-request/entities/money-request.entity.ts delete mode 100644 src/money-request/enums/index.ts delete mode 100644 src/money-request/enums/money-request-frequency.enum.ts delete mode 100644 src/money-request/enums/money-request-status.enum.ts delete mode 100644 src/money-request/money-request.module.ts delete mode 100644 src/money-request/repositories/index.ts delete mode 100644 src/money-request/repositories/money-requests.repository.ts delete mode 100644 src/money-request/services/index.ts delete mode 100644 src/money-request/services/money-requests.service.ts delete mode 100644 src/saving-goals/controllers/index.ts delete mode 100644 src/saving-goals/controllers/saving-goals.controller.ts delete mode 100644 src/saving-goals/dtos/request/create-category.request.dto.ts delete mode 100644 src/saving-goals/dtos/request/create-goal.request.dto.ts delete mode 100644 src/saving-goals/dtos/request/fund-goal.request.dto.ts delete mode 100644 src/saving-goals/dtos/request/index.ts delete mode 100644 src/saving-goals/dtos/response/categories-list.response.dto.ts delete mode 100644 src/saving-goals/dtos/response/category-response.dto.ts delete mode 100644 src/saving-goals/dtos/response/goals-stats.response.dto.ts delete mode 100644 src/saving-goals/dtos/response/index.ts delete mode 100644 src/saving-goals/dtos/response/saving-goal-details.response.dto.ts delete mode 100644 src/saving-goals/entities/category.entity.ts delete mode 100644 src/saving-goals/entities/index.ts delete mode 100644 src/saving-goals/entities/saving-goal.entity.ts delete mode 100644 src/saving-goals/enums/category-type.enum.ts delete mode 100644 src/saving-goals/enums/index.ts delete mode 100644 src/saving-goals/interfaces/goal-stats.interface.ts delete mode 100644 src/saving-goals/interfaces/index.ts delete mode 100644 src/saving-goals/repositories/category.repository.ts delete mode 100644 src/saving-goals/repositories/index.ts delete mode 100644 src/saving-goals/repositories/saving-goals.repository.ts delete mode 100644 src/saving-goals/saving-goals.module.ts delete mode 100644 src/saving-goals/services/category.service.ts delete mode 100644 src/saving-goals/services/index.ts delete mode 100644 src/saving-goals/services/saving-goals.service.ts delete mode 100644 src/task/controllers/index.ts delete mode 100644 src/task/controllers/task.controller.ts delete mode 100644 src/task/dtos/request/create-task.request.dto.ts delete mode 100644 src/task/dtos/request/index.ts delete mode 100644 src/task/dtos/request/task-submission.request.dto.ts delete mode 100644 src/task/dtos/request/tasks-filter-options.request.dto.ts delete mode 100644 src/task/dtos/response/index.ts delete mode 100644 src/task/dtos/response/task-submission-details.response.dto.ts delete mode 100644 src/task/dtos/response/task.response.dto.ts delete mode 100644 src/task/entities/index.ts delete mode 100644 src/task/entities/task-submissions.entity.ts delete mode 100644 src/task/entities/task.entity.ts delete mode 100644 src/task/enums/index.ts delete mode 100644 src/task/enums/submission-status.enum.ts delete mode 100644 src/task/enums/task-status.enum.ts delete mode 100644 src/task/enums/task.frequency.enum.ts delete mode 100644 src/task/repositories/index.ts delete mode 100644 src/task/repositories/task.repository.ts delete mode 100644 src/task/services/index.ts delete mode 100644 src/task/services/task.service.ts delete mode 100644 src/task/task.module.ts create mode 100644 src/user/entities/user-auth-token.entity.ts delete mode 100644 src/user/entities/user-registration-token.entity.ts diff --git a/client/.gitignore b/client/.gitignore deleted file mode 100644 index a547bf3..0000000 --- a/client/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -pnpm-debug.log* -lerna-debug.log* - -node_modules -dist -dist-ssr -*.local - -# Editor directories and files -.vscode/* -!.vscode/extensions.json -.idea -.DS_Store -*.suo -*.ntvs* -*.njsproj -*.sln -*.sw? diff --git a/client/README.md b/client/README.md deleted file mode 100644 index 74872fd..0000000 --- a/client/README.md +++ /dev/null @@ -1,50 +0,0 @@ -# React + TypeScript + Vite - -This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. - -Currently, two official plugins are available: - -- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh -- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh - -## Expanding the ESLint configuration - -If you are developing a production application, we recommend updating the configuration to enable type aware lint rules: - -- Configure the top-level `parserOptions` property like this: - -```js -export default tseslint.config({ - languageOptions: { - // other options... - parserOptions: { - project: ['./tsconfig.node.json', './tsconfig.app.json'], - tsconfigRootDir: import.meta.dirname, - }, - }, -}) -``` - -- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked` -- Optionally add `...tseslint.configs.stylisticTypeChecked` -- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config: - -```js -// eslint.config.js -import react from 'eslint-plugin-react' - -export default tseslint.config({ - // Set the react version - settings: { react: { version: '18.3' } }, - plugins: { - // Add the react plugin - react, - }, - rules: { - // other rules... - // Enable its recommended rules - ...react.configs.recommended.rules, - ...react.configs['jsx-runtime'].rules, - }, -}) -``` diff --git a/client/eslint.config.js b/client/eslint.config.js deleted file mode 100644 index 092408a..0000000 --- a/client/eslint.config.js +++ /dev/null @@ -1,28 +0,0 @@ -import js from '@eslint/js' -import globals from 'globals' -import reactHooks from 'eslint-plugin-react-hooks' -import reactRefresh from 'eslint-plugin-react-refresh' -import tseslint from 'typescript-eslint' - -export default tseslint.config( - { ignores: ['dist'] }, - { - extends: [js.configs.recommended, ...tseslint.configs.recommended], - files: ['**/*.{ts,tsx}'], - languageOptions: { - ecmaVersion: 2020, - globals: globals.browser, - }, - plugins: { - 'react-hooks': reactHooks, - 'react-refresh': reactRefresh, - }, - rules: { - ...reactHooks.configs.recommended.rules, - 'react-refresh/only-export-components': [ - 'warn', - { allowConstantExport: true }, - ], - }, - }, -) diff --git a/client/index.html b/client/index.html deleted file mode 100644 index e4b78ea..0000000 --- a/client/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - Vite + React + TS - - -
- - - diff --git a/client/package-lock.json b/client/package-lock.json deleted file mode 100644 index 03a0ab0..0000000 --- a/client/package-lock.json +++ /dev/null @@ -1,4115 +0,0 @@ -{ - "name": "client", - "version": "0.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "client", - "version": "0.0.0", - "dependencies": { - "@emotion/react": "^11.14.0", - "@emotion/styled": "^11.14.0", - "@fontsource/roboto": "^5.1.1", - "@mui/icons-material": "^6.3.1", - "@mui/material": "^6.3.1", - "@react-oauth/google": "^0.12.1", - "axios": "^1.7.9", - "react": "^18.3.1", - "react-apple-signin-auth": "^1.1.0", - "react-dom": "^18.3.1", - "react-router-dom": "^7.1.1" - }, - "devDependencies": { - "@eslint/js": "^9.17.0", - "@types/react": "^18.3.18", - "@types/react-dom": "^18.3.5", - "@vitejs/plugin-react": "^4.3.4", - "eslint": "^9.17.0", - "eslint-plugin-react-hooks": "^5.0.0", - "eslint-plugin-react-refresh": "^0.4.16", - "globals": "^15.14.0", - "typescript": "~5.6.2", - "typescript-eslint": "^8.18.2", - "vite": "^6.0.5" - } - }, - "node_modules/@ampproject/remapping": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", - "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@jridgewell/gen-mapping": "^0.3.5", - "@jridgewell/trace-mapping": "^0.3.24" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@babel/code-frame": { - "version": "7.26.2", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz", - "integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==", - "license": "MIT", - "dependencies": { - "@babel/helper-validator-identifier": "^7.25.9", - "js-tokens": "^4.0.0", - "picocolors": "^1.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/compat-data": { - "version": "7.26.3", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.26.3.tgz", - "integrity": "sha512-nHIxvKPniQXpmQLb0vhY3VaFb3S0YrTAwpOWJZh1wn3oJPjJk9Asva204PsBdmAE8vpzfHudT8DB0scYvy9q0g==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/core": { - "version": "7.26.0", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.26.0.tgz", - "integrity": "sha512-i1SLeK+DzNnQ3LL/CswPCa/E5u4lh1k6IAEphON8F+cXt0t9euTshDru0q7/IqMa1PMPz5RnHuHscF8/ZJsStg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@ampproject/remapping": "^2.2.0", - "@babel/code-frame": "^7.26.0", - "@babel/generator": "^7.26.0", - "@babel/helper-compilation-targets": "^7.25.9", - "@babel/helper-module-transforms": "^7.26.0", - "@babel/helpers": "^7.26.0", - "@babel/parser": "^7.26.0", - "@babel/template": "^7.25.9", - "@babel/traverse": "^7.25.9", - "@babel/types": "^7.26.0", - "convert-source-map": "^2.0.0", - "debug": "^4.1.0", - "gensync": "^1.0.0-beta.2", - "json5": "^2.2.3", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/babel" - } - }, - "node_modules/@babel/core/node_modules/convert-source-map": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", - "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", - "dev": true, - "license": "MIT" - }, - "node_modules/@babel/generator": { - "version": "7.26.3", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.26.3.tgz", - "integrity": "sha512-6FF/urZvD0sTeO7k6/B15pMLC4CHUv1426lzr3N01aHJTl046uCAh9LXW/fzeXXjPNCJ6iABW5XaWOsIZB93aQ==", - "license": "MIT", - "dependencies": { - "@babel/parser": "^7.26.3", - "@babel/types": "^7.26.3", - "@jridgewell/gen-mapping": "^0.3.5", - "@jridgewell/trace-mapping": "^0.3.25", - "jsesc": "^3.0.2" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-compilation-targets": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.25.9.tgz", - "integrity": "sha512-j9Db8Suy6yV/VHa4qzrj9yZfZxhLWQdVnRlXxmKLYlhWUVB1sB2G5sxuWYXk/whHD9iW76PmNzxZ4UCnTQTVEQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/compat-data": "^7.25.9", - "@babel/helper-validator-option": "^7.25.9", - "browserslist": "^4.24.0", - "lru-cache": "^5.1.1", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-imports": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.25.9.tgz", - "integrity": "sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw==", - "license": "MIT", - "dependencies": { - "@babel/traverse": "^7.25.9", - "@babel/types": "^7.25.9" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-transforms": { - "version": "7.26.0", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.26.0.tgz", - "integrity": "sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-module-imports": "^7.25.9", - "@babel/helper-validator-identifier": "^7.25.9", - "@babel/traverse": "^7.25.9" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-plugin-utils": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.25.9.tgz", - "integrity": "sha512-kSMlyUVdWe25rEsRGviIgOWnoT/nfABVWlqt9N19/dIPWViAOW2s9wznP5tURbs/IDuNk4gPy3YdYRgH3uxhBw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-string-parser": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz", - "integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==", - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-identifier": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz", - "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==", - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-option": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.25.9.tgz", - "integrity": "sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helpers": { - "version": "7.26.0", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.0.tgz", - "integrity": "sha512-tbhNuIxNcVb21pInl3ZSjksLCvgdZy9KwJ8brv993QtIVKJBBkYXz4q4ZbAv31GdnC+R90np23L5FbEBlthAEw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/template": "^7.25.9", - "@babel/types": "^7.26.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/parser": { - "version": "7.26.3", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.3.tgz", - "integrity": "sha512-WJ/CvmY8Mea8iDXo6a7RK2wbmJITT5fN3BEkRuFlxVyNx8jOKIIhmC4fSkTcPcf8JyavbBwIe6OpiCOBXt/IcA==", - "license": "MIT", - "dependencies": { - "@babel/types": "^7.26.3" - }, - "bin": { - "parser": "bin/babel-parser.js" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@babel/plugin-transform-react-jsx-self": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.25.9.tgz", - "integrity": "sha512-y8quW6p0WHkEhmErnfe58r7x0A70uKphQm8Sp8cV7tjNQwK56sNVK0M73LK3WuYmsuyrftut4xAkjjgU0twaMg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.25.9" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-react-jsx-source": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.25.9.tgz", - "integrity": "sha512-+iqjT8xmXhhYv4/uiYd8FNQsraMFZIfxVSqxxVSZP0WbbSAWvBXAul0m/zu+7Vv4O/3WtApy9pmaTMiumEZgfg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.25.9" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/runtime": { - "version": "7.26.0", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.26.0.tgz", - "integrity": "sha512-FDSOghenHTiToteC/QRlv2q3DhPZ/oOXTBoirfWNx1Cx3TMVcGWQtMMmQcSvb/JjpNeGzx8Pq/b4fKEJuWm1sw==", - "license": "MIT", - "dependencies": { - "regenerator-runtime": "^0.14.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/template": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.25.9.tgz", - "integrity": "sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg==", - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.25.9", - "@babel/parser": "^7.25.9", - "@babel/types": "^7.25.9" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/traverse": { - "version": "7.26.4", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.26.4.tgz", - "integrity": "sha512-fH+b7Y4p3yqvApJALCPJcwb0/XaOSgtK4pzV6WVjPR5GLFQBRI7pfoX2V2iM48NXvX07NUxxm1Vw98YjqTcU5w==", - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.26.2", - "@babel/generator": "^7.26.3", - "@babel/parser": "^7.26.3", - "@babel/template": "^7.25.9", - "@babel/types": "^7.26.3", - "debug": "^4.3.1", - "globals": "^11.1.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/traverse/node_modules/globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/types": { - "version": "7.26.3", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.3.tgz", - "integrity": "sha512-vN5p+1kl59GVKMvTHt55NzzmYVxprfJD+ql7U9NFIfKCBkYE55LYtS+WtPlaYOyzydrKI8Nezd+aZextrd+FMA==", - "license": "MIT", - "dependencies": { - "@babel/helper-string-parser": "^7.25.9", - "@babel/helper-validator-identifier": "^7.25.9" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@emotion/babel-plugin": { - "version": "11.13.5", - "resolved": "https://registry.npmjs.org/@emotion/babel-plugin/-/babel-plugin-11.13.5.tgz", - "integrity": "sha512-pxHCpT2ex+0q+HH91/zsdHkw/lXd468DIN2zvfvLtPKLLMo6gQj7oLObq8PhkrxOZb/gGCq03S3Z7PDhS8pduQ==", - "license": "MIT", - "dependencies": { - "@babel/helper-module-imports": "^7.16.7", - "@babel/runtime": "^7.18.3", - "@emotion/hash": "^0.9.2", - "@emotion/memoize": "^0.9.0", - "@emotion/serialize": "^1.3.3", - "babel-plugin-macros": "^3.1.0", - "convert-source-map": "^1.5.0", - "escape-string-regexp": "^4.0.0", - "find-root": "^1.1.0", - "source-map": "^0.5.7", - "stylis": "4.2.0" - } - }, - "node_modules/@emotion/cache": { - "version": "11.14.0", - "resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-11.14.0.tgz", - "integrity": "sha512-L/B1lc/TViYk4DcpGxtAVbx0ZyiKM5ktoIyafGkH6zg/tj+mA+NE//aPYKG0k8kCHSHVJrpLpcAlOBEXQ3SavA==", - "license": "MIT", - "dependencies": { - "@emotion/memoize": "^0.9.0", - "@emotion/sheet": "^1.4.0", - "@emotion/utils": "^1.4.2", - "@emotion/weak-memoize": "^0.4.0", - "stylis": "4.2.0" - } - }, - "node_modules/@emotion/hash": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.9.2.tgz", - "integrity": "sha512-MyqliTZGuOm3+5ZRSaaBGP3USLw6+EGykkwZns2EPC5g8jJ4z9OrdZY9apkl3+UP9+sdz76YYkwCKP5gh8iY3g==", - "license": "MIT" - }, - "node_modules/@emotion/is-prop-valid": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-1.3.1.tgz", - "integrity": "sha512-/ACwoqx7XQi9knQs/G0qKvv5teDMhD7bXYns9N/wM8ah8iNb8jZ2uNO0YOgiq2o2poIvVtJS2YALasQuMSQ7Kw==", - "license": "MIT", - "dependencies": { - "@emotion/memoize": "^0.9.0" - } - }, - "node_modules/@emotion/memoize": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.9.0.tgz", - "integrity": "sha512-30FAj7/EoJ5mwVPOWhAyCX+FPfMDrVecJAM+Iw9NRoSl4BBAQeqj4cApHHUXOVvIPgLVDsCFoz/hGD+5QQD1GQ==", - "license": "MIT" - }, - "node_modules/@emotion/react": { - "version": "11.14.0", - "resolved": "https://registry.npmjs.org/@emotion/react/-/react-11.14.0.tgz", - "integrity": "sha512-O000MLDBDdk/EohJPFUqvnp4qnHeYkVP5B0xEG0D/L7cOKP9kefu2DXn8dj74cQfsEzUqh+sr1RzFqiL1o+PpA==", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.18.3", - "@emotion/babel-plugin": "^11.13.5", - "@emotion/cache": "^11.14.0", - "@emotion/serialize": "^1.3.3", - "@emotion/use-insertion-effect-with-fallbacks": "^1.2.0", - "@emotion/utils": "^1.4.2", - "@emotion/weak-memoize": "^0.4.0", - "hoist-non-react-statics": "^3.3.1" - }, - "peerDependencies": { - "react": ">=16.8.0" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/@emotion/serialize": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@emotion/serialize/-/serialize-1.3.3.tgz", - "integrity": "sha512-EISGqt7sSNWHGI76hC7x1CksiXPahbxEOrC5RjmFRJTqLyEK9/9hZvBbiYn70dw4wuwMKiEMCUlR6ZXTSWQqxA==", - "license": "MIT", - "dependencies": { - "@emotion/hash": "^0.9.2", - "@emotion/memoize": "^0.9.0", - "@emotion/unitless": "^0.10.0", - "@emotion/utils": "^1.4.2", - "csstype": "^3.0.2" - } - }, - "node_modules/@emotion/sheet": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@emotion/sheet/-/sheet-1.4.0.tgz", - "integrity": "sha512-fTBW9/8r2w3dXWYM4HCB1Rdp8NLibOw2+XELH5m5+AkWiL/KqYX6dc0kKYlaYyKjrQ6ds33MCdMPEwgs2z1rqg==", - "license": "MIT" - }, - "node_modules/@emotion/styled": { - "version": "11.14.0", - "resolved": "https://registry.npmjs.org/@emotion/styled/-/styled-11.14.0.tgz", - "integrity": "sha512-XxfOnXFffatap2IyCeJyNov3kiDQWoR08gPUQxvbL7fxKryGBKUZUkG6Hz48DZwVrJSVh9sJboyV1Ds4OW6SgA==", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.18.3", - "@emotion/babel-plugin": "^11.13.5", - "@emotion/is-prop-valid": "^1.3.0", - "@emotion/serialize": "^1.3.3", - "@emotion/use-insertion-effect-with-fallbacks": "^1.2.0", - "@emotion/utils": "^1.4.2" - }, - "peerDependencies": { - "@emotion/react": "^11.0.0-rc.0", - "react": ">=16.8.0" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/@emotion/unitless": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.10.0.tgz", - "integrity": "sha512-dFoMUuQA20zvtVTuxZww6OHoJYgrzfKM1t52mVySDJnMSEa08ruEvdYQbhvyu6soU+NeLVd3yKfTfT0NeV6qGg==", - "license": "MIT" - }, - "node_modules/@emotion/use-insertion-effect-with-fallbacks": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@emotion/use-insertion-effect-with-fallbacks/-/use-insertion-effect-with-fallbacks-1.2.0.tgz", - "integrity": "sha512-yJMtVdH59sxi/aVJBpk9FQq+OR8ll5GT8oWd57UpeaKEVGab41JWaCFA7FRLoMLloOZF/c/wsPoe+bfGmRKgDg==", - "license": "MIT", - "peerDependencies": { - "react": ">=16.8.0" - } - }, - "node_modules/@emotion/utils": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/@emotion/utils/-/utils-1.4.2.tgz", - "integrity": "sha512-3vLclRofFziIa3J2wDh9jjbkUz9qk5Vi3IZ/FSTKViB0k+ef0fPV7dYrUIugbgupYDx7v9ud/SjrtEP8Y4xLoA==", - "license": "MIT" - }, - "node_modules/@emotion/weak-memoize": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/@emotion/weak-memoize/-/weak-memoize-0.4.0.tgz", - "integrity": "sha512-snKqtPW01tN0ui7yu9rGv69aJXr/a/Ywvl11sUjNtEcRc+ng/mQriFL0wLXMef74iHa/EkftbDzU9F8iFbH+zg==", - "license": "MIT" - }, - "node_modules/@esbuild/aix-ppc64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.24.2.tgz", - "integrity": "sha512-thpVCb/rhxE/BnMLQ7GReQLLN8q9qbHmI55F4489/ByVg2aQaQ6kbcLb6FHkocZzQhxc4gx0sCk0tJkKBFzDhA==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "aix" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-arm": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.24.2.tgz", - "integrity": "sha512-tmwl4hJkCfNHwFB3nBa8z1Uy3ypZpxqxfTQOcHX+xRByyYgunVbZ9MzUUfb0RxaHIMnbHagwAxuTL+tnNM+1/Q==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-arm64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.24.2.tgz", - "integrity": "sha512-cNLgeqCqV8WxfcTIOeL4OAtSmL8JjcN6m09XIgro1Wi7cF4t/THaWEa7eL5CMoMBdjoHOTh/vwTO/o2TRXIyzg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-x64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.24.2.tgz", - "integrity": "sha512-B6Q0YQDqMx9D7rvIcsXfmJfvUYLoP722bgfBlO5cGvNVb5V/+Y7nhBE3mHV9OpxBf4eAS2S68KZztiPaWq4XYw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/darwin-arm64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.24.2.tgz", - "integrity": "sha512-kj3AnYWc+CekmZnS5IPu9D+HWtUI49hbnyqk0FLEJDbzCIQt7hg7ucF1SQAilhtYpIujfaHr6O0UHlzzSPdOeA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.24.2.tgz", - "integrity": "sha512-WeSrmwwHaPkNR5H3yYfowhZcbriGqooyu3zI/3GGpF8AyUdsrrP0X6KumITGA9WOyiJavnGZUwPGvxvwfWPHIA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/freebsd-arm64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.24.2.tgz", - "integrity": "sha512-UN8HXjtJ0k/Mj6a9+5u6+2eZ2ERD7Edt1Q9IZiB5UZAIdPnVKDoG7mdTVGhHJIeEml60JteamR3qhsr1r8gXvg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/freebsd-x64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.24.2.tgz", - "integrity": "sha512-TvW7wE/89PYW+IevEJXZ5sF6gJRDY/14hyIGFXdIucxCsbRmLUcjseQu1SyTko+2idmCw94TgyaEZi9HUSOe3Q==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-arm": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.24.2.tgz", - "integrity": "sha512-n0WRM/gWIdU29J57hJyUdIsk0WarGd6To0s+Y+LwvlC55wt+GT/OgkwoXCXvIue1i1sSNWblHEig00GBWiJgfA==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-arm64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.24.2.tgz", - "integrity": "sha512-7HnAD6074BW43YvvUmE/35Id9/NB7BeX5EoNkK9obndmZBUk8xmJJeU7DwmUeN7tkysslb2eSl6CTrYz6oEMQg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-ia32": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.24.2.tgz", - "integrity": "sha512-sfv0tGPQhcZOgTKO3oBE9xpHuUqguHvSo4jl+wjnKwFpapx+vUDcawbwPNuBIAYdRAvIDBfZVvXprIj3HA+Ugw==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.24.2.tgz", - "integrity": "sha512-CN9AZr8kEndGooS35ntToZLTQLHEjtVB5n7dl8ZcTZMonJ7CCfStrYhrzF97eAecqVbVJ7APOEe18RPI4KLhwQ==", - "cpu": [ - "loong64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-mips64el": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.24.2.tgz", - "integrity": "sha512-iMkk7qr/wl3exJATwkISxI7kTcmHKE+BlymIAbHO8xanq/TjHaaVThFF6ipWzPHryoFsesNQJPE/3wFJw4+huw==", - "cpu": [ - "mips64el" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-ppc64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.24.2.tgz", - "integrity": "sha512-shsVrgCZ57Vr2L8mm39kO5PPIb+843FStGt7sGGoqiiWYconSxwTiuswC1VJZLCjNiMLAMh34jg4VSEQb+iEbw==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-riscv64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.24.2.tgz", - "integrity": "sha512-4eSFWnU9Hhd68fW16GD0TINewo1L6dRrB+oLNNbYyMUAeOD2yCK5KXGK1GH4qD/kT+bTEXjsyTCiJGHPZ3eM9Q==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-s390x": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.24.2.tgz", - "integrity": "sha512-S0Bh0A53b0YHL2XEXC20bHLuGMOhFDO6GN4b3YjRLK//Ep3ql3erpNcPlEFed93hsQAjAQDNsvcK+hV90FubSw==", - "cpu": [ - "s390x" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-x64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.24.2.tgz", - "integrity": "sha512-8Qi4nQcCTbLnK9WoMjdC9NiTG6/E38RNICU6sUNqK0QFxCYgoARqVqxdFmWkdonVsvGqWhmm7MO0jyTqLqwj0Q==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/netbsd-arm64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.24.2.tgz", - "integrity": "sha512-wuLK/VztRRpMt9zyHSazyCVdCXlpHkKm34WUyinD2lzK07FAHTq0KQvZZlXikNWkDGoT6x3TD51jKQ7gMVpopw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/netbsd-x64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.24.2.tgz", - "integrity": "sha512-VefFaQUc4FMmJuAxmIHgUmfNiLXY438XrL4GDNV1Y1H/RW3qow68xTwjZKfj/+Plp9NANmzbH5R40Meudu8mmw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openbsd-arm64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.24.2.tgz", - "integrity": "sha512-YQbi46SBct6iKnszhSvdluqDmxCJA+Pu280Av9WICNwQmMxV7nLRHZfjQzwbPs3jeWnuAhE9Jy0NrnJ12Oz+0A==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openbsd-x64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.24.2.tgz", - "integrity": "sha512-+iDS6zpNM6EnJyWv0bMGLWSWeXGN/HTaF/LXHXHwejGsVi+ooqDfMCCTerNFxEkM3wYVcExkeGXNqshc9iMaOA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/sunos-x64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.24.2.tgz", - "integrity": "sha512-hTdsW27jcktEvpwNHJU4ZwWFGkz2zRJUz8pvddmXPtXDzVKTTINmlmga3ZzwcuMpUvLw7JkLy9QLKyGpD2Yxig==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-arm64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.24.2.tgz", - "integrity": "sha512-LihEQ2BBKVFLOC9ZItT9iFprsE9tqjDjnbulhHoFxYQtQfai7qfluVODIYxt1PgdoyQkz23+01rzwNwYfutxUQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-ia32": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.24.2.tgz", - "integrity": "sha512-q+iGUwfs8tncmFC9pcnD5IvRHAzmbwQ3GPS5/ceCyHdjXubwQWI12MKWSNSMYLJMq23/IUCvJMS76PDqXe1fxA==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-x64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.24.2.tgz", - "integrity": "sha512-7VTgWzgMGvup6aSqDPLiW5zHaxYJGTO4OokMjIlrCtf+VpEL+cXKtCvg723iguPYI5oaUNdS+/V7OU2gvXVWEg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@eslint-community/eslint-utils": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.1.tgz", - "integrity": "sha512-s3O3waFUrMV8P/XaF/+ZTp1X9XBZW1a4B97ZnjQF2KYWaFD2A8KyFBsrsfSjEmjn3RGWAIuvlneuZm3CUK3jbA==", - "dev": true, - "license": "MIT", - "dependencies": { - "eslint-visitor-keys": "^3.4.3" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - }, - "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" - } - }, - "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", - "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/@eslint-community/regexpp": { - "version": "4.12.1", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.1.tgz", - "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^12.0.0 || ^14.0.0 || >=16.0.0" - } - }, - "node_modules/@eslint/config-array": { - "version": "0.19.1", - "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.19.1.tgz", - "integrity": "sha512-fo6Mtm5mWyKjA/Chy1BYTdn5mGJoDNjC7C64ug20ADsRDGrA85bN3uK3MaKbeRkRuuIEAR5N33Jr1pbm411/PA==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@eslint/object-schema": "^2.1.5", - "debug": "^4.3.1", - "minimatch": "^3.1.2" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@eslint/core": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.9.1.tgz", - "integrity": "sha512-GuUdqkyyzQI5RMIWkHhvTWLCyLo1jNK3vzkSyaExH5kHPDHcuL2VOpHjmMY+y3+NC69qAKToBqldTBgYeLSr9Q==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@types/json-schema": "^7.0.15" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@eslint/eslintrc": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.2.0.tgz", - "integrity": "sha512-grOjVNN8P3hjJn/eIETF1wwd12DdnwFDoyceUJLYYdkpbwq3nLi+4fqrTAONx7XDALqlL220wC/RHSC/QTI/0w==", - "dev": true, - "license": "MIT", - "dependencies": { - "ajv": "^6.12.4", - "debug": "^4.3.2", - "espree": "^10.0.1", - "globals": "^14.0.0", - "ignore": "^5.2.0", - "import-fresh": "^3.2.1", - "js-yaml": "^4.1.0", - "minimatch": "^3.1.2", - "strip-json-comments": "^3.1.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/@eslint/eslintrc/node_modules/globals": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", - "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@eslint/js": { - "version": "9.17.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.17.0.tgz", - "integrity": "sha512-Sxc4hqcs1kTu0iID3kcZDW3JHq2a77HO9P8CP6YEA/FpH3Ll8UXE2r/86Rz9YJLKme39S9vU5OWNjC6Xl0Cr3w==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@eslint/object-schema": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.5.tgz", - "integrity": "sha512-o0bhxnL89h5Bae5T318nFoFzGy+YE5i/gGkoPAgkmTVdRKTiv3p8JHevPiPaMwoloKfEiiaHlawCqaZMqRm+XQ==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@eslint/plugin-kit": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.4.tgz", - "integrity": "sha512-zSkKow6H5Kdm0ZUQUB2kV5JIXqoG0+uH5YADhaEHswm664N9Db8dXSi0nMJpacpMf+MyyglF1vnZohpEg5yUtg==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "levn": "^0.4.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@fontsource/roboto": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/@fontsource/roboto/-/roboto-5.1.1.tgz", - "integrity": "sha512-XwVVXtERDQIM7HPUIbyDe0FP4SRovpjF7zMI8M7pbqFp3ahLJsJTd18h+E6pkar6UbV3btbwkKjYARr5M+SQow==", - "license": "Apache-2.0" - }, - "node_modules/@humanfs/core": { - "version": "0.19.1", - "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", - "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=18.18.0" - } - }, - "node_modules/@humanfs/node": { - "version": "0.16.6", - "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.6.tgz", - "integrity": "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@humanfs/core": "^0.19.1", - "@humanwhocodes/retry": "^0.3.0" - }, - "engines": { - "node": ">=18.18.0" - } - }, - "node_modules/@humanfs/node/node_modules/@humanwhocodes/retry": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.1.tgz", - "integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=18.18" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - } - }, - "node_modules/@humanwhocodes/module-importer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", - "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=12.22" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - } - }, - "node_modules/@humanwhocodes/retry": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.1.tgz", - "integrity": "sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=18.18" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - } - }, - "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", - "integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==", - "license": "MIT", - "dependencies": { - "@jridgewell/set-array": "^1.2.1", - "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.24" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "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==", - "license": "MIT", - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/set-array": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", - "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", - "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==", - "license": "MIT" - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.25", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", - "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", - "license": "MIT", - "dependencies": { - "@jridgewell/resolve-uri": "^3.1.0", - "@jridgewell/sourcemap-codec": "^1.4.14" - } - }, - "node_modules/@mui/core-downloads-tracker": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-6.3.1.tgz", - "integrity": "sha512-2OmnEyoHpj5//dJJpMuxOeLItCCHdf99pjMFfUFdBteCunAK9jW+PwEo4mtdGcLs7P+IgZ+85ypd52eY4AigoQ==", - "license": "MIT", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/mui-org" - } - }, - "node_modules/@mui/icons-material": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@mui/icons-material/-/icons-material-6.3.1.tgz", - "integrity": "sha512-nJmWj1PBlwS3t1PnoqcixIsftE+7xrW3Su7f0yrjPw4tVjYrgkhU0hrRp+OlURfZ3ptdSkoBkalee9Bhf1Erfw==", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.26.0" - }, - "engines": { - "node": ">=14.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/mui-org" - }, - "peerDependencies": { - "@mui/material": "^6.3.1", - "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0", - "react": "^17.0.0 || ^18.0.0 || ^19.0.0" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/@mui/material": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@mui/material/-/material-6.3.1.tgz", - "integrity": "sha512-ynG9ayhxgCsHJ/dtDcT1v78/r2GwQyP3E0hPz3GdPRl0uFJz/uUTtI5KFYwadXmbC+Uv3bfB8laZ6+Cpzh03gA==", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.26.0", - "@mui/core-downloads-tracker": "^6.3.1", - "@mui/system": "^6.3.1", - "@mui/types": "^7.2.21", - "@mui/utils": "^6.3.1", - "@popperjs/core": "^2.11.8", - "@types/react-transition-group": "^4.4.12", - "clsx": "^2.1.1", - "csstype": "^3.1.3", - "prop-types": "^15.8.1", - "react-is": "^19.0.0", - "react-transition-group": "^4.4.5" - }, - "engines": { - "node": ">=14.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/mui-org" - }, - "peerDependencies": { - "@emotion/react": "^11.5.0", - "@emotion/styled": "^11.3.0", - "@mui/material-pigment-css": "^6.3.1", - "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0", - "react": "^17.0.0 || ^18.0.0 || ^19.0.0", - "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0" - }, - "peerDependenciesMeta": { - "@emotion/react": { - "optional": true - }, - "@emotion/styled": { - "optional": true - }, - "@mui/material-pigment-css": { - "optional": true - }, - "@types/react": { - "optional": true - } - } - }, - "node_modules/@mui/private-theming": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-6.3.1.tgz", - "integrity": "sha512-g0u7hIUkmXmmrmmf5gdDYv9zdAig0KoxhIQn1JN8IVqApzf/AyRhH3uDGx5mSvs8+a1zb4+0W6LC260SyTTtdQ==", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.26.0", - "@mui/utils": "^6.3.1", - "prop-types": "^15.8.1" - }, - "engines": { - "node": ">=14.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/mui-org" - }, - "peerDependencies": { - "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0", - "react": "^17.0.0 || ^18.0.0 || ^19.0.0" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/@mui/styled-engine": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-6.3.1.tgz", - "integrity": "sha512-/7CC0d2fIeiUxN5kCCwYu4AWUDd9cCTxWCyo0v/Rnv6s8uk6hWgJC3VLZBoDENBHf/KjqDZuYJ2CR+7hD6QYww==", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.26.0", - "@emotion/cache": "^11.13.5", - "@emotion/serialize": "^1.3.3", - "@emotion/sheet": "^1.4.0", - "csstype": "^3.1.3", - "prop-types": "^15.8.1" - }, - "engines": { - "node": ">=14.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/mui-org" - }, - "peerDependencies": { - "@emotion/react": "^11.4.1", - "@emotion/styled": "^11.3.0", - "react": "^17.0.0 || ^18.0.0 || ^19.0.0" - }, - "peerDependenciesMeta": { - "@emotion/react": { - "optional": true - }, - "@emotion/styled": { - "optional": true - } - } - }, - "node_modules/@mui/system": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@mui/system/-/system-6.3.1.tgz", - "integrity": "sha512-AwqQ3EAIT2np85ki+N15fF0lFXX1iFPqenCzVOSl3QXKy2eifZeGd9dGtt7pGMoFw5dzW4dRGGzRpLAq9rkl7A==", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.26.0", - "@mui/private-theming": "^6.3.1", - "@mui/styled-engine": "^6.3.1", - "@mui/types": "^7.2.21", - "@mui/utils": "^6.3.1", - "clsx": "^2.1.1", - "csstype": "^3.1.3", - "prop-types": "^15.8.1" - }, - "engines": { - "node": ">=14.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/mui-org" - }, - "peerDependencies": { - "@emotion/react": "^11.5.0", - "@emotion/styled": "^11.3.0", - "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0", - "react": "^17.0.0 || ^18.0.0 || ^19.0.0" - }, - "peerDependenciesMeta": { - "@emotion/react": { - "optional": true - }, - "@emotion/styled": { - "optional": true - }, - "@types/react": { - "optional": true - } - } - }, - "node_modules/@mui/types": { - "version": "7.2.21", - "resolved": "https://registry.npmjs.org/@mui/types/-/types-7.2.21.tgz", - "integrity": "sha512-6HstngiUxNqLU+/DPqlUJDIPbzUBxIVHb1MmXP0eTWDIROiCR2viugXpEif0PPe2mLqqakPzzRClWAnK+8UJww==", - "license": "MIT", - "peerDependencies": { - "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/@mui/utils": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-6.3.1.tgz", - "integrity": "sha512-sjGjXAngoio6lniQZKJ5zGfjm+LD2wvLwco7FbKe1fu8A7VIFmz2SwkLb+MDPLNX1lE7IscvNNyh1pobtZg2tw==", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.26.0", - "@mui/types": "^7.2.21", - "@types/prop-types": "^15.7.14", - "clsx": "^2.1.1", - "prop-types": "^15.8.1", - "react-is": "^19.0.0" - }, - "engines": { - "node": ">=14.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/mui-org" - }, - "peerDependencies": { - "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0", - "react": "^17.0.0 || ^18.0.0 || ^19.0.0" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - } - } - }, - "node_modules/@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@popperjs/core": { - "version": "2.11.8", - "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz", - "integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==", - "license": "MIT", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/popperjs" - } - }, - "node_modules/@react-oauth/google": { - "version": "0.12.1", - "resolved": "https://registry.npmjs.org/@react-oauth/google/-/google-0.12.1.tgz", - "integrity": "sha512-qagsy22t+7UdkYAiT5ZhfM4StXi9PPNvw0zuwNmabrWyMKddczMtBIOARflbaIj+wHiQjnMAsZmzsUYuXeyoSg==", - "license": "MIT", - "peerDependencies": { - "react": ">=16.8.0", - "react-dom": ">=16.8.0" - } - }, - "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.30.0.tgz", - "integrity": "sha512-qFcFto9figFLz2g25DxJ1WWL9+c91fTxnGuwhToCl8BaqDsDYMl/kOnBXAyAqkkzAWimYMSWNPWEjt+ADAHuoQ==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-android-arm64": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.30.0.tgz", - "integrity": "sha512-vqrQdusvVl7dthqNjWCL043qelBK+gv9v3ZiqdxgaJvmZyIAAXMjeGVSqZynKq69T7062T5VrVTuikKSAAVP6A==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.30.0.tgz", - "integrity": "sha512-617pd92LhdA9+wpixnzsyhVft3szYiN16aNUMzVkf2N+yAk8UXY226Bfp36LvxYTUt7MO/ycqGFjQgJ0wlMaWQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.30.0.tgz", - "integrity": "sha512-Y3b4oDoaEhCypg8ajPqigKDcpi5ZZovemQl9Edpem0uNv6UUjXv7iySBpGIUTSs2ovWOzYpfw9EbFJXF/fJHWw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.30.0.tgz", - "integrity": "sha512-3REQJ4f90sFIBfa0BUokiCdrV/E4uIjhkWe1bMgCkhFXbf4D8YN6C4zwJL881GM818qVYE9BO3dGwjKhpo2ABA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ] - }, - "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.30.0.tgz", - "integrity": "sha512-ZtY3Y8icbe3Cc+uQicsXG5L+CRGUfLZjW6j2gn5ikpltt3Whqjfo5mkyZ86UiuHF9Q3ZsaQeW7YswlHnN+lAcg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ] - }, - "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.30.0.tgz", - "integrity": "sha512-bsPGGzfiHXMhQGuFGpmo2PyTwcrh2otL6ycSZAFTESviUoBOuxF7iBbAL5IJXc/69peXl5rAtbewBFeASZ9O0g==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.30.0.tgz", - "integrity": "sha512-kvyIECEhs2DrrdfQf++maCWJIQ974EI4txlz1nNSBaCdtf7i5Xf1AQCEJWOC5rEBisdaMFFnOWNLYt7KpFqy5A==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.30.0.tgz", - "integrity": "sha512-CFE7zDNrokaotXu+shwIrmWrFxllg79vciH4E/zeK7NitVuWEaXRzS0mFfFvyhZfn8WfVOG/1E9u8/DFEgK7WQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.30.0.tgz", - "integrity": "sha512-MctNTBlvMcIBP0t8lV/NXiUwFg9oK5F79CxLU+a3xgrdJjfBLVIEHSAjQ9+ipofN2GKaMLnFFXLltg1HEEPaGQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-loongarch64-gnu": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.30.0.tgz", - "integrity": "sha512-fBpoYwLEPivL3q368+gwn4qnYnr7GVwM6NnMo8rJ4wb0p/Y5lg88vQRRP077gf+tc25akuqd+1Sxbn9meODhwA==", - "cpu": [ - "loong64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.30.0.tgz", - "integrity": "sha512-1hiHPV6dUaqIMXrIjN+vgJqtfkLpqHS1Xsg0oUfUVD98xGp1wX89PIXgDF2DWra1nxAd8dfE0Dk59MyeKaBVAw==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.30.0.tgz", - "integrity": "sha512-U0xcC80SMpEbvvLw92emHrNjlS3OXjAM0aVzlWfar6PR0ODWCTQtKeeB+tlAPGfZQXicv1SpWwRz9Hyzq3Jx3g==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.30.0.tgz", - "integrity": "sha512-VU/P/IODrNPasgZDLIFJmMiLGez+BN11DQWfTVlViJVabyF3JaeaJkP6teI8760f18BMGCQOW9gOmuzFaI1pUw==", - "cpu": [ - "s390x" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.30.0.tgz", - "integrity": "sha512-laQVRvdbKmjXuFA3ZiZj7+U24FcmoPlXEi2OyLfbpY2MW1oxLt9Au8q9eHd0x6Pw/Kw4oe9gwVXWwIf2PVqblg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.30.0.tgz", - "integrity": "sha512-3wzKzduS7jzxqcOvy/ocU/gMR3/QrHEFLge5CD7Si9fyHuoXcidyYZ6jyx8OPYmCcGm3uKTUl+9jUSAY74Ln5A==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.30.0.tgz", - "integrity": "sha512-jROwnI1+wPyuv696rAFHp5+6RFhXGGwgmgSfzE8e4xfit6oLRg7GyMArVUoM3ChS045OwWr9aTnU+2c1UdBMyw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.30.0.tgz", - "integrity": "sha512-duzweyup5WELhcXx5H1jokpr13i3BV9b48FMiikYAwk/MT1LrMYYk2TzenBd0jj4ivQIt58JWSxc19y4SvLP4g==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.30.0.tgz", - "integrity": "sha512-DYvxS0M07PvgvavMIybCOBYheyrqlui6ZQBHJs6GqduVzHSZ06TPPvlfvnYstjODHQ8UUXFwt5YE+h0jFI8kwg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@types/babel__core": { - "version": "7.20.5", - "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", - "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/parser": "^7.20.7", - "@babel/types": "^7.20.7", - "@types/babel__generator": "*", - "@types/babel__template": "*", - "@types/babel__traverse": "*" - } - }, - "node_modules/@types/babel__generator": { - "version": "7.6.8", - "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.8.tgz", - "integrity": "sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.0.0" - } - }, - "node_modules/@types/babel__template": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", - "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/parser": "^7.1.0", - "@babel/types": "^7.0.0" - } - }, - "node_modules/@types/babel__traverse": { - "version": "7.20.6", - "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.6.tgz", - "integrity": "sha512-r1bzfrm0tomOI8g1SzvCaQHo6Lcv6zu0EA+W2kHrt8dyrHQxGzBBL4kdkzIS+jBMV+EYcMAEAqXqYaLJq5rOZg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.20.7" - } - }, - "node_modules/@types/cookie": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.6.0.tgz", - "integrity": "sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA==", - "license": "MIT" - }, - "node_modules/@types/estree": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", - "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/json-schema": { - "version": "7.0.15", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", - "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/parse-json": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.2.tgz", - "integrity": "sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==", - "license": "MIT" - }, - "node_modules/@types/prop-types": { - "version": "15.7.14", - "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.14.tgz", - "integrity": "sha512-gNMvNH49DJ7OJYv+KAKn0Xp45p8PLl6zo2YnvDIbTd4J6MER2BmWN49TG7n9LvkyihINxeKW8+3bfS2yDC9dzQ==", - "license": "MIT" - }, - "node_modules/@types/react": { - "version": "18.3.18", - "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.18.tgz", - "integrity": "sha512-t4yC+vtgnkYjNSKlFx1jkAhH8LgTo2N/7Qvi83kdEaUtMDiwpbLAktKDaAMlRcJ5eSxZkH74eEGt1ky31d7kfQ==", - "license": "MIT", - "dependencies": { - "@types/prop-types": "*", - "csstype": "^3.0.2" - } - }, - "node_modules/@types/react-dom": { - "version": "18.3.5", - "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.5.tgz", - "integrity": "sha512-P4t6saawp+b/dFrUr2cvkVsfvPguwsxtH6dNIYRllMsefqFzkZk5UIjzyDOv5g1dXIPdG4Sp1yCR4Z6RCUsG/Q==", - "dev": true, - "license": "MIT", - "peerDependencies": { - "@types/react": "^18.0.0" - } - }, - "node_modules/@types/react-transition-group": { - "version": "4.4.12", - "resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.12.tgz", - "integrity": "sha512-8TV6R3h2j7a91c+1DXdJi3Syo69zzIZbz7Lg5tORM5LEJG7X/E6a1V3drRyBRZq7/utz7A+c4OgYLiLcYGHG6w==", - "license": "MIT", - "peerDependencies": { - "@types/react": "*" - } - }, - "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.19.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.19.1.tgz", - "integrity": "sha512-tJzcVyvvb9h/PB96g30MpxACd9IrunT7GF9wfA9/0TJ1LxGOJx1TdPzSbBBnNED7K9Ka8ybJsnEpiXPktolTLg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "8.19.1", - "@typescript-eslint/type-utils": "8.19.1", - "@typescript-eslint/utils": "8.19.1", - "@typescript-eslint/visitor-keys": "8.19.1", - "graphemer": "^1.4.0", - "ignore": "^5.3.1", - "natural-compare": "^1.4.0", - "ts-api-utils": "^2.0.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "@typescript-eslint/parser": "^8.0.0 || ^8.0.0-alpha.0", - "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <5.8.0" - } - }, - "node_modules/@typescript-eslint/parser": { - "version": "8.19.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.19.1.tgz", - "integrity": "sha512-67gbfv8rAwawjYx3fYArwldTQKoYfezNUT4D5ioWetr/xCrxXxvleo3uuiFuKfejipvq+og7mjz3b0G2bVyUCw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/scope-manager": "8.19.1", - "@typescript-eslint/types": "8.19.1", - "@typescript-eslint/typescript-estree": "8.19.1", - "@typescript-eslint/visitor-keys": "8.19.1", - "debug": "^4.3.4" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <5.8.0" - } - }, - "node_modules/@typescript-eslint/scope-manager": { - "version": "8.19.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.19.1.tgz", - "integrity": "sha512-60L9KIuN/xgmsINzonOcMDSB8p82h95hoBfSBtXuO4jlR1R9L1xSkmVZKgCPVfavDlXihh4ARNjXhh1gGnLC7Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/types": "8.19.1", - "@typescript-eslint/visitor-keys": "8.19.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/type-utils": { - "version": "8.19.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.19.1.tgz", - "integrity": "sha512-Rp7k9lhDKBMRJB/nM9Ksp1zs4796wVNyihG9/TU9R6KCJDNkQbc2EOKjrBtLYh3396ZdpXLtr/MkaSEmNMtykw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/typescript-estree": "8.19.1", - "@typescript-eslint/utils": "8.19.1", - "debug": "^4.3.4", - "ts-api-utils": "^2.0.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <5.8.0" - } - }, - "node_modules/@typescript-eslint/types": { - "version": "8.19.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.19.1.tgz", - "integrity": "sha512-JBVHMLj7B1K1v1051ZaMMgLW4Q/jre5qGK0Ew6UgXz1Rqh+/xPzV1aW581OM00X6iOfyr1be+QyW8LOUf19BbA==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.19.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.19.1.tgz", - "integrity": "sha512-jk/TZwSMJlxlNnqhy0Eod1PNEvCkpY6MXOXE/WLlblZ6ibb32i2We4uByoKPv1d0OD2xebDv4hbs3fm11SMw8Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/types": "8.19.1", - "@typescript-eslint/visitor-keys": "8.19.1", - "debug": "^4.3.4", - "fast-glob": "^3.3.2", - "is-glob": "^4.0.3", - "minimatch": "^9.0.4", - "semver": "^7.6.0", - "ts-api-utils": "^2.0.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "typescript": ">=4.8.4 <5.8.0" - } - }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", - "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/@typescript-eslint/typescript-estree/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/@typescript-eslint/utils": { - "version": "8.19.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.19.1.tgz", - "integrity": "sha512-IxG5gLO0Ne+KaUc8iW1A+XuKLd63o4wlbI1Zp692n1xojCl/THvgIKXJXBZixTh5dd5+yTJ/VXH7GJaaw21qXA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "8.19.1", - "@typescript-eslint/types": "8.19.1", - "@typescript-eslint/typescript-estree": "8.19.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <5.8.0" - } - }, - "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.19.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.19.1.tgz", - "integrity": "sha512-fzmjU8CHK853V/avYZAvuVut3ZTfwN5YtMaoi+X9Y9MA9keaWNHC3zEQ9zvyX/7Hj+5JkNyK1l7TOR2hevHB6Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/types": "8.19.1", - "eslint-visitor-keys": "^4.2.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@vitejs/plugin-react": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.3.4.tgz", - "integrity": "sha512-SCCPBJtYLdE8PX/7ZQAs1QAZ8Jqwih+0VBLum1EGqmCCQal+MIUqLCzj3ZUy8ufbC0cAM4LRlSTm7IQJwWT4ug==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/core": "^7.26.0", - "@babel/plugin-transform-react-jsx-self": "^7.25.9", - "@babel/plugin-transform-react-jsx-source": "^7.25.9", - "@types/babel__core": "^7.20.5", - "react-refresh": "^0.14.2" - }, - "engines": { - "node": "^14.18.0 || >=16.0.0" - }, - "peerDependencies": { - "vite": "^4.2.0 || ^5.0.0 || ^6.0.0" - } - }, - "node_modules/acorn": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", - "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", - "dev": true, - "license": "MIT", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-jsx": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", - "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "dev": true, - "license": "MIT", - "peerDependencies": { - "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" - } - }, - "node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true, - "license": "Python-2.0" - }, - "node_modules/asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", - "license": "MIT" - }, - "node_modules/axios": { - "version": "1.7.9", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.9.tgz", - "integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==", - "license": "MIT", - "dependencies": { - "follow-redirects": "^1.15.6", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" - } - }, - "node_modules/babel-plugin-macros": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/babel-plugin-macros/-/babel-plugin-macros-3.1.0.tgz", - "integrity": "sha512-Cg7TFGpIr01vOQNODXOOaGz2NpCU5gl8x1qJFbb6hbZxR7XrcE2vtbAsTAbJ7/xwJtUuJEw8K8Zr/AE0LHlesg==", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.12.5", - "cosmiconfig": "^7.0.0", - "resolve": "^1.19.0" - }, - "engines": { - "node": ">=10", - "npm": ">=6" - } - }, - "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/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/browserslist": { - "version": "4.24.3", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.3.tgz", - "integrity": "sha512-1CPmv8iobE2fyRMV97dAcMVegvvWKxmq94hkLiAkUGwKVTyDLw33K+ZxiFrREKmmps4rIw6grcCFCnTMSZ/YiA==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "caniuse-lite": "^1.0.30001688", - "electron-to-chromium": "^1.5.73", - "node-releases": "^2.0.19", - "update-browserslist-db": "^1.1.1" - }, - "bin": { - "browserslist": "cli.js" - }, - "engines": { - "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" - } - }, - "node_modules/callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/caniuse-lite": { - "version": "1.0.30001690", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001690.tgz", - "integrity": "sha512-5ExiE3qQN6oF8Clf8ifIDcMRCRE/dMGcETG/XGMD8/XiXm6HXQgQTh1yZYLXXpSOsEUlJm1Xr7kGULZTuGtP/w==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/caniuse-lite" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "CC-BY-4.0" - }, - "node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/clsx": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", - "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" - }, - "node_modules/combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "license": "MIT", - "dependencies": { - "delayed-stream": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "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/convert-source-map": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", - "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", - "license": "MIT" - }, - "node_modules/cookie": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.0.2.tgz", - "integrity": "sha512-9Kr/j4O16ISv8zBBhJoi4bXOYNTkFLOqSL3UDB0njXxCXNezjeyVrJyGOWtgfs/q2km1gwBcfH8q1yEGoMYunA==", - "license": "MIT", - "engines": { - "node": ">=18" - } - }, - "node_modules/cosmiconfig": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.1.0.tgz", - "integrity": "sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==", - "license": "MIT", - "dependencies": { - "@types/parse-json": "^4.0.0", - "import-fresh": "^3.2.1", - "parse-json": "^5.0.0", - "path-type": "^4.0.0", - "yaml": "^1.10.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/cosmiconfig/node_modules/yaml": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", - "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", - "license": "ISC", - "engines": { - "node": ">= 6" - } - }, - "node_modules/cross-spawn": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", - "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", - "dev": true, - "license": "MIT", - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/csstype": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", - "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", - "license": "MIT" - }, - "node_modules/debug": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", - "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/deep-is": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "license": "MIT", - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/dom-helpers": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-5.2.1.tgz", - "integrity": "sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA==", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.8.7", - "csstype": "^3.0.2" - } - }, - "node_modules/electron-to-chromium": { - "version": "1.5.77", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.77.tgz", - "integrity": "sha512-AnJSrt5JpRVgY6dgd5yccguLc5A7oMSF0Kt3fcW+Hp5WTuFbl5upeSFZbMZYy2o7jhmIhU8Ekrd82GhyXUqUUg==", - "dev": true, - "license": "ISC" - }, - "node_modules/error-ex": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", - "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", - "license": "MIT", - "dependencies": { - "is-arrayish": "^0.2.1" - } - }, - "node_modules/esbuild": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.24.2.tgz", - "integrity": "sha512-+9egpBW8I3CD5XPe0n6BfT5fxLzxrlDzqydF3aviG+9ni1lDC/OvMHcxqEFV0+LANZG5R1bFMWfUrjVsdwxJvA==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=18" - }, - "optionalDependencies": { - "@esbuild/aix-ppc64": "0.24.2", - "@esbuild/android-arm": "0.24.2", - "@esbuild/android-arm64": "0.24.2", - "@esbuild/android-x64": "0.24.2", - "@esbuild/darwin-arm64": "0.24.2", - "@esbuild/darwin-x64": "0.24.2", - "@esbuild/freebsd-arm64": "0.24.2", - "@esbuild/freebsd-x64": "0.24.2", - "@esbuild/linux-arm": "0.24.2", - "@esbuild/linux-arm64": "0.24.2", - "@esbuild/linux-ia32": "0.24.2", - "@esbuild/linux-loong64": "0.24.2", - "@esbuild/linux-mips64el": "0.24.2", - "@esbuild/linux-ppc64": "0.24.2", - "@esbuild/linux-riscv64": "0.24.2", - "@esbuild/linux-s390x": "0.24.2", - "@esbuild/linux-x64": "0.24.2", - "@esbuild/netbsd-arm64": "0.24.2", - "@esbuild/netbsd-x64": "0.24.2", - "@esbuild/openbsd-arm64": "0.24.2", - "@esbuild/openbsd-x64": "0.24.2", - "@esbuild/sunos-x64": "0.24.2", - "@esbuild/win32-arm64": "0.24.2", - "@esbuild/win32-ia32": "0.24.2", - "@esbuild/win32-x64": "0.24.2" - } - }, - "node_modules/escalade": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", - "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint": { - "version": "9.17.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.17.0.tgz", - "integrity": "sha512-evtlNcpJg+cZLcnVKwsai8fExnqjGPicK7gnUtlNuzu+Fv9bI0aLpND5T44VLQtoMEnI57LoXO9XAkIXwohKrA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@eslint-community/eslint-utils": "^4.2.0", - "@eslint-community/regexpp": "^4.12.1", - "@eslint/config-array": "^0.19.0", - "@eslint/core": "^0.9.0", - "@eslint/eslintrc": "^3.2.0", - "@eslint/js": "9.17.0", - "@eslint/plugin-kit": "^0.2.3", - "@humanfs/node": "^0.16.6", - "@humanwhocodes/module-importer": "^1.0.1", - "@humanwhocodes/retry": "^0.4.1", - "@types/estree": "^1.0.6", - "@types/json-schema": "^7.0.15", - "ajv": "^6.12.4", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.6", - "debug": "^4.3.2", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^8.2.0", - "eslint-visitor-keys": "^4.2.0", - "espree": "^10.3.0", - "esquery": "^1.5.0", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^8.0.0", - "find-up": "^5.0.0", - "glob-parent": "^6.0.2", - "ignore": "^5.2.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "json-stable-stringify-without-jsonify": "^1.0.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.1.2", - "natural-compare": "^1.4.0", - "optionator": "^0.9.3" - }, - "bin": { - "eslint": "bin/eslint.js" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://eslint.org/donate" - }, - "peerDependencies": { - "jiti": "*" - }, - "peerDependenciesMeta": { - "jiti": { - "optional": true - } - } - }, - "node_modules/eslint-plugin-react-hooks": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-5.1.0.tgz", - "integrity": "sha512-mpJRtPgHN2tNAvZ35AMfqeB3Xqeo273QxrHJsbBEPWODRM4r0yB6jfoROqKEYrOn27UtRPpcpHc2UqyBSuUNTw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - }, - "peerDependencies": { - "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0" - } - }, - "node_modules/eslint-plugin-react-refresh": { - "version": "0.4.16", - "resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.4.16.tgz", - "integrity": "sha512-slterMlxAhov/DZO8NScf6mEeMBBXodFUolijDvrtTxyezyLoTQaa73FyYus/VbTdftd8wBgBxPMRk3poleXNQ==", - "dev": true, - "license": "MIT", - "peerDependencies": { - "eslint": ">=8.40" - } - }, - "node_modules/eslint-scope": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.2.0.tgz", - "integrity": "sha512-PHlWUfG6lvPc3yvP5A4PNyBL1W8fkDUccmI21JUu/+GKZBoH/W5u6usENXUrWFRsyoW5ACUjFGgAFQp5gUlb/A==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint-visitor-keys": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", - "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/espree": { - "version": "10.3.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-10.3.0.tgz", - "integrity": "sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "acorn": "^8.14.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^4.2.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/esquery": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", - "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "estraverse": "^5.1.0" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/esrecurse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "estraverse": "^5.2.0" - }, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=4.0" - } - }, - "node_modules/esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true, - "license": "MIT" - }, - "node_modules/fast-glob": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", - "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.8" - }, - "engines": { - "node": ">=8.6.0" - } - }, - "node_modules/fast-glob/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/fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true, - "license": "MIT" - }, - "node_modules/fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", - "dev": true, - "license": "MIT" - }, - "node_modules/fastq": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.18.0.tgz", - "integrity": "sha512-QKHXPW0hD8g4UET03SdOdunzSouc9N4AuHdsX8XNcTsuz+yYFILVNIX4l9yHABMhiEI9Db0JTTIpu0wB+Y1QQw==", - "dev": true, - "license": "ISC", - "dependencies": { - "reusify": "^1.0.4" - } - }, - "node_modules/file-entry-cache": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", - "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "flat-cache": "^4.0.0" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "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/find-root": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/find-root/-/find-root-1.1.0.tgz", - "integrity": "sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==", - "license": "MIT" - }, - "node_modules/find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "license": "MIT", - "dependencies": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/flat-cache": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", - "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", - "dev": true, - "license": "MIT", - "dependencies": { - "flatted": "^3.2.9", - "keyv": "^4.5.4" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/flatted": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.2.tgz", - "integrity": "sha512-AiwGJM8YcNOaobumgtng+6NHuOqC3A7MixFeDafM3X9cIUM+xUXoS5Vfgf+OihAYe20fxqNM9yPBXJzRtZ/4eA==", - "dev": true, - "license": "ISC" - }, - "node_modules/follow-redirects": { - "version": "1.15.9", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz", - "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==", - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/RubenVerborgh" - } - ], - "license": "MIT", - "engines": { - "node": ">=4.0" - }, - "peerDependenciesMeta": { - "debug": { - "optional": true - } - } - }, - "node_modules/form-data": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.1.tgz", - "integrity": "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==", - "license": "MIT", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/function-bind": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/gensync": { - "version": "1.0.0-beta.2", - "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", - "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/glob-parent": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", - "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", - "dev": true, - "license": "ISC", - "dependencies": { - "is-glob": "^4.0.3" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/globals": { - "version": "15.14.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-15.14.0.tgz", - "integrity": "sha512-OkToC372DtlQeje9/zHIo5CT8lRP/FUgEOKBEhU4e0abL7J7CD24fD9ohiLN5hagG/kWCYj4K5oaxxtj2Z0Dig==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/graphemer": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", - "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", - "dev": true, - "license": "MIT" - }, - "node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/hasown": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", - "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", - "license": "MIT", - "dependencies": { - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/hoist-non-react-statics": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz", - "integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==", - "license": "BSD-3-Clause", - "dependencies": { - "react-is": "^16.7.0" - } - }, - "node_modules/hoist-non-react-statics/node_modules/react-is": { - "version": "16.13.1", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", - "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", - "license": "MIT" - }, - "node_modules/ignore": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", - "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4" - } - }, - "node_modules/import-fresh": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", - "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", - "license": "MIT", - "dependencies": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.8.19" - } - }, - "node_modules/is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", - "license": "MIT" - }, - "node_modules/is-core-module": { - "version": "2.16.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", - "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", - "license": "MIT", - "dependencies": { - "hasown": "^2.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "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/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true, - "license": "ISC" - }, - "node_modules/js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "license": "MIT" - }, - "node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "license": "MIT", - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/jsesc": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", - "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", - "license": "MIT", - "bin": { - "jsesc": "bin/jsesc" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/json-buffer": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", - "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/json-parse-even-better-errors": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", - "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", - "license": "MIT" - }, - "node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true, - "license": "MIT" - }, - "node_modules/json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", - "dev": true, - "license": "MIT" - }, - "node_modules/json5": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", - "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", - "dev": true, - "license": "MIT", - "bin": { - "json5": "lib/cli.js" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/keyv": { - "version": "4.5.4", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", - "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", - "dev": true, - "license": "MIT", - "dependencies": { - "json-buffer": "3.0.1" - } - }, - "node_modules/levn": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/lines-and-columns": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", - "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", - "license": "MIT" - }, - "node_modules/locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-locate": "^5.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/lodash.merge": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", - "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "license": "MIT", - "dependencies": { - "js-tokens": "^3.0.0 || ^4.0.0" - }, - "bin": { - "loose-envify": "cli.js" - } - }, - "node_modules/lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, - "license": "ISC", - "dependencies": { - "yallist": "^3.0.2" - } - }, - "node_modules/merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 8" - } - }, - "node_modules/micromatch": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", - "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", - "dev": true, - "license": "MIT", - "dependencies": { - "braces": "^3.0.3", - "picomatch": "^2.3.1" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "license": "MIT", - "dependencies": { - "mime-db": "1.52.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "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.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "license": "MIT" - }, - "node_modules/nanoid": { - "version": "3.3.8", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", - "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, - "node_modules/natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", - "dev": true, - "license": "MIT" - }, - "node_modules/node-releases": { - "version": "2.0.19", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.19.tgz", - "integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==", - "dev": true, - "license": "MIT" - }, - "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/optionator": { - "version": "0.9.4", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", - "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", - "dev": true, - "license": "MIT", - "dependencies": { - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.5" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "yocto-queue": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-limit": "^3.0.2" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "license": "MIT", - "dependencies": { - "callsites": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/parse-json": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", - "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.0.0", - "error-ex": "^1.3.1", - "json-parse-even-better-errors": "^2.3.0", - "lines-and-columns": "^1.1.6" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "license": "MIT" - }, - "node_modules/path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/picocolors": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", - "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", - "license": "ISC" - }, - "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/postcss": { - "version": "8.4.49", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.49.tgz", - "integrity": "sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/postcss" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "nanoid": "^3.3.7", - "picocolors": "^1.1.1", - "source-map-js": "^1.2.1" - }, - "engines": { - "node": "^10 || ^12 || >=14" - } - }, - "node_modules/prelude-ls": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/prop-types": { - "version": "15.8.1", - "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", - "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", - "license": "MIT", - "dependencies": { - "loose-envify": "^1.4.0", - "object-assign": "^4.1.1", - "react-is": "^16.13.1" - } - }, - "node_modules/prop-types/node_modules/react-is": { - "version": "16.13.1", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", - "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", - "license": "MIT" - }, - "node_modules/proxy-from-env": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", - "license": "MIT" - }, - "node_modules/punycode": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", - "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "node_modules/react": { - "version": "18.3.1", - "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", - "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", - "license": "MIT", - "dependencies": { - "loose-envify": "^1.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/react-apple-signin-auth": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/react-apple-signin-auth/-/react-apple-signin-auth-1.1.0.tgz", - "integrity": "sha512-cEFj5kVBa0R7K2Ah/F0kVtttVX19YZ0Fm6tSAICxEj9SmP6kwYHUysZ8N558cHHG09/cK+NTZ9pUxGVNXlG2Lg==", - "license": "MIT", - "peerDependencies": { - "react": ">= 16.8.0", - "react-dom": ">= 16.8.0" - } - }, - "node_modules/react-dom": { - "version": "18.3.1", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", - "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", - "license": "MIT", - "dependencies": { - "loose-envify": "^1.1.0", - "scheduler": "^0.23.2" - }, - "peerDependencies": { - "react": "^18.3.1" - } - }, - "node_modules/react-is": { - "version": "19.0.0", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-19.0.0.tgz", - "integrity": "sha512-H91OHcwjZsbq3ClIDHMzBShc1rotbfACdWENsmEf0IFvZ3FgGPtdHMcsv45bQ1hAbgdfiA8SnxTKfDS+x/8m2g==", - "license": "MIT" - }, - "node_modules/react-refresh": { - "version": "0.14.2", - "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.14.2.tgz", - "integrity": "sha512-jCvmsr+1IUSMUyzOkRcvnVbX3ZYC6g9TDrDbFuFmRDq7PD4yaGbLKNQL6k2jnArV8hjYxh7hVhAZB6s9HDGpZA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/react-router": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.1.1.tgz", - "integrity": "sha512-39sXJkftkKWRZ2oJtHhCxmoCrBCULr/HAH4IT5DHlgu/Q0FCPV0S4Lx+abjDTx/74xoZzNYDYbOZWlJjruyuDQ==", - "license": "MIT", - "dependencies": { - "@types/cookie": "^0.6.0", - "cookie": "^1.0.1", - "set-cookie-parser": "^2.6.0", - "turbo-stream": "2.4.0" - }, - "engines": { - "node": ">=20.0.0" - }, - "peerDependencies": { - "react": ">=18", - "react-dom": ">=18" - }, - "peerDependenciesMeta": { - "react-dom": { - "optional": true - } - } - }, - "node_modules/react-router-dom": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.1.1.tgz", - "integrity": "sha512-vSrQHWlJ5DCfyrhgo0k6zViOe9ToK8uT5XGSmnuC2R3/g261IdIMpZVqfjD6vWSXdnf5Czs4VA/V60oVR6/jnA==", - "license": "MIT", - "dependencies": { - "react-router": "7.1.1" - }, - "engines": { - "node": ">=20.0.0" - }, - "peerDependencies": { - "react": ">=18", - "react-dom": ">=18" - } - }, - "node_modules/react-transition-group": { - "version": "4.4.5", - "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.5.tgz", - "integrity": "sha512-pZcd1MCJoiKiBR2NRxeCRg13uCXbydPnmB4EOeRrY7480qNWO8IIgQG6zlDkm6uRMsURXPuKq0GWtiM59a5Q6g==", - "license": "BSD-3-Clause", - "dependencies": { - "@babel/runtime": "^7.5.5", - "dom-helpers": "^5.0.1", - "loose-envify": "^1.4.0", - "prop-types": "^15.6.2" - }, - "peerDependencies": { - "react": ">=16.6.0", - "react-dom": ">=16.6.0" - } - }, - "node_modules/regenerator-runtime": { - "version": "0.14.1", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", - "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==", - "license": "MIT" - }, - "node_modules/resolve": { - "version": "1.22.10", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz", - "integrity": "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==", - "license": "MIT", - "dependencies": { - "is-core-module": "^2.16.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", - "dev": true, - "license": "MIT", - "engines": { - "iojs": ">=1.0.0", - "node": ">=0.10.0" - } - }, - "node_modules/rollup": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.30.0.tgz", - "integrity": "sha512-sDnr1pcjTgUT69qBksNF1N1anwfbyYG6TBQ22b03bII8EdiUQ7J0TlozVaTMjT/eEJAO49e1ndV7t+UZfL1+vA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/estree": "1.0.6" - }, - "bin": { - "rollup": "dist/bin/rollup" - }, - "engines": { - "node": ">=18.0.0", - "npm": ">=8.0.0" - }, - "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.30.0", - "@rollup/rollup-android-arm64": "4.30.0", - "@rollup/rollup-darwin-arm64": "4.30.0", - "@rollup/rollup-darwin-x64": "4.30.0", - "@rollup/rollup-freebsd-arm64": "4.30.0", - "@rollup/rollup-freebsd-x64": "4.30.0", - "@rollup/rollup-linux-arm-gnueabihf": "4.30.0", - "@rollup/rollup-linux-arm-musleabihf": "4.30.0", - "@rollup/rollup-linux-arm64-gnu": "4.30.0", - "@rollup/rollup-linux-arm64-musl": "4.30.0", - "@rollup/rollup-linux-loongarch64-gnu": "4.30.0", - "@rollup/rollup-linux-powerpc64le-gnu": "4.30.0", - "@rollup/rollup-linux-riscv64-gnu": "4.30.0", - "@rollup/rollup-linux-s390x-gnu": "4.30.0", - "@rollup/rollup-linux-x64-gnu": "4.30.0", - "@rollup/rollup-linux-x64-musl": "4.30.0", - "@rollup/rollup-win32-arm64-msvc": "4.30.0", - "@rollup/rollup-win32-ia32-msvc": "4.30.0", - "@rollup/rollup-win32-x64-msvc": "4.30.0", - "fsevents": "~2.3.2" - } - }, - "node_modules/run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT", - "dependencies": { - "queue-microtask": "^1.2.2" - } - }, - "node_modules/scheduler": { - "version": "0.23.2", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", - "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==", - "license": "MIT", - "dependencies": { - "loose-envify": "^1.1.0" - } - }, - "node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/set-cookie-parser": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.1.tgz", - "integrity": "sha512-IOc8uWeOZgnb3ptbCURJWNjWUPcO3ZnTTdzsurqERrP6nPyv+paC55vJM0LpOlT2ne+Ix+9+CRG1MNLlyZ4GjQ==", - "license": "MIT" - }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "license": "MIT", - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==", - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/source-map-js": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", - "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/stylis": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.2.0.tgz", - "integrity": "sha512-Orov6g6BB1sDfYgzWfTHDOxamtX1bE/zo104Dh9e6fqJ3PooipYyfJ0pUmrZO2wAvO8YbEyeFrkV91XTsGMSrw==", - "license": "MIT" - }, - "node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "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/ts-api-utils": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.0.0.tgz", - "integrity": "sha512-xCt/TOAc+EOHS1XPnijD3/yzpH6qg2xppZO1YDqGoVsNXfQfzHpOdNuXwrwOU8u4ITXJyDCTyt8w5g1sZv9ynQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18.12" - }, - "peerDependencies": { - "typescript": ">=4.8.4" - } - }, - "node_modules/turbo-stream": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/turbo-stream/-/turbo-stream-2.4.0.tgz", - "integrity": "sha512-FHncC10WpBd2eOmGwpmQsWLDoK4cqsA/UT/GqNoaKOQnT8uzhtCbg3EoUDMvqpOSAI0S26mr0rkjzbOO6S3v1g==", - "license": "ISC" - }, - "node_modules/type-check": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", - "dev": true, - "license": "MIT", - "dependencies": { - "prelude-ls": "^1.2.1" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/typescript": { - "version": "5.6.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz", - "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==", - "dev": true, - "license": "Apache-2.0", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, - "node_modules/typescript-eslint": { - "version": "8.19.1", - "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.19.1.tgz", - "integrity": "sha512-LKPUQpdEMVOeKluHi8md7rwLcoXHhwvWp3x+sJkMuq3gGm9yaYJtPo8sRZSblMFJ5pcOGCAak/scKf1mvZDlQw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/eslint-plugin": "8.19.1", - "@typescript-eslint/parser": "8.19.1", - "@typescript-eslint/utils": "8.19.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <5.8.0" - } - }, - "node_modules/update-browserslist-db": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz", - "integrity": "sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "escalade": "^3.2.0", - "picocolors": "^1.1.0" - }, - "bin": { - "update-browserslist-db": "cli.js" - }, - "peerDependencies": { - "browserslist": ">= 4.21.0" - } - }, - "node_modules/uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "punycode": "^2.1.0" - } - }, - "node_modules/vite": { - "version": "6.0.7", - "resolved": "https://registry.npmjs.org/vite/-/vite-6.0.7.tgz", - "integrity": "sha512-RDt8r/7qx9940f8FcOIAH9PTViRrghKaK2K1jY3RaAURrEUbm9Du1mJ72G+jlhtG3WwodnfzY8ORQZbBavZEAQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "esbuild": "^0.24.2", - "postcss": "^8.4.49", - "rollup": "^4.23.0" - }, - "bin": { - "vite": "bin/vite.js" - }, - "engines": { - "node": "^18.0.0 || ^20.0.0 || >=22.0.0" - }, - "funding": { - "url": "https://github.com/vitejs/vite?sponsor=1" - }, - "optionalDependencies": { - "fsevents": "~2.3.3" - }, - "peerDependencies": { - "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", - "jiti": ">=1.21.0", - "less": "*", - "lightningcss": "^1.21.0", - "sass": "*", - "sass-embedded": "*", - "stylus": "*", - "sugarss": "*", - "terser": "^5.16.0", - "tsx": "^4.8.1", - "yaml": "^2.4.2" - }, - "peerDependenciesMeta": { - "@types/node": { - "optional": true - }, - "jiti": { - "optional": true - }, - "less": { - "optional": true - }, - "lightningcss": { - "optional": true - }, - "sass": { - "optional": true - }, - "sass-embedded": { - "optional": true - }, - "stylus": { - "optional": true - }, - "sugarss": { - "optional": true - }, - "terser": { - "optional": true - }, - "tsx": { - "optional": true - }, - "yaml": { - "optional": true - } - } - }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/word-wrap": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", - "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true, - "license": "ISC" - }, - "node_modules/yaml": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.7.0.tgz", - "integrity": "sha512-+hSoy/QHluxmC9kCIJyL/uyFmLmc+e5CFR5Wa+bpIhIj85LVb9ZH2nVnqrHoSvKogwODv0ClqZkmiSSaIH5LTA==", - "dev": true, - "license": "ISC", - "optional": true, - "peer": true, - "bin": { - "yaml": "bin.mjs" - }, - "engines": { - "node": ">= 14" - } - }, - "node_modules/yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - } - } -} diff --git a/client/package.json b/client/package.json deleted file mode 100644 index 4901c48..0000000 --- a/client/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "client", - "private": true, - "version": "0.0.0", - "type": "module", - "scripts": { - "dev": "vite", - "build": "tsc -b && vite build", - "lint": "eslint .", - "preview": "vite preview" - }, - "dependencies": { - "@emotion/react": "^11.14.0", - "@emotion/styled": "^11.14.0", - "@fontsource/roboto": "^5.1.1", - "@mui/icons-material": "^6.3.1", - "@mui/material": "^6.3.1", - "@react-oauth/google": "^0.12.1", - "axios": "^1.7.9", - "react": "^18.3.1", - "react-apple-signin-auth": "^1.1.0", - "react-dom": "^18.3.1", - "react-router-dom": "^7.1.1" - }, - "devDependencies": { - "@eslint/js": "^9.17.0", - "@types/react": "^18.3.18", - "@types/react-dom": "^18.3.5", - "@vitejs/plugin-react": "^4.3.4", - "eslint": "^9.17.0", - "eslint-plugin-react-hooks": "^5.0.0", - "eslint-plugin-react-refresh": "^0.4.16", - "globals": "^15.14.0", - "typescript": "~5.6.2", - "typescript-eslint": "^8.18.2", - "vite": "^6.0.5" - } -} diff --git a/client/public/vite.svg b/client/public/vite.svg deleted file mode 100644 index e7b8dfb..0000000 --- a/client/public/vite.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/client/src/App.css b/client/src/App.css deleted file mode 100644 index b9d355d..0000000 --- a/client/src/App.css +++ /dev/null @@ -1,42 +0,0 @@ -#root { - max-width: 1280px; - margin: 0 auto; - padding: 2rem; - text-align: center; -} - -.logo { - height: 6em; - padding: 1.5em; - will-change: filter; - transition: filter 300ms; -} -.logo:hover { - filter: drop-shadow(0 0 2em #646cffaa); -} -.logo.react:hover { - filter: drop-shadow(0 0 2em #61dafbaa); -} - -@keyframes logo-spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } -} - -@media (prefers-reduced-motion: no-preference) { - a:nth-of-type(2) .logo { - animation: logo-spin infinite 20s linear; - } -} - -.card { - padding: 2em; -} - -.read-the-docs { - color: #888; -} diff --git a/client/src/App.tsx b/client/src/App.tsx deleted file mode 100644 index 5894b95..0000000 --- a/client/src/App.tsx +++ /dev/null @@ -1,127 +0,0 @@ -import { CssBaseline, ThemeProvider, createTheme } from '@mui/material'; -import { BrowserRouter, Navigate, Route, Routes } from 'react-router-dom'; -import { LoginForm } from './components/auth/LoginForm'; -import { RegisterForm } from './components/auth/RegisterForm'; -import { Dashboard } from './components/dashboard/Dashboard'; -import { AddJuniorForm } from './components/juniors/AddJuniorForm'; -import { JuniorsList } from './components/juniors/JuniorsList'; -import { AuthLayout } from './components/layout/AuthLayout'; -import { AddTaskForm } from './components/tasks/AddTask'; -import { TaskDetails } from './components/tasks/TaskDetails'; -import { TasksList } from './components/tasks/TasksList'; -import { AuthProvider } from './contexts/AuthContext'; - -// Create theme -const theme = createTheme({ - palette: { - primary: { - main: '#00A7E1', // Bright blue like Zod Wallet - light: '#33B7E7', - dark: '#0074B2', - }, - secondary: { - main: '#FF6B6B', // Coral red for accents - light: '#FF8E8E', - dark: '#FF4848', - }, - background: { - default: '#F8F9FA', - paper: '#FFFFFF', - }, - text: { - primary: '#2D3748', // Dark gray for main text - secondary: '#718096', // Medium gray for secondary text - }, - }, - typography: { - fontFamily: '"Inter", "Helvetica", "Arial", sans-serif', - h1: { - fontWeight: 700, - fontSize: '2.5rem', - }, - h2: { - fontWeight: 600, - fontSize: '2rem', - }, - h3: { - fontWeight: 600, - fontSize: '1.75rem', - }, - h4: { - fontWeight: 600, - fontSize: '1.5rem', - }, - h5: { - fontWeight: 600, - fontSize: '1.25rem', - }, - h6: { - fontWeight: 600, - fontSize: '1rem', - }, - button: { - textTransform: 'none', - fontWeight: 500, - }, - }, - shape: { - borderRadius: 12, - }, - components: { - MuiButton: { - styleOverrides: { - root: { - borderRadius: '8px', - padding: '8px 16px', - fontWeight: 500, - }, - contained: { - boxShadow: 'none', - '&:hover': { - boxShadow: 'none', - }, - }, - }, - }, - MuiCard: { - styleOverrides: { - root: { - borderRadius: '16px', - boxShadow: '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)', - }, - }, - }, - }, -}); - -function App() { - return ( - - - - - - {/* Public routes */} - } /> - } /> - - {/* Protected routes */} - }> - } /> - } /> - } /> - } /> - } /> - } /> - - - {/* Redirect root to dashboard or login */} - } /> - - - - - ); -} - -export default App; diff --git a/client/src/api/client.ts b/client/src/api/client.ts deleted file mode 100644 index 165a7cb..0000000 --- a/client/src/api/client.ts +++ /dev/null @@ -1,140 +0,0 @@ -import axios from 'axios'; -import { LoginRequest } from '../types/auth'; -import { CreateJuniorRequest, JuniorTheme } from '../types/junior'; -import { CreateTaskRequest, TaskStatus, TaskSubmission } from '../types/task'; - -const API_BASE_URL = 'https://zod.life'; -const AUTH_TOKEN = btoa('zod-digital:Zod2025'); // Base64 encode credentials - -// Helper function to get auth header -const getAuthHeader = () => { - const token = localStorage.getItem('accessToken'); - return token ? `Bearer ${token}` : `Basic ${AUTH_TOKEN}`; -}; - -export const apiClient = axios.create({ - baseURL: API_BASE_URL, - headers: { - 'Content-Type': 'application/json', - 'x-client-id': 'web-client', - }, -}); - -// Add request interceptor to include current auth header -apiClient.interceptors.request.use((config) => { - config.headers.Authorization = getAuthHeader(); - return config; -}); - -// Add response interceptor to handle errors -apiClient.interceptors.response.use( - (response) => response, - (error) => { - const errorMessage = - error.response?.data?.message || error.response?.data?.error || error.message || 'An unexpected error occurred'; - - console.error('API Error:', { - status: error.response?.status, - message: errorMessage, - data: error.response?.data, - }); - - // Throw error with meaningful message - throw new Error(errorMessage); - }, -); - -// Auth API -export const authApi = { - register: (countryCode: string, phoneNumber: string) => { - // Ensure phone number is in the correct format (remove any non-digit characters) - const cleanPhoneNumber = phoneNumber.replace(/\D/g, ''); - return apiClient.post('/api/auth/register/otp', { - countryCode: countryCode.startsWith('+') ? countryCode : `+${countryCode}`, - phoneNumber: cleanPhoneNumber, - }); - }, - - verifyOtp: (countryCode: string, phoneNumber: string, otp: string) => - apiClient.post('/api/auth/register/verify', { countryCode, phoneNumber, otp }), - - setEmail: (email: string) => { - // Use the stored token from localStorage - const storedToken = localStorage.getItem('accessToken'); - if (!storedToken) { - throw new Error('No access token found'); - } - return apiClient.post('/api/auth/register/set-email', { email }); - }, - - setPasscode: (passcode: string) => { - // Use the stored token from localStorage - const storedToken = localStorage.getItem('accessToken'); - if (!storedToken) { - throw new Error('No access token found'); - } - return apiClient.post('/api/auth/register/set-passcode', { passcode }); - }, - - login: ({ grantType, email, password, appleToken, googleToken }: LoginRequest) => - apiClient.post('/api/auth/login', { - grantType, - email, - password, - appleToken, - googleToken, - fcmToken: 'web-client-token', // Required by API - signature: 'web-login', // Required by API - }), -}; - -// Juniors API -export const juniorsApi = { - createJunior: (data: CreateJuniorRequest) => apiClient.post('/api/juniors', data), - - getJuniors: (page = 1, size = 10) => apiClient.get(`/api/juniors?page=${page}&size=${size}`), - - getJunior: (juniorId: string) => apiClient.get(`/api/juniors/${juniorId}`), - - setTheme: (data: JuniorTheme) => apiClient.post('/api/juniors/set-theme', data), - - getQrCode: (juniorId: string) => apiClient.get(`/api/juniors/${juniorId}/qr-code`), - - validateQrCode: (token: string) => apiClient.get(`/api/juniors/qr-code/${token}/validate`), -}; - -// Document API -export const documentApi = { - upload: (file: File, documentType: string) => { - const formData = new FormData(); - formData.append('document', file); - formData.append('documentType', documentType); - return apiClient.post('/api/document', formData, { - headers: { - 'Content-Type': 'multipart/form-data', - }, - }); - }, -}; - -// Tasks API -export const tasksApi = { - createTask: (data: CreateTaskRequest) => apiClient.post('/api/tasks', data), - - getTasks: (status: TaskStatus, page = 1, size = 10, juniorId?: string) => { - const url = new URL('/api/tasks', API_BASE_URL); - url.searchParams.append('status', status); - url.searchParams.append('page', page.toString()); - url.searchParams.append('size', size.toString()); - if (juniorId) url.searchParams.append('juniorId', juniorId); - return apiClient.get(url.pathname + url.search); - }, - - getTaskById: (taskId: string) => apiClient.get(`/api/tasks/${taskId}`), - - submitTask: (taskId: string, data: TaskSubmission) => apiClient.patch(`/api/tasks/${taskId}/submit`, data), - - approveTask: (taskId: string) => apiClient.patch(`/api/tasks/${taskId}/approve`), - - rejectTask: (taskId: string) => apiClient.patch(`/api/tasks/${taskId}/reject`), -}; diff --git a/client/src/assets/react.svg b/client/src/assets/react.svg deleted file mode 100644 index 6c87de9..0000000 --- a/client/src/assets/react.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/client/src/components/auth/AppleLogin.tsx b/client/src/components/auth/AppleLogin.tsx deleted file mode 100644 index 4abaca8..0000000 --- a/client/src/components/auth/AppleLogin.tsx +++ /dev/null @@ -1,69 +0,0 @@ -import AppleSignInButton from 'react-apple-signin-auth'; -import { useNavigate } from 'react-router-dom'; -import { useAuth } from '../../contexts/AuthContext'; -import { GrantType } from '../../enums'; - -interface LoginProps { - setError: (error: string) => void; - setLoading: (loading: boolean) => void; -} -export const AppleLogin = ({ setError, setLoading }: LoginProps) => { - const { login } = useAuth(); - const navigate = useNavigate(); - - const onError = (err: any) => { - setError(err instanceof Error ? err.message : 'Login failed. Please check your credentials.'); - }; - - const onSuccess = async (response: any) => { - try { - setLoading(true); - await login({ grantType: GrantType.APPLE, appleToken: response.authorization.id_token }); - navigate('/dashboard'); - } catch (error) { - setError(error instanceof Error ? error.message : 'Login failed. Please check your credentials.'); - } finally { - setLoading(false); - } - }; - - return ( - { - onSuccess(response); - }} // default = undefined - /** Called upon signin error */ - onError={(error: any) => onError(error)} // default = undefined - /** Skips loading the apple script if true */ - skipScript={false} // default = undefined - /** Apple image props */ - - /** render function - called with all props - can be used to fully customize the UI by rendering your own component */ - /> - ); -}; diff --git a/client/src/components/auth/GoogleLogin.tsx b/client/src/components/auth/GoogleLogin.tsx deleted file mode 100644 index f7c6ab9..0000000 --- a/client/src/components/auth/GoogleLogin.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import { GoogleLogin as GoogleApiLogin, GoogleOAuthProvider } from '@react-oauth/google'; -import { useNavigate } from 'react-router-dom'; -import { useAuth } from '../../contexts/AuthContext'; -import { GrantType } from '../../enums'; -interface LoginProps { - setError: (error: string) => void; - setLoading: (loading: boolean) => void; -} -export const GoogleLogin = ({ setError, setLoading }: LoginProps) => { - const { login } = useAuth(); - const navigate = useNavigate(); - - const onError = (err: any) => { - setError(err instanceof Error ? err.message : 'Login failed. Please check your credentials.'); - }; - - const onSuccess = async (response: any) => { - try { - setLoading(true); - await login({ grantType: GrantType.GOOGLE, googleToken: response.credential }); - navigate('/dashboard'); - } catch (error) { - setError(error instanceof Error ? error.message : 'Login failed. Please check your credentials.'); - } finally { - setLoading(false); - } - }; - return ( - - { - onSuccess(credentialResponse); - }} - onError={() => { - onError('Login failed. Please check your credentials.'); - }} - /> - - ); -}; diff --git a/client/src/components/auth/LoginForm.tsx b/client/src/components/auth/LoginForm.tsx deleted file mode 100644 index 193c7f7..0000000 --- a/client/src/components/auth/LoginForm.tsx +++ /dev/null @@ -1,149 +0,0 @@ -import { Alert, Box, Button, Container, Paper, TextField, Typography } from '@mui/material'; -import React, { useState } from 'react'; -import { useNavigate } from 'react-router-dom'; -import { useAuth } from '../../contexts/AuthContext'; -import { GrantType } from '../../enums'; -import { AppleLogin } from './AppleLogin'; -import { GoogleLogin } from './GoogleLogin'; -export const LoginForm = () => { - const { login } = useAuth(); - const navigate = useNavigate(); - const [formData, setFormData] = useState({ - email: '', - password: '', - }); - const [error, setError] = useState(''); - const [loading, setLoading] = useState(false); - - const handleSubmit = async (e: React.FormEvent) => { - e.preventDefault(); - setError(''); - setLoading(true); - - try { - await login({ email: formData.email, password: formData.password, grantType: GrantType.PASSWORD }); - navigate('/dashboard'); - } catch (err) { - setError(err instanceof Error ? err.message : 'Login failed. Please check your credentials.'); - } finally { - setLoading(false); - } - }; - - const handleInputChange = (e: React.ChangeEvent) => { - const { name, value } = e.target; - setFormData((prev) => ({ - ...prev, - [name]: value, - })); - }; - return ( - - - - - Zod Alkhair | API TEST - - - login to your account. - - - - - {error && ( - - {error} - - )} - - - - - - - - - - - - - - - - ); -}; diff --git a/client/src/components/auth/RegisterForm.tsx b/client/src/components/auth/RegisterForm.tsx deleted file mode 100644 index 6278aea..0000000 --- a/client/src/components/auth/RegisterForm.tsx +++ /dev/null @@ -1,254 +0,0 @@ -import { Alert, Box, Button, Container, Paper, Step, StepLabel, Stepper, TextField, Typography } from '@mui/material'; -import React, { useState } from 'react'; -import { useNavigate } from 'react-router-dom'; -import { useAuth } from '../../contexts/AuthContext'; - -const steps = ['Phone Verification', 'Email', 'Set Passcode']; - -export const RegisterForm = () => { - const { register, verifyOtp, setEmail, setPasscode } = useAuth(); - const navigate = useNavigate(); - const [activeStep, setActiveStep] = useState(0); - const [loading, setLoading] = useState(false); - const [error, setError] = useState(''); - const [formData, setFormData] = useState({ - countryCode: '+962', - phoneNumber: '', - otp: '', - email: '', - passcode: '', - confirmPasscode: '', - otpRequested: false - }); - - const handleSubmit = async (e: React.FormEvent) => { - e.preventDefault(); - setError(''); - setLoading(true); - - try { - switch (activeStep) { - case 0: - if (!formData.otpRequested) { - // Request OTP - await register(formData.countryCode, formData.phoneNumber); - setFormData(prev => ({ ...prev, otpRequested: true })); - } else { - // Verify OTP - await verifyOtp(formData.countryCode, formData.phoneNumber, formData.otp); - setActiveStep(1); - } - break; - case 1: - await setEmail(formData.email); - setActiveStep(2); - break; - case 2: - if (formData.passcode !== formData.confirmPasscode) { - throw new Error('Passcodes do not match'); - } - await setPasscode(formData.passcode); - navigate('/dashboard'); - break; - } - } catch (err) { - setError(err instanceof Error ? err.message : 'Registration failed'); - } finally { - setLoading(false); - } - }; - - const handleInputChange = (e: React.ChangeEvent) => { - const { name, value } = e.target; - setFormData((prev) => ({ - ...prev, - [name]: value, - })); - }; - - const renderStepContent = () => { - switch (activeStep) { - case 0: - return ( - <> - - {formData.otpRequested && ( - - )} - - ); - case 1: - return ( - - ); - case 2: - return ( - <> - - - - ); - default: - return null; - } - }; - - return ( - - - - - Zod Alkhair | API TEST - - - signup - - - - - - {steps.map((label) => ( - - {label} - - ))} - - - {error && ( - - {error} - - )} - - - {renderStepContent()} - - - - - - - - - ); -}; diff --git a/client/src/components/dashboard/Dashboard.tsx b/client/src/components/dashboard/Dashboard.tsx deleted file mode 100644 index c1627ec..0000000 --- a/client/src/components/dashboard/Dashboard.tsx +++ /dev/null @@ -1,151 +0,0 @@ -import { - People as PeopleIcon, - Assignment as TaskIcon, - TrendingUp as TrendingUpIcon, - AccountBalance as WalletIcon -} from '@mui/icons-material'; -import { - Box, - Button, - Card, - CardContent, - Grid, - Paper, - Typography, - useTheme -} from '@mui/material'; -import { useNavigate } from 'react-router-dom'; - -export const Dashboard = () => { - const theme = useTheme(); - const navigate = useNavigate(); - - const stats = [ - { - title: 'Total Juniors', - value: '3', - icon: , - action: () => navigate('/juniors') - }, - { - title: 'Active Tasks', - value: '5', - icon: , - action: () => navigate('/tasks') - }, - { - title: 'Total Balance', - value: 'SAR 500', - icon: , - action: () => { } - }, - { - title: 'Monthly Growth', - value: '+15%', - icon: , - action: () => { } - } - ]; - - return ( - - - - Welcome to Zod Alkhair, - - - This is the API Testing client - - - - - {stats.map((stat, index) => ( - - - - - {stat.icon} - - - {stat.value} - - - {stat.title} - - - - - ))} - - - - - - - Quick Actions - - - - - - - - - - - - - - - Recent Activity - - - No recent activity - - - - - - ); -}; diff --git a/client/src/components/document/DocumentUpload.tsx b/client/src/components/document/DocumentUpload.tsx deleted file mode 100644 index 1eebc29..0000000 --- a/client/src/components/document/DocumentUpload.tsx +++ /dev/null @@ -1,86 +0,0 @@ -import { CloudUpload as CloudUploadIcon } from '@mui/icons-material'; -import { Alert, Box, Button, CircularProgress } from '@mui/material'; -import { AxiosError } from 'axios'; -import React, { useState } from 'react'; -import { documentApi } from '../../api/client'; -import { ApiError } from '../../types/api'; -import { DocumentType } from '../../types/document'; - -interface DocumentUploadProps { - onUploadSuccess: (documentId: string) => void; - documentType: DocumentType; - label: string; -} - -export const DocumentUpload = ({ onUploadSuccess, documentType, label }: DocumentUploadProps) => { - const [loading, setLoading] = useState(false); - const [error, setError] = useState(''); - const [success, setSuccess] = useState(false); - - const handleFileChange = async (event: React.ChangeEvent) => { - const file = event.target.files?.[0]; - if (!file) return; - - setLoading(true); - setError(''); - setSuccess(false); - - try { - const response = await documentApi.upload(file, documentType); - console.log('Document upload response:', response.data); - const documentId = response.data.data.id; - console.log('Extracted document ID:', documentId); - onUploadSuccess(documentId); - setSuccess(true); - } catch (err) { - if (err instanceof AxiosError && err.response?.data) { - const apiError = err.response.data as ApiError; - const messages = Array.isArray(apiError.message) - ? apiError.message.map((m) => `${m.field}: ${m.message}`).join('\n') - : apiError.message; - setError(messages); - } else { - setError(err instanceof Error ? err.message : 'Failed to upload document'); - } - } finally { - setLoading(false); - } - }; - - const now = new Date(); - return ( - - - - - {error && ( - - {error} - - )} - - {success && ( - - Document uploaded successfully - - )} - - ); -}; diff --git a/client/src/components/juniors/AddJuniorForm.tsx b/client/src/components/juniors/AddJuniorForm.tsx deleted file mode 100644 index cb8e344..0000000 --- a/client/src/components/juniors/AddJuniorForm.tsx +++ /dev/null @@ -1,266 +0,0 @@ -import React, { useState, useEffect } from 'react'; -import { - Box, - TextField, - Button, - Typography, - Paper, - FormControl, - InputLabel, - Select, - MenuItem, - Grid, - Alert, - SelectChangeEvent, - Divider -} from '@mui/material'; -import { useNavigate } from 'react-router-dom'; -import { juniorsApi } from '../../api/client'; -import { CreateJuniorRequest } from '../../types/junior'; -import { DocumentUpload } from '../document/DocumentUpload'; -import { DocumentType } from '../../types/document'; -import { ApiError } from '../../types/api'; -import { AxiosError } from 'axios'; - -export const AddJuniorForm = () => { - const navigate = useNavigate(); - const [loading, setLoading] = useState(false); - const [error, setError] = useState(''); - const [formData, setFormData] = useState({ - countryCode: '+962', - phoneNumber: '', - firstName: '', - lastName: '', - dateOfBirth: '', - email: '', - relationship: 'PARENT', - civilIdFrontId: '', - civilIdBackId: '' - }); - - const handleSubmit = async (e: React.FormEvent) => { - e.preventDefault(); - console.log('Form data:', formData); - - setError(''); - setLoading(true); - - try { - if (!formData.civilIdFrontId || !formData.civilIdBackId) { - console.log('Missing documents - Front:', formData.civilIdFrontId, 'Back:', formData.civilIdBackId); - throw new Error('Please upload both front and back civil ID documents'); - } - - console.log('Submitting data:', formData); - const dataToSubmit = { - ...formData, - civilIdFrontId: formData.civilIdFrontId.trim(), - civilIdBackId: formData.civilIdBackId.trim() - }; - await juniorsApi.createJunior(dataToSubmit); - navigate('/juniors'); - } catch (err) { - console.error('Create junior error:', err); - if (err instanceof AxiosError && err.response?.data) { - const apiError = err.response.data as ApiError; - const messages = Array.isArray(apiError.message) - ? apiError.message.map(m => `${m.field}: ${m.message}`).join('\n') - : apiError.message; - setError(messages); - } else { - setError(err instanceof Error ? err.message : 'Failed to create junior'); - } - } finally { - setLoading(false); - } - }; - - const handleInputChange = (e: React.ChangeEvent) => { - const { name, value } = e.target; - setFormData(prev => ({ - ...prev, - [name]: value - })); - }; - - const handleSelectChange = (e: SelectChangeEvent) => { - const { name, value } = e.target; - setFormData(prev => ({ - ...prev, - [name as string]: value - })); - }; - - useEffect(() => { - console.log('Form data updated:', formData); - }, [formData]); - - const handleCivilIdFrontUpload = (documentId: string) => { - console.log('Front ID uploaded:', documentId); - setFormData(prev => ({ - ...prev, - civilIdFrontId: documentId - })); - }; - - const handleCivilIdBackUpload = (documentId: string) => { - console.log('Back ID uploaded:', documentId); - setFormData(prev => ({ - ...prev, - civilIdBackId: documentId - })); - }; - - return ( - - - Add New Junior - - - - {error && ( - - {error} - - )} - - - - - - Country Code - - - - - - - - - - - - - - - - - - - - - Relationship - - - - - - - - Civil ID Documents - - - - - - - {formData.civilIdFrontId && ( - - Civil ID Front uploaded (ID: {formData.civilIdFrontId}) - - )} - - - - {formData.civilIdBackId && ( - - Civil ID Back uploaded (ID: {formData.civilIdBackId}) - - )} - - - - - - - - - - - ); -}; diff --git a/client/src/components/juniors/JuniorsList.tsx b/client/src/components/juniors/JuniorsList.tsx deleted file mode 100644 index 9694d86..0000000 --- a/client/src/components/juniors/JuniorsList.tsx +++ /dev/null @@ -1,121 +0,0 @@ -import React, { useEffect, useState } from 'react'; -import { - Box, - Typography, - Grid, - Card, - CardContent, - CardMedia, - Button, - CircularProgress, - Pagination -} from '@mui/material'; -import { juniorsApi } from '../../api/client'; -import { Junior, PaginatedResponse } from '../../types/junior'; -import { useNavigate } from 'react-router-dom'; - -export const JuniorsList = () => { - const [loading, setLoading] = useState(true); - const [error, setError] = useState(''); - const [juniors, setJuniors] = useState([]); - const [page, setPage] = useState(1); - const [totalPages, setTotalPages] = useState(1); - const navigate = useNavigate(); - - const fetchJuniors = async (pageNum: number) => { - try { - setLoading(true); - const response = await juniorsApi.getJuniors(pageNum); - const data = response.data as PaginatedResponse; - setJuniors(data.data); - setTotalPages(data.meta.pageCount); - } catch (err) { - setError(err instanceof Error ? err.message : 'Failed to load juniors'); - } finally { - setLoading(false); - } - }; - - useEffect(() => { - fetchJuniors(page); - }, [page]); - - const handlePageChange = (event: React.ChangeEvent, value: number) => { - setPage(value); - }; - - if (loading) { - return ( - - - - ); - } - - if (error) { - return ( - - {error} - - ); - } - - return ( - - - Juniors - - - - - {juniors.map((junior) => ( - - - - - - {junior.fullName} - - - {junior.relationship} - - - - - - - - ))} - - - {totalPages > 1 && ( - - - - )} - - ); -}; diff --git a/client/src/components/layout/AuthLayout.tsx b/client/src/components/layout/AuthLayout.tsx deleted file mode 100644 index 33850ed..0000000 --- a/client/src/components/layout/AuthLayout.tsx +++ /dev/null @@ -1,175 +0,0 @@ -import React from 'react'; -import { Navigate, Outlet, useNavigate } from 'react-router-dom'; -import { - AppBar, - Toolbar, - Typography, - Button, - Box, - Container, - List, - ListItem, - Drawer, - Divider -} from '@mui/material'; -import { - Dashboard as DashboardIcon, - People as PeopleIcon, - Assignment as TasksIcon, - Person as ProfileIcon -} from '@mui/icons-material'; -import { useAuth } from '../../contexts/AuthContext'; - -export const AuthLayout = () => { - const { isAuthenticated, user, logout } = useAuth(); - const navigate = useNavigate(); - - if (!isAuthenticated) { - return ; - } - - return ( - - theme.zIndex.drawer + 1, - backgroundColor: 'background.paper', - boxShadow: 'none', - borderBottom: '1px solid', - borderColor: 'divider' - }} - > - - - Zod Alkhair | API Testting client - - - {user && ( - - {user.firstName} {user.lastName} - - )} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ); -}; diff --git a/client/src/components/tasks/AddTask.tsx b/client/src/components/tasks/AddTask.tsx deleted file mode 100644 index 057ff38..0000000 --- a/client/src/components/tasks/AddTask.tsx +++ /dev/null @@ -1,245 +0,0 @@ -import { - Alert, - Box, - Button, - Checkbox, - FormControl, - FormControlLabel, - Grid, - InputLabel, - MenuItem, - Paper, - Select, - SelectChangeEvent, - TextField, - Typography, -} from '@mui/material'; -import { AxiosError } from 'axios'; -import React, { useEffect, useState } from 'react'; -import { useNavigate } from 'react-router-dom'; -import { juniorsApi, tasksApi } from '../../api/client'; -import { ApiError } from '../../types/api'; -import { DocumentType } from '../../types/document'; -import { Junior, PaginatedResponse } from '../../types/junior'; -import { CreateTaskRequest } from '../../types/task'; -import { DocumentUpload } from '../document/DocumentUpload'; - -export const AddTaskForm = () => { - const navigate = useNavigate(); - const [loading, setLoading] = useState(false); - const [error, setError] = useState(''); - const [formData, setFormData] = useState({ - title: '', - description: '', - dueDate: '', - rewardAmount: 0, - isProofRequired: false, - juniorId: '', - imageId: '', - }); - - const [juniors, setJuniors] = useState([]); - - const handleSubmit = async (e: React.FormEvent) => { - e.preventDefault(); - console.log('Form data:', formData); - - setError(''); - setLoading(true); - - try { - if (!formData.imageId) { - console.log('Proof is required but no image uploaded'); - } - - console.log('Submitting data:', formData); - const dataToSubmit = { - ...formData, - rewardAmount: Number(formData.rewardAmount), - imageId: formData.imageId, - }; - await tasksApi.createTask(dataToSubmit); - navigate('/tasks'); - } catch (err) { - console.error('Create junior error:', err); - if (err instanceof AxiosError && err.response?.data) { - const apiError = err.response.data as ApiError; - const messages = Array.isArray(apiError.message) - ? apiError.message.map((m) => `${m.field}: ${m.message}`).join('\n') - : apiError.message; - setError(messages); - } else { - setError(err instanceof Error ? err.message : 'Failed to create Task'); - } - } finally { - setLoading(false); - } - }; - - const handleInputChange = (e: React.ChangeEvent) => { - const { name, value } = e.target; - console.log(name, value); - setFormData((prev) => ({ - ...prev, - [name]: value, - })); - }; - - const fetchJuniors = async () => { - try { - const response = await juniorsApi.getJuniors(1, 50); - const data = response.data as PaginatedResponse; - setJuniors(data.data); - } catch (err) { - console.error('Failed to load juniors:', err); - } - }; - - const handleSelectChange = (e: SelectChangeEvent) => { - const { name, value } = e.target; - setFormData((prev) => ({ - ...prev, - [name as string]: value, - })); - }; - - useEffect(() => { - console.log('Form data updated:', formData); - }, [formData]); - - useEffect(() => { - fetchJuniors(); - }, []); - - const handleTaskImageUpload = (documentId: string) => { - console.log('task image ID uploaded:', documentId); - setFormData((prev) => ({ - ...prev, - imageId: documentId, - })); - }; - - const handleCheckedInputChange = (e: React.ChangeEvent) => { - setFormData((prev) => ({ - ...prev, - isProofRequired: e.target.checked, - })); - }; - - return ( - - - Add New Task - - - - {error && ( - - {error} - - )} - - - - - - - - - - - - - - - - - - - - - Junior - - - - - - - {formData.imageId && ( - - Task Image uploaded (ID: {formData.imageId}) - - )} - - - - - - } - label="Proof Required" - /> - - - - - - - - - - - - ); -}; diff --git a/client/src/components/tasks/TaskDetails.tsx b/client/src/components/tasks/TaskDetails.tsx deleted file mode 100644 index a6ae7ba..0000000 --- a/client/src/components/tasks/TaskDetails.tsx +++ /dev/null @@ -1,87 +0,0 @@ -import { Box, Card, CardContent, Chip, CircularProgress, Typography } from '@mui/material'; -import { useEffect, useState } from 'react'; -import { useNavigate, useParams } from 'react-router-dom'; -import { tasksApi } from '../../api/client'; -import { Task } from '../../types/task'; - -export const TaskDetails = () => { - useNavigate(); - const [loading, setLoading] = useState(false); - const [error, setError] = useState(''); - const statusColors = { - PENDING: 'warning', - IN_PROGRESS: 'info', - COMPLETED: 'success', - } as const; - - const { taskId } = useParams(); - if (!taskId) { - throw new Error('Task ID is required'); - } - const [task, setTask] = useState(); - const fetchTask = async () => { - try { - setLoading(true); - const response = await tasksApi.getTaskById(taskId); - setTask(response.data.data); - } catch (err) { - setError(err instanceof Error ? err.message : 'Failed to load task'); - } finally { - setLoading(false); - } - }; - - useEffect(() => { - fetchTask(); - }, []); - - if (loading) { - return ( - - - - ); - } - - if (error) { - return ( - - {error} - - ); - } - - if (!task) { - return ( - - Task not found - - ); - } - console.log(task); - - return ( - - - - - {task.title} - - - - - Due: {new Date(task.dueDate).toLocaleDateString()} - - - {task.description} - - - Reward: ${task.rewardAmount} - - - Assigned to: {task.junior.fullName} - - - - ); -}; diff --git a/client/src/components/tasks/TasksList.tsx b/client/src/components/tasks/TasksList.tsx deleted file mode 100644 index 7703498..0000000 --- a/client/src/components/tasks/TasksList.tsx +++ /dev/null @@ -1,200 +0,0 @@ -import { - Box, - Button, - Card, - CardContent, - Chip, - CircularProgress, - FormControl, - Grid, - InputLabel, - MenuItem, - Pagination, - Select, - SelectChangeEvent, - Typography -} from '@mui/material'; -import React, { useEffect, useState } from 'react'; -import { useNavigate } from 'react-router-dom'; -import { juniorsApi, tasksApi } from '../../api/client'; -import { Junior, PaginatedResponse } from '../../types/junior'; -import { Task, TaskStatus } from '../../types/task'; - -const statusColors = { - PENDING: 'warning', - IN_PROGRESS: 'info', - COMPLETED: 'success' -} as const; - -export const TasksList = () => { - const [loading, setLoading] = useState(true); - const [error, setError] = useState(''); - const [tasks, setTasks] = useState([]); - const [juniors, setJuniors] = useState([]); - const [page, setPage] = useState(1); - const [totalPages, setTotalPages] = useState(1); - const [status, setStatus] = useState('PENDING'); - const [selectedJuniorId, setSelectedJuniorId] = useState(''); - const navigate = useNavigate(); - - const fetchJuniors = async () => { - try { - const response = await juniorsApi.getJuniors(1, 50); - const data = response.data as PaginatedResponse; - setJuniors(data.data); - } catch (err) { - console.error('Failed to load juniors:', err); - } - }; - - const fetchTasks = async (pageNum: number) => { - try { - setLoading(true); - const response = await tasksApi.getTasks(status, pageNum, 10, selectedJuniorId || undefined); - const data = response.data as PaginatedResponse; - setTasks(data.data); - setTotalPages(data.meta.pageCount); - } catch (err) { - setError(err instanceof Error ? err.message : 'Failed to load tasks'); - } finally { - setLoading(false); - } - }; - - useEffect(() => { - fetchJuniors(); - }, []); - - useEffect(() => { - fetchTasks(page); - }, [page, status, selectedJuniorId]); - - const handlePageChange = (event: React.ChangeEvent, value: number) => { - setPage(value); - }; - - const handleStatusChange = (event: SelectChangeEvent) => { - setStatus(event.target.value as TaskStatus); - setPage(1); - }; - - const handleJuniorChange = (event: SelectChangeEvent) => { - setSelectedJuniorId(event.target.value); - setPage(1); - }; - - if (loading && page === 1) { - return ( - - - - ); - } - - if (error) { - return ( - - {error} - - ); - } - - return ( - - - Tasks - - - - - - Status - - - - - Junior - - - - - - {tasks.map((task) => ( - - - - - - {task.title} - - - - - Due: {new Date(task.dueDate).toLocaleDateString()} - - - {task.description} - - - Reward: ${task.rewardAmount} - - - Assigned to: {task.junior.fullName} - - - - - - - - ))} - - - {totalPages > 1 && ( - - - - )} - - ); -}; diff --git a/client/src/contexts/AuthContext.tsx b/client/src/contexts/AuthContext.tsx deleted file mode 100644 index a19aa46..0000000 --- a/client/src/contexts/AuthContext.tsx +++ /dev/null @@ -1,119 +0,0 @@ -import React, { createContext, useCallback, useContext, useState } from 'react'; -import { authApi } from '../api/client'; -import { LoginRequest, LoginResponse, User } from '../types/auth'; - -interface AuthContextType { - isAuthenticated: boolean; - user: User | null; - login: (loginRequest: LoginRequest) => Promise; - logout: () => void; - register: (countryCode: string, phoneNumber: string) => Promise; - verifyOtp: (countryCode: string, phoneNumber: string, otp: string) => Promise; - setEmail: (email: string) => Promise; - setPasscode: (passcode: string) => Promise; -} - -const AuthContext = createContext(null); - -export const useAuth = () => { - const context = useContext(AuthContext); - if (!context) { - throw new Error('useAuth must be used within an AuthProvider'); - } - return context; -}; - -export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => { - const [isAuthenticated, setIsAuthenticated] = useState(false); - const [user, setUser] = useState(null); - - const login = useCallback(async (loginRequest: LoginRequest) => { - try { - const response = await authApi.login(loginRequest); - const loginData = response.data.data as LoginResponse; - setUser(loginData.user); - // Store tokens - localStorage.setItem('accessToken', loginData.accessToken); - localStorage.setItem('refreshToken', loginData.refreshToken); - setIsAuthenticated(true); - // Store tokens or other auth data in localStorage if needed - } catch (error) { - console.error('Login failed:', error); - throw error; - } - }, []); - - const logout = useCallback(() => { - setUser(null); - setIsAuthenticated(false); - // Clear any stored auth data - localStorage.clear(); - }, []); - - // Registration state - const [registrationData, setRegistrationData] = useState<{ - countryCode?: string; - phoneNumber?: string; - email?: string; - token?: string; - }>({}); - - const register = useCallback(async (countryCode: string, phoneNumber: string) => { - try { - await authApi.register(countryCode, phoneNumber); - setRegistrationData({ countryCode, phoneNumber }); - } catch (error) { - console.error('Registration failed:', error); - throw error; - } - }, []); - - const verifyOtp = useCallback(async (countryCode: string, phoneNumber: string, otp: string) => { - try { - const response = await authApi.verifyOtp(countryCode, phoneNumber, otp); - console.log('OTP verification response:', response.data); - const { accessToken } = response.data.data; - console.log('Access token:', accessToken); - // Store token in localStorage immediately - localStorage.setItem('accessToken', accessToken); - setRegistrationData((prev) => ({ ...prev, token: accessToken })); - return accessToken; - } catch (error) { - console.error('OTP verification failed:', error); - throw error; - } - }, []); - - const setEmail = useCallback(async (email: string) => { - try { - await authApi.setEmail(email); - setRegistrationData((prev) => ({ ...prev, email })); - } catch (error) { - console.error('Setting email failed:', error); - throw error; - } - }, []); - - const setPasscode = useCallback(async (passcode: string) => { - try { - await authApi.setPasscode(passcode); - setIsAuthenticated(true); - } catch (error) { - console.error('Setting passcode failed:', error); - throw error; - } - }, []); - - const value = { - isAuthenticated, - user, - login, - logout, - register, - verifyOtp, - setEmail, - setPasscode, - }; - - return {children}; -}; diff --git a/client/src/enums/grantType.enum.ts b/client/src/enums/grantType.enum.ts deleted file mode 100644 index f4d19d3..0000000 --- a/client/src/enums/grantType.enum.ts +++ /dev/null @@ -1,6 +0,0 @@ -export enum GrantType { - PASSWORD = 'PASSWORD', - APPLE = 'APPLE', - GOOGLE = 'GOOGLE', - BIOMETRIC = 'BIOMETRIC', -} diff --git a/client/src/enums/index.ts b/client/src/enums/index.ts deleted file mode 100644 index 69dc8be..0000000 --- a/client/src/enums/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './grantType.enum'; diff --git a/client/src/index.css b/client/src/index.css deleted file mode 100644 index f5b7ffb..0000000 --- a/client/src/index.css +++ /dev/null @@ -1,52 +0,0 @@ -@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap'); - -* { - margin: 0; - padding: 0; - box-sizing: border-box; -} - -body { - font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', - 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', - sans-serif; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - background-color: #F8F9FA; - color: #2D3748; -} - -/* Custom scrollbar */ -::-webkit-scrollbar { - width: 8px; - height: 8px; -} - -::-webkit-scrollbar-track { - background: #F8F9FA; -} - -::-webkit-scrollbar-thumb { - background: #CBD5E0; - border-radius: 4px; -} - -::-webkit-scrollbar-thumb:hover { - background: #A0AEC0; -} - -/* Smooth transitions */ -a, button { - transition: all 0.2s ease-in-out; -} - -/* Remove focus outline for mouse users, keep for keyboard users */ -:focus:not(:focus-visible) { - outline: none; -} - -/* Keep focus outline for keyboard users */ -:focus-visible { - outline: 2px solid #00A7E1; - outline-offset: 2px; -} diff --git a/client/src/main.tsx b/client/src/main.tsx deleted file mode 100644 index c072d42..0000000 --- a/client/src/main.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import React from 'react'; -import ReactDOM from 'react-dom/client'; -import App from './App'; -import '@fontsource/roboto/300.css'; -import '@fontsource/roboto/400.css'; -import '@fontsource/roboto/500.css'; -import '@fontsource/roboto/700.css'; - -ReactDOM.createRoot(document.getElementById('root')!).render( - - - -); diff --git a/client/src/types/api.ts b/client/src/types/api.ts deleted file mode 100644 index b820ba3..0000000 --- a/client/src/types/api.ts +++ /dev/null @@ -1,14 +0,0 @@ -interface ApiErrorField { - field: string; - message: string; -} - -export interface ApiError { - statusCode: number; - message: string | ApiErrorField[]; - error: string; -} - -export interface ApiResponse { - data: T; -} diff --git a/client/src/types/auth.ts b/client/src/types/auth.ts deleted file mode 100644 index 8c2b38e..0000000 --- a/client/src/types/auth.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { GrantType } from '../enums'; - -export interface User { - id: string; - email: string; - customerStatus?: string; - firstName?: string; - lastName?: string; - dateOfBirth?: string; - countryOfResidence?: string; - isJunior?: boolean; - isGuardian?: boolean; -} - -export interface LoginResponse { - accessToken: string; - refreshToken: string; - user: User; -} - -export interface LoginRequest { - email?: string; - password?: string; - grantType: GrantType; - googleToken?: string; - appleToken?: string; -} diff --git a/client/src/types/document.ts b/client/src/types/document.ts deleted file mode 100644 index 30f434b..0000000 --- a/client/src/types/document.ts +++ /dev/null @@ -1,9 +0,0 @@ -export enum DocumentType { - PROFILE_PICTURE = 'PROFILE_PICTURE', - PASSPORT = 'PASSPORT', - DEFAULT_AVATAR = 'DEFAULT_AVATAR', - DEFAULT_TASKS_LOGO = 'DEFAULT_TASKS_LOGO', - CUSTOM_AVATAR = 'CUSTOM_AVATAR', - CUSTOM_TASKS_LOGO = 'CUSTOM_TASKS_LOGO', - GOALS = 'GOALS' -} diff --git a/client/src/types/junior.ts b/client/src/types/junior.ts deleted file mode 100644 index fbe3c89..0000000 --- a/client/src/types/junior.ts +++ /dev/null @@ -1,41 +0,0 @@ -export interface Junior { - id: string; - fullName: string; - relationship: string; - profilePicture?: { - id: string; - name: string; - extension: string; - documentType: string; - url: string; - }; -} - -export interface CreateJuniorRequest { - countryCode: string; - phoneNumber: string; - firstName: string; - lastName: string; - dateOfBirth: string; - email: string; - relationship: string; - civilIdFrontId: string; - civilIdBackId: string; -} - -export interface JuniorTheme { - color: string; - avatarId: string; -} - -export interface PaginatedResponse { - data: T[]; - meta: { - page: number; - size: number; - itemCount: number; - pageCount: number; - hasPreviousPage: boolean; - hasNextPage: boolean; - }; -} diff --git a/client/src/types/task.ts b/client/src/types/task.ts deleted file mode 100644 index 35f72f7..0000000 --- a/client/src/types/task.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Junior } from './junior'; - -export interface Task { - id: string; - title: string; - description: string; - status: 'PENDING' | 'IN_PROGRESS' | 'COMPLETED'; - dueDate: string; - rewardAmount: number; - isProofRequired: boolean; - submission?: { - imageId?: string; - submittedAt?: string; - status?: 'PENDING' | 'APPROVED' | 'REJECTED'; - }; - junior: Junior; - image?: { - id: string; - name: string; - extension: string; - documentType: string; - url: string; - }; - createdAt: string; - updatedAt: string; -} - -export interface CreateTaskRequest { - title: string; - description: string; - dueDate: string; - rewardAmount: number; - isProofRequired: boolean; - imageId?: string; - juniorId: string; -} - -export interface TaskSubmission { - imageId: string; -} - -export type TaskStatus = 'PENDING' | 'IN_PROGRESS' | 'COMPLETED'; diff --git a/client/src/vite-env.d.ts b/client/src/vite-env.d.ts deleted file mode 100644 index 11f02fe..0000000 --- a/client/src/vite-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/client/tsconfig.app.json b/client/tsconfig.app.json deleted file mode 100644 index a67d962..0000000 --- a/client/tsconfig.app.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "compilerOptions": { - "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", - "target": "ES2020", - "useDefineForClassFields": true, - "lib": ["ES2020", "DOM", "DOM.Iterable"], - "module": "ESNext", - "skipLibCheck": true, - - /* Bundler mode */ - "moduleResolution": "bundler", - "allowImportingTsExtensions": true, - "isolatedModules": true, - "moduleDetection": "force", - "noEmit": true, - "jsx": "react-jsx", - - /* Linting */ - "strict": true, - "noUnusedLocals": false, - "noUnusedParameters": false, - "noFallthroughCasesInSwitch": true, - "noUncheckedSideEffectImports": true - }, - "include": ["src"] -} diff --git a/client/tsconfig.json b/client/tsconfig.json deleted file mode 100644 index 1ffef60..0000000 --- a/client/tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "files": [], - "references": [ - { "path": "./tsconfig.app.json" }, - { "path": "./tsconfig.node.json" } - ] -} diff --git a/client/tsconfig.node.json b/client/tsconfig.node.json deleted file mode 100644 index db0becc..0000000 --- a/client/tsconfig.node.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", - "target": "ES2022", - "lib": ["ES2023"], - "module": "ESNext", - "skipLibCheck": true, - - /* Bundler mode */ - "moduleResolution": "bundler", - "allowImportingTsExtensions": true, - "isolatedModules": true, - "moduleDetection": "force", - "noEmit": true, - - /* Linting */ - "strict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noFallthroughCasesInSwitch": true, - "noUncheckedSideEffectImports": true - }, - "include": ["vite.config.ts"] -} diff --git a/client/vite.config.ts b/client/vite.config.ts deleted file mode 100644 index 43e4018..0000000 --- a/client/vite.config.ts +++ /dev/null @@ -1,16 +0,0 @@ -import react from '@vitejs/plugin-react'; -import path from 'path'; -import { defineConfig, loadEnv } from 'vite'; - -// https://vitejs.dev/config/ -export default defineConfig(({ mode }) => { - const env = loadEnv(mode, path.join(process.cwd(), '..'), ''); - return { - define: { - 'process.env.REACT_APP_APPLE_CLIENT_ID': JSON.stringify(env.REACT_APP_APPLE_CLIENT_ID), - 'process.env.REACT_APP_APPLE_REDIRECT_URI': JSON.stringify(env.REACT_APP_APPLE_REDIRECT_URI), - 'process.env.GOOGLE_WEB_CLIENT_ID': JSON.stringify(env.GOOGLE_WEB_CLIENT_ID), - }, - plugins: [react()], - }; -}); diff --git a/src/allowance/allowance.module.ts b/src/allowance/allowance.module.ts deleted file mode 100644 index ff2541c..0000000 --- a/src/allowance/allowance.module.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { Module } from '@nestjs/common'; -import { TypeOrmModule } from '@nestjs/typeorm'; -import { JuniorModule } from '~/junior/junior.module'; -import { AllowanceChangeRequestController, AllowancesController } from './controllers'; -import { Allowance, AllowanceChangeRequest } from './entities'; -import { AllowanceChangeRequestsRepository, AllowancesRepository } from './repositories'; -import { AllowanceChangeRequestsService, AllowancesService } from './services'; - -@Module({ - controllers: [AllowancesController, AllowanceChangeRequestController], - imports: [TypeOrmModule.forFeature([Allowance, AllowanceChangeRequest]), JuniorModule], - providers: [ - AllowancesService, - AllowancesRepository, - AllowanceChangeRequestsService, - AllowanceChangeRequestsRepository, - ], - exports: [AllowancesService], -}) -export class AllowanceModule {} diff --git a/src/allowance/controllers/allowance-change-request.controller.ts b/src/allowance/controllers/allowance-change-request.controller.ts deleted file mode 100644 index 88100b4..0000000 --- a/src/allowance/controllers/allowance-change-request.controller.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { Body, Controller, Get, HttpCode, HttpStatus, Param, Patch, Post, Query, UseGuards } from '@nestjs/common'; -import { ApiBearerAuth, ApiTags } from '@nestjs/swagger'; -import { Roles } from '~/auth/enums'; -import { IJwtPayload } from '~/auth/interfaces'; -import { AllowedRoles, AuthenticatedUser } from '~/common/decorators'; -import { RolesGuard } from '~/common/guards'; -import { ApiDataPageResponse, ApiDataResponse, ApiLangRequestHeader } from '~/core/decorators'; -import { PageOptionsRequestDto } from '~/core/dtos'; -import { CustomParseUUIDPipe } from '~/core/pipes'; -import { ResponseFactory } from '~/core/utils'; -import { CreateAllowanceChangeRequestDto } from '../dtos/request'; -import { AllowanceChangeRequestResponseDto } from '../dtos/response'; -import { AllowanceChangeRequestsService } from '../services'; - -@Controller('allowance-change-requests') -@ApiTags('Allowance Change Requests') -@ApiBearerAuth() -@ApiLangRequestHeader() -export class AllowanceChangeRequestController { - constructor(private readonly allowanceChangeRequestsService: AllowanceChangeRequestsService) {} - - @Post() - @UseGuards(RolesGuard) - @AllowedRoles(Roles.JUNIOR) - @HttpCode(HttpStatus.NO_CONTENT) - requestAllowanceChange(@AuthenticatedUser() { sub }: IJwtPayload, @Body() body: CreateAllowanceChangeRequestDto) { - return this.allowanceChangeRequestsService.createAllowanceChangeRequest(sub, body); - } - - @Get() - @UseGuards(RolesGuard) - @AllowedRoles(Roles.GUARDIAN) - @ApiDataPageResponse(AllowanceChangeRequestResponseDto) - async findAllowanceChangeRequests(@AuthenticatedUser() { sub }: IJwtPayload, @Query() query: PageOptionsRequestDto) { - const [requests, itemCount] = await this.allowanceChangeRequestsService.findAllowanceChangeRequests(sub, query); - - return ResponseFactory.dataPage( - requests.map((request) => new AllowanceChangeRequestResponseDto(request)), - { - itemCount, - page: query.page, - size: query.size, - }, - ); - } - - @Get('/:changeRequestId') - @UseGuards(RolesGuard) - @AllowedRoles(Roles.GUARDIAN) - @ApiDataResponse(AllowanceChangeRequestResponseDto) - async findAllowanceChangeRequestById( - @AuthenticatedUser() { sub }: IJwtPayload, - @Param('changeRequestId', CustomParseUUIDPipe) changeRequestId: string, - ) { - const request = await this.allowanceChangeRequestsService.findAllowanceChangeRequestById(sub, changeRequestId); - - return ResponseFactory.data(new AllowanceChangeRequestResponseDto(request)); - } - - @Patch(':changeRequestId/approve') - @UseGuards(RolesGuard) - @AllowedRoles(Roles.GUARDIAN) - @HttpCode(HttpStatus.NO_CONTENT) - approveAllowanceChangeRequest( - @AuthenticatedUser() { sub }: IJwtPayload, - @Param('changeRequestId', CustomParseUUIDPipe) changeRequestId: string, - ) { - return this.allowanceChangeRequestsService.approveAllowanceChangeRequest(sub, changeRequestId); - } - - @Patch(':changeRequestId/reject') - @UseGuards(RolesGuard) - @AllowedRoles(Roles.GUARDIAN) - @HttpCode(HttpStatus.NO_CONTENT) - rejectAllowanceChangeRequest( - @AuthenticatedUser() { sub }: IJwtPayload, - @Param('changeRequestId', CustomParseUUIDPipe) changeRequestId: string, - ) { - return this.allowanceChangeRequestsService.rejectAllowanceChangeRequest(sub, changeRequestId); - } -} diff --git a/src/allowance/controllers/allowances.controller.ts b/src/allowance/controllers/allowances.controller.ts deleted file mode 100644 index 44961e9..0000000 --- a/src/allowance/controllers/allowances.controller.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { Body, Controller, Delete, Get, HttpCode, HttpStatus, Param, Post, Query, UseGuards } from '@nestjs/common'; -import { ApiBearerAuth, ApiTags } from '@nestjs/swagger'; -import { Roles } from '~/auth/enums'; -import { IJwtPayload } from '~/auth/interfaces'; -import { AllowedRoles, AuthenticatedUser } from '~/common/decorators'; -import { RolesGuard } from '~/common/guards'; -import { ApiDataPageResponse, ApiDataResponse, ApiLangRequestHeader } from '~/core/decorators'; -import { PageOptionsRequestDto } from '~/core/dtos'; -import { CustomParseUUIDPipe } from '~/core/pipes'; -import { ResponseFactory } from '~/core/utils'; -import { CreateAllowanceRequestDto } from '../dtos/request'; -import { AllowanceResponseDto } from '../dtos/response'; -import { AllowancesService } from '../services'; - -@Controller('allowances') -@ApiTags('Allowances') -@ApiBearerAuth() -@ApiLangRequestHeader() -export class AllowancesController { - constructor(private readonly allowancesService: AllowancesService) {} - - @Post() - @UseGuards(RolesGuard) - @AllowedRoles(Roles.GUARDIAN) - @ApiDataResponse(AllowanceResponseDto) - async createAllowance(@AuthenticatedUser() { sub }: IJwtPayload, @Body() body: CreateAllowanceRequestDto) { - const allowance = await this.allowancesService.createAllowance(sub, body); - - return ResponseFactory.data(new AllowanceResponseDto(allowance)); - } - - @Get() - @UseGuards(RolesGuard) - @AllowedRoles(Roles.GUARDIAN) - @ApiDataPageResponse(AllowanceResponseDto) - async findAllowances(@AuthenticatedUser() { sub }: IJwtPayload, @Query() query: PageOptionsRequestDto) { - const [allowances, itemCount] = await this.allowancesService.findAllowances(sub, query); - - return ResponseFactory.dataPage( - allowances.map((allowance) => new AllowanceResponseDto(allowance)), - { - itemCount, - page: query.page, - size: query.size, - }, - ); - } - - @Get(':allowanceId') - @UseGuards(RolesGuard) - @AllowedRoles(Roles.GUARDIAN) - @ApiDataResponse(AllowanceResponseDto) - async findAllowanceById( - @AuthenticatedUser() { sub }: IJwtPayload, - @Param('allowanceId', CustomParseUUIDPipe) allowanceId: string, - ) { - const allowance = await this.allowancesService.findAllowanceById(allowanceId, sub); - - return ResponseFactory.data(new AllowanceResponseDto(allowance)); - } - - @Delete(':allowanceId') - @UseGuards(RolesGuard) - @AllowedRoles(Roles.GUARDIAN) - @ApiDataResponse(AllowanceResponseDto) - @HttpCode(HttpStatus.NO_CONTENT) - deleteAllowance( - @AuthenticatedUser() { sub }: IJwtPayload, - @Param('allowanceId', CustomParseUUIDPipe) allowanceId: string, - ) { - return this.allowancesService.deleteAllowance(sub, allowanceId); - } -} diff --git a/src/allowance/controllers/index.ts b/src/allowance/controllers/index.ts deleted file mode 100644 index 0c78bea..0000000 --- a/src/allowance/controllers/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './allowance-change-request.controller'; -export * from './allowances.controller'; diff --git a/src/allowance/dtos/request/create-allowance-change.request.dto.ts b/src/allowance/dtos/request/create-allowance-change.request.dto.ts deleted file mode 100644 index 350bf5e..0000000 --- a/src/allowance/dtos/request/create-allowance-change.request.dto.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { IsNotEmpty, IsNumber, IsPositive, IsString, IsUUID } from 'class-validator'; -import { i18nValidationMessage as i18n } from 'nestjs-i18n'; - -export class CreateAllowanceChangeRequestDto { - @ApiProperty({ example: 'I want to change the amount of the allowance' }) - @IsString({ message: i18n('validation.IsString', { path: 'general', property: 'allowanceChangeRequest.reason' }) }) - @IsNotEmpty({ - message: i18n('validation.IsNotEmpty', { path: 'general', property: 'allowanceChangeRequest.reason' }), - }) - reason!: string; - - @ApiProperty({ example: 100 }) - @IsNumber( - {}, - { message: i18n('validation.IsNumber', { path: 'general', property: 'allowanceChangeRequest.amount' }) }, - ) - @IsPositive({ - message: i18n('validation.IsPositive', { path: 'general', property: 'allowanceChangeRequest.amount' }), - }) - amount!: number; - - @ApiProperty({ example: 'd641bb71-2e7c-4e62-96fa-2785f0a651c6' }) - @IsUUID('4', { - message: i18n('validation.IsUUID', { path: 'general', property: 'allowanceChangeRequest.allowanceId' }), - }) - allowanceId!: string; -} diff --git a/src/allowance/dtos/request/create-allowance.request.dto.ts b/src/allowance/dtos/request/create-allowance.request.dto.ts deleted file mode 100644 index 2aed6ef..0000000 --- a/src/allowance/dtos/request/create-allowance.request.dto.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { Transform } from 'class-transformer'; -import { IsDate, IsEnum, IsInt, IsNotEmpty, IsNumber, IsPositive, IsString, IsUUID, ValidateIf } from 'class-validator'; -import moment from 'moment'; -import { i18nValidationMessage as i18n } from 'nestjs-i18n'; -import { AllowanceFrequency, AllowanceType } from '~/allowance/enums'; -export class CreateAllowanceRequestDto { - @ApiProperty({ example: 'Allowance name' }) - @IsString({ message: i18n('validation.IsString', { path: 'general', property: 'allowance.name' }) }) - @IsNotEmpty({ message: i18n('validation.IsNotEmpty', { path: 'general', property: 'allowance.name' }) }) - name!: string; - - @ApiProperty({ example: 100 }) - @IsNumber({}, { message: i18n('validation.IsNumber', { path: 'general', property: 'allowance.amount' }) }) - @IsPositive({ message: i18n('validation.IsPositive', { path: 'general', property: 'allowance.amount' }) }) - amount!: number; - - @ApiProperty({ example: AllowanceFrequency.WEEKLY }) - @IsEnum(AllowanceFrequency, { - message: i18n('validation.IsEnum', { path: 'general', property: 'allowance.frequency' }), - }) - frequency!: AllowanceFrequency; - - @ApiProperty({ example: AllowanceType.BY_END_DATE }) - @IsEnum(AllowanceType, { message: i18n('validation.IsEnum', { path: 'general', property: 'allowance.type' }) }) - type!: AllowanceType; - - @ApiProperty({ example: new Date() }) - @IsDate({ message: i18n('validation.IsDate', { path: 'general', property: 'allowance.startDate' }) }) - @Transform(({ value }) => moment(value).startOf('day').toDate()) - startDate!: Date; - - @ApiProperty({ example: new Date() }) - @IsDate({ message: i18n('validation.IsDate', { path: 'general', property: 'allowance.endDate' }) }) - @Transform(({ value }) => moment(value).endOf('day').toDate()) - @ValidateIf((o) => o.type === AllowanceType.BY_END_DATE) - endDate?: Date; - - @ApiProperty({ example: 10 }) - @IsNumber( - {}, - { message: i18n('validation.IsNumber', { path: 'general', property: 'allowance.numberOfTransactions' }) }, - ) - @IsInt({ message: i18n('validation.IsInt', { path: 'general', property: 'allowance.amount' }) }) - @IsPositive({ message: i18n('validation.IsPositive', { path: 'general', property: 'allowance.amount' }) }) - @ValidateIf((o) => o.type === AllowanceType.BY_COUNT) - numberOfTransactions?: number; - - @ApiProperty({ example: 'e7b1b3b4-4b3b-4b3b-4b3b-4b3b4b3b4b3b' }) - @IsUUID('4', { message: i18n('validation.IsUUID', { path: 'general', property: 'allowance.juniorId' }) }) - juniorId!: string; -} diff --git a/src/allowance/dtos/request/index.ts b/src/allowance/dtos/request/index.ts deleted file mode 100644 index bde72ae..0000000 --- a/src/allowance/dtos/request/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './create-allowance-change.request.dto'; -export * from './create-allowance.request.dto'; diff --git a/src/allowance/dtos/response/allowance-change-request.response.dto.ts b/src/allowance/dtos/response/allowance-change-request.response.dto.ts deleted file mode 100644 index 0d9b674..0000000 --- a/src/allowance/dtos/response/allowance-change-request.response.dto.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { AllowanceChangeRequest } from '~/allowance/entities'; -import { AllowanceChangeRequestStatus } from '~/allowance/enums'; -import { JuniorResponseDto } from '~/junior/dtos/response'; - -export class AllowanceChangeRequestResponseDto { - @ApiProperty({ example: 'd641bb71-2e7c-4e62-96fa-2785f0a651c6' }) - id!: string; - - @ApiProperty({ example: AllowanceChangeRequestStatus.APPROVED }) - status!: AllowanceChangeRequestStatus; - - @ApiProperty({ example: 'Allowance name' }) - name!: string; - - @ApiProperty({ example: '100' }) - oldAmount!: number; - - @ApiProperty({ example: '200' }) - newAmount!: number; - - @ApiProperty({ example: 'Some reason' }) - reason!: string; - - @ApiProperty({ example: 'd641bb71-2e7c-4e62-96fa-2785f0a651c6' }) - allowanceId!: string; - - @ApiProperty({ type: JuniorResponseDto }) - junior!: JuniorResponseDto; - - @ApiProperty({ example: new Date() }) - createdAt!: Date; - - constructor(allowanceChangeRequest: AllowanceChangeRequest) { - this.id = allowanceChangeRequest.id; - this.status = allowanceChangeRequest.status; - this.name = allowanceChangeRequest.allowance.name; - this.oldAmount = allowanceChangeRequest.allowance.amount; - this.newAmount = allowanceChangeRequest.amount; - this.reason = allowanceChangeRequest.reason; - this.allowanceId = allowanceChangeRequest.allowanceId; - this.junior = new JuniorResponseDto(allowanceChangeRequest.allowance.junior); - this.createdAt = allowanceChangeRequest.createdAt; - } -} diff --git a/src/allowance/dtos/response/allowance.response.dto.ts b/src/allowance/dtos/response/allowance.response.dto.ts deleted file mode 100644 index 95b4542..0000000 --- a/src/allowance/dtos/response/allowance.response.dto.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { Allowance } from '~/allowance/entities'; -import { AllowanceFrequency, AllowanceType } from '~/allowance/enums'; -import { JuniorResponseDto } from '~/junior/dtos/response'; - -export class AllowanceResponseDto { - @ApiProperty({ example: 'd641bb71-2e7c-4e62-96fa-2785f0a651c6' }) - id!: string; - - @ApiProperty({ example: 'Allowance name' }) - name!: string; - - @ApiProperty({ example: 100 }) - amount!: number; - - @ApiProperty({ example: AllowanceFrequency.WEEKLY }) - frequency!: AllowanceFrequency; - - @ApiProperty({ example: AllowanceType.BY_END_DATE }) - type!: AllowanceType; - - @ApiProperty({ example: new Date() }) - startDate!: Date; - - @ApiProperty({ example: new Date() }) - endDate?: Date; - - @ApiProperty({ example: 10 }) - numberOfTransactions?: number; - - @ApiProperty({ type: JuniorResponseDto }) - junior!: JuniorResponseDto; - - @ApiProperty({ example: new Date() }) - createdAt!: Date; - - @ApiProperty({ example: new Date() }) - updatedAt!: Date; - - constructor(allowance: Allowance) { - this.id = allowance.id; - this.name = allowance.name; - this.amount = allowance.amount; - this.frequency = allowance.frequency; - this.type = allowance.type; - this.startDate = allowance.startDate; - this.endDate = allowance.endDate; - this.numberOfTransactions = allowance.numberOfTransactions; - this.junior = new JuniorResponseDto(allowance.junior); - this.createdAt = allowance.createdAt; - this.updatedAt = allowance.updatedAt; - } -} diff --git a/src/allowance/dtos/response/index.ts b/src/allowance/dtos/response/index.ts deleted file mode 100644 index 7147613..0000000 --- a/src/allowance/dtos/response/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './allowance-change-request.response.dto'; -export * from './allowance.response.dto'; diff --git a/src/allowance/entities/allowance-change-request.entity.ts b/src/allowance/entities/allowance-change-request.entity.ts deleted file mode 100644 index 57ab265..0000000 --- a/src/allowance/entities/allowance-change-request.entity.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { - Column, - CreateDateColumn, - Entity, - JoinColumn, - ManyToOne, - PrimaryGeneratedColumn, - UpdateDateColumn, -} from 'typeorm'; -import { AllowanceChangeRequestStatus } from '../enums'; -import { Allowance } from './allowance.entity'; - -@Entity('allowance_change_requests') -export class AllowanceChangeRequest { - @PrimaryGeneratedColumn('uuid') - id!: string; - - @Column({ type: 'text', name: 'reason' }) - reason!: string; - - @Column({ - type: 'decimal', - precision: 10, - scale: 2, - name: 'amount', - transformer: { to: (value: number) => value, from: (value: string) => parseFloat(value) }, - }) - amount!: number; - - @Column({ type: 'varchar', length: 255, name: 'status', default: AllowanceChangeRequestStatus.PENDING }) - status!: AllowanceChangeRequestStatus; - - @Column({ type: 'uuid', name: 'allowance_id' }) - allowanceId!: string; - - @ManyToOne(() => Allowance, (allowance) => allowance.changeRequests) - @JoinColumn({ name: 'allowance_id' }) - allowance!: Allowance; - - @CreateDateColumn({ name: 'created_at', type: 'timestamp with time zone', default: () => 'CURRENT_TIMESTAMP' }) - createdAt!: Date; - - @UpdateDateColumn({ name: 'updated_at', type: 'timestamp with time zone', default: () => 'CURRENT_TIMESTAMP' }) - updatedAt!: Date; -} diff --git a/src/allowance/entities/allowance.entity.ts b/src/allowance/entities/allowance.entity.ts deleted file mode 100644 index 12ecf7b..0000000 --- a/src/allowance/entities/allowance.entity.ts +++ /dev/null @@ -1,107 +0,0 @@ -import moment from 'moment'; -import { - Column, - CreateDateColumn, - DeleteDateColumn, - Entity, - JoinColumn, - ManyToOne, - OneToMany, - PrimaryGeneratedColumn, - UpdateDateColumn, -} from 'typeorm'; -import { Guardian } from '~/guardian/entities/guradian.entity'; -import { Junior } from '~/junior/entities'; -import { AllowanceFrequency, AllowanceType } from '../enums'; -import { AllowanceChangeRequest } from './allowance-change-request.entity'; -@Entity('allowances') -export class Allowance { - @PrimaryGeneratedColumn('uuid') - id!: string; - - @Column({ type: 'varchar', length: 255, name: 'name' }) - name!: string; - - @Column({ - type: 'decimal', - precision: 10, - scale: 2, - name: 'amount', - transformer: { to: (value: number) => value, from: (value: string) => parseFloat(value) }, - }) - amount!: number; - - @Column({ type: 'varchar', length: 255, name: 'frequency' }) - frequency!: AllowanceFrequency; - - @Column({ type: 'varchar', length: 255, name: 'type' }) - type!: AllowanceType; - - @Column({ type: 'timestamp with time zone', name: 'start_date' }) - startDate!: Date; - - @Column({ type: 'timestamp with time zone', name: 'end_date', nullable: true }) - endDate?: Date; - - @Column({ type: 'int', name: 'number_of_transactions', nullable: true }) - numberOfTransactions?: number; - - @Column({ type: 'uuid', name: 'guardian_id' }) - guardianId!: string; - - @Column({ type: 'uuid', name: 'junior_id' }) - juniorId!: string; - - @ManyToOne(() => Guardian, (guardian) => guardian.allowances) - @JoinColumn({ name: 'guardian_id' }) - guardian!: Guardian; - - @ManyToOne(() => Junior, (junior) => junior.allowances) - @JoinColumn({ name: 'junior_id' }) - junior!: Junior; - - @OneToMany(() => AllowanceChangeRequest, (changeRequest) => changeRequest.allowance) - changeRequests!: AllowanceChangeRequest[]; - - @CreateDateColumn({ name: 'created_at', type: 'timestamp with time zone', default: () => 'CURRENT_TIMESTAMP' }) - createdAt!: Date; - - @UpdateDateColumn({ name: 'updated_at', type: 'timestamp with time zone', default: () => 'CURRENT_TIMESTAMP' }) - updatedAt!: Date; - - @DeleteDateColumn({ name: 'deleted_at', type: 'timestamp with time zone', nullable: true }) - deletedAt?: Date; - - get nextPaymentDate(): Date | null { - const startDate = moment(this.startDate).clone().startOf('day'); - const endDate = this.endDate ? moment(this.endDate).endOf('day') : null; - const now = moment().startOf('day'); - - if (endDate && moment().isAfter(endDate)) { - return null; - } - - const calculateNextDate = (unit: moment.unitOfTime.Diff) => { - const diff = now.diff(startDate, unit); - const nextDate = startDate.clone().add(diff, unit); - const adjustedDate = nextDate.isSameOrAfter(now) ? nextDate : nextDate.add('1', unit); - - if (endDate && adjustedDate.isAfter(endDate)) { - return null; - } - - return adjustedDate.toDate(); - }; - - switch (this.frequency) { - case AllowanceFrequency.DAILY: - return calculateNextDate('days'); - case AllowanceFrequency.WEEKLY: - return calculateNextDate('weeks'); - case AllowanceFrequency.MONTHLY: - return calculateNextDate('months'); - default: - return null; - } - } -} diff --git a/src/allowance/entities/index.ts b/src/allowance/entities/index.ts deleted file mode 100644 index 450ddc4..0000000 --- a/src/allowance/entities/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './allowance-change-request.entity'; -export * from './allowance.entity'; diff --git a/src/allowance/enums/allowance-change-request-status.enum.ts b/src/allowance/enums/allowance-change-request-status.enum.ts deleted file mode 100644 index e257bf1..0000000 --- a/src/allowance/enums/allowance-change-request-status.enum.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum AllowanceChangeRequestStatus { - PENDING = 'PENDING', - APPROVED = 'APPROVED', - REJECTED = 'REJECTED', -} diff --git a/src/allowance/enums/allowance-frequency.enum.ts b/src/allowance/enums/allowance-frequency.enum.ts deleted file mode 100644 index 4b6a5ec..0000000 --- a/src/allowance/enums/allowance-frequency.enum.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum AllowanceFrequency { - DAILY = 'DAILY', - WEEKLY = 'WEEKLY', - MONTHLY = 'MONTHLY', -} diff --git a/src/allowance/enums/allowance-type.enum.ts b/src/allowance/enums/allowance-type.enum.ts deleted file mode 100644 index 4fa9180..0000000 --- a/src/allowance/enums/allowance-type.enum.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum AllowanceType { - BY_END_DATE = 'BY_END_DATE', - BY_COUNT = 'BY_COUNT', -} diff --git a/src/allowance/enums/index.ts b/src/allowance/enums/index.ts deleted file mode 100644 index d537ace..0000000 --- a/src/allowance/enums/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './allowance-change-request-status.enum'; -export * from './allowance-frequency.enum'; -export * from './allowance-type.enum'; diff --git a/src/allowance/repositories/allowance-change-request.repository.ts b/src/allowance/repositories/allowance-change-request.repository.ts deleted file mode 100644 index de2941f..0000000 --- a/src/allowance/repositories/allowance-change-request.repository.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { Injectable } from '@nestjs/common'; -import { InjectRepository } from '@nestjs/typeorm'; -import { FindOptionsWhere, Repository } from 'typeorm'; -import { PageOptionsRequestDto } from '~/core/dtos'; -import { CreateAllowanceChangeRequestDto } from '../dtos/request'; -import { AllowanceChangeRequest } from '../entities'; -import { AllowanceChangeRequestStatus } from '../enums'; -const ONE = 1; -@Injectable() -export class AllowanceChangeRequestsRepository { - constructor( - @InjectRepository(AllowanceChangeRequest) - private readonly allowanceChangeRequestsRepository: Repository, - ) {} - - createAllowanceChangeRequest(allowanceId: string, body: CreateAllowanceChangeRequestDto) { - return this.allowanceChangeRequestsRepository.save( - this.allowanceChangeRequestsRepository.create({ - allowanceId, - amount: body.amount, - reason: body.reason, - }), - ); - } - - findAllowanceChangeRequestBy(where: FindOptionsWhere, withRelations = false) { - const relations = withRelations - ? ['allowance', 'allowance.junior', 'allowance.junior.customer', 'allowance.junior.customer.profilePicture'] - : []; - return this.allowanceChangeRequestsRepository.findOne({ where, relations }); - } - - updateAllowanceChangeRequestStatus(requestId: string, status: AllowanceChangeRequestStatus) { - return this.allowanceChangeRequestsRepository.update({ id: requestId }, { status }); - } - - findAllowanceChangeRequests(guardianId: string, query: PageOptionsRequestDto) { - return this.allowanceChangeRequestsRepository.findAndCount({ - where: { allowance: { guardianId } }, - take: query.size, - skip: query.size * (query.page - ONE), - relations: [ - 'allowance', - 'allowance.junior', - 'allowance.junior.customer', - 'allowance.junior.customer.profilePicture', - ], - }); - } -} diff --git a/src/allowance/repositories/allowances.repository.ts b/src/allowance/repositories/allowances.repository.ts deleted file mode 100644 index 2914ff1..0000000 --- a/src/allowance/repositories/allowances.repository.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { Injectable } from '@nestjs/common'; -import { InjectRepository } from '@nestjs/typeorm'; -import { Repository } from 'typeorm'; -import { PageOptionsRequestDto } from '~/core/dtos'; -import { CreateAllowanceRequestDto } from '../dtos/request'; -import { Allowance } from '../entities'; -const ONE = 1; -@Injectable() -export class AllowancesRepository { - constructor(@InjectRepository(Allowance) private readonly allowancesRepository: Repository) {} - - createAllowance(guardianId: string, body: CreateAllowanceRequestDto) { - return this.allowancesRepository.save( - this.allowancesRepository.create({ - guardianId, - name: body.name, - amount: body.amount, - frequency: body.frequency, - type: body.type, - startDate: body.startDate, - endDate: body.endDate, - numberOfTransactions: body.numberOfTransactions, - juniorId: body.juniorId, - }), - ); - } - - findAllowanceById(allowanceId: string, guardianId?: string) { - return this.allowancesRepository.findOne({ - where: { id: allowanceId, guardianId }, - relations: ['junior', 'junior.customer', 'junior.customer.profilePicture'], - }); - } - - findAllowances(guardianId: string, query: PageOptionsRequestDto) { - return this.allowancesRepository.findAndCount({ - where: { guardianId }, - relations: ['junior', 'junior.customer', 'junior.customer.profilePicture'], - take: query.size, - skip: query.size * (query.page - ONE), - }); - } - - deleteAllowance(guardianId: string, allowanceId: string) { - return this.allowancesRepository.softDelete({ id: allowanceId, guardianId }); - } - - async *findAllowancesChunks(chunkSize: number) { - let offset = 0; - while (true) { - const allowances = await this.allowancesRepository.find({ - take: chunkSize, - skip: offset, - }); - - if (!allowances.length) { - break; - } - - yield allowances; - offset += chunkSize; - } - } -} diff --git a/src/allowance/repositories/index.ts b/src/allowance/repositories/index.ts deleted file mode 100644 index 93cb12e..0000000 --- a/src/allowance/repositories/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './allowance-change-request.repository'; -export * from './allowances.repository'; diff --git a/src/allowance/services/allowance-change-requests.service.ts b/src/allowance/services/allowance-change-requests.service.ts deleted file mode 100644 index 0e343ba..0000000 --- a/src/allowance/services/allowance-change-requests.service.ts +++ /dev/null @@ -1,132 +0,0 @@ -import { BadRequestException, Injectable, Logger } from '@nestjs/common'; -import { FindOptionsWhere } from 'typeorm'; -import { PageOptionsRequestDto } from '~/core/dtos'; -import { OciService } from '~/document/services'; -import { CreateAllowanceChangeRequestDto } from '../dtos/request'; -import { AllowanceChangeRequest } from '../entities'; -import { AllowanceChangeRequestStatus } from '../enums'; -import { AllowanceChangeRequestsRepository } from '../repositories'; -import { AllowancesService } from './allowances.service'; - -@Injectable() -export class AllowanceChangeRequestsService { - private readonly logger = new Logger(AllowanceChangeRequestsService.name); - constructor( - private readonly allowanceChangeRequestsRepository: AllowanceChangeRequestsRepository, - private readonly ociService: OciService, - private readonly allowanceService: AllowancesService, - ) {} - - async createAllowanceChangeRequest(juniorId: string, body: CreateAllowanceChangeRequestDto) { - this.logger.log(`Creating allowance change request for junior ${juniorId}`); - const allowance = await this.allowanceService.validateAllowanceForJunior(juniorId, body.allowanceId); - - if (allowance.amount === body.amount) { - this.logger.error(`Amount is the same as the current allowance amount`); - throw new BadRequestException('ALLOWANCE_CHANGE_REQUEST.SAME_AMOUNT'); - } - - const requestWithTheSameAmount = await this.findAllowanceChangeRequestBy({ - allowanceId: body.allowanceId, - amount: body.amount, - status: AllowanceChangeRequestStatus.PENDING, - }); - - if (requestWithTheSameAmount) { - this.logger.error(`There is a pending request with the same amount`); - throw new BadRequestException('ALLOWANCE_CHANGE_REQUEST.SAME_AMOUNT_PENDING'); - } - - return this.allowanceChangeRequestsRepository.createAllowanceChangeRequest(body.allowanceId, body); - } - - findAllowanceChangeRequestBy(where: FindOptionsWhere) { - this.logger.log(`Finding allowance change request by ${JSON.stringify(where)}`); - return this.allowanceChangeRequestsRepository.findAllowanceChangeRequestBy(where); - } - - async approveAllowanceChangeRequest(guardianId: string, requestId: string) { - this.logger.log(`Approving allowance change request ${requestId} by guardian ${guardianId}`); - const request = await this.findAllowanceChangeRequestBy({ id: requestId, allowance: { guardianId } }); - - if (!request) { - this.logger.error(`Allowance change request ${requestId} not found for guardian ${guardianId}`); - throw new BadRequestException('ALLOWANCE_CHANGE_REQUEST.NOT_FOUND'); - } - if (request.status === AllowanceChangeRequestStatus.APPROVED) { - this.logger.error(`Allowance change request ${requestId} already approved`); - throw new BadRequestException('ALLOWANCE_CHANGE_REQUEST.ALREADY_APPROVED'); - } - return this.allowanceChangeRequestsRepository.updateAllowanceChangeRequestStatus( - requestId, - AllowanceChangeRequestStatus.APPROVED, - ); - } - - async rejectAllowanceChangeRequest(guardianId: string, requestId: string) { - this.logger.log(`Rejecting allowance change request ${requestId} by guardian ${guardianId}`); - const request = await this.findAllowanceChangeRequestBy({ id: requestId, allowance: { guardianId } }); - - if (!request) { - this.logger.error(`Allowance change request ${requestId} not found for guardian ${guardianId}`); - throw new BadRequestException('ALLOWANCE_CHANGE_REQUEST.NOT_FOUND'); - } - if (request.status === AllowanceChangeRequestStatus.REJECTED) { - this.logger.error(`Allowance change request ${requestId} already rejected`); - throw new BadRequestException('ALLOWANCE_CHANGE_REQUEST.ALREADY_REJECTED'); - } - return this.allowanceChangeRequestsRepository.updateAllowanceChangeRequestStatus( - requestId, - AllowanceChangeRequestStatus.REJECTED, - ); - } - - async findAllowanceChangeRequests( - guardianId: string, - query: PageOptionsRequestDto, - ): Promise<[AllowanceChangeRequest[], number]> { - this.logger.log(`Finding allowance change requests for guardian ${guardianId}`); - const [requests, itemCount] = await this.allowanceChangeRequestsRepository.findAllowanceChangeRequests( - guardianId, - query, - ); - - await this.prepareAllowanceChangeRequestsImages(requests); - - this.logger.log(`Returning allowance change requests for guardian ${guardianId}`); - return [requests, itemCount]; - } - - async findAllowanceChangeRequestById(guardianId: string, requestId: string) { - this.logger.log(`Finding allowance change request ${requestId} for guardian ${guardianId}`); - const request = await this.allowanceChangeRequestsRepository.findAllowanceChangeRequestBy( - { - id: requestId, - allowance: { guardianId }, - }, - true, - ); - - if (!request) { - this.logger.error(`Allowance change request ${requestId} not found for guardian ${guardianId}`); - throw new BadRequestException('ALLOWANCE_CHANGE_REQUEST.NOT_FOUND'); - } - - await this.prepareAllowanceChangeRequestsImages([request]); - - this.logger.log(`Allowance change request ${requestId} found successfully`); - return request; - } - - private prepareAllowanceChangeRequestsImages(requests: AllowanceChangeRequest[]) { - this.logger.log(`Preparing allowance change requests images`); - return Promise.all( - requests.map(async (request) => { - const profilePicture = request.allowance.junior.customer.profilePicture; - if (profilePicture) { - profilePicture.url = await this.ociService.generatePreSignedUrl(profilePicture); - } - }), - ); - } -} diff --git a/src/allowance/services/allowances.service.ts b/src/allowance/services/allowances.service.ts deleted file mode 100644 index 9d3547a..0000000 --- a/src/allowance/services/allowances.service.ts +++ /dev/null @@ -1,110 +0,0 @@ -import { BadRequestException, Injectable, Logger } from '@nestjs/common'; -import moment from 'moment'; -import { PageOptionsRequestDto } from '~/core/dtos'; -import { OciService } from '~/document/services'; -import { JuniorService } from '~/junior/services'; -import { CreateAllowanceRequestDto } from '../dtos/request'; -import { Allowance } from '../entities'; -import { AllowancesRepository } from '../repositories'; - -@Injectable() -export class AllowancesService { - private readonly logger = new Logger(AllowancesService.name); - constructor( - private readonly allowancesRepository: AllowancesRepository, - private readonly juniorService: JuniorService, - private readonly ociService: OciService, - ) {} - - async createAllowance(guardianId: string, body: CreateAllowanceRequestDto) { - this.logger.log(`Creating allowance for junior ${body.juniorId} by guardian ${guardianId}`); - if (moment(body.startDate).isBefore(moment().startOf('day'))) { - this.logger.error(`Start date ${body.startDate} is before today`); - throw new BadRequestException('ALLOWANCE.START_DATE_BEFORE_TODAY'); - } - if (moment(body.startDate).isAfter(body.endDate)) { - this.logger.error(`Start date ${body.startDate} is after end date ${body.endDate}`); - throw new BadRequestException('ALLOWANCE.START_DATE_AFTER_END_DATE'); - } - - const doesJuniorBelongToGuardian = await this.juniorService.doesJuniorBelongToGuardian(guardianId, body.juniorId); - - if (!doesJuniorBelongToGuardian) { - this.logger.error(`Junior ${body.juniorId} does not belong to guardian ${guardianId}`); - throw new BadRequestException('JUNIOR.DOES_NOT_BELONG_TO_GUARDIAN'); - } - - const allowance = await this.allowancesRepository.createAllowance(guardianId, body); - - this.logger.log(`Allowance ${allowance.id} created successfully`); - return this.findAllowanceById(allowance.id); - } - - async findAllowanceById(allowanceId: string, guardianId?: string) { - this.logger.log(`Finding allowance ${allowanceId} ${guardianId ? `by guardian ${guardianId}` : ''}`); - const allowance = await this.allowancesRepository.findAllowanceById(allowanceId, guardianId); - - if (!allowance) { - this.logger.error(`Allowance ${allowanceId} not found ${guardianId ? `for guardian ${guardianId}` : ''}`); - throw new BadRequestException('ALLOWANCE.NOT_FOUND'); - } - await this.prepareAllowanceDocuments([allowance]); - this.logger.log(`Allowance ${allowanceId} found successfully`); - return allowance; - } - - async findAllowances(guardianId: string, query: PageOptionsRequestDto): Promise<[Allowance[], number]> { - this.logger.log(`Finding allowances for guardian ${guardianId}`); - const [allowances, itemCount] = await this.allowancesRepository.findAllowances(guardianId, query); - await this.prepareAllowanceDocuments(allowances); - this.logger.log(`Returning allowances for guardian ${guardianId}`); - return [allowances, itemCount]; - } - - async deleteAllowance(guardianId: string, allowanceId: string) { - this.logger.log(`Deleting allowance ${allowanceId} for guardian ${guardianId}`); - const { affected } = await this.allowancesRepository.deleteAllowance(guardianId, allowanceId); - - if (!affected) { - this.logger.error(`Allowance ${allowanceId} not found`); - throw new BadRequestException('ALLOWANCE.NOT_FOUND'); - } - this.logger.log(`Allowance ${allowanceId} deleted successfully`); - } - - async validateAllowanceForJunior(juniorId: string, allowanceId: string) { - this.logger.log(`Validating allowance ${allowanceId} for junior ${juniorId}`); - const allowance = await this.allowancesRepository.findAllowanceById(allowanceId); - - if (!allowance) { - this.logger.error(`Allowance ${allowanceId} not found`); - throw new BadRequestException('ALLOWANCE.NOT_FOUND'); - } - - if (allowance.juniorId !== juniorId) { - this.logger.error(`Allowance ${allowanceId} does not belong to junior ${juniorId}`); - throw new BadRequestException('ALLOWANCE.DOES_NOT_BELONG_TO_JUNIOR'); - } - - return allowance; - } - - async findAllowancesChunks(chunkSize: number) { - this.logger.log(`Finding allowances chunks`); - const allowances = await this.allowancesRepository.findAllowancesChunks(chunkSize); - this.logger.log(`Returning allowances chunks`); - return allowances; - } - - private async prepareAllowanceDocuments(allowance: Allowance[]) { - this.logger.log(`Preparing document for allowances`); - await Promise.all( - allowance.map(async (allowance) => { - const profilePicture = allowance.junior.customer.profilePicture; - if (profilePicture) { - profilePicture.url = await this.ociService.generatePreSignedUrl(profilePicture); - } - }), - ); - } -} diff --git a/src/allowance/services/index.ts b/src/allowance/services/index.ts deleted file mode 100644 index 1302512..0000000 --- a/src/allowance/services/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './allowance-change-requests.service'; -export * from './allowances.service'; diff --git a/src/app.module.ts b/src/app.module.ts index 4c2b94b..31af17a 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -8,7 +8,6 @@ import { I18nMiddleware, I18nModule } from 'nestjs-i18n'; import { LoggerModule } from 'nestjs-pino'; import { DataSource } from 'typeorm'; import { addTransactionalDataSource } from 'typeorm-transactional'; -import { AllowanceModule } from './allowance/allowance.module'; import { AuthModule } from './auth/auth.module'; import { CacheModule } from './common/modules/cache/cache.module'; import { LookupModule } from './common/modules/lookup/lookup.module'; @@ -22,13 +21,9 @@ import { CronModule } from './cron/cron.module'; import { CustomerModule } from './customer/customer.module'; import { migrations } from './db'; import { DocumentModule } from './document/document.module'; -import { GiftModule } from './gift/gift.module'; import { GuardianModule } from './guardian/guardian.module'; import { HealthModule } from './health/health.module'; import { JuniorModule } from './junior/junior.module'; -import { MoneyRequestModule } from './money-request/money-request.module'; -import { SavingGoalsModule } from './saving-goals/saving-goals.module'; -import { TaskModule } from './task/task.module'; import { UserModule } from './user/user.module'; @Module({ @@ -41,7 +36,6 @@ import { UserModule } from './user/user.module'; useFactory: (config: ConfigService) => { return buildTypeormOptions(config, migrations); }, - /* eslint-disable require-await */ async dataSourceFactory(options) { if (!options) { throw new Error('Invalid options passed'); @@ -49,7 +43,6 @@ import { UserModule } from './user/user.module'; return addTransactionalDataSource(new DataSource(options)); }, - /* eslint-enable require-await */ }), LoggerModule.forRootAsync({ useFactory: (config: ConfigService) => buildLoggerOptions(config), @@ -61,15 +54,12 @@ import { UserModule } from './user/user.module'; ScheduleModule.forRoot(), // App modules AuthModule, + UserModule, + CustomerModule, JuniorModule, - - TaskModule, GuardianModule, - SavingGoalsModule, - AllowanceModule, - MoneyRequestModule, - GiftModule, + NotificationModule, OtpModule, DocumentModule, @@ -77,8 +67,6 @@ import { UserModule } from './user/user.module'; HealthModule, - UserModule, - CronModule, ], providers: [ diff --git a/src/cron/cron.module.ts b/src/cron/cron.module.ts index c14a995..477d02a 100644 --- a/src/cron/cron.module.ts +++ b/src/cron/cron.module.ts @@ -1,11 +1,8 @@ import { Module } from '@nestjs/common'; -import { AllowanceModule } from '~/allowance/allowance.module'; -import { MoneyRequestModule } from '~/money-request/money-request.module'; import { BaseCronService } from './services'; -import { AllowanceTask, MoneyRequestTask } from './tasks'; @Module({ - imports: [AllowanceModule, MoneyRequestModule], - providers: [AllowanceTask, MoneyRequestTask, BaseCronService], + imports: [], + providers: [BaseCronService], }) export class CronModule {} diff --git a/src/cron/tasks/allowance.task.ts b/src/cron/tasks/allowance.task.ts deleted file mode 100644 index 44ddd2e..0000000 --- a/src/cron/tasks/allowance.task.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { Injectable, Logger } from '@nestjs/common'; -import { Cron, CronExpression } from '@nestjs/schedule'; -import moment from 'moment'; -import { AllowancesService } from '~/allowance/services'; -import { CacheService } from '~/common/modules/cache/services'; -import { BaseCronService } from '../services/base-cron.service'; -const TEN = 10; -const SIXTY = 60; -const THOUSAND = 1000; -const TEN_MINUTES = TEN * SIXTY * THOUSAND; -const CHUNK_SIZE = 50; - -@Injectable() -export class AllowanceTask extends BaseCronService { - private readonly logger = new Logger(AllowanceTask.name); - private readonly cronLockKey = `${AllowanceTask.name}-lock`; - private readonly cronLockTtl = TEN_MINUTES; - constructor(cacheService: CacheService, private readonly allowanceService: AllowancesService) { - super(cacheService); - } - - @Cron(CronExpression.EVERY_DAY_AT_3AM) - async handleCron() { - try { - const isLockAcquired = await this.acquireLock(this.cronLockKey, this.cronLockTtl); - if (!isLockAcquired) { - this.logger.log('Lock already acquired. Skipping cron job.'); - return; - } - this.logger.log('Processing cron job'); - await this.processJob(); - } catch (error) { - this.logger.error('Error processing cron job', error); - } finally { - this.logger.log('Releasing lock'); - await this.releaseLock(this.cronLockKey); - } - } - - private async processJob() { - const today = moment().startOf('day'); - const allowancesChunks = await this.allowanceService.findAllowancesChunks(CHUNK_SIZE); - for await (const allowances of allowancesChunks) { - for (const allowance of allowances) { - this.logger.log(`Processing allowance ${allowance.id} with next payment date ${allowance.nextPaymentDate}`); - // if today is the same as allowance payment date - if (moment(allowance.nextPaymentDate).startOf('day').isSame(today)) { - this.logger.log(`Today is the payment date for allowance ${allowance.id}`); - //@TODO: Implement payment logic - } - } - } - } -} diff --git a/src/cron/tasks/index.ts b/src/cron/tasks/index.ts index 8a1925a..e69de29 100644 --- a/src/cron/tasks/index.ts +++ b/src/cron/tasks/index.ts @@ -1,2 +0,0 @@ -export * from './allowance.task'; -export * from './money-request.task'; diff --git a/src/cron/tasks/money-request.task.ts b/src/cron/tasks/money-request.task.ts deleted file mode 100644 index a88ca35..0000000 --- a/src/cron/tasks/money-request.task.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { Injectable, Logger } from '@nestjs/common'; -import { Cron, CronExpression } from '@nestjs/schedule'; -import moment from 'moment'; -import { CacheService } from '~/common/modules/cache/services'; -import { MoneyRequestsService } from '~/money-request/services'; -import { BaseCronService } from '../services'; -const TEN = 10; -const SIXTY = 60; -const THOUSAND = 1000; -const TEN_MINUTES = TEN * SIXTY * THOUSAND; -const CHUNK_SIZE = 50; -@Injectable() -export class MoneyRequestTask extends BaseCronService { - private readonly cronLockKey = `${MoneyRequestTask.name}-lock`; - private readonly cronLockTtl = TEN_MINUTES; - private readonly logger = new Logger(MoneyRequestTask.name); - constructor(cacheService: CacheService, private readonly moneyRequestService: MoneyRequestsService) { - super(cacheService); - } - - @Cron(CronExpression.EVERY_DAY_AT_3AM) - async handleCron() { - try { - const isLockAcquired = await this.acquireLock(this.cronLockKey, this.cronLockTtl); - if (!isLockAcquired) { - this.logger.log('Lock already acquired. Skipping cron job for MoneyRequestTask.'); - return; - } - this.logger.log('Processing cron job for MoneyRequestTask'); - await this.processJob(); - } catch (error) { - this.logger.error('Error processing MoneyRequestTask cron job', error); - } finally { - this.logger.log('Releasing lock for MoneyRequestTask'); - await this.releaseLock(this.cronLockKey); - } - } - - private async processJob() { - const today = moment().startOf('day'); - const moneyRequestsChunks = await this.moneyRequestService.findMoneyRequestsChunks(CHUNK_SIZE); - for await (const moneyRequests of moneyRequestsChunks) { - for (const moneyRequest of moneyRequests) { - this.logger.log( - `Processing money request ${moneyRequest.id} with next payment date ${moneyRequest.nextPaymentDate}`, - ); - // if today is the same as money request payment date - if (moment(moneyRequest.nextPaymentDate).startOf('day').isSame(today)) { - this.logger.log(`Today is the payment date for money request ${moneyRequest.id}`); - } - } - } - } -} diff --git a/src/customer/dtos/response/internal.customer-details.response.dto.ts b/src/customer/dtos/response/internal.customer-details.response.dto.ts index ee8c985..7945147 100644 --- a/src/customer/dtos/response/internal.customer-details.response.dto.ts +++ b/src/customer/dtos/response/internal.customer-details.response.dto.ts @@ -82,8 +82,6 @@ export class InternalCustomerDetailsResponseDto { this.gender = customer.gender; this.isJunior = customer.isJunior; this.isGuardian = customer.isGuardian; - this.civilIdFront = new DocumentMetaResponseDto(customer.civilIdFront); - this.civilIdBack = new DocumentMetaResponseDto(customer.civilIdBack); this.profilePicture = customer.profilePicture ? new DocumentMetaResponseDto(customer.profilePicture) : null; } } diff --git a/src/customer/entities/customer.entity.ts b/src/customer/entities/customer.entity.ts index 6b977cc..e6d51e8 100644 --- a/src/customer/entities/customer.entity.ts +++ b/src/customer/entities/customer.entity.ts @@ -92,20 +92,6 @@ export class Customer extends BaseEntity { @OneToOne(() => Guardian, (guardian) => guardian.customer, { cascade: true }) guardian!: Guardian; - @Column('uuid', { name: 'civil_id_front_id', nullable: true }) - civilIdFrontId!: string; - - @Column('uuid', { name: 'civil_id_back_id', nullable: true }) - civilIdBackId!: string; - - @OneToOne(() => Document, (document) => document.customerCivilIdFront, { nullable: true }) - @JoinColumn({ name: 'civil_id_front_id' }) - civilIdFront!: Document; - - @OneToOne(() => Document, (document) => document.customerCivilIdBack, { nullable: true }) - @JoinColumn({ name: 'civil_id_back_id' }) - civilIdBack!: Document; - @CreateDateColumn({ type: 'timestamp with time zone', default: () => 'CURRENT_TIMESTAMP', name: 'created_at' }) createdAt!: Date; diff --git a/src/customer/repositories/customer.repository.ts b/src/customer/repositories/customer.repository.ts index a17b383..d5b9d0a 100644 --- a/src/customer/repositories/customer.repository.ts +++ b/src/customer/repositories/customer.repository.ts @@ -61,10 +61,4 @@ export class CustomerRepository { return query.getManyAndCount(); } - - findCustomerByCivilId(civilIdFrontId: string, civilIdBackId: string) { - return this.customerRepository.findOne({ - where: [{ civilIdFrontId, civilIdBackId }, { civilIdFrontId }, { civilIdBackId }], - }); - } } diff --git a/src/customer/services/customer.service.ts b/src/customer/services/customer.service.ts index 85c4d0a..6df05c2 100644 --- a/src/customer/services/customer.service.ts +++ b/src/customer/services/customer.service.ts @@ -35,8 +35,6 @@ export class CustomerService { async createJuniorCustomer(guardianId: string, juniorId: string, body: CreateJuniorRequestDto) { this.logger.log(`Creating junior customer for user ${juniorId}`); - await this.validateCivilIdForCustomer(guardianId, body.civilIdFrontId, body.civilIdBackId); - return this.customerRepository.createCustomer(juniorId, body, false); } @@ -143,48 +141,9 @@ export class CustomerService { } } - private async validateCivilIdForCustomer(userId: string, civilIdFrontId: string, civilIdBackId: string) { - this.logger.log(`Validating customer documents`); - - if (!civilIdFrontId || !civilIdBackId) { - this.logger.error('Civil id front and back are required'); - throw new BadRequestException('CUSTOMER.CIVIL_ID_REQUIRED'); - } - - const [civilIdFront, civilIdBack] = await Promise.all([ - this.documentService.findDocumentById(civilIdFrontId), - this.documentService.findDocumentById(civilIdBackId), - ]); - - if (!civilIdFront || !civilIdBack) { - this.logger.error('Civil id front or back not found'); - throw new BadRequestException('CUSTOMER.CIVIL_ID_REQUIRED'); - } - - if (civilIdFront.createdById !== userId || civilIdBack.createdById !== userId) { - this.logger.error(`Civil id front or back not created by user with id ${userId}`); - throw new BadRequestException('CUSTOMER.CIVIL_ID_NOT_CREATED_BY_USER'); - } - - const customerWithTheSameCivilId = await this.customerRepository.findCustomerByCivilId( - civilIdFrontId, - civilIdBackId, - ); - - if (customerWithTheSameCivilId) { - this.logger.error( - `Customer with civil id front ${civilIdFrontId} and civil id back ${civilIdBackId} already exists`, - ); - throw new BadRequestException('CUSTOMER.CIVIL_ID_ALREADY_EXISTS'); - } - } - private async prepareCustomerDocuments(customer: Customer) { const promises = []; - promises.push(this.ociService.generatePreSignedUrl(customer.civilIdFront)); - promises.push(this.ociService.generatePreSignedUrl(customer.civilIdBack)); - if (customer.profilePicture) { promises.push(this.ociService.generatePreSignedUrl(customer.profilePicture)); } @@ -194,8 +153,6 @@ export class CustomerService { customer.profilePicture.url = profilePictureUrl; } - customer.civilIdFront.url = civilIdFrontUrl; - customer.civilIdBack.url = civilIdBackUrl; return customer; } } diff --git a/src/db/migrations/1733750228289-initial-migration.ts b/src/db/migrations/1733750228289-initial-migration.ts deleted file mode 100644 index f578f76..0000000 --- a/src/db/migrations/1733750228289-initial-migration.ts +++ /dev/null @@ -1,249 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class InitialMigration1733750228289 implements MigrationInterface { - name = 'InitialMigration1733750228289'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `CREATE TABLE "gift_replies" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "status" character varying NOT NULL DEFAULT 'PENDING', "color" character varying NOT NULL, "gift_id" uuid NOT NULL, "created_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "REL_8292da97f1ceb9a806b8bc812f" UNIQUE ("gift_id"), CONSTRAINT "PK_ec6567bb5ab318bb292fa6599a2" PRIMARY KEY ("id"))`, - ); - await queryRunner.query( - `CREATE TABLE "gift" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "name" character varying(255) NOT NULL, "description" text NOT NULL, "color" character varying NOT NULL, "amount" numeric(10,3) NOT NULL, "status" character varying NOT NULL DEFAULT 'AVAILABLE', "redeemed_at" TIMESTAMP WITH TIME ZONE, "giver_id" uuid NOT NULL, "image_id" uuid NOT NULL, "recipient_id" uuid NOT NULL, "created_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updated_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "PK_f91217caddc01a085837ebe0606" PRIMARY KEY ("id"))`, - ); - await queryRunner.query( - `CREATE TABLE "gift_redemptions" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "gift_id" uuid NOT NULL, "created_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updated_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "PK_6ad7ac76169c3a224ce4a3afff4" PRIMARY KEY ("id"))`, - ); - await queryRunner.query( - `CREATE TABLE "saving_goals" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "name" character varying(255) NOT NULL, "description" character varying(255), "due_date" TIMESTAMP WITH TIME ZONE NOT NULL, "target_amount" numeric(12,3) NOT NULL, "current_amount" numeric(12,3) NOT NULL DEFAULT '0', "image_id" uuid, "junior_id" uuid NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_5193f14c1c3a38e6657a159795e" PRIMARY KEY ("id"))`, - ); - await queryRunner.query( - `CREATE TABLE "categories" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "name" character varying(255) NOT NULL, "type" character varying(255) NOT NULL, "junior_id" uuid, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_24dbc6126a28ff948da33e97d3b" PRIMARY KEY ("id"))`, - ); - await queryRunner.query( - `CREATE TABLE "task_submissions" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "status" character varying NOT NULL, "submitted_at" TIMESTAMP WITH TIME ZONE NOT NULL, "task_id" uuid NOT NULL, "proof_of_completion_id" uuid, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "REL_d6cfaee118a0300d652e28ee16" UNIQUE ("task_id"), CONSTRAINT "PK_8d19d6b5dd776e373113de50018" PRIMARY KEY ("id"))`, - ); - await queryRunner.query( - `CREATE TABLE "tasks" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "title" character varying(255) NOT NULL, "description" character varying(255) NOT NULL, "reward_amount" numeric(12,3) NOT NULL, "image_id" uuid NOT NULL, "task_frequency" character varying NOT NULL, "start_date" TIMESTAMP WITH TIME ZONE NOT NULL, "due_date" TIMESTAMP WITH TIME ZONE NOT NULL, "is_proof_required" boolean NOT NULL, "assigned_to_id" uuid NOT NULL, "assigned_by_id" uuid NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_8d12ff38fcc62aaba2cab748772" PRIMARY KEY ("id"))`, - ); - await queryRunner.query( - `CREATE TABLE "notifications" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "title" character varying NOT NULL, "message" character varying NOT NULL, "recipient" character varying, "scope" character varying NOT NULL, "status" character varying, "channel" character varying NOT NULL, "user_id" uuid, "created_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updated_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "PK_6a72c3c0f683f6462415e653c3a" PRIMARY KEY ("id"))`, - ); - await queryRunner.query( - `CREATE TABLE "otp" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "value" character varying(255) NOT NULL, "scope" character varying(255) NOT NULL, "otp_type" character varying(255) NOT NULL, "expires_at" TIMESTAMP WITH TIME ZONE NOT NULL, "user_id" uuid NOT NULL, "is_used" boolean NOT NULL DEFAULT false, "created_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "PK_32556d9d7b22031d7d0e1fd6723" PRIMARY KEY ("id"))`, - ); - await queryRunner.query(`CREATE INDEX "IDX_6427c192ef35355ebac18fb683" ON "otp" ("scope") `); - await queryRunner.query(`CREATE INDEX "IDX_258d028d322ea3b856bf9f12f2" ON "otp" ("user_id") `); - await queryRunner.query( - `CREATE TABLE "user_registration_tokens" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "token" character varying(255) NOT NULL, "user_type" character varying(255) NOT NULL, "is_used" boolean NOT NULL DEFAULT false, "expiry_date" TIMESTAMP NOT NULL, "user_id" uuid, "junior_id" uuid, "updated_at" TIMESTAMP NOT NULL DEFAULT now(), "created_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "UQ_5881556d05b46fc7bd9e3bba935" UNIQUE ("token"), CONSTRAINT "PK_135a2d86443071ff0ba1c14135c" PRIMARY KEY ("id"))`, - ); - await queryRunner.query(`CREATE INDEX "IDX_5881556d05b46fc7bd9e3bba93" ON "user_registration_tokens" ("token") `); - await queryRunner.query( - `CREATE TABLE "users" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "email" character varying(255), "phone_number" character varying(255), "country_code" character varying(10), "password" character varying(255), "salt" character varying(255), "google_id" character varying(255), "apple_id" character varying(255), "is_phone_verified" boolean NOT NULL DEFAULT false, "is_email_verified" boolean NOT NULL DEFAULT false, "is_profile_completed" boolean NOT NULL DEFAULT false, "is_email_enabled" boolean NOT NULL DEFAULT false, "is_push_enabled" boolean NOT NULL DEFAULT false, "is_sms_enabled" boolean NOT NULL DEFAULT false, "roles" text array, "created_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updated_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "PK_a3ffb1c0c8416b9fc6f907b7433" PRIMARY KEY ("id"))`, - ); - await queryRunner.query( - `CREATE TABLE "devices" ("deviceId" character varying(255) NOT NULL, "user_id" uuid NOT NULL, "device_name" character varying, "public_key" character varying, "fcm_token" character varying, "last_access_on" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "created_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updated_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "PK_666c9b59efda8ca85b29157152c" PRIMARY KEY ("deviceId"))`, - ); - await queryRunner.query( - `CREATE TABLE "documents" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "name" character varying(255) NOT NULL, "extension" character varying(255) NOT NULL, "document_type" character varying(255) NOT NULL, "created_by_id" uuid, "updated_at" TIMESTAMP NOT NULL DEFAULT now(), "created_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_ac51aa5181ee2036f5ca482857c" PRIMARY KEY ("id"))`, - ); - await queryRunner.query( - `CREATE TABLE "customers" ("id" uuid NOT NULL, "customer_status" character varying(255) NOT NULL DEFAULT 'PENDING', "kyc_status" character varying(255) NOT NULL DEFAULT 'PENDING', "rejection_reason" text, "first_name" character varying(255), "last_name" character varying(255), "date_of_birth" date, "national_id" character varying(255), "national_id_expiry" date, "country_of_residence" character varying(255), "source_of_income" character varying(255), "profession" character varying(255), "profession_type" character varying(255), "is_pep" boolean NOT NULL DEFAULT false, "gender" character varying(255), "is_junior" boolean NOT NULL DEFAULT false, "is_guardian" boolean NOT NULL DEFAULT false, "application_number" SERIAL NOT NULL, "user_id" uuid NOT NULL, "profile_picture_id" uuid, "civil_id_front_id" uuid, "civil_id_back_id" uuid, "created_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updated_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "REL_e7574892da11dd01de5cfc4649" UNIQUE ("profile_picture_id"), CONSTRAINT "REL_11d81cd7be87b6f8865b0cf766" UNIQUE ("user_id"), CONSTRAINT "REL_d5f99c497892ce31598ba19a72" UNIQUE ("civil_id_front_id"), CONSTRAINT "REL_2191662d124c56dd968ba01bf1" UNIQUE ("civil_id_back_id"), CONSTRAINT "PK_133ec679a801fab5e070f73d3ea" PRIMARY KEY ("id"))`, - ); - await queryRunner.query( - `CREATE TABLE "money_requests" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "requested_amount" numeric(10,3) NOT NULL, "message" character varying NOT NULL, "frequency" character varying NOT NULL DEFAULT 'ONE_TIME', "status" character varying NOT NULL DEFAULT 'PENDING', "reviewed_at" TIMESTAMP WITH TIME ZONE, "start_date" TIMESTAMP WITH TIME ZONE, "end_date" TIMESTAMP WITH TIME ZONE, "requester_id" uuid NOT NULL, "reviewer_id" uuid NOT NULL, "created_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updated_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "PK_28cff23e9fb06cd5dbf73cd53e7" PRIMARY KEY ("id"))`, - ); - await queryRunner.query( - `CREATE TABLE "themes" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "color" character varying(255) NOT NULL, "avatar_id" uuid, "junior_id" uuid NOT NULL, CONSTRAINT "REL_73fcb76399a308cdd2d431a8f2" UNIQUE ("junior_id"), CONSTRAINT "PK_ddbeaab913c18682e5c88155592" PRIMARY KEY ("id"))`, - ); - await queryRunner.query( - `CREATE TABLE "juniors" ("id" uuid NOT NULL, "relationship" character varying(255) NOT NULL, "customer_id" uuid NOT NULL, "guardian_id" uuid NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "REL_dfbf64ede1ff823a489902448a" UNIQUE ("customer_id"), CONSTRAINT "PK_2d273092322c1f8bf26296fa608" PRIMARY KEY ("id"))`, - ); - await queryRunner.query( - `CREATE TABLE "allowances" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "name" character varying(255) NOT NULL, "amount" numeric(10,2) NOT NULL, "frequency" character varying(255) NOT NULL, "type" character varying(255) NOT NULL, "start_date" TIMESTAMP WITH TIME ZONE NOT NULL, "end_date" TIMESTAMP WITH TIME ZONE, "number_of_transactions" integer, "guardian_id" uuid NOT NULL, "junior_id" uuid NOT NULL, "created_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updated_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deleted_at" TIMESTAMP WITH TIME ZONE, CONSTRAINT "PK_3731e781e7c4e932ba4d4213ac1" PRIMARY KEY ("id"))`, - ); - await queryRunner.query( - `CREATE TABLE "allowance_change_requests" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "reason" text NOT NULL, "amount" numeric(10,2) NOT NULL, "status" character varying(255) NOT NULL DEFAULT 'PENDING', "allowance_id" uuid NOT NULL, "created_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updated_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "PK_664715670e1e72c64ce65a078de" PRIMARY KEY ("id"))`, - ); - await queryRunner.query( - `CREATE TABLE "guardians" ("id" uuid NOT NULL, "customer_id" uuid NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "REL_6c46a1b6af00e6457cb1b70f7e" UNIQUE ("customer_id"), CONSTRAINT "PK_3dcf02f3dc96a2c017106f280be" PRIMARY KEY ("id"))`, - ); - await queryRunner.query( - `CREATE TABLE "saving_goals_categories" ("saving_goal_id" uuid NOT NULL, "category_id" uuid NOT NULL, CONSTRAINT "PK_a49d4f57d06d0a36a8385b6c28f" PRIMARY KEY ("saving_goal_id", "category_id"))`, - ); - await queryRunner.query( - `CREATE INDEX "IDX_d421de423f21c01672ea7c2e98" ON "saving_goals_categories" ("saving_goal_id") `, - ); - await queryRunner.query( - `CREATE INDEX "IDX_b0a721a8f7f5b6fe93f3603ebc" ON "saving_goals_categories" ("category_id") `, - ); - await queryRunner.query( - `ALTER TABLE "gift_replies" ADD CONSTRAINT "FK_8292da97f1ceb9a806b8bc812f2" FOREIGN KEY ("gift_id") REFERENCES "gift"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, - ); - await queryRunner.query( - `ALTER TABLE "gift" ADD CONSTRAINT "FK_0d317b68508819308455db9b9be" FOREIGN KEY ("giver_id") REFERENCES "guardians"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, - ); - await queryRunner.query( - `ALTER TABLE "gift" ADD CONSTRAINT "FK_4a46b5734fb573dc956904c18d0" FOREIGN KEY ("recipient_id") REFERENCES "juniors"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, - ); - await queryRunner.query( - `ALTER TABLE "gift" ADD CONSTRAINT "FK_83bb54c127d0e6ee487b90e2996" FOREIGN KEY ("image_id") REFERENCES "documents"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, - ); - await queryRunner.query( - `ALTER TABLE "gift_redemptions" ADD CONSTRAINT "FK_243c4349f0c45ce5385ac316aaa" FOREIGN KEY ("gift_id") REFERENCES "gift"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, - ); - await queryRunner.query( - `ALTER TABLE "saving_goals" ADD CONSTRAINT "FK_dad35932272342c1a247a2cee1c" FOREIGN KEY ("image_id") REFERENCES "documents"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, - ); - await queryRunner.query( - `ALTER TABLE "saving_goals" ADD CONSTRAINT "FK_f494ba0a361b2f9cbe5f6e56e38" FOREIGN KEY ("junior_id") REFERENCES "juniors"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, - ); - await queryRunner.query( - `ALTER TABLE "categories" ADD CONSTRAINT "FK_4f98e0b010d5e90cae0a2007748" FOREIGN KEY ("junior_id") REFERENCES "juniors"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, - ); - await queryRunner.query( - `ALTER TABLE "task_submissions" ADD CONSTRAINT "FK_d6cfaee118a0300d652e28ee166" FOREIGN KEY ("task_id") REFERENCES "tasks"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, - ); - await queryRunner.query( - `ALTER TABLE "task_submissions" ADD CONSTRAINT "FK_87876dfe440de7aafce216e9f58" FOREIGN KEY ("proof_of_completion_id") REFERENCES "documents"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, - ); - await queryRunner.query( - `ALTER TABLE "tasks" ADD CONSTRAINT "FK_f1f00d41b1e95d0bbda2710a62b" FOREIGN KEY ("image_id") REFERENCES "documents"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, - ); - await queryRunner.query( - `ALTER TABLE "tasks" ADD CONSTRAINT "FK_9430f12c5a1604833f64595a57f" FOREIGN KEY ("assigned_to_id") REFERENCES "juniors"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, - ); - await queryRunner.query( - `ALTER TABLE "tasks" ADD CONSTRAINT "FK_3e08a7ca125a175cf899b09f71a" FOREIGN KEY ("assigned_by_id") REFERENCES "guardians"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, - ); - await queryRunner.query( - `ALTER TABLE "notifications" ADD CONSTRAINT "FK_9a8a82462cab47c73d25f49261f" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, - ); - await queryRunner.query( - `ALTER TABLE "otp" ADD CONSTRAINT "FK_258d028d322ea3b856bf9f12f25" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, - ); - await queryRunner.query( - `ALTER TABLE "user_registration_tokens" ADD CONSTRAINT "FK_57cbbe079a7945d6ed1df114825" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, - ); - await queryRunner.query( - `ALTER TABLE "user_registration_tokens" ADD CONSTRAINT "FK_e41bec3ed6e549cbf90f57cc344" FOREIGN KEY ("junior_id") REFERENCES "juniors"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, - ); - await queryRunner.query( - `ALTER TABLE "devices" ADD CONSTRAINT "FK_5e9bee993b4ce35c3606cda194c" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, - ); - await queryRunner.query( - `ALTER TABLE "documents" ADD CONSTRAINT "FK_7f46f4f77acde1dcedba64cb220" FOREIGN KEY ("created_by_id") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE NO ACTION`, - ); - await queryRunner.query( - `ALTER TABLE "customers" ADD CONSTRAINT "FK_e7574892da11dd01de5cfc46499" FOREIGN KEY ("profile_picture_id") REFERENCES "documents"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, - ); - await queryRunner.query( - `ALTER TABLE "customers" ADD CONSTRAINT "FK_11d81cd7be87b6f8865b0cf7661" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, - ); - await queryRunner.query( - `ALTER TABLE "customers" ADD CONSTRAINT "FK_d5f99c497892ce31598ba19a72c" FOREIGN KEY ("civil_id_front_id") REFERENCES "documents"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, - ); - await queryRunner.query( - `ALTER TABLE "customers" ADD CONSTRAINT "FK_2191662d124c56dd968ba01bf18" FOREIGN KEY ("civil_id_back_id") REFERENCES "documents"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, - ); - await queryRunner.query( - `ALTER TABLE "money_requests" ADD CONSTRAINT "FK_5cce02836c6033b6e2412995e34" FOREIGN KEY ("requester_id") REFERENCES "juniors"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, - ); - await queryRunner.query( - `ALTER TABLE "money_requests" ADD CONSTRAINT "FK_75ba0766db9a7bf03126facf31c" FOREIGN KEY ("reviewer_id") REFERENCES "guardians"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, - ); - await queryRunner.query( - `ALTER TABLE "themes" ADD CONSTRAINT "FK_169b672cc28cc757e1f4464864d" FOREIGN KEY ("avatar_id") REFERENCES "documents"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, - ); - await queryRunner.query( - `ALTER TABLE "themes" ADD CONSTRAINT "FK_73fcb76399a308cdd2d431a8f2e" FOREIGN KEY ("junior_id") REFERENCES "juniors"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, - ); - await queryRunner.query( - `ALTER TABLE "juniors" ADD CONSTRAINT "FK_dfbf64ede1ff823a489902448a2" FOREIGN KEY ("customer_id") REFERENCES "customers"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, - ); - await queryRunner.query( - `ALTER TABLE "juniors" ADD CONSTRAINT "FK_0b11aa56264184690e2220da4a0" FOREIGN KEY ("guardian_id") REFERENCES "guardians"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, - ); - await queryRunner.query( - `ALTER TABLE "allowances" ADD CONSTRAINT "FK_80b144a74e630ed63311e97427b" FOREIGN KEY ("guardian_id") REFERENCES "guardians"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, - ); - await queryRunner.query( - `ALTER TABLE "allowances" ADD CONSTRAINT "FK_61e6e612f6d4644f8910d453cc9" FOREIGN KEY ("junior_id") REFERENCES "juniors"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, - ); - await queryRunner.query( - `ALTER TABLE "allowance_change_requests" ADD CONSTRAINT "FK_4ea6382927f50cb93873fae16d2" FOREIGN KEY ("allowance_id") REFERENCES "allowances"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, - ); - await queryRunner.query( - `ALTER TABLE "guardians" ADD CONSTRAINT "FK_6c46a1b6af00e6457cb1b70f7e7" FOREIGN KEY ("customer_id") REFERENCES "customers"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, - ); - await queryRunner.query( - `ALTER TABLE "saving_goals_categories" ADD CONSTRAINT "FK_d421de423f21c01672ea7c2e98f" FOREIGN KEY ("saving_goal_id") REFERENCES "saving_goals"("id") ON DELETE CASCADE ON UPDATE CASCADE`, - ); - await queryRunner.query( - `ALTER TABLE "saving_goals_categories" ADD CONSTRAINT "FK_b0a721a8f7f5b6fe93f3603ebc8" FOREIGN KEY ("category_id") REFERENCES "categories"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE "saving_goals_categories" DROP CONSTRAINT "FK_b0a721a8f7f5b6fe93f3603ebc8"`); - await queryRunner.query(`ALTER TABLE "saving_goals_categories" DROP CONSTRAINT "FK_d421de423f21c01672ea7c2e98f"`); - await queryRunner.query(`ALTER TABLE "guardians" DROP CONSTRAINT "FK_6c46a1b6af00e6457cb1b70f7e7"`); - await queryRunner.query(`ALTER TABLE "allowance_change_requests" DROP CONSTRAINT "FK_4ea6382927f50cb93873fae16d2"`); - await queryRunner.query(`ALTER TABLE "allowances" DROP CONSTRAINT "FK_61e6e612f6d4644f8910d453cc9"`); - await queryRunner.query(`ALTER TABLE "allowances" DROP CONSTRAINT "FK_80b144a74e630ed63311e97427b"`); - await queryRunner.query(`ALTER TABLE "juniors" DROP CONSTRAINT "FK_0b11aa56264184690e2220da4a0"`); - await queryRunner.query(`ALTER TABLE "juniors" DROP CONSTRAINT "FK_dfbf64ede1ff823a489902448a2"`); - await queryRunner.query(`ALTER TABLE "themes" DROP CONSTRAINT "FK_73fcb76399a308cdd2d431a8f2e"`); - await queryRunner.query(`ALTER TABLE "themes" DROP CONSTRAINT "FK_169b672cc28cc757e1f4464864d"`); - await queryRunner.query(`ALTER TABLE "money_requests" DROP CONSTRAINT "FK_75ba0766db9a7bf03126facf31c"`); - await queryRunner.query(`ALTER TABLE "money_requests" DROP CONSTRAINT "FK_5cce02836c6033b6e2412995e34"`); - await queryRunner.query(`ALTER TABLE "customers" DROP CONSTRAINT "FK_2191662d124c56dd968ba01bf18"`); - await queryRunner.query(`ALTER TABLE "customers" DROP CONSTRAINT "FK_d5f99c497892ce31598ba19a72c"`); - await queryRunner.query(`ALTER TABLE "customers" DROP CONSTRAINT "FK_11d81cd7be87b6f8865b0cf7661"`); - await queryRunner.query(`ALTER TABLE "customers" DROP CONSTRAINT "FK_e7574892da11dd01de5cfc46499"`); - await queryRunner.query(`ALTER TABLE "documents" DROP CONSTRAINT "FK_7f46f4f77acde1dcedba64cb220"`); - await queryRunner.query(`ALTER TABLE "devices" DROP CONSTRAINT "FK_5e9bee993b4ce35c3606cda194c"`); - await queryRunner.query(`ALTER TABLE "user_registration_tokens" DROP CONSTRAINT "FK_e41bec3ed6e549cbf90f57cc344"`); - await queryRunner.query(`ALTER TABLE "user_registration_tokens" DROP CONSTRAINT "FK_57cbbe079a7945d6ed1df114825"`); - await queryRunner.query(`ALTER TABLE "otp" DROP CONSTRAINT "FK_258d028d322ea3b856bf9f12f25"`); - await queryRunner.query(`ALTER TABLE "notifications" DROP CONSTRAINT "FK_9a8a82462cab47c73d25f49261f"`); - await queryRunner.query(`ALTER TABLE "tasks" DROP CONSTRAINT "FK_3e08a7ca125a175cf899b09f71a"`); - await queryRunner.query(`ALTER TABLE "tasks" DROP CONSTRAINT "FK_9430f12c5a1604833f64595a57f"`); - await queryRunner.query(`ALTER TABLE "tasks" DROP CONSTRAINT "FK_f1f00d41b1e95d0bbda2710a62b"`); - await queryRunner.query(`ALTER TABLE "task_submissions" DROP CONSTRAINT "FK_87876dfe440de7aafce216e9f58"`); - await queryRunner.query(`ALTER TABLE "task_submissions" DROP CONSTRAINT "FK_d6cfaee118a0300d652e28ee166"`); - await queryRunner.query(`ALTER TABLE "categories" DROP CONSTRAINT "FK_4f98e0b010d5e90cae0a2007748"`); - await queryRunner.query(`ALTER TABLE "saving_goals" DROP CONSTRAINT "FK_f494ba0a361b2f9cbe5f6e56e38"`); - await queryRunner.query(`ALTER TABLE "saving_goals" DROP CONSTRAINT "FK_dad35932272342c1a247a2cee1c"`); - await queryRunner.query(`ALTER TABLE "gift_redemptions" DROP CONSTRAINT "FK_243c4349f0c45ce5385ac316aaa"`); - await queryRunner.query(`ALTER TABLE "gift" DROP CONSTRAINT "FK_83bb54c127d0e6ee487b90e2996"`); - await queryRunner.query(`ALTER TABLE "gift" DROP CONSTRAINT "FK_4a46b5734fb573dc956904c18d0"`); - await queryRunner.query(`ALTER TABLE "gift" DROP CONSTRAINT "FK_0d317b68508819308455db9b9be"`); - await queryRunner.query(`ALTER TABLE "gift_replies" DROP CONSTRAINT "FK_8292da97f1ceb9a806b8bc812f2"`); - await queryRunner.query(`DROP INDEX "public"."IDX_b0a721a8f7f5b6fe93f3603ebc"`); - await queryRunner.query(`DROP INDEX "public"."IDX_d421de423f21c01672ea7c2e98"`); - await queryRunner.query(`DROP TABLE "saving_goals_categories"`); - await queryRunner.query(`DROP TABLE "guardians"`); - await queryRunner.query(`DROP TABLE "allowance_change_requests"`); - await queryRunner.query(`DROP TABLE "allowances"`); - await queryRunner.query(`DROP TABLE "juniors"`); - await queryRunner.query(`DROP TABLE "themes"`); - await queryRunner.query(`DROP TABLE "money_requests"`); - await queryRunner.query(`DROP TABLE "customers"`); - await queryRunner.query(`DROP TABLE "documents"`); - await queryRunner.query(`DROP TABLE "devices"`); - await queryRunner.query(`DROP TABLE "users"`); - await queryRunner.query(`DROP INDEX "public"."IDX_5881556d05b46fc7bd9e3bba93"`); - await queryRunner.query(`DROP TABLE "user_registration_tokens"`); - await queryRunner.query(`DROP INDEX "public"."IDX_258d028d322ea3b856bf9f12f2"`); - await queryRunner.query(`DROP INDEX "public"."IDX_6427c192ef35355ebac18fb683"`); - await queryRunner.query(`DROP TABLE "otp"`); - await queryRunner.query(`DROP TABLE "notifications"`); - await queryRunner.query(`DROP TABLE "tasks"`); - await queryRunner.query(`DROP TABLE "task_submissions"`); - await queryRunner.query(`DROP TABLE "categories"`); - await queryRunner.query(`DROP TABLE "saving_goals"`); - await queryRunner.query(`DROP TABLE "gift_redemptions"`); - await queryRunner.query(`DROP TABLE "gift"`); - await queryRunner.query(`DROP TABLE "gift_replies"`); - } -} diff --git a/src/db/migrations/1733990253208-seeds-default-tasks-logo.ts b/src/db/migrations/1733990253208-seeds-default-tasks-logo.ts deleted file mode 100644 index ea02a1c..0000000 --- a/src/db/migrations/1733990253208-seeds-default-tasks-logo.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; -import { v4 as uuid } from 'uuid'; -import { Document } from '~/document/entities'; -import { DocumentType } from '~/document/enums'; -const DEFAULT_TASK_LOGOS = [ - { - id: uuid(), - name: 'bed-furniture', - extension: '.jpg', - documentType: DocumentType.DEFAULT_TASKS_LOGO, - }, - { - id: uuid(), - name: 'dog', - extension: '.jpg', - documentType: DocumentType.DEFAULT_TASKS_LOGO, - }, - { - id: uuid(), - name: 'dish-washing', - extension: '.jpg', - documentType: DocumentType.DEFAULT_TASKS_LOGO, - }, - { - id: uuid(), - name: 'walking-the-dog', - extension: '.jpg', - documentType: DocumentType.DEFAULT_TASKS_LOGO, - }, -]; -export class SeedsDefaultTasksLogo1733990253208 implements MigrationInterface { - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.manager.getRepository(Document).save(DEFAULT_TASK_LOGOS); - } - - public async down(queryRunner: QueryRunner): Promise { - await DEFAULT_TASK_LOGOS.forEach(async (logo) => { - await queryRunner.manager.getRepository(Document).delete({ name: logo.name, documentType: logo.documentType }); - }); - } -} diff --git a/src/db/migrations/1734247702310-seeds-goals-categories.ts b/src/db/migrations/1734247702310-seeds-goals-categories.ts deleted file mode 100644 index ed31973..0000000 --- a/src/db/migrations/1734247702310-seeds-goals-categories.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; -import { CategoryType } from '~/saving-goals/enums'; -const DEFAULT_CATEGORIES = [ - { - name: 'School', - type: CategoryType.GLOBAL, - }, - { - name: 'Toys', - type: CategoryType.GLOBAL, - }, - { - name: 'Games', - type: CategoryType.GLOBAL, - }, - { - name: 'Clothes', - type: CategoryType.GLOBAL, - }, - { - name: 'Hobbies', - type: CategoryType.GLOBAL, - }, - { - name: 'Party', - type: CategoryType.GLOBAL, - }, - { - name: 'Sport', - type: CategoryType.GLOBAL, - }, - { - name: 'University', - type: CategoryType.GLOBAL, - }, - { - name: 'Travel', - type: CategoryType.GLOBAL, - }, -]; -export class SeedsGoalsCategories1734247702310 implements MigrationInterface { - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `INSERT INTO categories (name, type) VALUES ${DEFAULT_CATEGORIES.map( - (category) => `('${category.name}', '${category.type}')`, - )}`, - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `DELETE FROM categories WHERE name IN (${DEFAULT_CATEGORIES.map( - (category) => `'${category.name}'`, - )}) AND type = '${CategoryType.GLOBAL}'`, - ); - } -} diff --git a/src/db/migrations/1754913378460-initial-migration.ts b/src/db/migrations/1754913378460-initial-migration.ts new file mode 100644 index 0000000..1557f56 --- /dev/null +++ b/src/db/migrations/1754913378460-initial-migration.ts @@ -0,0 +1,105 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; + +export class InitialMigration1754913378460 implements MigrationInterface { + name = 'InitialMigration1754913378460'; + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `CREATE TABLE "themes" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "color" character varying(255) NOT NULL, "avatar_id" uuid, "junior_id" uuid NOT NULL, CONSTRAINT "REL_73fcb76399a308cdd2d431a8f2" UNIQUE ("junior_id"), CONSTRAINT "PK_ddbeaab913c18682e5c88155592" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE TABLE "juniors" ("id" uuid NOT NULL, "relationship" character varying(255) NOT NULL, "customer_id" uuid NOT NULL, "guardian_id" uuid NOT NULL, "created_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updated_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "REL_dfbf64ede1ff823a489902448a" UNIQUE ("customer_id"), CONSTRAINT "PK_2d273092322c1f8bf26296fa608" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE TABLE "notifications" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "title" character varying NOT NULL, "message" character varying NOT NULL, "recipient" character varying, "scope" character varying NOT NULL, "status" character varying, "channel" character varying NOT NULL, "user_id" uuid, "created_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updated_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "PK_6a72c3c0f683f6462415e653c3a" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE TABLE "otp" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "value" character varying(255) NOT NULL, "scope" character varying(255) NOT NULL, "otp_type" character varying(255) NOT NULL, "expires_at" TIMESTAMP WITH TIME ZONE NOT NULL, "user_id" uuid NOT NULL, "is_used" boolean NOT NULL DEFAULT false, "created_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "PK_32556d9d7b22031d7d0e1fd6723" PRIMARY KEY ("id"))`, + ); + await queryRunner.query(`CREATE INDEX "IDX_6427c192ef35355ebac18fb683" ON "otp" ("scope") `); + await queryRunner.query(`CREATE INDEX "IDX_258d028d322ea3b856bf9f12f2" ON "otp" ("user_id") `); + await queryRunner.query( + `CREATE TABLE "user_auth_tokens" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "token" character varying(255) NOT NULL, "is_used" boolean NOT NULL DEFAULT false, "expiry_date" TIMESTAMP WITH TIME ZONE NOT NULL, "user_id" uuid NOT NULL, "updated_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "created_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "UQ_579eaaadf51ae3542caf3491062" UNIQUE ("token"), CONSTRAINT "PK_e15c7c76bf967080b272104d828" PRIMARY KEY ("id"))`, + ); + await queryRunner.query(`CREATE INDEX "IDX_579eaaadf51ae3542caf349106" ON "user_auth_tokens" ("token") `); + await queryRunner.query( + `CREATE TABLE "users" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "email" character varying(255), "phone_number" character varying(255), "country_code" character varying(10), "password" character varying(255), "salt" character varying(255), "google_id" character varying(255), "apple_id" character varying(255), "is_phone_verified" boolean NOT NULL DEFAULT false, "is_email_verified" boolean NOT NULL DEFAULT false, "is_profile_completed" boolean NOT NULL DEFAULT false, "is_email_enabled" boolean NOT NULL DEFAULT false, "is_push_enabled" boolean NOT NULL DEFAULT false, "is_sms_enabled" boolean NOT NULL DEFAULT false, "roles" text array, "created_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updated_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "PK_a3ffb1c0c8416b9fc6f907b7433" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE TABLE "devices" ("deviceId" character varying(255) NOT NULL, "user_id" uuid NOT NULL, "device_name" character varying, "public_key" character varying, "fcm_token" character varying, "last_access_on" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "created_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updated_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "PK_666c9b59efda8ca85b29157152c" PRIMARY KEY ("deviceId"))`, + ); + await queryRunner.query( + `CREATE TABLE "documents" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "name" character varying(255) NOT NULL, "extension" character varying(255) NOT NULL, "document_type" character varying(255) NOT NULL, "created_by_id" uuid, "updated_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "created_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "PK_ac51aa5181ee2036f5ca482857c" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE TABLE "customers" ("id" uuid NOT NULL, "customer_status" character varying(255) NOT NULL DEFAULT 'PENDING', "kyc_status" character varying(255) NOT NULL DEFAULT 'PENDING', "rejection_reason" text, "first_name" character varying(255), "last_name" character varying(255), "date_of_birth" date, "national_id" character varying(255), "national_id_expiry" date, "country_of_residence" character varying(255), "source_of_income" character varying(255), "profession" character varying(255), "profession_type" character varying(255), "is_pep" boolean NOT NULL DEFAULT false, "gender" character varying(255), "is_junior" boolean NOT NULL DEFAULT false, "is_guardian" boolean NOT NULL DEFAULT false, "application_number" SERIAL NOT NULL, "user_id" uuid NOT NULL, "profile_picture_id" uuid, "created_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updated_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "REL_e7574892da11dd01de5cfc4649" UNIQUE ("profile_picture_id"), CONSTRAINT "REL_11d81cd7be87b6f8865b0cf766" UNIQUE ("user_id"), CONSTRAINT "PK_133ec679a801fab5e070f73d3ea" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE TABLE "guardians" ("id" uuid NOT NULL, "customer_id" uuid NOT NULL, "created_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updated_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "REL_6c46a1b6af00e6457cb1b70f7e" UNIQUE ("customer_id"), CONSTRAINT "PK_3dcf02f3dc96a2c017106f280be" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `ALTER TABLE "themes" ADD CONSTRAINT "FK_169b672cc28cc757e1f4464864d" FOREIGN KEY ("avatar_id") REFERENCES "documents"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "themes" ADD CONSTRAINT "FK_73fcb76399a308cdd2d431a8f2e" FOREIGN KEY ("junior_id") REFERENCES "juniors"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "juniors" ADD CONSTRAINT "FK_dfbf64ede1ff823a489902448a2" FOREIGN KEY ("customer_id") REFERENCES "customers"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "juniors" ADD CONSTRAINT "FK_0b11aa56264184690e2220da4a0" FOREIGN KEY ("guardian_id") REFERENCES "guardians"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "notifications" ADD CONSTRAINT "FK_9a8a82462cab47c73d25f49261f" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "otp" ADD CONSTRAINT "FK_258d028d322ea3b856bf9f12f25" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "user_auth_tokens" ADD CONSTRAINT "FK_bab7def1955bd13dcc47c036c03" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "devices" ADD CONSTRAINT "FK_5e9bee993b4ce35c3606cda194c" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "documents" ADD CONSTRAINT "FK_7f46f4f77acde1dcedba64cb220" FOREIGN KEY ("created_by_id") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "customers" ADD CONSTRAINT "FK_e7574892da11dd01de5cfc46499" FOREIGN KEY ("profile_picture_id") REFERENCES "documents"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "customers" ADD CONSTRAINT "FK_11d81cd7be87b6f8865b0cf7661" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "guardians" ADD CONSTRAINT "FK_6c46a1b6af00e6457cb1b70f7e7" FOREIGN KEY ("customer_id") REFERENCES "customers"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "guardians" DROP CONSTRAINT "FK_6c46a1b6af00e6457cb1b70f7e7"`); + await queryRunner.query(`ALTER TABLE "customers" DROP CONSTRAINT "FK_11d81cd7be87b6f8865b0cf7661"`); + await queryRunner.query(`ALTER TABLE "customers" DROP CONSTRAINT "FK_e7574892da11dd01de5cfc46499"`); + await queryRunner.query(`ALTER TABLE "documents" DROP CONSTRAINT "FK_7f46f4f77acde1dcedba64cb220"`); + await queryRunner.query(`ALTER TABLE "devices" DROP CONSTRAINT "FK_5e9bee993b4ce35c3606cda194c"`); + await queryRunner.query(`ALTER TABLE "user_auth_tokens" DROP CONSTRAINT "FK_bab7def1955bd13dcc47c036c03"`); + await queryRunner.query(`ALTER TABLE "otp" DROP CONSTRAINT "FK_258d028d322ea3b856bf9f12f25"`); + await queryRunner.query(`ALTER TABLE "notifications" DROP CONSTRAINT "FK_9a8a82462cab47c73d25f49261f"`); + await queryRunner.query(`ALTER TABLE "juniors" DROP CONSTRAINT "FK_0b11aa56264184690e2220da4a0"`); + await queryRunner.query(`ALTER TABLE "juniors" DROP CONSTRAINT "FK_dfbf64ede1ff823a489902448a2"`); + await queryRunner.query(`ALTER TABLE "themes" DROP CONSTRAINT "FK_73fcb76399a308cdd2d431a8f2e"`); + await queryRunner.query(`ALTER TABLE "themes" DROP CONSTRAINT "FK_169b672cc28cc757e1f4464864d"`); + await queryRunner.query(`DROP TABLE "guardians"`); + await queryRunner.query(`DROP TABLE "customers"`); + await queryRunner.query(`DROP TABLE "documents"`); + await queryRunner.query(`DROP TABLE "devices"`); + await queryRunner.query(`DROP TABLE "users"`); + await queryRunner.query(`DROP INDEX "public"."IDX_579eaaadf51ae3542caf349106"`); + await queryRunner.query(`DROP TABLE "user_auth_tokens"`); + await queryRunner.query(`DROP INDEX "public"."IDX_258d028d322ea3b856bf9f12f2"`); + await queryRunner.query(`DROP INDEX "public"."IDX_6427c192ef35355ebac18fb683"`); + await queryRunner.query(`DROP TABLE "otp"`); + await queryRunner.query(`DROP TABLE "notifications"`); + await queryRunner.query(`DROP TABLE "juniors"`); + await queryRunner.query(`DROP TABLE "themes"`); + } +} diff --git a/src/db/migrations/1753869637732-seed-default-avatar.ts b/src/db/migrations/1754913378461-seed-default-avatar.ts similarity index 96% rename from src/db/migrations/1753869637732-seed-default-avatar.ts rename to src/db/migrations/1754913378461-seed-default-avatar.ts index 7b1a5e3..297c684 100644 --- a/src/db/migrations/1753869637732-seed-default-avatar.ts +++ b/src/db/migrations/1754913378461-seed-default-avatar.ts @@ -58,7 +58,7 @@ const DEFAULT_AVATARS = [ documentType: DocumentType.DEFAULT_AVATAR, }, ]; -export class SeedDefaultAvatar1753869637732 implements MigrationInterface { +export class SeedDefaultAvatar1754913378460 implements MigrationInterface { public async up(queryRunner: QueryRunner): Promise { await queryRunner.manager.getRepository(Document).save(DEFAULT_AVATARS); } diff --git a/src/db/migrations/index.ts b/src/db/migrations/index.ts index e06880b..462234a 100644 --- a/src/db/migrations/index.ts +++ b/src/db/migrations/index.ts @@ -1,4 +1,2 @@ -export * from './1753869637732-seed-default-avatar'; -export * from './1733990253208-seeds-default-tasks-logo'; -export * from './1734247702310-seeds-goals-categories'; -export * from './1733750228289-initial-migration'; +export * from './1754913378460-initial-migration'; +export * from './1754913378461-seed-default-avatar'; diff --git a/src/document/entities/document.entity.ts b/src/document/entities/document.entity.ts index 7c327f1..304b95f 100644 --- a/src/document/entities/document.entity.ts +++ b/src/document/entities/document.entity.ts @@ -9,11 +9,7 @@ import { UpdateDateColumn, } from 'typeorm'; import { Customer } from '~/customer/entities'; -import { Gift } from '~/gift/entities'; import { Theme } from '~/junior/entities'; -import { SavingGoal } from '~/saving-goals/entities'; -import { Task } from '~/task/entities'; -import { TaskSubmission } from '~/task/entities/task-submissions.entity'; import { User } from '~/user/entities'; import { DocumentType } from '../enums'; @@ -37,35 +33,17 @@ export class Document { @OneToOne(() => Customer, (customer) => customer.profilePicture, { onDelete: 'SET NULL' }) customerPicture?: Customer; - @OneToOne(() => Customer, (customer) => customer.civilIdFront, { onDelete: 'SET NULL' }) - customerCivilIdFront?: User; - - @OneToOne(() => Customer, (customer) => customer.civilIdBack, { onDelete: 'SET NULL' }) - customerCivilIdBack?: User; - @OneToMany(() => Theme, (theme) => theme.avatar) themes?: Theme[]; - @OneToMany(() => Task, (task) => task.image) - tasks?: Task[]; - - @OneToMany(() => TaskSubmission, (taskSubmission) => taskSubmission.proofOfCompletion) - submissions?: TaskSubmission[]; - - @OneToMany(() => SavingGoal, (savingGoal) => savingGoal.image) - goals?: SavingGoal[]; - - @OneToMany(() => Gift, (gift) => gift.image) - gifts?: Gift[]; - @ManyToOne(() => User, (user) => user.createdDocuments, { nullable: true, onDelete: 'SET NULL' }) @JoinColumn({ name: 'created_by_id' }) createdBy?: User; - @UpdateDateColumn({ name: 'updated_at', type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' }) + @UpdateDateColumn({ name: 'updated_at', type: 'timestamp with time zone', default: () => 'CURRENT_TIMESTAMP' }) updatedAt!: Date; - @Column({ name: 'created_at', type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' }) + @Column({ name: 'created_at', type: 'timestamp with time zone', default: () => 'CURRENT_TIMESTAMP' }) createdAt!: Date; // virtual field diff --git a/src/gift/controllers/gifts.controller.ts b/src/gift/controllers/gifts.controller.ts deleted file mode 100644 index 6d8f2e6..0000000 --- a/src/gift/controllers/gifts.controller.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { Body, Controller, Get, HttpCode, HttpStatus, Param, Post, Query, UseGuards } from '@nestjs/common'; -import { ApiBearerAuth, ApiTags } from '@nestjs/swagger'; -import { Roles } from '~/auth/enums'; -import { IJwtPayload } from '~/auth/interfaces'; -import { AllowedRoles, AuthenticatedUser } from '~/common/decorators'; -import { AccessTokenGuard, RolesGuard } from '~/common/guards'; -import { ApiDataPageResponse, ApiDataResponse, ApiLangRequestHeader } from '~/core/decorators'; -import { ResponseFactory } from '~/core/utils'; -import { CreateGiftRequestDto, GiftFiltersRequestDto, GiftReplyRequestDto } from '../dtos/request'; -import { GiftDetailsResponseDto, GiftListResponseDto } from '../dtos/response'; -import { GiftsService } from '../services'; - -@Controller('gift') -@ApiTags('Gifts') -@ApiBearerAuth() -@ApiLangRequestHeader() -export class GiftsController { - constructor(private readonly giftsService: GiftsService) {} - - @Post() - @UseGuards(RolesGuard) - @AllowedRoles(Roles.GUARDIAN) - @ApiDataResponse(GiftDetailsResponseDto) - async createGift(@AuthenticatedUser() { sub }: IJwtPayload, @Body() body: CreateGiftRequestDto) { - const gift = await this.giftsService.createGift(sub, body); - - return ResponseFactory.data(new GiftDetailsResponseDto(gift)); - } - - @Get() - @UseGuards(AccessTokenGuard) - @ApiDataPageResponse(GiftListResponseDto) - async findGifts(@AuthenticatedUser() user: IJwtPayload, @Query() filters: GiftFiltersRequestDto) { - const [gifts, itemCount] = await this.giftsService.findGifts(user, filters); - - return ResponseFactory.dataPage( - gifts.map((gift) => new GiftListResponseDto(gift)), - { - size: filters.size, - page: filters.page, - itemCount, - }, - ); - } - - @Get(':giftId') - @UseGuards(AccessTokenGuard) - @ApiDataResponse(GiftDetailsResponseDto) - async findGiftById(@AuthenticatedUser() user: IJwtPayload, @Param('giftId') giftId: string) { - const gift = await this.giftsService.findUserGiftById(user, giftId); - - return ResponseFactory.data(new GiftDetailsResponseDto(gift)); - } - - @Post(':giftId/redeem') - @UseGuards(RolesGuard) - @AllowedRoles(Roles.JUNIOR) - @HttpCode(HttpStatus.NO_CONTENT) - redeemGift(@AuthenticatedUser() { sub }: IJwtPayload, @Param('giftId') giftId: string) { - return this.giftsService.redeemGift(sub, giftId); - } - - @Post(':giftId/undo-redeem') - @UseGuards(RolesGuard) - @AllowedRoles(Roles.JUNIOR) - @HttpCode(HttpStatus.NO_CONTENT) - UndoGiftRedemption(@AuthenticatedUser() { sub }: IJwtPayload, @Param('giftId') giftId: string) { - return this.giftsService.UndoGiftRedemption(sub, giftId); - } - - @Post(':giftId/reply') - @UseGuards(RolesGuard) - @AllowedRoles(Roles.JUNIOR) - @HttpCode(HttpStatus.NO_CONTENT) - replyToGift( - @AuthenticatedUser() { sub }: IJwtPayload, - @Param('giftId') giftId: string, - @Body() body: GiftReplyRequestDto, - ) { - return this.giftsService.replyToGift(sub, giftId, body); - } -} diff --git a/src/gift/controllers/index.ts b/src/gift/controllers/index.ts deleted file mode 100644 index 3d8e776..0000000 --- a/src/gift/controllers/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './gifts.controller'; diff --git a/src/gift/dtos/request/create-gift.request.dto.ts b/src/gift/dtos/request/create-gift.request.dto.ts deleted file mode 100644 index 8b2aa82..0000000 --- a/src/gift/dtos/request/create-gift.request.dto.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { IsEnum, IsNotEmpty, IsNumber, IsPositive, IsString, IsUUID } from 'class-validator'; -import { i18nValidationMessage as i18n } from 'nestjs-i18n'; -import { GiftColor } from '~/gift/enums'; -export class CreateGiftRequestDto { - @ApiProperty({ example: 'Happy Birthday' }) - @IsString({ message: i18n('validation.IsString', { path: 'general', property: 'gift.name' }) }) - @IsNotEmpty({ message: i18n('validation.IsNotEmpty', { path: 'general', property: 'gift.name' }) }) - name!: string; - - @ApiProperty({ example: 'Description of the gift' }) - @IsString({ message: i18n('validation.IsString', { path: 'general', property: 'gift.description' }) }) - @IsNotEmpty({ message: i18n('validation.IsNotEmpty', { path: 'general', property: 'gift.description' }) }) - description!: string; - - @ApiProperty({ example: GiftColor.VIOLET }) - @IsEnum(GiftColor, { message: i18n('validation.IsEnum', { path: 'general', property: 'gift.color' }) }) - color!: GiftColor; - - @ApiProperty({ example: 100 }) - @IsNumber({}, { message: i18n('validation.IsNumber', { path: 'general', property: 'gift.amount' }) }) - @IsPositive({ message: i18n('validation.IsPositive', { path: 'general', property: 'gift.amount' }) }) - amount!: number; - - @ApiProperty({ example: 'f7b9b1b0-0b3b-4b3b-8b3b-0b3b4b3b8b3b' }) - @IsUUID('4', { message: i18n('validation.IsUUID', { path: 'general', property: 'gift.imageId' }) }) - imageId!: string; - - @ApiProperty({ example: 'f7b9b1b0-0b3b-4b3b-8b3b-0b3b4b3b8b3b' }) - @IsUUID('4', { message: i18n('validation.IsUUID', { path: 'general', property: 'gift.recipientId' }) }) - recipientId!: string; -} diff --git a/src/gift/dtos/request/gift-filters.request.dto.ts b/src/gift/dtos/request/gift-filters.request.dto.ts deleted file mode 100644 index dae57e8..0000000 --- a/src/gift/dtos/request/gift-filters.request.dto.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { IsEnum } from 'class-validator'; -import { i18nValidationMessage as i18n } from 'nestjs-i18n'; -import { PageOptionsRequestDto } from '~/core/dtos'; -import { GiftStatus } from '~/gift/enums'; -export class GiftFiltersRequestDto extends PageOptionsRequestDto { - @ApiProperty({ enum: GiftStatus }) - @IsEnum(GiftStatus, { message: i18n('validation.IsEnum', { path: 'general', property: 'gift.status' }) }) - status!: GiftStatus; -} diff --git a/src/gift/dtos/request/gift-reply.request.dto.ts b/src/gift/dtos/request/gift-reply.request.dto.ts deleted file mode 100644 index ca28387..0000000 --- a/src/gift/dtos/request/gift-reply.request.dto.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { IsEnum } from 'class-validator'; -import { i18nValidationMessage as i18n } from 'nestjs-i18n'; -import { GiftColor } from '~/gift/enums'; -export class GiftReplyRequestDto { - @ApiProperty() - @IsEnum(GiftColor, { message: i18n('validation.IsEnum', { path: 'general', property: 'gift.color' }) }) - color!: GiftColor; -} diff --git a/src/gift/dtos/request/index.ts b/src/gift/dtos/request/index.ts deleted file mode 100644 index ef6249c..0000000 --- a/src/gift/dtos/request/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './create-gift.request.dto'; -export * from './gift-filters.request.dto'; -export * from './gift-reply.request.dto'; diff --git a/src/gift/dtos/response/gift-details.response.dto.ts b/src/gift/dtos/response/gift-details.response.dto.ts deleted file mode 100644 index ceaaf10..0000000 --- a/src/gift/dtos/response/gift-details.response.dto.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { DocumentMetaResponseDto } from '~/document/dtos/response'; -import { Gift } from '~/gift/entities'; -import { GiftColor, GiftStatus } from '~/gift/enums'; -import { JuniorResponseDto } from '~/junior/dtos/response'; - -export class GiftDetailsResponseDto { - @ApiProperty({ example: 'f7b9b1b0-0b3b-4b3b-8b3b-0b3b4b3b8b3b' }) - id!: string; - - @ApiProperty({ example: 'Happy Birthday' }) - name!: string; - - @ApiProperty({ example: 'Description of the gift' }) - description!: string; - - @ApiProperty({ example: '200' }) - amount!: number; - - @ApiProperty({ example: GiftStatus.AVAILABLE }) - status!: GiftStatus; - - @ApiProperty({ example: GiftColor.GREEN }) - color!: GiftColor; - - @ApiProperty({ type: JuniorResponseDto }) - recipient!: JuniorResponseDto; - - @ApiProperty({ example: 'Ahmad Khalid' }) - giverName!: string; - - @ApiProperty({ type: DocumentMetaResponseDto }) - image!: DocumentMetaResponseDto; - - @ApiProperty({ example: '2022-01-01T00:00:00.000Z' }) - createdAt!: Date; - - @ApiProperty({ example: '2022-01-01T00:00:00.000Z' }) - updatedAt!: Date; - - constructor(gift: Gift) { - this.id = gift.id; - this.name = gift.name; - this.description = gift.description; - this.amount = gift.amount; - this.status = gift.status; - this.color = gift.color; - this.giverName = gift.giver.customer.firstName + ' ' + gift.giver.customer.lastName; - this.recipient = new JuniorResponseDto(gift.recipient); - this.image = new DocumentMetaResponseDto(gift.image); - this.createdAt = gift.createdAt; - this.updatedAt = gift.updatedAt; - } -} diff --git a/src/gift/dtos/response/gift-list.response.dto.ts b/src/gift/dtos/response/gift-list.response.dto.ts deleted file mode 100644 index a3a1cb8..0000000 --- a/src/gift/dtos/response/gift-list.response.dto.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { Gift } from '~/gift/entities'; -import { GiftColor, GiftStatus } from '~/gift/enums'; - -export class GiftListResponseDto { - @ApiProperty({ example: 'f7b9b1b0-0b3b-4b3b-8b3b-0b3b4b3b8b3b' }) - id!: string; - - @ApiProperty({ example: 'Happy Birthday' }) - name!: string; - - @ApiProperty({ example: '242' }) - amount!: number; - - @ApiProperty({ example: GiftStatus.AVAILABLE }) - status!: GiftStatus; - - @ApiProperty({ example: GiftColor.GREEN }) - color!: GiftColor; - - @ApiProperty({ example: '2022-01-01T00:00:00.000Z' }) - createdAt!: Date; - - constructor(gift: Gift) { - this.id = gift.id; - this.name = gift.name; - this.amount = gift.amount; - this.status = gift.status; - this.color = gift.color; - this.createdAt = gift.createdAt; - } -} diff --git a/src/gift/dtos/response/index.ts b/src/gift/dtos/response/index.ts deleted file mode 100644 index 7fa8981..0000000 --- a/src/gift/dtos/response/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './gift-details.response.dto'; -export * from './gift-list.response.dto'; diff --git a/src/gift/entities/gift-redemption.entity.ts b/src/gift/entities/gift-redemption.entity.ts deleted file mode 100644 index 88bec89..0000000 --- a/src/gift/entities/gift-redemption.entity.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { - BaseEntity, - Column, - CreateDateColumn, - Entity, - JoinColumn, - ManyToOne, - PrimaryGeneratedColumn, - UpdateDateColumn, -} from 'typeorm'; -import { Gift } from './gift.entity'; - -@Entity('gift_redemptions') -export class GiftRedemption extends BaseEntity { - @PrimaryGeneratedColumn('uuid') - id!: string; - - @Column({ type: 'uuid', name: 'gift_id' }) - giftId!: string; - - @ManyToOne(() => Gift, (gift) => gift.redemptions, { onDelete: 'CASCADE' }) - @JoinColumn({ name: 'gift_id' }) - gift!: Gift; - - @CreateDateColumn({ name: 'created_at', type: 'timestamp with time zone', default: () => 'CURRENT_TIMESTAMP' }) - createdAt!: Date; - - @UpdateDateColumn({ name: 'updated_at', type: 'timestamp with time zone', default: () => 'CURRENT_TIMESTAMP' }) - updatedAt!: Date; -} diff --git a/src/gift/entities/gift-reply.entity.ts b/src/gift/entities/gift-reply.entity.ts deleted file mode 100644 index 8b9bdd9..0000000 --- a/src/gift/entities/gift-reply.entity.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { BaseEntity, Column, CreateDateColumn, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from 'typeorm'; -import { GiftColor, GiftReplyStatus } from '../enums'; -import { Gift } from './gift.entity'; - -@Entity('gift_replies') -export class GiftReply extends BaseEntity { - @PrimaryGeneratedColumn('uuid') - id!: string; - - @Column({ type: 'varchar', name: 'status', default: GiftReplyStatus.PENDING }) - status!: GiftReplyStatus; - - @Column({ type: 'varchar', name: 'color' }) - color!: GiftColor; - - @Column({ type: 'uuid', name: 'gift_id' }) - giftId!: string; - - @OneToOne(() => Gift, (gift) => gift.reply, { onDelete: 'CASCADE' }) - @JoinColumn({ name: 'gift_id' }) - gift!: Gift; - - @CreateDateColumn({ name: 'created_at', type: 'timestamp with time zone', default: () => 'CURRENT_TIMESTAMP' }) - createdAt!: Date; -} diff --git a/src/gift/entities/gift.entity.ts b/src/gift/entities/gift.entity.ts deleted file mode 100644 index 0442cb2..0000000 --- a/src/gift/entities/gift.entity.ts +++ /dev/null @@ -1,83 +0,0 @@ -import { - Column, - CreateDateColumn, - Entity, - JoinColumn, - ManyToOne, - OneToMany, - OneToOne, - PrimaryGeneratedColumn, - UpdateDateColumn, -} from 'typeorm'; -import { Document } from '~/document/entities'; -import { Guardian } from '~/guardian/entities/guradian.entity'; -import { Junior } from '~/junior/entities'; -import { GiftColor, GiftStatus } from '../enums'; -import { GiftRedemption } from './gift-redemption.entity'; -import { GiftReply } from './gift-reply.entity'; - -@Entity('gift') -export class Gift { - @PrimaryGeneratedColumn('uuid') - id!: string; - - @Column({ type: 'varchar', length: 255, name: 'name' }) - name!: string; - - @Column({ type: 'text', name: 'description' }) - description!: string; - - @Column({ type: 'varchar', name: 'color' }) - color!: GiftColor; - - @Column({ - type: 'decimal', - name: 'amount', - precision: 10, - scale: 3, - transformer: { - to: (value: number) => value, - from: (value: string) => parseFloat(value), - }, - }) - amount!: number; - - @Column({ type: 'varchar', name: 'status', default: GiftStatus.AVAILABLE }) - status!: GiftStatus; - - @Column({ type: 'timestamp with time zone', name: 'redeemed_at', nullable: true }) - redeemedAt!: Date | null; - - @Column({ type: 'uuid', name: 'giver_id' }) - giverId!: string; - - @Column({ type: 'uuid', name: 'image_id' }) - imageId!: string; - - @Column({ type: 'uuid', name: 'recipient_id' }) - recipientId!: string; - - @ManyToOne(() => Guardian, (guardian) => guardian.gifts) - @JoinColumn({ name: 'giver_id' }) - giver!: Guardian; - - @ManyToOne(() => Junior, (junior) => junior.gifts) - @JoinColumn({ name: 'recipient_id' }) - recipient!: Junior; - - @ManyToOne(() => Document, (document) => document.gifts) - @JoinColumn({ name: 'image_id' }) - image!: Document; - - @OneToMany(() => GiftRedemption, (giftRedemption) => giftRedemption.gift, { cascade: true }) - redemptions!: GiftRedemption[]; - - @OneToOne(() => GiftReply, (giftReply) => giftReply.gift, { cascade: true }) - reply?: GiftReply; - - @CreateDateColumn({ name: 'created_at', type: 'timestamp with time zone', default: () => 'CURRENT_TIMESTAMP' }) - createdAt!: Date; - - @UpdateDateColumn({ name: 'updated_at', type: 'timestamp with time zone', default: () => 'CURRENT_TIMESTAMP' }) - updatedAt!: Date; -} diff --git a/src/gift/entities/index.ts b/src/gift/entities/index.ts deleted file mode 100644 index 0be791f..0000000 --- a/src/gift/entities/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './gift-redemption.entity'; -export * from './gift-reply.entity'; -export * from './gift.entity'; diff --git a/src/gift/enums/gift-color.enum.ts b/src/gift/enums/gift-color.enum.ts deleted file mode 100644 index ee67cf6..0000000 --- a/src/gift/enums/gift-color.enum.ts +++ /dev/null @@ -1,6 +0,0 @@ -export enum GiftColor { - VIOLET = 'VIOLET', - PINK = 'PINK', - BLUE = 'BLUE', - GREEN = 'GREEN', -} diff --git a/src/gift/enums/gift-reply-status.enum.ts b/src/gift/enums/gift-reply-status.enum.ts deleted file mode 100644 index 12183a5..0000000 --- a/src/gift/enums/gift-reply-status.enum.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum GiftReplyStatus { - PENDING = 'PENDING', - OPENED = 'OPENED', -} diff --git a/src/gift/enums/gift-status.enum.ts b/src/gift/enums/gift-status.enum.ts deleted file mode 100644 index 96d84ec..0000000 --- a/src/gift/enums/gift-status.enum.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum GiftStatus { - AVAILABLE = 'AVAILABLE', - REDEEMED = 'REDEEMED', -} diff --git a/src/gift/enums/index.ts b/src/gift/enums/index.ts deleted file mode 100644 index e76b986..0000000 --- a/src/gift/enums/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './gift-color.enum'; -export * from './gift-reply-status.enum'; -export * from './gift-status.enum'; diff --git a/src/gift/gift.module.ts b/src/gift/gift.module.ts deleted file mode 100644 index 080a2e0..0000000 --- a/src/gift/gift.module.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Module } from '@nestjs/common'; -import { TypeOrmModule } from '@nestjs/typeorm'; -import { JuniorModule } from '~/junior/junior.module'; -import { GiftsController } from './controllers'; -import { Gift, GiftRedemption, GiftReply } from './entities'; -import { GiftsRepository } from './repositories'; -import { GiftsService } from './services'; - -@Module({ - imports: [TypeOrmModule.forFeature([Gift, GiftReply, GiftRedemption]), JuniorModule], - controllers: [GiftsController], - providers: [GiftsService, GiftsRepository], -}) -export class GiftModule {} diff --git a/src/gift/repositories/gifts.repository.ts b/src/gift/repositories/gifts.repository.ts deleted file mode 100644 index 0226e58..0000000 --- a/src/gift/repositories/gifts.repository.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { Injectable } from '@nestjs/common'; -import { InjectRepository } from '@nestjs/typeorm'; -import { Repository } from 'typeorm'; -import { Roles } from '~/auth/enums'; -import { IJwtPayload } from '~/auth/interfaces'; -import { CreateGiftRequestDto, GiftFiltersRequestDto, GiftReplyRequestDto } from '../dtos/request'; -import { Gift, GiftRedemption, GiftReply } from '../entities'; -import { GiftStatus } from '../enums'; -const ONE = 1; - -@Injectable() -export class GiftsRepository { - constructor(@InjectRepository(Gift) private readonly giftsRepository: Repository) {} - - create(guardianId: string, gift: CreateGiftRequestDto): Promise { - return this.giftsRepository.save( - this.giftsRepository.create({ - name: gift.name, - description: gift.description, - amount: gift.amount, - recipientId: gift.recipientId, - imageId: gift.imageId, - color: gift.color, - giverId: guardianId, - }), - ); - } - - findJuniorGiftById(juniorId: string, giftId: string): Promise { - return this.giftsRepository.findOne({ - where: { recipientId: juniorId, id: giftId }, - relations: ['recipient', 'recipient.customer', 'image', 'giver', 'giver.customer', 'reply'], - }); - } - - findGuardianGiftById(guardianId: string, giftId: string): Promise { - return this.giftsRepository.findOne({ - where: { giverId: guardianId, id: giftId }, - relations: ['recipient', 'recipient.customer', 'image', 'giver', 'giver.customer', 'reply'], - }); - } - - findGifts(user: IJwtPayload, filters: GiftFiltersRequestDto) { - const query = this.giftsRepository.createQueryBuilder('gift'); - if (user.roles.includes(Roles.GUARDIAN)) { - query.where('gift.giverId = :giverId', { giverId: user.sub }); - } else { - query.where('gift.recipientId = :recipientId', { recipientId: user.sub }); - } - query.andWhere('gift.status = :status', { status: filters.status }); - query.skip((filters.page - ONE) * filters.size); - query.take(filters.size); - query.orderBy('gift.createdAt', 'DESC'); - return query.getManyAndCount(); - } - - redeemGift(gift: Gift) { - const redemptions = gift.redemptions || []; - gift.status = GiftStatus.REDEEMED; - gift.redeemedAt = new Date(); - gift.redemptions = [...redemptions, new GiftRedemption()]; - return this.giftsRepository.save(gift); - } - - UndoGiftRedemption(gift: Gift) { - gift.status = GiftStatus.AVAILABLE; - gift.redeemedAt = null; - return this.giftsRepository.save(gift); - } - - replyToGift(gift: Gift, reply: GiftReplyRequestDto) { - gift.reply = GiftReply.create({ ...reply }); - - return this.giftsRepository.save(gift); - } -} diff --git a/src/gift/repositories/index.ts b/src/gift/repositories/index.ts deleted file mode 100644 index 77bbb18..0000000 --- a/src/gift/repositories/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './gifts.repository'; diff --git a/src/gift/services/gifts.service.ts b/src/gift/services/gifts.service.ts deleted file mode 100644 index 5e0d2c4..0000000 --- a/src/gift/services/gifts.service.ts +++ /dev/null @@ -1,139 +0,0 @@ -import { BadRequestException, Injectable, Logger } from '@nestjs/common'; -import { Roles } from '~/auth/enums'; -import { IJwtPayload } from '~/auth/interfaces'; -import { DocumentService, OciService } from '~/document/services'; -import { JuniorService } from '~/junior/services'; -import { CreateGiftRequestDto, GiftFiltersRequestDto, GiftReplyRequestDto } from '../dtos/request'; -import { Gift } from '../entities'; -import { GiftStatus } from '../enums'; -import { GiftsRepository } from '../repositories'; - -@Injectable() -export class GiftsService { - private readonly logger = new Logger(GiftsService.name); - constructor( - private readonly juniorService: JuniorService, - private readonly giftsRepository: GiftsRepository, - private readonly ociService: OciService, - private readonly documentService: DocumentService, - ) {} - - async createGift(guardianId: string, body: CreateGiftRequestDto) { - this.logger.log(`Creating gift for junior ${body.recipientId} by guardian ${guardianId}`); - - await this.validateGiftImage(guardianId, body.imageId); - const doesJuniorBelongToGuardian = await this.juniorService.doesJuniorBelongToGuardian( - guardianId, - body.recipientId, - ); - - if (!doesJuniorBelongToGuardian) { - this.logger.error(`Junior ${body.recipientId} does not belong to guardian ${guardianId}`); - throw new BadRequestException('JUNIOR.DOES_NOT_BELONG_TO_GUARDIAN'); - } - - const gift = await this.giftsRepository.create(guardianId, body); - this.logger.log(`Gift ${gift.id} created successfully`); - return this.findUserGiftById({ sub: guardianId, roles: [Roles.GUARDIAN] }, gift.id); - } - - async findUserGiftById(user: IJwtPayload, giftId: string) { - this.logger.log(`Finding gift ${giftId} for user ${user.sub} with roles ${user.roles}`); - const gift = user.roles.includes(Roles.GUARDIAN) - ? await this.giftsRepository.findGuardianGiftById(user.sub, giftId) - : await this.giftsRepository.findJuniorGiftById(user.sub, giftId); - - if (!gift) { - this.logger.error(`Gift ${giftId} not found`); - throw new BadRequestException('GIFT.NOT_FOUND'); - } - - await this.prepareGiftImages([gift]); - - this.logger.log(`Gift ${giftId} found successfully`); - - return gift; - } - - async redeemGift(juniorId: string, giftId: string) { - this.logger.log(`Redeeming gift ${giftId} for junior ${juniorId}`); - const gift = await this.giftsRepository.findJuniorGiftById(juniorId, giftId); - - if (!gift) { - this.logger.error(`Gift ${giftId} not found`); - throw new BadRequestException('GIFT.NOT_FOUND'); - } - - if (gift.status === GiftStatus.REDEEMED) { - this.logger.error(`Gift ${giftId} already redeemed`); - throw new BadRequestException('GIFT.ALREADY_REDEEMED'); - } - - return this.giftsRepository.redeemGift(gift); - } - - async UndoGiftRedemption(juniorId: string, giftId: string) { - this.logger.log(`Undoing gift redemption for junior ${juniorId} and gift ${giftId}`); - const gift = await this.giftsRepository.findJuniorGiftById(juniorId, giftId); - - if (!gift) { - this.logger.error(`Gift ${giftId} not found`); - throw new BadRequestException('GIFT.NOT_FOUND'); - } - - if (gift.status === GiftStatus.AVAILABLE) { - this.logger.error(`Gift ${giftId} is not redeemed yet`); - throw new BadRequestException('GIFT.NOT_REDEEMED'); - } - - return this.giftsRepository.UndoGiftRedemption(gift); - } - - async replyToGift(juniorId: string, giftId: string, body: GiftReplyRequestDto) { - this.logger.log(`Replying to gift ${giftId} for junior ${juniorId}`); - const gift = await this.giftsRepository.findJuniorGiftById(juniorId, giftId); - - if (!gift) { - this.logger.error(`Gift ${giftId} not found`); - throw new BadRequestException('GIFT.NOT_FOUND'); - } - - if (gift.reply) { - this.logger.error(`Gift ${giftId} already replied`); - throw new BadRequestException('GIFT.ALREADY_REPLIED'); - } - - return this.giftsRepository.replyToGift(gift, body); - } - - findGifts(user: IJwtPayload, filters: GiftFiltersRequestDto) { - this.logger.log(`Finding gifts for user ${user.sub} with roles ${user.roles}`); - return this.giftsRepository.findGifts(user, filters); - } - - private async prepareGiftImages(gifts: Gift[]) { - this.logger.log('Preparing gifts image'); - await Promise.all( - gifts.map(async (gift) => { - gift.image.url = await this.ociService.generatePreSignedUrl(gift.image); - }), - ); - } - - private async validateGiftImage(userId: string, imageId?: string) { - if (!imageId) return; - - this.logger.log(`Validating gift image ${imageId}`); - const image = await this.documentService.findDocumentById(imageId); - - if (!image) { - this.logger.error(`Gift image ${imageId} not found`); - throw new BadRequestException('DOCUMENT.NOT_FOUND'); - } - - if (image.createdById && image.createdById !== userId) { - this.logger.error(`Gift image ${imageId} does not belong to user ${userId}`); - throw new BadRequestException('DOCUMENT.NOT_CREATED_BY_USER'); - } - } -} diff --git a/src/gift/services/index.ts b/src/gift/services/index.ts deleted file mode 100644 index 4bb6e70..0000000 --- a/src/gift/services/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './gifts.service'; diff --git a/src/guardian/entities/guradian.entity.ts b/src/guardian/entities/guradian.entity.ts index 6ae87ca..a578bdc 100644 --- a/src/guardian/entities/guradian.entity.ts +++ b/src/guardian/entities/guradian.entity.ts @@ -9,12 +9,8 @@ import { PrimaryColumn, UpdateDateColumn, } from 'typeorm'; -import { Allowance } from '~/allowance/entities'; import { Customer } from '~/customer/entities'; -import { Gift } from '~/gift/entities'; import { Junior } from '~/junior/entities'; -import { MoneyRequest } from '~/money-request/entities'; -import { Task } from '~/task/entities'; @Entity('guardians') export class Guardian extends BaseEntity { @@ -31,21 +27,9 @@ export class Guardian extends BaseEntity { @OneToMany(() => Junior, (junior) => junior.guardian) juniors!: Junior[]; - @OneToMany(() => Task, (task) => task.assignedBy) - tasks?: Task[]; - - @OneToMany(() => MoneyRequest, (moneyRequest) => moneyRequest.reviewer) - moneyRequests?: MoneyRequest[]; - - @OneToMany(() => Allowance, (allowance) => allowance.guardian) - allowances?: Allowance[]; - - @OneToMany(() => Gift, (gift) => gift.giver) - gifts?: Gift[]; - - @CreateDateColumn({ name: 'created_at', type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' }) + @CreateDateColumn({ name: 'created_at', type: 'timestamp with time zone', default: () => 'CURRENT_TIMESTAMP' }) createdAt!: Date; - @UpdateDateColumn({ name: 'updated_at', type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' }) + @UpdateDateColumn({ name: 'updated_at', type: 'timestamp with time zone', default: () => 'CURRENT_TIMESTAMP' }) updatedAt!: Date; } diff --git a/src/junior/entities/junior.entity.ts b/src/junior/entities/junior.entity.ts index 8c27704..87c6fab 100644 --- a/src/junior/entities/junior.entity.ts +++ b/src/junior/entities/junior.entity.ts @@ -5,19 +5,12 @@ import { Entity, JoinColumn, ManyToOne, - OneToMany, OneToOne, PrimaryColumn, UpdateDateColumn, } from 'typeorm'; -import { Allowance } from '~/allowance/entities'; import { Customer } from '~/customer/entities'; -import { Gift } from '~/gift/entities'; import { Guardian } from '~/guardian/entities/guradian.entity'; -import { MoneyRequest } from '~/money-request/entities'; -import { Category, SavingGoal } from '~/saving-goals/entities'; -import { Task } from '~/task/entities'; -import { UserRegistrationToken } from '~/user/entities'; import { Relationship } from '../enums'; import { Theme } from './theme.entity'; @@ -46,30 +39,9 @@ export class Junior extends BaseEntity { @JoinColumn({ name: 'guardian_id' }) guardian!: Guardian; - @OneToMany(() => Task, (task) => task.assignedTo) - tasks!: Task[]; - - @OneToMany(() => SavingGoal, (savingGoal) => savingGoal.junior) - goals!: SavingGoal[]; - - @OneToMany(() => Category, (category) => category.junior) - categories!: Category[]; - - @OneToMany(() => UserRegistrationToken, (token) => token.junior) - registrationTokens!: UserRegistrationToken[]; - - @OneToMany(() => MoneyRequest, (moneyRequest) => moneyRequest.requester) - moneyRequests!: MoneyRequest[]; - - @OneToMany(() => Allowance, (allowance) => allowance.junior) - allowances!: Allowance[]; - - @OneToMany(() => Gift, (gift) => gift.recipient) - gifts!: Gift[]; - - @CreateDateColumn({ name: 'created_at', type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' }) + @CreateDateColumn({ name: 'created_at', type: 'timestamp with time zone', default: () => 'CURRENT_TIMESTAMP' }) createdAt!: Date; - @UpdateDateColumn({ name: 'updated_at', type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' }) + @UpdateDateColumn({ name: 'updated_at', type: 'timestamp with time zone', default: () => 'CURRENT_TIMESTAMP' }) updatedAt!: Date; } diff --git a/src/junior/services/junior.service.ts b/src/junior/services/junior.service.ts index 5d2abbd..9d65360 100644 --- a/src/junior/services/junior.service.ts +++ b/src/junior/services/junior.service.ts @@ -116,7 +116,7 @@ export class JuniorService { async generateToken(juniorId: string) { this.logger.log(`Generating token for junior ${juniorId}`); - const token = await this.userTokenService.generateToken(juniorId, UserType.JUNIOR); + const token = await this.userTokenService.generateToken(juniorId); return this.qrCodeService.generateQrCode(token); } diff --git a/src/money-request/controllers/index.ts b/src/money-request/controllers/index.ts deleted file mode 100644 index fba9009..0000000 --- a/src/money-request/controllers/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './money-requests.controller'; diff --git a/src/money-request/controllers/money-requests.controller.ts b/src/money-request/controllers/money-requests.controller.ts deleted file mode 100644 index d7c8387..0000000 --- a/src/money-request/controllers/money-requests.controller.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { Body, Controller, Get, HttpCode, HttpStatus, Param, Patch, Post, Query, UseGuards } from '@nestjs/common'; -import { ApiBearerAuth, ApiTags } from '@nestjs/swagger'; -import { Roles } from '~/auth/enums'; -import { IJwtPayload } from '~/auth/interfaces'; -import { AllowedRoles, AuthenticatedUser } from '~/common/decorators'; -import { RolesGuard } from '~/common/guards'; -import { ApiDataPageResponse, ApiDataResponse, ApiLangRequestHeader } from '~/core/decorators'; -import { CustomParseUUIDPipe } from '~/core/pipes'; -import { ResponseFactory } from '~/core/utils'; -import { CreateMoneyRequestRequestDto, MoneyRequestsFiltersRequestDto } from '../dtos/request'; -import { MoneyRequestResponseDto } from '../dtos/response/money-request.response.dto'; -import { MoneyRequestsService } from '../services'; - -@Controller('money-requests') -@ApiTags('Money Requests') -@ApiBearerAuth() -@ApiLangRequestHeader() -export class MoneyRequestsController { - constructor(private readonly moneyRequestsService: MoneyRequestsService) {} - - @Post() - @UseGuards(RolesGuard) - @AllowedRoles(Roles.JUNIOR) - @ApiDataResponse(MoneyRequestResponseDto) - async createMoneyRequest(@AuthenticatedUser() { sub }: IJwtPayload, @Body() body: CreateMoneyRequestRequestDto) { - const moneyRequest = await this.moneyRequestsService.createMoneyRequest(sub, body); - - return ResponseFactory.data(new MoneyRequestResponseDto(moneyRequest)); - } - - @UseGuards(RolesGuard) - @AllowedRoles(Roles.GUARDIAN) - @Get() - @ApiDataPageResponse(MoneyRequestResponseDto) - async findMoneyRequests(@AuthenticatedUser() { sub }: IJwtPayload, @Query() filters: MoneyRequestsFiltersRequestDto) { - const [moneyRequests, itemCount] = await this.moneyRequestsService.findMoneyRequests(sub, filters); - - return ResponseFactory.dataPage( - moneyRequests.map((moneyRequest) => new MoneyRequestResponseDto(moneyRequest)), - { - itemCount, - page: filters.page, - size: filters.size, - }, - ); - } - - @UseGuards(RolesGuard) - @AllowedRoles(Roles.GUARDIAN) - @Get(':moneyRequestId') - @ApiDataResponse(MoneyRequestResponseDto) - async findMoneyRequestById( - @AuthenticatedUser() { sub }: IJwtPayload, - @Param('moneyRequestId', CustomParseUUIDPipe) moneyRequestId: string, - ) { - const moneyRequest = await this.moneyRequestsService.findMoneyRequestById(moneyRequestId, sub); - - return ResponseFactory.data(new MoneyRequestResponseDto(moneyRequest)); - } - - @UseGuards(RolesGuard) - @AllowedRoles(Roles.GUARDIAN) - @Patch(':moneyRequestId/approve') - @HttpCode(HttpStatus.NO_CONTENT) - async approveMoneyRequest( - @AuthenticatedUser() { sub }: IJwtPayload, - @Param('moneyRequestId', CustomParseUUIDPipe) moneyRequestId: string, - ) { - await this.moneyRequestsService.approveMoneyRequest(moneyRequestId, sub); - } - - @UseGuards(RolesGuard) - @AllowedRoles(Roles.GUARDIAN) - @Patch(':moneyRequestId/reject') - @HttpCode(HttpStatus.NO_CONTENT) - async rejectMoneyRequest( - @AuthenticatedUser() { sub }: IJwtPayload, - @Param('moneyRequestId', CustomParseUUIDPipe) moneyRequestId: string, - ) { - await this.moneyRequestsService.rejectMoneyRequest(moneyRequestId, sub); - } -} diff --git a/src/money-request/dtos/request/create-money-request.request.dto.ts b/src/money-request/dtos/request/create-money-request.request.dto.ts deleted file mode 100644 index f7b1dab..0000000 --- a/src/money-request/dtos/request/create-money-request.request.dto.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; -import { - IsDateString, - IsEnum, - IsNotEmpty, - IsNumber, - IsOptional, - IsString, - Max, - Min, - ValidateIf, -} from 'class-validator'; -import { i18nValidationMessage as i18n } from 'nestjs-i18n'; -import { MoneyRequestFrequency } from '~/money-request/enums'; -const MIN_REQUESTED_AMOUNT = 0.01; -const MAX_REQUESTED_AMOUNT = 1000000; -export class CreateMoneyRequestRequestDto { - @Min(MIN_REQUESTED_AMOUNT, { - message: i18n('validation.Min', { path: 'general', property: 'moneyRequest.requestedAmount' }), - }) - @Max(MAX_REQUESTED_AMOUNT, { - message: i18n('validation.Max', { path: 'general', property: 'moneyRequest.requestedAmount' }), - }) - @IsNumber( - { allowNaN: false }, - { message: i18n('validation.IsNumber', { path: 'general', property: 'moneyRequest.requestedAmount' }) }, - ) - @ApiProperty() - requestedAmount!: number; - - @ApiProperty() - @IsString({ message: i18n('validation.IsString', { path: 'general', property: 'moneyRequest.message' }) }) - @IsNotEmpty({ message: i18n('validation.IsNotEmpty', { path: 'general', property: 'moneyRequest.message' }) }) - message!: string; - - @ApiPropertyOptional({ example: MoneyRequestFrequency.ONE_TIME }) - @IsEnum(MoneyRequestFrequency, { - message: i18n('validation.IsEnum', { path: 'general', property: 'moneyRequest.frequency' }), - }) - @IsOptional() - frequency: MoneyRequestFrequency = MoneyRequestFrequency.ONE_TIME; - - @ApiPropertyOptional({ example: '2021-01-01' }) - @IsDateString( - {}, - { message: i18n('validation.IsDateString', { path: 'general', property: 'moneyRequest.startDate' }) }, - ) - @ValidateIf((o) => o.frequency !== MoneyRequestFrequency.ONE_TIME) - startDate?: string; - - @ApiPropertyOptional({ example: '2021-01-01' }) - @IsDateString({}, { message: i18n('validation.IsDateString', { path: 'general', property: 'moneyRequest.endDate' }) }) - @IsOptional() - endDate?: string; -} diff --git a/src/money-request/dtos/request/index.ts b/src/money-request/dtos/request/index.ts deleted file mode 100644 index 814b709..0000000 --- a/src/money-request/dtos/request/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './create-money-request.request.dto'; -export * from './money-requests-filters.request.dto'; diff --git a/src/money-request/dtos/request/money-requests-filters.request.dto.ts b/src/money-request/dtos/request/money-requests-filters.request.dto.ts deleted file mode 100644 index ac47232..0000000 --- a/src/money-request/dtos/request/money-requests-filters.request.dto.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { IsEnum } from 'class-validator'; -import { i18nValidationMessage as i18n } from 'nestjs-i18n'; -import { PageOptionsRequestDto } from '~/core/dtos'; -import { MoneyRequestStatus } from '~/money-request/enums'; -export class MoneyRequestsFiltersRequestDto extends PageOptionsRequestDto { - @ApiProperty({ example: MoneyRequestStatus.PENDING, enum: MoneyRequestStatus }) - @IsEnum(MoneyRequestStatus, { - message: i18n('validation.IsEnum', { path: 'general', property: 'moneyRequest.status' }), - }) - status: MoneyRequestStatus = MoneyRequestStatus.PENDING; -} diff --git a/src/money-request/dtos/response/money-request.response.dto.ts b/src/money-request/dtos/response/money-request.response.dto.ts deleted file mode 100644 index 0d28e61..0000000 --- a/src/money-request/dtos/response/money-request.response.dto.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { JuniorResponseDto } from '~/junior/dtos/response'; -import { MoneyRequest } from '~/money-request/entities'; -import { MoneyRequestFrequency, MoneyRequestStatus } from '~/money-request/enums'; - -export class MoneyRequestResponseDto { - @ApiProperty({ example: 'f5c7e193-bc5e-4aa5-837b-c1edc6449880' }) - id!: string; - - @ApiProperty({ type: JuniorResponseDto }) - requester!: JuniorResponseDto; - - @ApiProperty({ example: 'f5c7e193-bc5e-4aa5-837b-c1edc6449880' }) - reviewerId!: string; - - @ApiProperty({ example: 100.0 }) - requestedAmount!: number; - - @ApiProperty({ example: 'Please give me money' }) - message!: string; - - @ApiProperty({ example: MoneyRequestFrequency.ONE_TIME }) - frequency!: MoneyRequestFrequency; - - @ApiProperty({ example: '2021-01-01' }) - startDate!: Date | null; - - @ApiProperty({ example: '2021-01-01' }) - endDate!: Date | null; - - @ApiProperty({ example: MoneyRequestStatus.PENDING }) - status!: MoneyRequestStatus; - - @ApiProperty() - reviewedAt!: Date | null; - - @ApiProperty() - createdAt!: Date; - - constructor(moneyRequest: MoneyRequest) { - this.id = moneyRequest.id; - this.requester = new JuniorResponseDto(moneyRequest.requester); - this.reviewerId = moneyRequest.reviewerId; - this.requestedAmount = moneyRequest.requestedAmount; - this.message = moneyRequest.message; - this.frequency = moneyRequest.frequency; - this.startDate = moneyRequest.startDate || null; - this.endDate = moneyRequest.endDate || null; - this.status = moneyRequest.status; - this.reviewedAt = moneyRequest.reviewedAt || null; - this.createdAt = moneyRequest.createdAt; - } -} diff --git a/src/money-request/entities/index.ts b/src/money-request/entities/index.ts deleted file mode 100644 index 5701511..0000000 --- a/src/money-request/entities/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './money-request.entity'; diff --git a/src/money-request/entities/money-request.entity.ts b/src/money-request/entities/money-request.entity.ts deleted file mode 100644 index ac2cca5..0000000 --- a/src/money-request/entities/money-request.entity.ts +++ /dev/null @@ -1,97 +0,0 @@ -import moment from 'moment'; -import { - Column, - CreateDateColumn, - Entity, - JoinColumn, - ManyToOne, - PrimaryGeneratedColumn, - UpdateDateColumn, -} from 'typeorm'; -import { Guardian } from '~/guardian/entities/guradian.entity'; -import { Junior } from '~/junior/entities'; -import { MoneyRequestFrequency, MoneyRequestStatus } from '../enums'; - -@Entity('money_requests') -export class MoneyRequest { - @PrimaryGeneratedColumn('uuid') - id!: string; - - @Column({ type: 'decimal', precision: 10, scale: 3, name: 'requested_amount' }) - requestedAmount!: number; - - @Column({ type: 'varchar', name: 'message' }) - message!: string; - - @Column({ type: 'varchar', name: 'frequency', default: MoneyRequestFrequency.ONE_TIME }) - frequency!: MoneyRequestFrequency; - - @Column({ type: 'varchar', name: 'status', default: MoneyRequestStatus.PENDING }) - status!: MoneyRequestStatus; - - @Column({ type: 'timestamp with time zone', name: 'reviewed_at', nullable: true }) - reviewedAt!: Date; - - @Column({ type: 'timestamp with time zone', name: 'start_date', nullable: true }) - startDate!: Date | null; - - @Column({ type: 'timestamp with time zone', name: 'end_date', nullable: true }) - endDate!: Date | null; - - @Column({ type: 'uuid', name: 'requester_id' }) - requesterId!: string; - - @Column({ type: 'uuid', name: 'reviewer_id' }) - reviewerId!: string; - - @ManyToOne(() => Junior, (junior) => junior.moneyRequests) - @JoinColumn({ name: 'requester_id' }) - requester!: Junior; - - @ManyToOne(() => Guardian, (guardian) => guardian.moneyRequests) - @JoinColumn({ name: 'reviewer_id' }) - reviewer!: Guardian; - - @CreateDateColumn({ type: 'timestamp with time zone', name: 'created_at' }) - createdAt!: Date; - - @UpdateDateColumn({ type: 'timestamp with time zone', name: 'updated_at' }) - updatedAt!: Date; - - get nextPaymentDate(): Date | null { - if (this.frequency === MoneyRequestFrequency.ONE_TIME) { - return null; - } - const startDate = moment(this.startDate).clone().startOf('day'); - const endDate = this.endDate ? moment(this.endDate).endOf('day') : null; - const now = moment().startOf('day'); - - if (endDate && moment().isAfter(endDate)) { - return null; - } - - const calculateNextDate = (unit: moment.unitOfTime.Diff) => { - const diff = now.diff(startDate, unit); - const nextDate = startDate.clone().add(diff, unit); - - const adjustedDate = nextDate.isSameOrAfter(now) ? nextDate : nextDate.add('1', unit); - - if (endDate && adjustedDate.isAfter(endDate)) { - return null; - } - - return adjustedDate.toDate(); - }; - - switch (this.frequency) { - case MoneyRequestFrequency.DAILY: - return calculateNextDate('days'); - case MoneyRequestFrequency.WEEKLY: - return calculateNextDate('weeks'); - case MoneyRequestFrequency.MONTHLY: - return calculateNextDate('months'); - default: - return null; - } - } -} diff --git a/src/money-request/enums/index.ts b/src/money-request/enums/index.ts deleted file mode 100644 index 63205a2..0000000 --- a/src/money-request/enums/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './money-request-frequency.enum'; -export * from './money-request-status.enum'; diff --git a/src/money-request/enums/money-request-frequency.enum.ts b/src/money-request/enums/money-request-frequency.enum.ts deleted file mode 100644 index 88f44cd..0000000 --- a/src/money-request/enums/money-request-frequency.enum.ts +++ /dev/null @@ -1,6 +0,0 @@ -export enum MoneyRequestFrequency { - ONE_TIME = 'ONE_TIME', - DAILY = 'DAILY', - WEEKLY = 'WEEKLY', - MONTHLY = 'MONTHLY', -} diff --git a/src/money-request/enums/money-request-status.enum.ts b/src/money-request/enums/money-request-status.enum.ts deleted file mode 100644 index bf317f7..0000000 --- a/src/money-request/enums/money-request-status.enum.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum MoneyRequestStatus { - PENDING = 'PENDING', - APPROVED = 'APPROVED', - REJECTED = 'REJECTED', -} diff --git a/src/money-request/money-request.module.ts b/src/money-request/money-request.module.ts deleted file mode 100644 index 7cd4f11..0000000 --- a/src/money-request/money-request.module.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Module } from '@nestjs/common'; -import { TypeOrmModule } from '@nestjs/typeorm'; -import { JuniorModule } from '~/junior/junior.module'; -import { MoneyRequestsController } from './controllers'; -import { MoneyRequest } from './entities'; -import { MoneyRequestsRepository } from './repositories'; -import { MoneyRequestsService } from './services'; - -@Module({ - controllers: [MoneyRequestsController], - providers: [MoneyRequestsService, MoneyRequestsRepository], - exports: [MoneyRequestsService], - imports: [TypeOrmModule.forFeature([MoneyRequest]), JuniorModule], -}) -export class MoneyRequestModule {} diff --git a/src/money-request/repositories/index.ts b/src/money-request/repositories/index.ts deleted file mode 100644 index ff6ac5f..0000000 --- a/src/money-request/repositories/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './money-requests.repository'; diff --git a/src/money-request/repositories/money-requests.repository.ts b/src/money-request/repositories/money-requests.repository.ts deleted file mode 100644 index db93dea..0000000 --- a/src/money-request/repositories/money-requests.repository.ts +++ /dev/null @@ -1,79 +0,0 @@ -import { Injectable } from '@nestjs/common'; -import { InjectRepository } from '@nestjs/typeorm'; -import { IsNull, MoreThan, Not, Repository } from 'typeorm'; -import { CreateMoneyRequestRequestDto, MoneyRequestsFiltersRequestDto } from '../dtos/request'; -import { MoneyRequest } from '../entities'; -import { MoneyRequestFrequency, MoneyRequestStatus } from '../enums'; -const ONE = 1; -@Injectable() -export class MoneyRequestsRepository { - constructor(@InjectRepository(MoneyRequest) private readonly moneyRequestRepository: Repository) {} - - createMoneyRequest(requesterId: string, reviewerId: string, body: CreateMoneyRequestRequestDto) { - return this.moneyRequestRepository.save( - this.moneyRequestRepository.create({ - requesterId, - reviewerId, - requestedAmount: body.requestedAmount, - message: body.message, - startDate: body.startDate, - endDate: body.endDate, - frequency: body.frequency, - }), - ); - } - - findMoneyRequestById(moneyRequestId: string, reviewerId?: string) { - return this.moneyRequestRepository.findOne({ - where: { id: moneyRequestId, reviewerId }, - relations: ['requester', 'requester.customer', 'requester.customer.profilePicture'], - }); - } - - findMoneyRequests(reviewerId: string, filters: MoneyRequestsFiltersRequestDto) { - const query = this.moneyRequestRepository.createQueryBuilder('moneyRequest'); - query.leftJoinAndSelect('moneyRequest.requester', 'requester'); - query.leftJoinAndSelect('requester.customer', 'customer'); - query.leftJoinAndSelect('customer.profilePicture', 'profilePicture'); - query.orderBy('moneyRequest.createdAt', 'DESC'); - query.where('moneyRequest.reviewerId = :reviewerId', { reviewerId }); - query.andWhere('moneyRequest.status = :status', { status: filters.status }); - query.skip((filters.page - ONE) * filters.size); - query.take(filters.size); - - return query.getManyAndCount(); - } - - updateMoneyRequestStatus(moneyRequestId: string, reviewerId: string, status: MoneyRequestStatus) { - return this.moneyRequestRepository.update({ id: moneyRequestId, reviewerId }, { status, reviewedAt: new Date() }); - } - - async *findMoneyRequestsChunks(chunkSize: number) { - let offset = 0; - while (true) { - const moneyRequests = await this.moneyRequestRepository.find({ - take: chunkSize, - skip: offset, - where: [ - { - status: MoneyRequestStatus.APPROVED, - frequency: Not(MoneyRequestFrequency.ONE_TIME), - endDate: MoreThan(new Date()), - }, - { - status: MoneyRequestStatus.APPROVED, - frequency: Not(MoneyRequestFrequency.ONE_TIME), - endDate: IsNull(), - }, - ], - }); - - if (!moneyRequests.length) { - break; - } - - yield moneyRequests; - offset += chunkSize; - } - } -} diff --git a/src/money-request/services/index.ts b/src/money-request/services/index.ts deleted file mode 100644 index 5abf42b..0000000 --- a/src/money-request/services/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './money-requests.service'; diff --git a/src/money-request/services/money-requests.service.ts b/src/money-request/services/money-requests.service.ts deleted file mode 100644 index 7e9d7d9..0000000 --- a/src/money-request/services/money-requests.service.ts +++ /dev/null @@ -1,137 +0,0 @@ -import { BadRequestException, Injectable, Logger } from '@nestjs/common'; -import { OciService } from '~/document/services'; -import { JuniorService } from '~/junior/services'; -import { CreateMoneyRequestRequestDto, MoneyRequestsFiltersRequestDto } from '../dtos/request'; -import { MoneyRequest } from '../entities'; -import { MoneyRequestFrequency, MoneyRequestStatus } from '../enums'; -import { MoneyRequestsRepository } from '../repositories'; - -@Injectable() -export class MoneyRequestsService { - private readonly logger = new Logger(MoneyRequestsService.name); - constructor( - private readonly moneyRequestsRepository: MoneyRequestsRepository, - private readonly juniorService: JuniorService, - private readonly ociService: OciService, - ) {} - - async createMoneyRequest(userId: string, body: CreateMoneyRequestRequestDto) { - this.logger.log(`Creating money request for junior ${userId}`); - if (body.frequency === MoneyRequestFrequency.ONE_TIME) { - this.logger.log(`Setting end date to null for one time money request`); - delete body.endDate; - delete body.startDate; - } - - if (body.startDate && new Date(body.startDate) < new Date()) { - this.logger.error(`Start date ${body.startDate} is in the past`); - throw new BadRequestException('MONEY_REQUEST.START_DATE_IN_THE_PAST'); - } - - if (body.endDate && new Date(body.endDate) < new Date()) { - this.logger.error(`End date ${body.endDate} is in the past`); - throw new BadRequestException('MONEY_REQUEST.END_DATE_IN_THE_PAST'); - } - - if (body.endDate && body.startDate && new Date(body.endDate) < new Date(body.startDate)) { - this.logger.error(`End date ${body.endDate} is before start date ${body.startDate}`); - throw new BadRequestException('MONEY_REQUEST.END_DATE_BEFORE_START_DATE'); - } - - const junior = await this.juniorService.findJuniorById(userId, true); - - const moneyRequest = await this.moneyRequestsRepository.createMoneyRequest(junior.id, junior.guardianId, body); - this.logger.log(`Money request ${moneyRequest.id} created successfully`); - return this.findMoneyRequestById(moneyRequest.id); - } - - async findMoneyRequestById(moneyRequestId: string, reviewerId?: string) { - this.logger.log(`Finding money request ${moneyRequestId} ${reviewerId ? `by reviewer ${reviewerId}` : ''}`); - const moneyRequest = await this.moneyRequestsRepository.findMoneyRequestById(moneyRequestId, reviewerId); - - if (!moneyRequest) { - this.logger.error(`Money request ${moneyRequestId} not found ${reviewerId ? `for reviewer ${reviewerId}` : ''}`); - throw new BadRequestException('MONEY_REQUEST.NOT_FOUND'); - } - - await this.prepareMoneyRequestDocument([moneyRequest]); - - this.logger.log(`Money request ${moneyRequestId} found successfully`); - return moneyRequest; - } - - async findMoneyRequests( - ReviewerId: string, - filters: MoneyRequestsFiltersRequestDto, - ): Promise<[MoneyRequest[], number]> { - this.logger.log(`Finding money requests for reviewer ${ReviewerId}`); - const [moneyRequests, itemCount] = await this.moneyRequestsRepository.findMoneyRequests(ReviewerId, filters); - await this.prepareMoneyRequestDocument(moneyRequests); - - this.logger.log(`Returning money requests for reviewer ${ReviewerId}`); - return [moneyRequests, itemCount]; - } - - async approveMoneyRequest(moneyRequestId: string, reviewerId: string) { - this.logger.log(`Approving money request ${moneyRequestId} by reviewer ${reviewerId}`); - await this.validateMoneyRequestForReview(moneyRequestId, reviewerId); - await this.moneyRequestsRepository.updateMoneyRequestStatus( - moneyRequestId, - reviewerId, - MoneyRequestStatus.APPROVED, - ); - - //@TODO send notification and update junior balance - } - - async rejectMoneyRequest(moneyRequestId: string, reviewerId: string) { - this.logger.log(`Rejecting money request ${moneyRequestId} by reviewer ${reviewerId}`); - await this.validateMoneyRequestForReview(moneyRequestId, reviewerId); - - await this.moneyRequestsRepository.updateMoneyRequestStatus( - moneyRequestId, - reviewerId, - MoneyRequestStatus.REJECTED, - ); - - //@TODO send notification - } - - findMoneyRequestsChunks(chunkSize: number) { - this.logger.log(`Finding money requests chunks`); - return this.moneyRequestsRepository.findMoneyRequestsChunks(chunkSize); - } - - private async prepareMoneyRequestDocument(moneyRequests: MoneyRequest[]) { - this.logger.log(`Preparing document for money requests`); - await Promise.all( - moneyRequests.map(async (moneyRequest) => { - const profilePicture = moneyRequest.requester.customer.profilePicture; - - if (profilePicture) { - profilePicture.url = await this.ociService.generatePreSignedUrl(profilePicture); - } - }), - ); - } - - private async validateMoneyRequestForReview(moneyRequestId: string, reviewerId: string) { - this.logger.log(`Validating money request ${moneyRequestId} for reviewer ${reviewerId}`); - const moneyRequest = await this.moneyRequestsRepository.findMoneyRequestById(moneyRequestId, reviewerId); - - if (!moneyRequest) { - this.logger.error(`Money request ${moneyRequestId} not found`); - throw new BadRequestException('MONEY_REQUEST.NOT_FOUND'); - } - - if (moneyRequest.endDate && new Date(moneyRequest.endDate) < new Date()) { - this.logger.error(`Money request ${moneyRequestId} has already ended`); - throw new BadRequestException('MONEY_REQUEST.ENDED'); - } - - if (moneyRequest.status !== MoneyRequestStatus.PENDING) { - this.logger.error(`Money request ${moneyRequestId} already reviewed`); - throw new BadRequestException('MONEY_REQUEST.ALREADY_REVIEWED'); - } - } -} diff --git a/src/saving-goals/controllers/index.ts b/src/saving-goals/controllers/index.ts deleted file mode 100644 index dd26911..0000000 --- a/src/saving-goals/controllers/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './saving-goals.controller'; diff --git a/src/saving-goals/controllers/saving-goals.controller.ts b/src/saving-goals/controllers/saving-goals.controller.ts deleted file mode 100644 index 22e65d6..0000000 --- a/src/saving-goals/controllers/saving-goals.controller.ts +++ /dev/null @@ -1,96 +0,0 @@ -import { Body, Controller, Get, HttpCode, HttpStatus, Param, Post, Query, UseGuards } from '@nestjs/common'; -import { ApiBearerAuth, ApiTags } from '@nestjs/swagger'; -import { Roles } from '~/auth/enums'; -import { IJwtPayload } from '~/auth/interfaces'; -import { AllowedRoles, AuthenticatedUser } from '~/common/decorators'; -import { RolesGuard } from '~/common/guards'; -import { ApiDataPageResponse, ApiDataResponse, ApiLangRequestHeader } from '~/core/decorators'; -import { PageOptionsRequestDto } from '~/core/dtos'; -import { CustomParseUUIDPipe } from '~/core/pipes'; -import { ResponseFactory } from '~/core/utils'; -import { createCategoryRequestDto, CreateGoalRequestDto, FundGoalRequestDto } from '../dtos/request'; -import { - CategoriesListResponseDto, - CategoryResponseDto, - GoalsStatsResponseDto, - SavingGoalDetailsResponseDto, -} from '../dtos/response'; -import { SavingGoalsService } from '../services'; -import { CategoryService } from '../services/category.service'; - -@Controller('saving-goals') -@ApiTags('Saving Goals') -@UseGuards(RolesGuard) -@AllowedRoles(Roles.JUNIOR) -@ApiBearerAuth() -@ApiLangRequestHeader() -export class SavingGoalsController { - constructor( - private readonly savingGoalsService: SavingGoalsService, - private readonly categoryService: CategoryService, - ) {} - - @Post() - @ApiDataResponse(SavingGoalDetailsResponseDto) - async createGoal(@AuthenticatedUser() { sub }: IJwtPayload, @Body() body: CreateGoalRequestDto) { - const goal = await this.savingGoalsService.createGoal(sub, body); - - return ResponseFactory.data(new SavingGoalDetailsResponseDto(goal)); - } - - @Get() - @ApiDataPageResponse(SavingGoalDetailsResponseDto) - async getGoals(@AuthenticatedUser() { sub }: IJwtPayload, @Query() pageOptions: PageOptionsRequestDto) { - const [goals, itemCount] = await this.savingGoalsService.findGoals(sub, pageOptions); - - return ResponseFactory.dataPage( - goals.map((goal) => new SavingGoalDetailsResponseDto(goal)), - { - page: pageOptions.page, - size: pageOptions.size, - itemCount, - }, - ); - } - - @Get('stats') - @ApiDataResponse(GoalsStatsResponseDto) - async getStats(@AuthenticatedUser() { sub }: IJwtPayload) { - const stats = await this.savingGoalsService.getStats(sub); - - return ResponseFactory.data(new GoalsStatsResponseDto(stats)); - } - - @Get('categories') - @ApiDataResponse(CategoriesListResponseDto) - async getCategories(@AuthenticatedUser() { sub }: IJwtPayload) { - const categories = await this.categoryService.findCategories(sub); - - return ResponseFactory.data(new CategoriesListResponseDto(categories)); - } - - @Get(':goalId') - @ApiDataResponse(SavingGoalDetailsResponseDto) - async getGoal(@AuthenticatedUser() { sub }: IJwtPayload, @Param('goalId', CustomParseUUIDPipe) goalId: string) { - const goal = await this.savingGoalsService.findGoalById(sub, goalId); - - return ResponseFactory.data(new SavingGoalDetailsResponseDto(goal)); - } - - @Post('categories') - @ApiDataResponse(CategoryResponseDto) - async createCategory(@AuthenticatedUser() { sub }: IJwtPayload, @Body() body: createCategoryRequestDto) { - const category = await this.categoryService.createCustomCategory(sub, body); - return ResponseFactory.data(new CategoryResponseDto(category)); - } - - @Post(':goalId/fund') - @HttpCode(HttpStatus.NO_CONTENT) - async fundGoal( - @AuthenticatedUser() { sub }: IJwtPayload, - @Param('goalId', CustomParseUUIDPipe) goalId: string, - @Body() body: FundGoalRequestDto, - ) { - await this.savingGoalsService.fundGoal(sub, goalId, body); - } -} diff --git a/src/saving-goals/dtos/request/create-category.request.dto.ts b/src/saving-goals/dtos/request/create-category.request.dto.ts deleted file mode 100644 index 3de4852..0000000 --- a/src/saving-goals/dtos/request/create-category.request.dto.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { IsNotEmpty, IsString } from 'class-validator'; -import { i18nValidationMessage as i18n } from 'nestjs-i18n'; -export class createCategoryRequestDto { - @ApiProperty() - @IsString({ message: i18n('validation.IsString', { path: 'general', property: 'category.name' }) }) - @IsNotEmpty({ message: i18n('validation.IsNotEmpty', { path: 'general', property: 'category.name' }) }) - name!: string; -} diff --git a/src/saving-goals/dtos/request/create-goal.request.dto.ts b/src/saving-goals/dtos/request/create-goal.request.dto.ts deleted file mode 100644 index 998a051..0000000 --- a/src/saving-goals/dtos/request/create-goal.request.dto.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; -import { Transform } from 'class-transformer'; -import { IsArray, IsDateString, IsNotEmpty, IsNumber, IsOptional, IsString, IsUUID } from 'class-validator'; -import { i18nValidationMessage as i18n } from 'nestjs-i18n'; -export class CreateGoalRequestDto { - @ApiProperty() - @IsString({ message: i18n('validation.IsString', { path: 'general', property: 'goal.name' }) }) - @IsNotEmpty({ message: i18n('validation.IsNotEmpty', { path: 'general', property: 'goal.name' }) }) - name!: string; - - @ApiPropertyOptional() - @IsString({ message: i18n('validation.IsString', { path: 'general', property: 'goal.description' }) }) - @IsOptional() - description?: string; - - @ApiProperty({ example: '2021-12-31' }) - @IsDateString({}, { message: i18n('validation.IsDateString', { path: 'general', property: 'goal.dueDate' }) }) - dueDate!: string; - - @ApiProperty() - @IsNumber({}, { message: i18n('validation.IsNumber', { path: 'general', property: 'goal.targetAmount' }) }) - @IsNotEmpty({ message: i18n('validation.IsNotEmpty', { path: 'general', property: 'goal.targetAmount' }) }) - targetAmount!: number; - - @ApiProperty() - @IsArray({ message: i18n('validation.IsArray', { path: 'general', property: 'goal.categoryIds' }) }) - @IsUUID('4', { each: true, message: i18n('validation.IsUUID', { path: 'general', property: 'goal.categoryIds' }) }) - @Transform(({ value }) => (typeof value === 'string' ? [value] : value)) - categoryIds!: string[]; - - @ApiPropertyOptional() - @IsUUID('4', { message: i18n('validation.IsUUID', { path: 'general', property: 'goal.imageId' }) }) - @IsOptional() - imageId?: string; -} diff --git a/src/saving-goals/dtos/request/fund-goal.request.dto.ts b/src/saving-goals/dtos/request/fund-goal.request.dto.ts deleted file mode 100644 index a8acd92..0000000 --- a/src/saving-goals/dtos/request/fund-goal.request.dto.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { IsNumber, Min } from 'class-validator'; -import { i18nValidationMessage as i18n } from 'nestjs-i18n'; -const MIN_FUND = 1; -export class FundGoalRequestDto { - @ApiProperty({ example: '200' }) - @IsNumber({}, { message: i18n('validation.IsNumber', { path: 'general', property: 'goal.fundAmount' }) }) - @Min(MIN_FUND) - fundAmount!: number; -} diff --git a/src/saving-goals/dtos/request/index.ts b/src/saving-goals/dtos/request/index.ts deleted file mode 100644 index 56fe67d..0000000 --- a/src/saving-goals/dtos/request/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './create-category.request.dto'; -export * from './create-goal.request.dto'; -export * from './fund-goal.request.dto'; diff --git a/src/saving-goals/dtos/response/categories-list.response.dto.ts b/src/saving-goals/dtos/response/categories-list.response.dto.ts deleted file mode 100644 index b95dbc1..0000000 --- a/src/saving-goals/dtos/response/categories-list.response.dto.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { Category } from '~/saving-goals/entities'; -import { CategoryResponseDto } from './category-response.dto'; - -export class CategoriesListResponseDto { - @ApiProperty({ type: CategoryResponseDto, isArray: true }) - globalCategories!: CategoryResponseDto[]; - - @ApiProperty({ type: CategoryResponseDto, isArray: true }) - customCategories!: CategoryResponseDto[]; - - constructor(data: { globalCategories: Category[]; customCategories: Category[] }) { - this.globalCategories = data.globalCategories.map((category) => new CategoryResponseDto(category)); - this.customCategories = data.customCategories.map((category) => new CategoryResponseDto(category)); - } -} diff --git a/src/saving-goals/dtos/response/category-response.dto.ts b/src/saving-goals/dtos/response/category-response.dto.ts deleted file mode 100644 index 31e602f..0000000 --- a/src/saving-goals/dtos/response/category-response.dto.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { CategoryType } from '~/saving-goals/enums'; - -export class CategoryResponseDto { - @ApiProperty() - id!: string; - - @ApiProperty() - name!: string; - - @ApiProperty({ example: CategoryType.CUSTOM }) - type!: CategoryType; - - constructor(data: CategoryResponseDto) { - this.id = data.id; - this.name = data.name; - this.type = data.type; - } -} diff --git a/src/saving-goals/dtos/response/goals-stats.response.dto.ts b/src/saving-goals/dtos/response/goals-stats.response.dto.ts deleted file mode 100644 index 88e6df8..0000000 --- a/src/saving-goals/dtos/response/goals-stats.response.dto.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { IGoalStats } from '~/saving-goals/interfaces'; -const ZERO = 0; -export class GoalsStatsResponseDto { - @ApiProperty() - totalTarget: number; - - @ApiProperty() - totalSaved: number; - - constructor(stats: IGoalStats) { - this.totalTarget = stats.totalTarget || ZERO; - this.totalSaved = stats.totalSaved || ZERO; - } -} diff --git a/src/saving-goals/dtos/response/index.ts b/src/saving-goals/dtos/response/index.ts deleted file mode 100644 index 74359dd..0000000 --- a/src/saving-goals/dtos/response/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './categories-list.response.dto'; -export * from './category-response.dto'; -export * from './goals-stats.response.dto'; -export * from './saving-goal-details.response.dto'; diff --git a/src/saving-goals/dtos/response/saving-goal-details.response.dto.ts b/src/saving-goals/dtos/response/saving-goal-details.response.dto.ts deleted file mode 100644 index 0311e0a..0000000 --- a/src/saving-goals/dtos/response/saving-goal-details.response.dto.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; -import { DocumentMetaResponseDto } from '~/document/dtos/response'; -import { SavingGoal } from '~/saving-goals/entities'; -import { CategoryResponseDto } from './category-response.dto'; - -export class SavingGoalDetailsResponseDto { - @ApiProperty() - id!: string; - - @ApiProperty() - name!: string; - - @ApiPropertyOptional() - description?: string; - - @ApiProperty() - dueDate!: Date; - - @ApiProperty() - targetAmount!: number; - - @ApiProperty() - currentAmount!: number; - - @ApiPropertyOptional({ type: CategoryResponseDto, isArray: true }) - categories?: CategoryResponseDto[]; - - @ApiPropertyOptional({ type: DocumentMetaResponseDto, isArray: true }) - image: DocumentMetaResponseDto | null; - - @ApiProperty() - createdAt!: Date; - - @ApiProperty() - updatedAt!: Date; - - constructor(data: SavingGoal) { - this.id = data.id; - this.name = data.name; - this.description = data.description; - this.dueDate = data.dueDate; - this.targetAmount = data.targetAmount; - this.currentAmount = data.currentAmount; - this.categories = data.categories ? data.categories.map((category) => new CategoryResponseDto(category)) : []; - this.image = data.image ? new DocumentMetaResponseDto(data.image) : null; - this.createdAt = data.createdAt; - this.updatedAt = data.updatedAt; - } -} diff --git a/src/saving-goals/entities/category.entity.ts b/src/saving-goals/entities/category.entity.ts deleted file mode 100644 index 42129f3..0000000 --- a/src/saving-goals/entities/category.entity.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { - Column, - CreateDateColumn, - Entity, - JoinColumn, - ManyToMany, - ManyToOne, - PrimaryGeneratedColumn, - UpdateDateColumn, -} from 'typeorm'; -import { Junior } from '~/junior/entities'; -import { CategoryType } from '../enums'; -import { SavingGoal } from './saving-goal.entity'; - -@Entity('categories') -export class Category { - @PrimaryGeneratedColumn('uuid') - id!: string; - - @Column({ type: 'varchar', length: 255, name: 'name' }) - name!: string; - - @Column({ type: 'varchar', length: 255, name: 'type' }) - type!: CategoryType; - - @Column({ type: 'uuid', name: 'junior_id', nullable: true }) - juniorId!: string; - - @ManyToOne(() => Junior, (junior) => junior.categories, { onDelete: 'CASCADE', nullable: true }) - @JoinColumn({ name: 'junior_id' }) - junior!: Junior; - - @ManyToMany(() => SavingGoal, (savingGoal) => savingGoal.categories) - goals!: SavingGoal[]; - - @CreateDateColumn({ type: 'timestamp', name: 'created_at', default: () => 'CURRENT_TIMESTAMP' }) - createdAt!: Date; - - @UpdateDateColumn({ type: 'timestamp', name: 'updated_at', default: () => 'CURRENT_TIMESTAMP' }) - updatedAt!: Date; -} diff --git a/src/saving-goals/entities/index.ts b/src/saving-goals/entities/index.ts deleted file mode 100644 index 754584e..0000000 --- a/src/saving-goals/entities/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './category.entity'; -export * from './saving-goal.entity'; diff --git a/src/saving-goals/entities/saving-goal.entity.ts b/src/saving-goals/entities/saving-goal.entity.ts deleted file mode 100644 index 57abcc5..0000000 --- a/src/saving-goals/entities/saving-goal.entity.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { - BaseEntity, - Column, - CreateDateColumn, - Entity, - JoinColumn, - JoinTable, - ManyToMany, - ManyToOne, - PrimaryGeneratedColumn, -} from 'typeorm'; -import { Document } from '~/document/entities'; -import { Junior } from '~/junior/entities'; -import { Category } from './category.entity'; -const ZERO = 0; -@Entity('saving_goals') -export class SavingGoal extends BaseEntity { - @PrimaryGeneratedColumn('uuid') - id!: string; - - @Column({ type: 'varchar', length: 255, name: 'name' }) - name!: string; - - @Column({ type: 'varchar', length: 255, name: 'description', nullable: true }) - description!: string; - - @Column({ type: 'timestamp with time zone', name: 'due_date' }) - dueDate!: Date; - - @Column({ - type: 'decimal', - name: 'target_amount', - precision: 12, - scale: 3, - transformer: { to: (value: number) => value, from: (value: string) => parseFloat(value) }, - }) - targetAmount!: number; - - @Column({ - type: 'decimal', - name: 'current_amount', - precision: 12, - scale: 3, - default: ZERO, - transformer: { to: (value: number) => value, from: (value: string) => parseFloat(value) }, - }) - currentAmount!: number; - - @Column({ type: 'uuid', name: 'image_id', nullable: true }) - imageId!: string; - - @Column({ type: 'uuid', name: 'junior_id' }) - juniorId!: string; - - @ManyToOne(() => Document, (document) => document.goals, { onDelete: 'CASCADE', nullable: true }) - @JoinColumn({ name: 'image_id' }) - image!: Document; - - @ManyToOne(() => Junior, (junior) => junior.goals, { onDelete: 'CASCADE' }) - @JoinColumn({ name: 'junior_id' }) - junior!: Junior; - - @ManyToMany(() => Category, (category) => category.goals) - @JoinTable({ - name: 'saving_goals_categories', - joinColumn: { name: 'saving_goal_id', referencedColumnName: 'id' }, - inverseJoinColumn: { name: 'category_id', referencedColumnName: 'id' }, - }) - categories!: Category[]; - - @CreateDateColumn({ type: 'timestamp', name: 'created_at', default: () => 'CURRENT_TIMESTAMP' }) - createdAt!: Date; - - @CreateDateColumn({ type: 'timestamp', name: 'updated_at', default: () => 'CURRENT_TIMESTAMP' }) - updatedAt!: Date; -} diff --git a/src/saving-goals/enums/category-type.enum.ts b/src/saving-goals/enums/category-type.enum.ts deleted file mode 100644 index 8fdba80..0000000 --- a/src/saving-goals/enums/category-type.enum.ts +++ /dev/null @@ -1,4 +0,0 @@ -export class CategoryType { - static readonly GLOBAL = 'GLOBAL'; - static readonly CUSTOM = 'CUSTOM'; -} diff --git a/src/saving-goals/enums/index.ts b/src/saving-goals/enums/index.ts deleted file mode 100644 index 1ecf223..0000000 --- a/src/saving-goals/enums/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './category-type.enum'; diff --git a/src/saving-goals/interfaces/goal-stats.interface.ts b/src/saving-goals/interfaces/goal-stats.interface.ts deleted file mode 100644 index 3523915..0000000 --- a/src/saving-goals/interfaces/goal-stats.interface.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface IGoalStats { - totalTarget: number; - totalSaved: number; -} diff --git a/src/saving-goals/interfaces/index.ts b/src/saving-goals/interfaces/index.ts deleted file mode 100644 index 1ba52ba..0000000 --- a/src/saving-goals/interfaces/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './goal-stats.interface'; diff --git a/src/saving-goals/repositories/category.repository.ts b/src/saving-goals/repositories/category.repository.ts deleted file mode 100644 index 20a03df..0000000 --- a/src/saving-goals/repositories/category.repository.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { Injectable } from '@nestjs/common'; -import { InjectRepository } from '@nestjs/typeorm'; -import { In, Repository } from 'typeorm'; -import { createCategoryRequestDto } from '../dtos/request'; -import { Category } from '../entities'; -import { CategoryType } from '../enums'; - -@Injectable() -export class CategoryRepository { - constructor(@InjectRepository(Category) private categoryRepository: Repository) {} - - createCustomCategory(juniorId: string, body: createCategoryRequestDto): Promise { - return this.categoryRepository.save( - this.categoryRepository.create({ - juniorId, - name: body.name, - type: CategoryType.CUSTOM, - }), - ); - } - - findCategoryById(ids: string[], juniorId: string): Promise { - return this.categoryRepository.find({ - where: [ - { id: In(ids), type: CategoryType.GLOBAL }, - { id: In(ids), juniorId, type: CategoryType.CUSTOM }, - ], - }); - } - - findCategories(juniorId: string): Promise { - return this.categoryRepository.find({ - where: [{ type: 'GLOBAL' }, { juniorId, type: CategoryType.CUSTOM }], - }); - } -} diff --git a/src/saving-goals/repositories/index.ts b/src/saving-goals/repositories/index.ts deleted file mode 100644 index 46ef0e0..0000000 --- a/src/saving-goals/repositories/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './category.repository'; -export * from './saving-goals.repository'; diff --git a/src/saving-goals/repositories/saving-goals.repository.ts b/src/saving-goals/repositories/saving-goals.repository.ts deleted file mode 100644 index 5a0c9c6..0000000 --- a/src/saving-goals/repositories/saving-goals.repository.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { Injectable } from '@nestjs/common'; -import { InjectRepository } from '@nestjs/typeorm'; -import { Repository } from 'typeorm'; -import { PageOptionsRequestDto } from '~/core/dtos'; -import { CreateGoalRequestDto } from '../dtos/request'; -import { Category, SavingGoal } from '../entities'; -const ONE = 1; -@Injectable() -export class SavingGoalsRepository { - constructor(@InjectRepository(SavingGoal) private readonly savingGoalRepository: Repository) {} - - createGoal(juniorId: string, body: CreateGoalRequestDto, categories: Category[]) { - return this.savingGoalRepository.save( - this.savingGoalRepository.create({ - name: body.name, - description: body.description, - dueDate: body.dueDate, - targetAmount: body.targetAmount, - juniorId, - imageId: body.imageId, - categories, - }), - ); - } - - findGoals(juniorId: string, pageOptions: PageOptionsRequestDto) { - return this.savingGoalRepository.findAndCount({ - where: { juniorId }, - take: pageOptions.size, - skip: pageOptions.size * (pageOptions.page - ONE), - relations: ['categories', 'image'], - }); - } - - findGoalById(juniorId: string, goalId: string) { - return this.savingGoalRepository.findOneOrFail({ - where: { juniorId, id: goalId }, - relations: ['categories', 'image'], - }); - } - - fundGoal(juniorId: string, goalId: string, amount: number) { - return this.savingGoalRepository.increment({ juniorId, id: goalId }, 'currentAmount', amount); - } - - getStats(juniorId: string) { - return this.savingGoalRepository - .createQueryBuilder('savingGoal') - .select('SUM(savingGoal.currentAmount)', 'totalSaved') - .addSelect('SUM(savingGoal.targetAmount)', 'totalTarget') - .where('savingGoal.juniorId = :juniorId', { juniorId }) - .getRawOne(); - } -} diff --git a/src/saving-goals/saving-goals.module.ts b/src/saving-goals/saving-goals.module.ts deleted file mode 100644 index 3677901..0000000 --- a/src/saving-goals/saving-goals.module.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Module } from '@nestjs/common'; -import { TypeOrmModule } from '@nestjs/typeorm'; -import { SavingGoalsController } from './controllers'; -import { Category, SavingGoal } from './entities'; -import { CategoryRepository, SavingGoalsRepository } from './repositories'; -import { SavingGoalsService } from './services'; -import { CategoryService } from './services/category.service'; - -@Module({ - imports: [TypeOrmModule.forFeature([SavingGoal, Category])], - providers: [SavingGoalsService, SavingGoalsRepository, CategoryService, CategoryRepository], - controllers: [SavingGoalsController], -}) -export class SavingGoalsModule {} diff --git a/src/saving-goals/services/category.service.ts b/src/saving-goals/services/category.service.ts deleted file mode 100644 index cc88943..0000000 --- a/src/saving-goals/services/category.service.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { BadRequestException, Injectable, Logger } from '@nestjs/common'; -import { createCategoryRequestDto } from '../dtos/request'; -import { Category } from '../entities'; -import { CategoryType } from '../enums'; -import { CategoryRepository } from '../repositories'; - -@Injectable() -export class CategoryService { - private readonly logger = new Logger(CategoryService.name); - constructor(private readonly categoryRepository: CategoryRepository) {} - - createCustomCategory(juniorId: string, body: createCategoryRequestDto) { - this.logger.log(`Creating custom category for junior ${juniorId}`); - return this.categoryRepository.createCustomCategory(juniorId, body); - } - - async findCategoryByIds(categoryIds: string[], juniorId: string) { - this.logger.log(`Finding categories by ids for junior ${juniorId} with ids ${categoryIds}`); - const categories = await this.categoryRepository.findCategoryById(categoryIds, juniorId); - - if (categories.length !== categoryIds.length) { - this.logger.error(`Invalid category ids ${categoryIds}`); - throw new BadRequestException('CATEGORY.INVALID_CATEGORY_ID'); - } - - this.logger.log(`Categories found successfully for junior ${juniorId}`); - return categories; - } - - async findCategories(juniorId: string): Promise<{ globalCategories: Category[]; customCategories: Category[] }> { - this.logger.log(`Finding categories for junior ${juniorId}`); - const categories = await this.categoryRepository.findCategories(juniorId); - - const globalCategories = categories.filter((category) => category.type === CategoryType.GLOBAL); - const customCategories = categories.filter((category) => category.type === CategoryType.CUSTOM); - - this.logger.log(`Returning categories for junior ${juniorId}`); - return { - globalCategories, - customCategories, - }; - } -} diff --git a/src/saving-goals/services/index.ts b/src/saving-goals/services/index.ts deleted file mode 100644 index 3c7af7b..0000000 --- a/src/saving-goals/services/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './saving-goals.service'; diff --git a/src/saving-goals/services/saving-goals.service.ts b/src/saving-goals/services/saving-goals.service.ts deleted file mode 100644 index 1d6535e..0000000 --- a/src/saving-goals/services/saving-goals.service.ts +++ /dev/null @@ -1,98 +0,0 @@ -import { BadRequestException, Injectable, Logger } from '@nestjs/common'; -import moment from 'moment'; -import { PageOptionsRequestDto } from '~/core/dtos'; -import { OciService } from '~/document/services'; -import { CreateGoalRequestDto, FundGoalRequestDto } from '../dtos/request'; -import { SavingGoal } from '../entities'; -import { IGoalStats } from '../interfaces'; -import { SavingGoalsRepository } from '../repositories'; -import { CategoryService } from './category.service'; -@Injectable() -export class SavingGoalsService { - private readonly logger = new Logger(SavingGoalsService.name); - constructor( - private readonly savingGoalsRepository: SavingGoalsRepository, - private readonly categoryService: CategoryService, - private readonly ociService: OciService, - ) {} - - async createGoal(juniorId: string, body: CreateGoalRequestDto) { - this.logger.log(`Creating goal for junior ${juniorId}`); - if (moment(body.dueDate).isBefore(moment())) { - this.logger.error(`Due date must be in the future`); - throw new BadRequestException('GOAL.DUE_DATE_MUST_BE_IN_THE_FUTURE'); - } - - const categories = await this.categoryService.findCategoryByIds(body.categoryIds, juniorId); - - const createdGoal = await this.savingGoalsRepository.createGoal(juniorId, body, categories); - - this.logger.log(`Goal ${createdGoal.id} created successfully`); - - return this.findGoalById(juniorId, createdGoal.id); - } - - async findGoals(juniorId: string, pageOptions: PageOptionsRequestDto): Promise<[SavingGoal[], number]> { - this.logger.log(`Finding goals for junior ${juniorId}`); - const [goals, itemCount] = await this.savingGoalsRepository.findGoals(juniorId, pageOptions); - await this.prepareGoalsImages(goals); - - this.logger.log(`Returning goals for junior ${juniorId}`); - return [goals, itemCount]; - } - - async findGoalById(juniorId: string, goalId: string) { - this.logger.log(`Finding goal ${goalId} for junior ${juniorId}`); - const goal = await this.savingGoalsRepository.findGoalById(juniorId, goalId); - - if (!goal) { - this.logger.error(`Goal ${goalId} not found`); - throw new BadRequestException('GOAL.NOT_FOUND'); - } - - await this.prepareGoalsImages([goal]); - - this.logger.log(`Goal ${goalId} found successfully`); - return goal; - } - - async fundGoal(juniorId: string, goalId: string, body: FundGoalRequestDto) { - this.logger.log(`Funding goal ${goalId} for junior ${juniorId}`); - const goal = await this.savingGoalsRepository.findGoalById(juniorId, goalId); - - if (!goal) { - this.logger.error(`Goal ${goalId} not found`); - throw new BadRequestException('GOAL.NOT_FOUND'); - } - - if (goal.currentAmount + body.fundAmount > goal.targetAmount) { - this.logger.error( - `Funding amount exceeds total amount , currentAmount: ${goal.currentAmount}, fundAmount: ${body.fundAmount}, targetAmount: ${goal.targetAmount}`, - ); - throw new BadRequestException('GOAL.FUND_EXCEEDS_TOTAL_AMOUNT'); - } - - await this.savingGoalsRepository.fundGoal(juniorId, goalId, body.fundAmount); - this.logger.log(`Goal ${goalId} funded successfully with amount ${body.fundAmount}`); - } - - async getStats(juniorId: string): Promise { - this.logger.log(`Getting stats for junior ${juniorId}`); - const result = await this.savingGoalsRepository.getStats(juniorId); - return { - totalTarget: result?.totalTarget, - totalSaved: result?.totalSaved, - }; - } - - private async prepareGoalsImages(goals: SavingGoal[]) { - this.logger.log(`Preparing images for goals`); - await Promise.all( - goals.map(async (goal) => { - if (goal.imageId) { - goal.image.url = await this.ociService.generatePreSignedUrl(goal.image); - } - }), - ); - } -} diff --git a/src/task/controllers/index.ts b/src/task/controllers/index.ts deleted file mode 100644 index f1546d0..0000000 --- a/src/task/controllers/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './task.controller'; diff --git a/src/task/controllers/task.controller.ts b/src/task/controllers/task.controller.ts deleted file mode 100644 index 773b868..0000000 --- a/src/task/controllers/task.controller.ts +++ /dev/null @@ -1,85 +0,0 @@ -import { Body, Controller, Get, HttpCode, HttpStatus, Param, Patch, Post, Query, UseGuards } from '@nestjs/common'; -import { ApiBearerAuth, ApiTags } from '@nestjs/swagger'; -import { Roles } from '~/auth/enums'; -import { IJwtPayload } from '~/auth/interfaces'; -import { AllowedRoles, AuthenticatedUser } from '~/common/decorators'; -import { AccessTokenGuard, RolesGuard } from '~/common/guards'; -import { ApiDataPageResponse, ApiLangRequestHeader } from '~/core/decorators'; -import { CustomParseUUIDPipe } from '~/core/pipes'; -import { ResponseFactory } from '~/core/utils'; -import { CreateTaskRequestDto, TaskSubmissionRequestDto } from '../dtos/request'; -import { TasksFilterOptions } from '../dtos/request/tasks-filter-options.request.dto'; -import { TaskResponseDto } from '../dtos/response'; -import { TaskService } from '../services'; - -@Controller('tasks') -@ApiTags('Tasks') -@ApiBearerAuth() -@ApiLangRequestHeader() -export class TaskController { - constructor(private readonly taskService: TaskService) {} - - @Post() - @UseGuards(RolesGuard) - @AllowedRoles(Roles.GUARDIAN) - async createTask(@AuthenticatedUser() { sub }: IJwtPayload, @Body() body: CreateTaskRequestDto) { - const task = await this.taskService.createTask(sub, body); - return ResponseFactory.data(new TaskResponseDto(task)); - } - - @Get() - @UseGuards(AccessTokenGuard) - @ApiDataPageResponse(TaskResponseDto) - async findTasks(@Query() query: TasksFilterOptions, @AuthenticatedUser() user: IJwtPayload) { - const [tasks, itemCount] = await this.taskService.findTasks(user, query); - return ResponseFactory.dataPage( - tasks.map((task) => new TaskResponseDto(task)), - { - page: query.page, - size: query.size, - itemCount, - }, - ); - } - - @Get(':taskId') - @UseGuards(AccessTokenGuard) - async findTask(@Param('taskId', CustomParseUUIDPipe) taskId: string, @AuthenticatedUser() user: IJwtPayload) { - const task = await this.taskService.findTaskForUser(taskId, user); - return ResponseFactory.data(new TaskResponseDto(task)); - } - - @Patch(':taskId/submit') - @UseGuards(RolesGuard) - @AllowedRoles(Roles.JUNIOR) - @HttpCode(HttpStatus.NO_CONTENT) - async submitTask( - @AuthenticatedUser() { sub }: IJwtPayload, - @Param('taskId', CustomParseUUIDPipe) taskId: string, - @Body() body: TaskSubmissionRequestDto, - ) { - await this.taskService.submitTask(sub, taskId, body); - } - - @Patch(':taskId/approve') - @UseGuards(RolesGuard) - @AllowedRoles(Roles.GUARDIAN) - @HttpCode(HttpStatus.NO_CONTENT) - async approveTaskSubmission( - @AuthenticatedUser() { sub }: IJwtPayload, - @Param('taskId', CustomParseUUIDPipe) taskId: string, - ) { - await this.taskService.approveTaskSubmission(sub, taskId); - } - - @Patch(':taskId/reject') - @UseGuards(RolesGuard) - @AllowedRoles(Roles.GUARDIAN) - @HttpCode(HttpStatus.NO_CONTENT) - async rejectTaskSubmission( - @AuthenticatedUser() { sub }: IJwtPayload, - @Param('taskId', CustomParseUUIDPipe) taskId: string, - ) { - await this.taskService.rejectTaskSubmission(sub, taskId); - } -} diff --git a/src/task/dtos/request/create-task.request.dto.ts b/src/task/dtos/request/create-task.request.dto.ts deleted file mode 100644 index da9db47..0000000 --- a/src/task/dtos/request/create-task.request.dto.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { - IsBoolean, - IsDateString, - IsEnum, - IsNotEmpty, - IsNumber, - IsOptional, - IsPositive, - IsString, - IsUUID, - MaxLength, -} from 'class-validator'; -import { i18nValidationMessage as i18n } from 'nestjs-i18n'; -import { TaskFrequency } from '~/task/enums/task.frequency.enum'; -const TEXT_LENGTH = 255; -const MAX_DECIMAL_PLACES = 3; -export class CreateTaskRequestDto { - @ApiProperty() - @IsString({ message: i18n('validation.IsString', { path: 'general', property: 'task.title' }) }) - @IsNotEmpty({ message: i18n('validation.IsNotEmpty', { path: 'general', property: 'task.title' }) }) - @MaxLength(TEXT_LENGTH, { - message: i18n('validation.MaxLength', { path: 'general', property: 'task.title', length: TEXT_LENGTH }), - }) - title!: string; - - @ApiProperty({ required: false }) - @IsString({ message: i18n('validation.IsString', { path: 'general', property: 'task.description' }) }) - @IsNotEmpty({ message: i18n('validation.IsNotEmpty', { path: 'general', property: 'task.description' }) }) - @MaxLength(TEXT_LENGTH, { - message: i18n('validation.MaxLength', { path: 'general', property: 'task.description', length: TEXT_LENGTH }), - }) - @IsOptional() - description!: string; - - @IsDateString({}, { message: i18n('validation.IsDateString', { path: 'general', property: 'task.startDate' }) }) - @IsOptional() - startDate: string = new Date().toISOString(); - - @ApiProperty({ example: '2024-01-15' }) - @IsDateString({}, { message: i18n('validation.IsDateString', { path: 'general', property: 'task.dueDate' }) }) - dueDate!: string; - - @ApiProperty({ example: 100 }) - @IsNumber( - { maxDecimalPlaces: MAX_DECIMAL_PLACES }, - { message: i18n('validation.IsNumber', { path: 'general', property: 'task.rewardAmount' }) }, - ) - @IsPositive({ message: i18n('validation.IsPositive', { path: 'general', property: 'task.rewardAmount' }) }) - rewardAmount!: number; - - @IsEnum(TaskFrequency, { message: i18n('validation.IsEnum', { path: 'general', property: 'task.frequency' }) }) - @IsOptional() - frequency: TaskFrequency = TaskFrequency.ONE_TIME; - - @ApiProperty({ example: false }) - @IsBoolean({ message: i18n('validation.IsBoolean', { path: 'general', property: 'task.isProofRequired' }) }) - isProofRequired!: boolean; - - @ApiProperty({ example: 'e7b1b3b1-4b3b-4b3b-4b3b-4b3b4b3b4b3b' }) - @IsUUID('4', { message: i18n('validation.IsUUID', { path: 'general', property: 'task.imageId' }) }) - imageId!: string; - - @ApiProperty({ example: 'e7b1b3b1-4b3b-4b3b-4b3b-4b3b4b3b4b3b' }) - @IsUUID('4', { message: i18n('validation.IsUUID', { path: 'general', property: 'task.juniorId' }) }) - juniorId!: string; -} diff --git a/src/task/dtos/request/index.ts b/src/task/dtos/request/index.ts deleted file mode 100644 index 790564d..0000000 --- a/src/task/dtos/request/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './create-task.request.dto'; -export * from './task-submission.request.dto'; -export * from './tasks-filter-options.request.dto'; diff --git a/src/task/dtos/request/task-submission.request.dto.ts b/src/task/dtos/request/task-submission.request.dto.ts deleted file mode 100644 index 83f392c..0000000 --- a/src/task/dtos/request/task-submission.request.dto.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { ApiPropertyOptional } from '@nestjs/swagger'; -import { IsOptional, IsUUID } from 'class-validator'; -import { i18nValidationMessage as i18n } from 'nestjs-i18n'; -export class TaskSubmissionRequestDto { - @ApiPropertyOptional({ example: '4dsf3-4dsf3-4dsf3-4dsf3', description: 'The Proof id of the task submission' }) - @IsUUID('4', { message: i18n('validation.isUUID', { path: 'general', property: 'task.imageId' }) }) - @IsOptional() - imageId!: string; -} diff --git a/src/task/dtos/request/tasks-filter-options.request.dto.ts b/src/task/dtos/request/tasks-filter-options.request.dto.ts deleted file mode 100644 index 36c664d..0000000 --- a/src/task/dtos/request/tasks-filter-options.request.dto.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; -import { IsEnum, IsOptional, IsUUID } from 'class-validator'; -import { i18nValidationMessage as i18n } from 'nestjs-i18n'; -import { PageOptionsRequestDto } from '~/core/dtos'; -import { TaskStatus } from '~/task/enums'; -export class TasksFilterOptions extends PageOptionsRequestDto { - @ApiProperty({ enum: TaskStatus, required: true }) - @IsEnum(TaskStatus, { - message: i18n('validation.IsEnum', { path: 'general', property: 'task.status' }), - }) - status?: TaskStatus; - - @ApiPropertyOptional() - @IsUUID('4', { message: i18n('validation.IsUUID', { path: 'general', property: 'task.juniorId' }) }) - @IsOptional() - juniorId?: string; -} diff --git a/src/task/dtos/response/index.ts b/src/task/dtos/response/index.ts deleted file mode 100644 index 891389e..0000000 --- a/src/task/dtos/response/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './task-submission-details.response.dto'; -export * from './task.response.dto'; diff --git a/src/task/dtos/response/task-submission-details.response.dto.ts b/src/task/dtos/response/task-submission-details.response.dto.ts deleted file mode 100644 index 6ec3e93..0000000 --- a/src/task/dtos/response/task-submission-details.response.dto.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { DocumentMetaResponseDto } from '~/document/dtos/response'; -import { TaskSubmission } from '~/task/entities/task-submissions.entity'; - -export class TaskSubmissionDetailsResponsetDto { - @ApiProperty() - submittedAt!: Date; - - @ApiProperty({ type: DocumentMetaResponseDto }) - proofOfCompletion!: DocumentMetaResponseDto | null; - - constructor(taskSubmission: TaskSubmission) { - this.submittedAt = taskSubmission.submittedAt; - this.proofOfCompletion = taskSubmission.proofOfCompletion - ? new DocumentMetaResponseDto(taskSubmission.proofOfCompletion) - : null; - } -} diff --git a/src/task/dtos/response/task.response.dto.ts b/src/task/dtos/response/task.response.dto.ts deleted file mode 100644 index 0fcb104..0000000 --- a/src/task/dtos/response/task.response.dto.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { DocumentMetaResponseDto } from '~/document/dtos/response'; -import { JuniorResponseDto } from '~/junior/dtos/response'; -import { Task } from '~/task/entities'; -import { TaskSubmissionDetailsResponsetDto } from './task-submission-details.response.dto'; - -export class TaskResponseDto { - @ApiProperty() - id!: string; - - @ApiProperty() - title!: string; - - @ApiProperty() - description!: string; - - @ApiProperty() - status!: string; - - @ApiProperty() - dueDate!: Date; - - @ApiProperty() - rewardAmount!: number; - - @ApiProperty() - isProofRequired!: boolean; - - @ApiProperty() - submission?: TaskSubmissionDetailsResponsetDto | null; - - @ApiProperty() - junior!: JuniorResponseDto; - - @ApiProperty() - image!: DocumentMetaResponseDto; - - @ApiProperty() - createdAt!: Date; - - @ApiProperty() - updatedAt!: Date; - - constructor(task: Task) { - this.id = task.id; - this.title = task.title; - this.description = task.description; - this.status = task.status; - this.dueDate = task.dueDate; - this.rewardAmount = task.rewardAmount; - this.isProofRequired = task.isProofRequired; - this.submission = task.submission ? new TaskSubmissionDetailsResponsetDto(task.submission) : null; - this.image = new DocumentMetaResponseDto(task.image); - this.junior = new JuniorResponseDto(task.assignedTo); - this.createdAt = task.createdAt; - this.updatedAt = task.updatedAt; - } -} diff --git a/src/task/entities/index.ts b/src/task/entities/index.ts deleted file mode 100644 index 1ab88d2..0000000 --- a/src/task/entities/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './task.entity'; diff --git a/src/task/entities/task-submissions.entity.ts b/src/task/entities/task-submissions.entity.ts deleted file mode 100644 index 84a01df..0000000 --- a/src/task/entities/task-submissions.entity.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { - BaseEntity, - Column, - CreateDateColumn, - Entity, - JoinColumn, - ManyToOne, - OneToOne, - PrimaryGeneratedColumn, - UpdateDateColumn, -} from 'typeorm'; -import { Document } from '~/document/entities'; -import { SubmissionStatus } from '../enums'; -import { Task } from './task.entity'; - -@Entity('task_submissions') -export class TaskSubmission extends BaseEntity { - @PrimaryGeneratedColumn('uuid') - id!: string; - - @Column({ type: 'varchar', name: 'status' }) - status!: SubmissionStatus; - - @Column({ type: 'timestamp with time zone', name: 'submitted_at' }) - submittedAt!: Date; - - @Column({ type: 'uuid', name: 'task_id' }) - taskId!: string; - - @Column({ type: 'uuid', name: 'proof_of_completion_id', nullable: true }) - proofOfCompletionId!: string; - - @OneToOne(() => Task, (task) => task.submission, { onDelete: 'CASCADE' }) - @JoinColumn({ name: 'task_id' }) - task!: Task; - - @ManyToOne(() => Document, (document) => document.submissions, { nullable: true }) - @JoinColumn({ name: 'proof_of_completion_id' }) - proofOfCompletion!: Document; - - @CreateDateColumn({ type: 'timestamp', name: 'created_at', default: () => 'CURRENT_TIMESTAMP' }) - createdAt!: Date; - - @UpdateDateColumn({ type: 'timestamp', name: 'updated_at', default: () => 'CURRENT_TIMESTAMP' }) - updatedAt!: Date; -} diff --git a/src/task/entities/task.entity.ts b/src/task/entities/task.entity.ts deleted file mode 100644 index a9a96a1..0000000 --- a/src/task/entities/task.entity.ts +++ /dev/null @@ -1,90 +0,0 @@ -import { - BaseEntity, - Column, - CreateDateColumn, - Entity, - JoinColumn, - ManyToOne, - OneToOne, - PrimaryGeneratedColumn, - UpdateDateColumn, -} from 'typeorm'; -import { Document } from '~/document/entities'; -import { Guardian } from '~/guardian/entities/guradian.entity'; -import { Junior } from '~/junior/entities'; -import { SubmissionStatus, TaskStatus } from '../enums'; -import { TaskFrequency } from '../enums/task.frequency.enum'; -import { TaskSubmission } from './task-submissions.entity'; - -@Entity('tasks') -export class Task extends BaseEntity { - @PrimaryGeneratedColumn('uuid') - id!: string; - - @Column({ type: 'varchar', length: 255, name: 'title' }) - title!: string; - - @Column({ type: 'varchar', length: 255, name: 'description' }) - description!: string; - - @Column({ type: 'decimal', name: 'reward_amount', precision: 12, scale: 3 }) - rewardAmount!: number; - - @Column({ type: 'uuid', name: 'image_id' }) - imageId!: string; - - @Column({ type: 'varchar', name: 'task_frequency' }) - taskFrequency!: TaskFrequency; - - @Column({ type: 'timestamp with time zone', name: 'start_date' }) - startDate!: Date; - - @Column({ type: 'timestamp with time zone', name: 'due_date' }) - dueDate!: Date; - - @Column({ type: 'boolean', name: 'is_proof_required' }) - isProofRequired!: boolean; - - @Column({ type: 'uuid', name: 'assigned_to_id' }) - assignedToId!: string; - - @Column({ type: 'uuid', name: 'assigned_by_id' }) - assignedById!: string; - - @ManyToOne(() => Document, (document) => document.tasks) - @JoinColumn({ name: 'image_id' }) - image!: Document; - - @ManyToOne(() => Junior, (junior) => junior.tasks, { onDelete: 'CASCADE' }) - @JoinColumn({ name: 'assigned_to_id' }) - assignedTo!: Junior; - - @ManyToOne(() => Guardian, (guardian) => guardian.tasks) - @JoinColumn({ name: 'assigned_by_id' }) - assignedBy!: Guardian; - - @OneToOne(() => TaskSubmission, (submission) => submission.task, { cascade: true }) - submission?: TaskSubmission; - - @CreateDateColumn({ type: 'timestamp', name: 'created_at', default: () => 'CURRENT_TIMESTAMP' }) - createdAt!: Date; - - @UpdateDateColumn({ type: 'timestamp', name: 'updated_at', default: () => 'CURRENT_TIMESTAMP' }) - updatedAt!: Date; - - get status(): string { - if (new Date(this.dueDate) < new Date()) { - return TaskStatus.COMPLETED; - } - - if (this.submission && this.submission.status === SubmissionStatus.APPROVED) { - return TaskStatus.COMPLETED; - } - - if (this.submission && this.submission.status !== SubmissionStatus.APPROVED) { - return TaskStatus.IN_PROGRESS; - } - - return TaskStatus.PENDING; - } -} diff --git a/src/task/enums/index.ts b/src/task/enums/index.ts deleted file mode 100644 index 158b5c7..0000000 --- a/src/task/enums/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './submission-status.enum'; -export * from './task-status.enum'; diff --git a/src/task/enums/submission-status.enum.ts b/src/task/enums/submission-status.enum.ts deleted file mode 100644 index f8888df..0000000 --- a/src/task/enums/submission-status.enum.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum SubmissionStatus { - PENDING = 'PENDING', - APPROVED = 'APPROVED', - REJECTED = 'REJECTED', -} diff --git a/src/task/enums/task-status.enum.ts b/src/task/enums/task-status.enum.ts deleted file mode 100644 index c681469..0000000 --- a/src/task/enums/task-status.enum.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum TaskStatus { - PENDING = 'PENDING', - IN_PROGRESS = 'IN_PROGRESS', - COMPLETED = 'COMPLETED', -} diff --git a/src/task/enums/task.frequency.enum.ts b/src/task/enums/task.frequency.enum.ts deleted file mode 100644 index 6fbc68b..0000000 --- a/src/task/enums/task.frequency.enum.ts +++ /dev/null @@ -1,6 +0,0 @@ -export enum TaskFrequency { - ONE_TIME = 'ONE_TIME', - DAILY = 'DAILY', - WEEKLY = 'WEEKLY', - MONTHLY = 'MONTHLY', -} diff --git a/src/task/repositories/index.ts b/src/task/repositories/index.ts deleted file mode 100644 index eb065ae..0000000 --- a/src/task/repositories/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './task.repository'; diff --git a/src/task/repositories/task.repository.ts b/src/task/repositories/task.repository.ts deleted file mode 100644 index e53dc2b..0000000 --- a/src/task/repositories/task.repository.ts +++ /dev/null @@ -1,116 +0,0 @@ -import { Injectable } from '@nestjs/common'; -import { InjectRepository } from '@nestjs/typeorm'; -import { Brackets, FindOptionsWhere, Repository } from 'typeorm'; -import { Roles } from '~/auth/enums'; -import { IJwtPayload } from '~/auth/interfaces'; -import { CreateTaskRequestDto, TasksFilterOptions, TaskSubmissionRequestDto } from '../dtos/request'; -import { Task } from '../entities'; -import { TaskSubmission } from '../entities/task-submissions.entity'; -import { SubmissionStatus, TaskStatus } from '../enums'; -const ONE = 1; -@Injectable() -export class TaskRepository { - constructor(@InjectRepository(Task) private readonly taskRepository: Repository) {} - - createTask(userId: string, body: CreateTaskRequestDto) { - return this.taskRepository.save( - this.taskRepository.create({ - title: body.title, - description: body.description, - rewardAmount: body.rewardAmount, - taskFrequency: body.frequency, - startDate: body.startDate, - dueDate: body.dueDate, - assignedById: userId, - assignedToId: body.juniorId, - imageId: body.imageId, - isProofRequired: body.isProofRequired, - }), - ); - } - - findTask(where: FindOptionsWhere) { - return this.taskRepository.findOne({ - where, - relations: [ - 'image', - 'assignedTo', - 'assignedTo.customer', - 'assignedTo.customer.profilePicture', - 'submission', - 'submission.proofOfCompletion', - ], - }); - } - - findTasks({ roles, sub: userId }: IJwtPayload, query: TasksFilterOptions) { - const queryBuilder = this.taskRepository.createQueryBuilder('task'); - - queryBuilder - .leftJoinAndSelect('task.image', 'image') - .leftJoinAndSelect('task.assignedTo', 'assignedTo') - .leftJoinAndSelect('assignedTo.customer', 'customer') - .leftJoinAndSelect('customer.profilePicture', 'profilePicture') - .leftJoinAndSelect('task.submission', 'submission') - .leftJoinAndSelect('submission.proofOfCompletion', 'proofOfCompletion'); - - if (roles.includes(Roles.GUARDIAN)) { - queryBuilder.where('task.assignedById = :userId', { userId }); - - // Add a condition for juniorId if it exists - if (query.juniorId) { - queryBuilder.andWhere('task.assignedToId = :juniorId', { juniorId: query.juniorId }); - } - } else { - queryBuilder.where('task.assignedToId = :userId', { userId }); - } - - if (query.status === TaskStatus.PENDING) { - queryBuilder.andWhere('task.dueDate >= :today', { today: new Date() }); - queryBuilder.andWhere('submission IS NULL'); - } - - if (query.status === TaskStatus.IN_PROGRESS) { - queryBuilder.andWhere('submission IS NOT NULL'); - queryBuilder.andWhere('submission.status != :status', { status: SubmissionStatus.APPROVED }); - queryBuilder.andWhere('task.dueDate >= :today', { today: new Date() }); - } - - if (query.status === TaskStatus.COMPLETED) { - queryBuilder.andWhere( - new Brackets((qb) => { - qb.where('task.dueDate < :today', { today: new Date() }).orWhere('submission.status = :status', { - status: SubmissionStatus.APPROVED, - }); - }), - ); - } - - queryBuilder.orderBy('task.createdAt', 'DESC'); - queryBuilder.skip((query.page - ONE) * query.size); - queryBuilder.take(query.size); - - return queryBuilder.getManyAndCount(); - } - - createSubmission(task: Task, body: TaskSubmissionRequestDto) { - const submission = task.submission || new TaskSubmission(); - submission.status = task.isProofRequired ? SubmissionStatus.PENDING : SubmissionStatus.APPROVED; - submission.submittedAt = new Date(); - submission.taskId = task.id; - submission.proofOfCompletionId = body.imageId; - - task.submission = submission; - return task.save(); - } - - approveSubmission(submission: TaskSubmission) { - submission.status = SubmissionStatus.APPROVED; - return submission.save(); - } - - rejectSubmission(submission: TaskSubmission) { - submission.status = SubmissionStatus.REJECTED; - return submission.save(); - } -} diff --git a/src/task/services/index.ts b/src/task/services/index.ts deleted file mode 100644 index a9c6287..0000000 --- a/src/task/services/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './task.service'; diff --git a/src/task/services/task.service.ts b/src/task/services/task.service.ts deleted file mode 100644 index 264c47d..0000000 --- a/src/task/services/task.service.ts +++ /dev/null @@ -1,167 +0,0 @@ -import { BadRequestException, Injectable, Logger } from '@nestjs/common'; -import moment from 'moment'; -import { FindOptionsWhere } from 'typeorm'; -import { Roles } from '~/auth/enums'; -import { IJwtPayload } from '~/auth/interfaces'; -import { DocumentService, OciService } from '~/document/services'; -import { CreateTaskRequestDto, TasksFilterOptions, TaskSubmissionRequestDto } from '../dtos/request'; -import { Task } from '../entities'; -import { SubmissionStatus, TaskStatus } from '../enums'; -import { TaskRepository } from '../repositories'; - -@Injectable() -export class TaskService { - private readonly logger = new Logger(TaskService.name); - constructor( - private readonly taskRepository: TaskRepository, - private readonly ociService: OciService, - private readonly documentService: DocumentService, - ) {} - async createTask(userId: string, body: CreateTaskRequestDto) { - this.logger.log(`Creating task for user ${userId}`); - if (moment(body.dueDate).isBefore(moment(body.startDate))) { - this.logger.error(`Due date must be after start date`); - throw new BadRequestException('TASK.DUE_DATE_BEFORE_START_DATE'); - } - - if (moment(body.dueDate).isBefore(moment())) { - this.logger.error(`Due date must be in the future`); - throw new BadRequestException('TASK.DUE_DATE_IN_PAST'); - } - - await this.validateTaskImage(userId, body.imageId); - const task = await this.taskRepository.createTask(userId, body); - - this.logger.log(`Task ${task.id} created successfully`); - return this.findTask({ id: task.id }); - } - - findTaskForUser(taskId: string, user: IJwtPayload) { - this.logger.log(`Finding task ${taskId} for user ${user.sub}`); - - return this.findTask({ - id: taskId, - assignedById: user.roles.includes(Roles.GUARDIAN) ? user.sub : undefined, - assignedToId: user.roles.includes(Roles.JUNIOR) ? user.sub : undefined, - }); - } - - async findTask(where: FindOptionsWhere) { - this.logger.log(`Finding task with where ${JSON.stringify(where)}`); - const task = await this.taskRepository.findTask(where); - - if (!task) { - this.logger.error(`Task not found`); - throw new BadRequestException('TASK.NOT_FOUND'); - } - - await this.prepareTasksPictures([task]); - - this.logger.log(`Task found successfully`); - return task; - } - - async findTasks(user: IJwtPayload, query: TasksFilterOptions): Promise<[Task[], number]> { - this.logger.log(`Finding tasks for user ${user.sub} and roles ${user.roles} and filters ${JSON.stringify(query)}`); - const [tasks, count] = await this.taskRepository.findTasks(user, query); - await this.prepareTasksPictures(tasks); - - this.logger.log(`Returning tasks for user ${user.sub}`); - return [tasks, count]; - } - async submitTask(userId: string, taskId: string, body: TaskSubmissionRequestDto) { - this.logger.log(`Submitting task ${taskId} for user ${userId}`); - const task = await this.findTask({ id: taskId, assignedToId: userId }); - - if (task.status == TaskStatus.COMPLETED) { - this.logger.error(`Task ${taskId} already completed`); - throw new BadRequestException('TASK.ALREADY_COMPLETED'); - } - - if (task.isProofRequired && !body.imageId) { - this.logger.error(`Proof of completion is required for task ${taskId}`); - throw new BadRequestException('TASK.PROOF_REQUIRED'); - } - - await this.validateTaskImage(userId, body.imageId); - - await this.taskRepository.createSubmission(task, body); - this.logger.log(`Task ${taskId} submitted successfully`); - } - - async approveTaskSubmission(userId: string, taskId: string) { - this.logger.log(`Approving task submission ${taskId} by user ${userId}`); - const task = await this.findTask({ id: taskId, assignedById: userId }); - - if (!task.submission) { - this.logger.error(`No submission found for task ${taskId}`); - throw new BadRequestException('TASK.NO_SUBMISSION'); - } - - if (task.submission.status == SubmissionStatus.APPROVED) { - this.logger.error(`Submission already approved for task ${taskId}`); - throw new BadRequestException('TASK.SUBMISSION_ALREADY_REVIEWED'); - } - - await this.taskRepository.approveSubmission(task.submission); - this.logger.log(`Task submission ${taskId} approved successfully`); - } - - async rejectTaskSubmission(userId: string, taskId: string) { - this.logger.log(`Rejecting task submission ${taskId} by user ${userId}`); - const task = await this.findTask({ id: taskId, assignedById: userId }); - - if (!task.submission) { - this.logger.error(`No submission found for task ${taskId}`); - throw new BadRequestException('TASK.NO_SUBMISSION'); - } - - if (task.submission.status == SubmissionStatus.REJECTED) { - this.logger.error(`Submission already rejected for task ${taskId}`); - throw new BadRequestException('TASK.SUBMISSION_ALREADY_REVIEWED'); - } - - await this.taskRepository.rejectSubmission(task.submission); - this.logger.log(`Task submission ${taskId} rejected successfully`); - } - - async prepareTasksPictures(tasks: Task[]) { - this.logger.log(`Preparing tasks pictures`); - await Promise.all( - tasks.map(async (task) => { - const [imageUrl, submissionUrl, profilePictureUrl] = await Promise.all([ - this.ociService.generatePreSignedUrl(task.image), - this.ociService.generatePreSignedUrl(task.submission?.proofOfCompletion), - this.ociService.generatePreSignedUrl(task.assignedTo.customer.profilePicture), - ]); - - task.image.url = imageUrl; - - if (task.submission?.proofOfCompletion) { - task.submission.proofOfCompletion.url = submissionUrl; - } - - if (task.assignedTo.customer.profilePicture) { - task.assignedTo.customer.profilePicture.url = profilePictureUrl; - } - }), - ); - } - - private async validateTaskImage(userId: string, imageId?: string) { - if (!imageId) return; - - this.logger.log(`Validating task image ${imageId}`); - const image = await this.documentService.findDocumentById(imageId); - - if (!image) { - this.logger.error(`Task image ${imageId} not found`); - throw new BadRequestException('DOCUMENT.NOT_FOUND'); - } - - if (image.createdById && image.createdById !== userId) { - this.logger.error(`Task image ${imageId} not created by user ${userId}`); - throw new BadRequestException('DOCUMENT.NOT_CREATED_BY_USER'); - } - } -} diff --git a/src/task/task.module.ts b/src/task/task.module.ts deleted file mode 100644 index 18b1847..0000000 --- a/src/task/task.module.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Module } from '@nestjs/common'; -import { TypeOrmModule } from '@nestjs/typeorm'; -import { TaskController } from './controllers'; -import { Task } from './entities'; -import { TaskSubmission } from './entities/task-submissions.entity'; -import { TaskRepository } from './repositories'; -import { TaskService } from './services'; - -@Module({ - imports: [TypeOrmModule.forFeature([Task, TaskSubmission])], - controllers: [TaskController], - providers: [TaskService, TaskRepository], -}) -export class TaskModule {} diff --git a/src/user/entities/index.ts b/src/user/entities/index.ts index 013c9ea..ca220c8 100644 --- a/src/user/entities/index.ts +++ b/src/user/entities/index.ts @@ -1,3 +1,3 @@ export * from './device.entity'; -export * from './user-registration-token.entity'; +export * from './user-auth-token.entity'; export * from './user.entity'; diff --git a/src/user/entities/user-auth-token.entity.ts b/src/user/entities/user-auth-token.entity.ts new file mode 100644 index 0000000..7623857 --- /dev/null +++ b/src/user/entities/user-auth-token.entity.ts @@ -0,0 +1,41 @@ +import { + BaseEntity, + Column, + CreateDateColumn, + Entity, + Index, + JoinColumn, + ManyToOne, + PrimaryGeneratedColumn, + UpdateDateColumn, +} from 'typeorm'; +import { User } from './user.entity'; + +@Entity('user_auth_tokens') +export class UserAuthToken extends BaseEntity { + @PrimaryGeneratedColumn('uuid') + id!: string; + + @Column({ type: 'varchar', length: 255, name: 'token', unique: true }) + @Index() + token!: string; + + @Column({ type: 'boolean', default: false, name: 'is_used' }) + isUsed!: boolean; + + @Column({ type: 'timestamp with time zone', name: 'expiry_date' }) + expiryDate!: Date; + + @Column({ type: 'uuid', name: 'user_id', nullable: false }) + userId!: string | null; + + @ManyToOne(() => User, (user) => user.registrationTokens, { nullable: false, onDelete: 'CASCADE' }) + @JoinColumn({ name: 'user_id' }) + user!: User; + + @UpdateDateColumn({ type: 'timestamp with time zone', default: () => 'CURRENT_TIMESTAMP', name: 'updated_at' }) + updatedAt!: Date; + + @CreateDateColumn({ type: 'timestamp with time zone', default: () => 'CURRENT_TIMESTAMP', name: 'created_at' }) + createdAt!: Date; +} diff --git a/src/user/entities/user-registration-token.entity.ts b/src/user/entities/user-registration-token.entity.ts deleted file mode 100644 index e4a551a..0000000 --- a/src/user/entities/user-registration-token.entity.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { - BaseEntity, - Column, - CreateDateColumn, - Entity, - Index, - JoinColumn, - ManyToOne, - PrimaryGeneratedColumn, - UpdateDateColumn, -} from 'typeorm'; -import { Junior } from '~/junior/entities'; -import { UserType } from '../enums'; -import { User } from './user.entity'; - -@Entity('user_registration_tokens') -export class UserRegistrationToken extends BaseEntity { - @PrimaryGeneratedColumn('uuid') - id!: string; - - @Column({ type: 'varchar', length: 255, name: 'token', unique: true }) - @Index() - token!: string; - - @Column({ type: 'varchar', length: 255, name: 'user_type' }) - userType!: UserType; - - @Column({ type: 'boolean', default: false, name: 'is_used' }) - isUsed!: boolean; - - @Column({ type: 'timestamp', name: 'expiry_date' }) - expiryDate!: Date; - - @Column({ type: 'uuid', name: 'user_id', nullable: true }) - userId!: string | null; - - @Column({ type: 'uuid', name: 'junior_id', nullable: true }) - juniorId!: string | null; - - @ManyToOne(() => User, (user) => user.registrationTokens, { nullable: true, onDelete: 'CASCADE' }) - @JoinColumn({ name: 'user_id' }) - user!: User; - - @ManyToOne(() => Junior, (junior) => junior.registrationTokens, { nullable: true, onDelete: 'CASCADE' }) - @JoinColumn({ name: 'junior_id' }) - junior!: Junior; - - @UpdateDateColumn({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP', name: 'updated_at' }) - updatedAt!: Date; - - @CreateDateColumn({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP', name: 'created_at' }) - createdAt!: Date; -} diff --git a/src/user/entities/user.entity.ts b/src/user/entities/user.entity.ts index a18173d..b3f0250 100644 --- a/src/user/entities/user.entity.ts +++ b/src/user/entities/user.entity.ts @@ -14,7 +14,7 @@ import { Customer } from '~/customer/entities/customer.entity'; import { Document } from '~/document/entities'; import { Roles } from '../../auth/enums'; import { Device } from './device.entity'; -import { UserRegistrationToken } from './user-registration-token.entity'; +import { UserAuthToken } from './user-auth-token.entity'; @Entity('users') export class User extends BaseEntity { @@ -78,8 +78,8 @@ export class User extends BaseEntity { @OneToMany(() => Document, (document) => document.createdBy) createdDocuments!: Document[]; - @OneToMany(() => UserRegistrationToken, (token) => token.user) - registrationTokens!: UserRegistrationToken[]; + @OneToMany(() => UserAuthToken, (token) => token.user) + registrationTokens!: UserAuthToken[]; @CreateDateColumn({ name: 'created_at', type: 'timestamp with time zone' }) createdAt!: Date; diff --git a/src/user/repositories/user-token-repository.ts b/src/user/repositories/user-token-repository.ts index 3e130db..5fb4045 100644 --- a/src/user/repositories/user-token-repository.ts +++ b/src/user/repositories/user-token-repository.ts @@ -3,31 +3,29 @@ import { InjectRepository } from '@nestjs/typeorm'; import * as crypto from 'crypto'; import moment from 'moment'; import { Repository } from 'typeorm'; -import { UserRegistrationToken } from '../entities'; +import { UserAuthToken } from '../entities'; import { UserType } from '../enums'; const TOKEN_LENGTH = 16; @Injectable() export class UserTokenRepository { constructor( - @InjectRepository(UserRegistrationToken) - private readonly userTokenRepository: Repository, + @InjectRepository(UserAuthToken) + private readonly userTokenRepository: Repository, ) {} - generateToken(userId: string, userType: UserType, expiryDate?: Date) { + generateToken(userId: string, expiryDate?: Date) { return this.userTokenRepository.save( this.userTokenRepository.create({ - userId: userType === UserType.CHECKER ? userId : null, - juniorId: userType === UserType.JUNIOR ? userId : null, + userId, expiryDate: expiryDate ?? moment().add('15', 'minutes').toDate(), - userType, token: `${moment().unix()}-${crypto.randomBytes(TOKEN_LENGTH).toString('hex')}`, }), ); } findByToken(token: string, userType: UserType) { - return this.userTokenRepository.findOne({ where: { token, isUsed: false, userType } }); + return this.userTokenRepository.findOne({ where: { token, isUsed: false } }); } invalidateToken(token: string) { diff --git a/src/user/services/user-token.service.ts b/src/user/services/user-token.service.ts index 3a3ee1b..986c413 100644 --- a/src/user/services/user-token.service.ts +++ b/src/user/services/user-token.service.ts @@ -7,9 +7,9 @@ export class UserTokenService { constructor(private readonly userTokenRepository: UserTokenRepository) {} private readonly logger = new Logger(UserTokenService.name); - async generateToken(userId: string, userType: UserType, expiryDate?: Date): Promise { + async generateToken(userId: string, expiryDate?: Date): Promise { this.logger.log(`Generating token for user ${userId}`); - const tokenEntity = await this.userTokenRepository.generateToken(userId, userType, expiryDate); + const tokenEntity = await this.userTokenRepository.generateToken(userId, expiryDate); this.logger.log(`Token generated successfully for junior ${userId}`); return tokenEntity.token; } @@ -29,7 +29,7 @@ export class UserTokenService { } this.logger.log(`Token validated successfully`); - return tokenEntity.juniorId! || tokenEntity.userId!; + return tokenEntity.userId!; } invalidateToken(token: string) { diff --git a/src/user/services/user.service.ts b/src/user/services/user.service.ts index ec32953..ca09ec2 100644 --- a/src/user/services/user.service.ts +++ b/src/user/services/user.service.ts @@ -154,7 +154,7 @@ export class UserService { isProfileCompleted: true, }); const ONE_DAY = moment().add(1, 'day').toDate(); - const token = await this.userTokenService.generateToken(user.id, UserType.CHECKER, ONE_DAY); + const token = await this.userTokenService.generateToken(user.id, ONE_DAY); await this.sendCheckerAccountCreatedEmail(data.email, token); return user; diff --git a/src/user/user.module.ts b/src/user/user.module.ts index 50c740f..584ad7f 100644 --- a/src/user/user.module.ts +++ b/src/user/user.module.ts @@ -3,13 +3,13 @@ import { TypeOrmModule } from '@nestjs/typeorm'; import { NotificationModule } from '~/common/modules/notification/notification.module'; import { CustomerModule } from '~/customer/customer.module'; import { AdminUserController, UserController } from './controllers'; -import { Device, User, UserRegistrationToken } from './entities'; +import { Device, User, UserAuthToken } from './entities'; import { DeviceRepository, UserRepository, UserTokenRepository } from './repositories'; import { DeviceService, UserService, UserTokenService } from './services'; @Module({ imports: [ - TypeOrmModule.forFeature([User, Device, UserRegistrationToken]), + TypeOrmModule.forFeature([User, Device, UserAuthToken]), forwardRef(() => NotificationModule), forwardRef(() => CustomerModule), ],