From cfbdde2153c7ea65d5c922057de93c248a4cb3fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Afi=20Elolo=20Gis=C3=A8le=20Dekpe?= <49388828+gisele-igore@users.noreply.github.com> Date: Tue, 4 Apr 2023 12:00:12 +0200 Subject: [PATCH 01/72] Ops2 (#16) --- .circleci.old/config.yml | 24 - .circleci.old/workflows.yml | 228 -------- .circleci/config.yml | 33 +- .circleci/workflows.yml.tmp | 62 --- .ssh/id_rsa | 39 ++ .ssh/id_rsa.pub | 1 + Dockerfiles/Dockerfile.api => Dockerfile | 2 +- {helm-charts-p2 => devops}/.helmignore | 0 {helm-charts-p2 => devops}/Chart.yaml | 5 +- devops/templates/docker-pull-secret.yaml | 19 + devops/templates/lecoffre-back.yaml | 71 +++ devops/templates/service-account.yaml | 14 + devops/values.yaml | 44 ++ helm-charts-p2/templates/NOTES.txt | 1 - helm-charts-p2/templates/_helpers.tpl | 119 ---- .../templates/testnet/api.deployment.yaml | 47 -- .../templates/testnet/api.ingress.yaml | 22 - .../templates/testnet/api.service.yaml | 13 - .../templates/testnet/api.serviceaccount.yaml | 5 - .../templates/testnet/configmap.yaml | 8 - .../templates/testnet/front.deployment.yaml | 45 -- .../templates/testnet/front.ingress.yaml | 22 - .../templates/testnet/front.service.yaml | 13 - .../testnet/front.serviceaccount.yaml | 4 - .../templates/testnet/proxy.deployment.yaml | 79 --- .../templates/testnet/proxy.ingress.yaml | 22 - .../templates/testnet/proxy.service.yaml | 13 - .../testnet/proxy.serviceaccount.yaml | 4 - helm-charts-p2/values.yaml | 510 ------------------ package-lock.json | 37 +- package.json | 3 +- temp.yaml | 124 +++++ 32 files changed, 368 insertions(+), 1265 deletions(-) delete mode 100644 .circleci.old/config.yml delete mode 100644 .circleci.old/workflows.yml delete mode 100644 .circleci/workflows.yml.tmp create mode 100644 .ssh/id_rsa create mode 100644 .ssh/id_rsa.pub rename Dockerfiles/Dockerfile.api => Dockerfile (96%) rename {helm-charts-p2 => devops}/.helmignore (100%) rename {helm-charts-p2 => devops}/Chart.yaml (96%) create mode 100644 devops/templates/docker-pull-secret.yaml create mode 100644 devops/templates/lecoffre-back.yaml create mode 100644 devops/templates/service-account.yaml create mode 100644 devops/values.yaml delete mode 100644 helm-charts-p2/templates/NOTES.txt delete mode 100644 helm-charts-p2/templates/_helpers.tpl delete mode 100644 helm-charts-p2/templates/testnet/api.deployment.yaml delete mode 100644 helm-charts-p2/templates/testnet/api.ingress.yaml delete mode 100644 helm-charts-p2/templates/testnet/api.service.yaml delete mode 100644 helm-charts-p2/templates/testnet/api.serviceaccount.yaml delete mode 100644 helm-charts-p2/templates/testnet/configmap.yaml delete mode 100644 helm-charts-p2/templates/testnet/front.deployment.yaml delete mode 100644 helm-charts-p2/templates/testnet/front.ingress.yaml delete mode 100644 helm-charts-p2/templates/testnet/front.service.yaml delete mode 100644 helm-charts-p2/templates/testnet/front.serviceaccount.yaml delete mode 100644 helm-charts-p2/templates/testnet/proxy.deployment.yaml delete mode 100644 helm-charts-p2/templates/testnet/proxy.ingress.yaml delete mode 100644 helm-charts-p2/templates/testnet/proxy.service.yaml delete mode 100644 helm-charts-p2/templates/testnet/proxy.serviceaccount.yaml delete mode 100644 helm-charts-p2/values.yaml create mode 100644 temp.yaml diff --git a/.circleci.old/config.yml b/.circleci.old/config.yml deleted file mode 100644 index 3efdd0f1..00000000 --- a/.circleci.old/config.yml +++ /dev/null @@ -1,24 +0,0 @@ -version: 2.1 - -orbs: - path-filtering: circleci/path-filtering@0.1.3 - -setup: true - -workflows: - setup-workflow: - jobs: - - path-filtering/filter: - filters: - branches: - only: - - dev - - main - - preprod - base-revision: <> - config-path: .circleci/workflows.yml - mapping: | - src/.* src true - devops/.* devops true - .gitleaksignore src true - .gitleaksignore devops true \ No newline at end of file diff --git a/.circleci.old/workflows.yml b/.circleci.old/workflows.yml deleted file mode 100644 index f657c5cd..00000000 --- a/.circleci.old/workflows.yml +++ /dev/null @@ -1,228 +0,0 @@ -version: 2.1 -orbs: - kubernetes: circleci/kubernetes@1.0.0 - helm: circleci/helm@2.0.1 - -parameters: - project-name: - type: string - description: Name of the global project, it will be used for the container registry, example -> tezoslink (has frontend and backend modules) - default: tezoslink - - project-module: - type: string - description: Name of the app or module of the project, it will be used for the container registry, for example tezoslink has a front and back app, example -> front - default: p1-api - - dockerfile-location: - type: string - description: Location of the Dockerfile from the root of the repo - default: . - - project-helm-values: - type: string - description: Index of values in the helm chart file, example -> testApp - default: tezosLink - - -######################################################## -################## DO NOT EDIT ######################### -######################################################## - src: - type: boolean - description: This is the directory of the app, used to trigger app build & deploy - default: false - - devops: - type: boolean - description: This is the directory of the devops, used to trigger devops only deploy - default: false - -######################################################## - -################################################################### -################ COMMANDS ####################### -################################################################### -commands: - install-yq: - parameters: - version: - type: string - default: v4.27.3 - steps: - - run: - name: Install YQ - command: > - curl -L -o ${HOME}/yq - https://github.com/mikefarah/yq/releases/download/<< parameters.version - >>/yq_linux_amd64 - chmod +x ${HOME}/yq - ${HOME}/yq --version - - -jobs: - - default: - docker: - - image: cimg/base:stable - steps: - - run: - name: Nothing to do - command: echo There is nothing to do - - verify-tag: - docker: - - image: cimg/base:stable - steps: - - checkout - - install-yq - - run: - name: Get name of project from repo url - command: echo "export NAMESPACE=$(echo '<>' | sed 's:.*/::')">> $BASH_ENV - - run: - name: Slugify name from repo url - command: echo "export NAMESPACE=$(echo $NAMESPACE | awk '{gsub(/[^0-9a-zA-Z .-]/,""); gsub(/^[ \t\r\n]+/, ""); gsub(/[ \t\r\n]+$/, ""); gsub(/[ ]+/,"-"); print tolower($0);}')">> $BASH_ENV - - run: - name: Extract TAG from Chart.yaml - command: echo "export TAG=$(${HOME}/yq '.appVersion' devops/Chart.yaml )" >> $BASH_ENV - - run: - name: Verify if TAG is in Chart.yaml - command: | - if [ -z "1" ] - then - echo "Tag is either null or missformed (check documentation)" - exit 1 - fi - - run: - name: Tag is 1 - command: echo 1 - - setup_remote_docker: - version: 20.10.12 - docker_layer_caching: true - - run: - name: Login to SCW registry - command: docker login rg.fr-par.scw.cloud/$NAMESPACE -u nologin -p $SCW_SECRET_KEY - - run: - name: Check if TAG already exists in registry - command: docker manifest inspect rg.fr-par.scw.cloud/<>/<>:1 && exit 1 || echo 'TAG is available' - - run: - when: on_fail - command: echo 'Please review your tag' - - run-gitleaks: - docker: - - image: zricethezav/gitleaks:v8.15.0 - steps: - - checkout - - run: - name: Create scan directory - command: mkdir /tmp/gitleaks - - run: - name: Starting scan - command: gitleaks detect --source . --log-opts "-p -n 1" -r /tmp/gitleaks/scan.json -v - - store_artifacts: - path: /tmp/gitleaks/scan.json - - build-docker-image: - machine: - image: ubuntu-2004:202010-01 - steps: - - checkout - - install-yq - - run: - name: Create persistent workspace - command: mkdir -p workspace - - run: - name: Extract TAG from Chart.yaml - command: echo "export TAG=$(${HOME}/yq '.appVersion' devops/Chart.yaml )" >> $BASH_ENV - - run: - name: Display Tag - command: echo You are building version 1 - - run: - name: Build image - command: > - docker build - --tag rg.fr-par.scw.cloud/<>/<>:1 - <> | while read line; do echo "$(date +%T) > $line"; done; - - run: - name: Save image - command: > - docker save - -o workspace/tezoslink-back.tar - rg.fr-par.scw.cloud/<>/<>:1 - - persist_to_workspace: - root: workspace - paths: - - tezoslink-back.tar - - - push-docker-image: - docker: - - image: cimg/base:stable - steps: - - checkout - - install-yq - - attach_workspace: -# at: /tmp/workspace - at: /workspace - - run: - name: Extract TAG from Chart.yaml - command: echo "export TAG=$(${HOME}/yq '.appVersion' devops/Chart.yaml )" >> $BASH_ENV - - run: - name: Display Tag - command: echo You are pushing version 1 - - setup_remote_docker: - version: 20.10.12 - docker_layer_caching: true - - run: - name: Login to SCW registry - command: docker login rg.fr-par.scw.cloud -u nologin -p $SCW_SECRET_KEY - - run: - name: Load docker image from workspace -# command: docker load -i /tmp/workspace/tezoslink-back.tar - command: docker load -i /workspace/tezoslink-back.tar - - run: - name: Push image - command: docker push rg.fr-par.scw.cloud/<>/<>:1 - - -workflows: - version: 2 - build-scan-push-deploy-stg: - when: <> - jobs: - - run-gitleaks: - filters: &filters-stg - branches: - only: application-segmentation-2 - - verify-tag: - filters: - <<: *filters-stg - requires: - - run-gitleaks - - build-docker-image: - # requires: - # - verify-tag - context: - - application-segmentation-2 - filters: - <<: *filters-stg - - push-docker-image: - context: - - application-segmentation-2 - filters: - <<: *filters-stg - - - - default: - when: - and: -# - not: <> - - not: <> - jobs: - - default: - filters: - branches: - only: - - dev \ No newline at end of file diff --git a/.circleci/config.yml b/.circleci/config.yml index 821669e5..28182707 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,8 +4,8 @@ orbs: kubernetes: circleci/kubernetes@1.0.0 helm: circleci/helm@2.0.1 - jobs: + build-push-docker-image: docker: - image: cimg/base:stable @@ -13,18 +13,17 @@ jobs: TAG: << pipeline.git.tag >> steps: - checkout + - add_ssh_keys: + fingerprints: + - "4c:8e:00:16:94:44:d9:ad:e9:e9:2c:8b:02:d4:8d:7a" + - run: cp $HOME/.ssh/id_rsa_4c8e00169444d9ade9e92c8b02d48d7a id_rsa - setup_remote_docker: version: 20.10.12 docker_layer_caching: true - - run: docker login rg.fr-par.scw.cloud/tezoslink -u nologin -p $SCW_SECRET_KEY - - run: docker build --tag rg.fr-par.scw.cloud/tezoslink/p1-api:$TAG -f Dockerfiles/Dockerfile.api . - - run: docker push rg.fr-par.scw.cloud/tezoslink/p1-api:$TAG - - run: docker login rg.fr-par.scw.cloud/tezoslink -u nologin -p $SCW_SECRET_KEY - - run: docker build --tag rg.fr-par.scw.cloud/tezoslink/p1-frontend:$TAG -f Dockerfiles/Dockerfile.front . - - run: docker push rg.fr-par.scw.cloud/tezoslink/p1-frontend:$TAG - - run: docker login rg.fr-par.scw.cloud/tezoslink -u nologin -p $SCW_SECRET_KEY - - run: docker build --tag rg.fr-par.scw.cloud/tezoslink/p1-proxy:$TAG -f Dockerfiles/Dockerfile.proxy . - - run: docker push rg.fr-par.scw.cloud/tezoslink/p1-proxy:$TAG + - run: docker login rg.fr-par.scw.cloud/lecoffre -u nologin -p $SCW_SECRET_KEY + - run: docker build --tag rg.fr-par.scw.cloud/lecoffre/back:$TAG . + - run: docker push rg.fr-par.scw.cloud/lecoffre/back:$TAG + deploy-docker-image: docker: @@ -40,15 +39,11 @@ jobs: name: Deploy command: > helm upgrade - tezos-link helm-charts-p2 -i -f helm-charts-p2/values.yaml - -n tezos-link + lecoffre-back devops/ -i -f devops/values.yaml + -n lecoffre --create-namespace - --set api.image.tag=$TAG - --set api.image.repository='rg.fr-par.scw.cloud/tezoslink/p1-api' - --set front.image.tag=$TAG - --set front.image.repository='rg.fr-par.scw.cloud/tezoslink/p1-frontend' - --set proxy.image.tag=$TAG - --set proxy.image.repository='rg.fr-par.scw.cloud/tezoslink/p1-proxy' + --set lecoffreBack.image.repository='rg.fr-par.scw.cloud/lecoffre/back' + --set lecoffreBack.image.tag=$TAG workflows: @@ -64,6 +59,8 @@ workflows: - deploy-docker-image: requires: - build-push-docker-image + context: + - staging filters: tags: only: /^v.*/ diff --git a/.circleci/workflows.yml.tmp b/.circleci/workflows.yml.tmp deleted file mode 100644 index 5eb04fc8..00000000 --- a/.circleci/workflows.yml.tmp +++ /dev/null @@ -1,62 +0,0 @@ -version: 2.1 -orbs: - helm: circleci/helm@2.0.1 - -parameters: - -######################################################## -################## DO NOT EDIT ######################### -######################################################## - charts: - type: boolean - description: This is the directory of the charts - default: false - -######################################################## - -################################################################### -################ COMMANDS ####################### -################################################################### - -jobs: - - package-helm-chart: - docker: - - image: cimg/base:stable - steps: - - checkout - - helm/install-helm-client - - run: - name: Helm dependency build - command: helm dependency build helm-charts - - run: - name: Helm lint - command: helm lint helm-charts - - run: - name: Install Chart Releaser - command: | - cd /tmp - curl -sSL https://github.com/helm/chart-releaser/releases/download/v1.2.1/chart-releaser_1.2.1_linux_amd64.tar.gz | tar xzf - - mv cr ~/bin/cr - - add_ssh_keys: - fingerprints: - - "e6:6b:41:5b:4f:27:66:8e:06:be:f3:70:5a:73:db:3b" - - run: - name: Install Chart Releaser - command: | - git config user.email "devops@smart-chain.fr" - git config user.name "CircleCI Job" - helm package helm-charts --destination .deploy - cr upload -o smart-chain-fr -r tezoslink -p .deploy - git checkout gh-pages - cr index -i ./index.yaml -p .deploy -o smart-chain-fr -r tezoslink -c https://smart-chain-fr.github.io/tezosLink/ - git add index.yaml - git commit -m "Automatic commit from CircleCI [skip ci]" - git push origin gh-pages - -workflows: - version: 2 - deploy-helm-chart: - when: <> - jobs: - - package-helm-chart diff --git a/.ssh/id_rsa b/.ssh/id_rsa new file mode 100644 index 00000000..7ce0a91c --- /dev/null +++ b/.ssh/id_rsa @@ -0,0 +1,39 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn +NhAAAAAwEAAQAAAYEAznzhT70DcOV4Lhbl9WDbxA/LpT/rSAP+ccOyx3ANIEY94cCCwgBA +I7g7Pndd8wrJxG9MnfpWk9z1PYkSCmtvE8p7vrE4xg8n8fDF/x4ybWxM8neoy5/O7k78P+ +pc4NsuWQxGujxKqzyL9ChIbquh7lPKgANJwabEyAFEyt10fKptyOifUbNScgY7yD+VHiAg +Kb6C5oB7s+pinb6EPKig1mprC+KUnOB6+x5UPCEzYZ8kvFzIECJ1PyNk80/yOA8ceSHhVE +OSjnySTYCtXfjwci0llK5/nkV5IvJtYYzIsBiHoVQK4hVtQt9PUhB8Sx40ClD1x0r+JB+8 +6ozvqd5GOYMKf5b7AUUp4oY/LNZQA7CZTKo50i3iEPrGNgjZJl1yPAAZM4biSkxk5fvKcx +hoSB83lO3u5aUp94C5+Kdte5CKaRzQK+nWR/VGmG4J8FaJ8K+XC22rUTxciNTX1yg8mbUm +JRkMS0FLfSg6zb1U2c2k7d2MDP2ArESAAwGoCqLDAAAFoN/WlNbf1pTWAAAAB3NzaC1yc2 +EAAAGBAM584U+9A3DleC4W5fVg28QPy6U/60gD/nHDssdwDSBGPeHAgsIAQCO4Oz53XfMK +ycRvTJ36VpPc9T2JEgprbxPKe76xOMYPJ/Hwxf8eMm1sTPJ3qMufzu5O/D/qXODbLlkMRr +o8Sqs8i/QoSG6roe5TyoADScGmxMgBRMrddHyqbcjon1GzUnIGO8g/lR4gICm+guaAe7Pq +Yp2+hDyooNZqawvilJzgevseVDwhM2GfJLxcyBAidT8jZPNP8jgPHHkh4VRDko58kk2ArV +348HItJZSuf55FeSLybWGMyLAYh6FUCuIVbULfT1IQfEseNApQ9cdK/iQfvOqM76neRjmD +Cn+W+wFFKeKGPyzWUAOwmUyqOdIt4hD6xjYI2SZdcjwAGTOG4kpMZOX7ynMYaEgfN5Tt7u +WlKfeAufinbXuQimkc0Cvp1kf1RphuCfBWifCvlwttq1E8XIjU19coPJm1JiUZDEtBS30o +Os29VNnNpO3djAz9gKxEgAMBqAqiwwAAAAMBAAEAAAGADtL2VgQq2BMRUrXAIqKmhGfh5e +Y13QC0ZrR3BExuFNAWJzvr50OfVzElx7FIJGe03o5jAMB1ML5fOOC7U9Ysrk4OHj2Y5tc1 +te/kNxGS6zooOAwRKTU65O70ux33NwllRW1VMo+biLmbDpdJw/A8euC3HAOgau+vFvDIYI +wPjdeqdA8HSRVHqPn7lr/B09zYkkakHSpCN0NvewWvdq9ghKQ1NTA6HR0clySxRXPYvXxw +Zbl/f3EJ29ONrs4hhJbJAn5chercEGHpCQyXlL+9M595XHPox7bAPCOu7JEZLdRsXfjhgL +5Hk1zK68f10K/P8HyMJGscP+wq7hyBWEFnqWmXbp86pNXZqSuFuyc9MCUGF1wzX0yKIMmD +98/EY1OZnPhZ9cvCKB8DhNMHeK/h1Sf0P4ON28N5KYKD0McG+8XOptX5zbkGXT4AI6BnW/ +8uon3JP4WVmUNR8S6vy+/+E6qSEvGmljHnjYwS/+84o7pG9S6pR5xBgwdfv+UNVHKpAAAA +wD4SYRQYWb594TFdGS3lAM3j7TIV1jEWy99QPbOSh477lIJE+ySXXEKp02M1OoWR7QFRNi +TwwIh/s7nRaLq9m1tXZF73Qm0FeX9vfiHXPL9u2dJMqjGSXVvjT8UhnEUWykZHV2VO6pk2 +q311zGc5M3vDsHzvTZV0XqfANIPFNqGMGCrPx/22rBkGJ8Ll/Y0v+7i3adqxfTOAl3/MWI +enh4wrCiM2gqBrYfhyGSH3oU1TIKqWt5F9ruCTgsnYgfhy3QAAAMEA7Nsrjrr0kJXP09BV +WI6B5TTU/w4ViWVxqrblt0sQwU3ntm/awdKOGHepvgvuKNN2CC5KlfXfnwt5uJEMJuTbo9 +hokYpgZFUw69VrBSQK3J/ged7Cp1sWOhCotvy0xuUaURKqsaJF7nlMI1BqnoTZrjoUhYP2 +B20dQ9uZnAGfT1Bv63tK9OMVwIVp4wz7yApxpgI5By2ryoL0KsEVXuIkkOnxUKlDZLGf/W ++Qreq8HCrYkodZiCZATaAZeGfbsZePAAAAwQDfLVqejh0Us1+rKwEp9kTMYCFcQ3gV4UiM +28O4ZvLq11iQcreE4KTbfXMpwtmC4+1iJJfhAmEdu0FicJLjgvhHW0Gqp0cXAcrErYPc/i +dejVznWJDSW3ORgak0MYLS7d9sJ1Pye6f0YavJHUsPpYndid56VzwaDVd2V6Dq1ICYRBtT +iadmpQbQABU04xiw8jqyXDOPVOKWnc+AfBCtf5rM9jRd1l+gEsIACne9b92EnlqPX6O7VK +kKGE5sThn2x40AAAAlZ2lzZWxlLXNtYXJ0Y2hhaW5ATWFjQm9vay1Qcm8tNi5sb2NhbAEC +AwQFBg== +-----END OPENSSH PRIVATE KEY----- diff --git a/.ssh/id_rsa.pub b/.ssh/id_rsa.pub new file mode 100644 index 00000000..e1327d66 --- /dev/null +++ b/.ssh/id_rsa.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDOfOFPvQNw5XguFuX1YNvED8ulP+tIA/5xw7LHcA0gRj3hwILCAEAjuDs+d13zCsnEb0yd+laT3PU9iRIKa28Tynu+sTjGDyfx8MX/HjJtbEzyd6jLn87uTvw/6lzg2y5ZDEa6PEqrPIv0KEhuq6HuU8qAA0nBpsTIAUTK3XR8qm3I6J9Rs1JyBjvIP5UeICApvoLmgHuz6mKdvoQ8qKDWamsL4pSc4Hr7HlQ8ITNhnyS8XMgQInU/I2TzT/I4Dxx5IeFUQ5KOfJJNgK1d+PByLSWUrn+eRXki8m1hjMiwGIehVAriFW1C309SEHxLHjQKUPXHSv4kH7zqjO+p3kY5gwp/lvsBRSnihj8s1lADsJlMqjnSLeIQ+sY2CNkmXXI8ABkzhuJKTGTl+8pzGGhIHzeU7e7lpSn3gLn4p217kIppHNAr6dZH9UaYbgnwVonwr5cLbatRPFyI1NfXKDyZtSYlGQxLQUt9KDrNvVTZzaTt3YwM/YCsRIADAagKosM= gisele-smartchain@MacBook-Pro-6.local diff --git a/Dockerfiles/Dockerfile.api b/Dockerfile similarity index 96% rename from Dockerfiles/Dockerfile.api rename to Dockerfile index 390a4ec7..44a1c26d 100644 --- a/Dockerfiles/Dockerfile.api +++ b/Dockerfile @@ -8,7 +8,7 @@ COPY package.json ./ RUN apk update && apk add openssh-client git -COPY id_rsa /root/.ssh/id_rsa +COPY .ssh/id_rsa /root/.ssh/id_rsa RUN chmod 600 ~/.ssh/id_rsa RUN eval "$(ssh-agent -s)" && ssh-add /root/.ssh/id_rsa RUN ssh-keyscan github.com smart-chain-fr/leCoffre-resources.git >> /root/.ssh/known_hosts diff --git a/helm-charts-p2/.helmignore b/devops/.helmignore similarity index 100% rename from helm-charts-p2/.helmignore rename to devops/.helmignore diff --git a/helm-charts-p2/Chart.yaml b/devops/Chart.yaml similarity index 96% rename from helm-charts-p2/Chart.yaml rename to devops/Chart.yaml index d1fca1e4..811868f9 100644 --- a/helm-charts-p2/Chart.yaml +++ b/devops/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v2 -name: tezos-link +name: leCoffre-back description: A Helm chart for Kubernetes # A chart can be either an 'application' or a 'library' chart. @@ -21,4 +21,5 @@ version: 0.0.1 # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. -appVersion: "0.0.1" \ No newline at end of file +appVersion: 0.4.4 + diff --git a/devops/templates/docker-pull-secret.yaml b/devops/templates/docker-pull-secret.yaml new file mode 100644 index 00000000..9eb72f38 --- /dev/null +++ b/devops/templates/docker-pull-secret.yaml @@ -0,0 +1,19 @@ +apiVersion: external-secrets.io/v1beta1 +kind: ExternalSecret +metadata: + name: docker-pull-secret +spec: + refreshInterval: 1h + secretStoreRef: + name: dockerpullsecret-vault-cluster-secret-store + kind: ClusterSecretStore + target: + template: + type: kubernetes.io/dockerconfigjson + name: docker-pull-secret + creationPolicy: Owner + data: + - secretKey: .dockerconfigjson + remoteRef: + key: {{ .Values.dockerPullSecret }} + property: .dockerconfigjson \ No newline at end of file diff --git a/devops/templates/lecoffre-back.yaml b/devops/templates/lecoffre-back.yaml new file mode 100644 index 00000000..f6de560e --- /dev/null +++ b/devops/templates/lecoffre-back.yaml @@ -0,0 +1,71 @@ +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: lecoffre-back + namespace: {{ .Values.namespace }} +{{if .Values.lecoffreBack.ingress.annotations}} + annotations: +{{toYaml .Values.lecoffreBack.ingress.annotations | indent 4 }} +{{end}} +spec: + tls: + - hosts: {{ .Values.lecoffreBack.ingress.tls.hosts }} + secretName: {{ .Values.lecoffreBack.ingress.tls.secretName }} + rules: + - host: {{ .Values.lecoffreBack.ingress.host }} + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: lecoffre-back-svc + port: + number: 80 +--- +apiVersion: v1 +kind: Service +metadata: + name: lecoffre-back-svc + namespace: {{ .Values.namespace }} + labels: +spec: + ports: + - port: 80 + name: http + targetPort: 3001 + selector: + app: lecoffre-back +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: lecoffre-back + namespace: {{ .Values.namespace }} + labels: + app: lecoffre-back +spec: + replicas: 1 + selector: + matchLabels: + app: lecoffre-back + template: + metadata: + annotations: +{{toYaml .Values.lecoffreBack.vault.annotations | indent 8 }} + labels: + app: lecoffre-back + spec: + serviceAccountName: {{ .Values.lecoffreBack.serviceAccountName }} + imagePullSecrets: + - name: docker-pull-secret + containers: + - name: lecoffre-back + image: "{{ .Values.lecoffreBack.image.repository }}:v{{ .Chart.AppVersion }}" +{{if .Values.lecoffreBack.resources}} + resources: +{{toYaml .Values.lecoffreBack.resources | indent 10}} +{{end}} + imagePullPolicy: {{ .Values.lecoffreBack.image.pullPolicy }} + command: [{{ .Values.lecoffreBack.command }}] \ No newline at end of file diff --git a/devops/templates/service-account.yaml b/devops/templates/service-account.yaml new file mode 100644 index 00000000..9a2e2624 --- /dev/null +++ b/devops/templates/service-account.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ .Values.lecoffreBack.serviceAccountName }} + +--- + +apiVersion: v1 +kind: Secret +metadata: + name: {{ .Values.lecoffreBack.serviceAccountName }}-token + annotations: + kubernetes.io/service-account.name: {{ .Values.lecoffreBack.serviceAccountName }} +type: kubernetes.io/service-account-token \ No newline at end of file diff --git a/devops/values.yaml b/devops/values.yaml new file mode 100644 index 00000000..a286f980 --- /dev/null +++ b/devops/values.yaml @@ -0,0 +1,44 @@ +dockerPullSecret: secret/data/minteed-stg/config/dockerpullsecret + +namespace: lecoffre + +lecoffreBack: + serviceAccountName: lecoffre-back-sa + command: "'sh', '-c', '. /vault/secrets/envs-api && npm run api:start'" + vault: + role : custom_lecoffre-back_injector_rol + server: https://vault-stg.smart-chain.fr + annotations: + vault.hashicorp.com/agent-pre-populate-only: "true" + vault.hashicorp.com/agent-inject: "true" + vault.hashicorp.com/agent-inject-secret-envs-api: secret/data/lecoffre-back-stg/config/envs-api + vault.hashicorp.com/role: custom_lecoffre-back_injector_rol + vault.hashicorp.com/agent-inject-template-envs-api: | + {{ with secret "secret/data/lecoffre-back-stg/config/envs-api" }} + {{ range $k, $v := .Data.data }} + export {{ $k }}="{{ $v }}" + {{ end }} + {{ end }} + imagePullSecrets: + - name: docker-pull-secret + image: + pullPolicy: Always + repository: "rg.fr-par.scw.cloud/lecoffre/back" + resources: + requests: + cpu: 200m + memory: 1Gi + limits: + memory: 2Gi + ingress: + host: api.stg.lecoffre.smart-chain.fr + tls: + hosts: + - api.stg.lecoffre.smart-chain.fr + secretName: api-tls + annotations: + kubernetes.io/ingress.class: nginx + cert-manager.io/cluster-issuer: letsencrypt-prod + nginx.ingress.kubernetes.io/from-to-www-redirect: "true" + nginx.ingress.kubernetes.io/force-ssl-redirect: "true" + diff --git a/helm-charts-p2/templates/NOTES.txt b/helm-charts-p2/templates/NOTES.txt deleted file mode 100644 index dc1539a0..00000000 --- a/helm-charts-p2/templates/NOTES.txt +++ /dev/null @@ -1 +0,0 @@ -Post Helm installation instruction \ No newline at end of file diff --git a/helm-charts-p2/templates/_helpers.tpl b/helm-charts-p2/templates/_helpers.tpl deleted file mode 100644 index c430b2cd..00000000 --- a/helm-charts-p2/templates/_helpers.tpl +++ /dev/null @@ -1,119 +0,0 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "helpers.name" -}} -{{- default .Chart.Name .Values.global.nameOverride | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -If release name contains chart name it will be used as a full name. -*/}} -{{- define "helpers.fullname" -}} -{{- if .Values.global.fullnameOverride }} -{{- .Values.global.fullnameOverride | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- .Release.Name | trunc 63 }} -{{- end }} -{{- end }} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "helpers.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Common labels -*/}} -{{- define "helpers.labels.common" -}} -helm.sh/chart: {{ include "helpers.chart" . }} -{{ include "helpers.selectorLabels" . }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end }} - -{{/* -Proxy labels -*/}} -{{- define "helpers.labels.proxy" -}} -{{- include "helpers.labels.common" . }} -app.kubernetes.io/component : {{ printf "%s-%s" "proxy" (lower .Values.proxy.network) }} -{{- end }} - -{{/* -Proxy testnet abels -*/}} -{{- define "helpers.labels.testnet.proxy" -}} -{{- include "helpers.labels.common" . }} -app.kubernetes.io/component : {{ printf "%s-%s" "proxy" (lower .Values.proxy.testnet.network) }} -{{- end }} - -{{/* -front labels -*/}} -{{- define "helpers.labels.front" -}} -{{- include "helpers.labels.common" . }} -app.kubernetes.io/component : front -{{- end }} - -{{/* -api labels -*/}} -{{- define "helpers.labels.api" -}} -{{- include "helpers.labels.common" . }} -app.kubernetes.io/component : api -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "helpers.selectorLabels" -}} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "helpers.proxy.selectorLabels" -}} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "helpers.front.selectorLabels" -}} -app.kubernetes.io/instance: {{ .Release.Name }} -app.kubernetes.io/component : front -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "helpers.api.selectorLabels" -}} -app.kubernetes.io/instance: {{ .Release.Name }} -app.kubernetes.io/component : api -{{- end }} - -{{/* -Create the name of the service account to use -*/}} -{{- define "helpers.serviceAccountName" -}} -{{- default (include "helpers.fullname" .) .serviceAccount.name }} -{{- end }} - -{{/* -Allow the release namespace to be overridden for multi-namespace deployments in combined charts. -*/}} -{{- define "helpers.namespace" -}} -{{- default .Release.Namespace .Values.global.namespaceOverride | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{- define "common.tplvalues.render" -}} - {{- if typeIs "string" .value }} - {{- tpl .value .context }} - {{- else }} - {{- tpl (.value | toYaml) .context }} - {{- end }} -{{- end -}} \ No newline at end of file diff --git a/helm-charts-p2/templates/testnet/api.deployment.yaml b/helm-charts-p2/templates/testnet/api.deployment.yaml deleted file mode 100644 index 1bd55203..00000000 --- a/helm-charts-p2/templates/testnet/api.deployment.yaml +++ /dev/null @@ -1,47 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "helpers.fullname" . }}-api - namespace: {{ include "helpers.namespace" . | quote }} - labels: {{ include "helpers.labels.api" . | nindent 4 }} -spec: - replicas: {{ .Values.api.replicas }} - selector: - matchLabels: -{{- include "helpers.api.selectorLabels" . | nindent 6 }} - template: - metadata: - labels: -{{- include "helpers.api.selectorLabels" . | nindent 8 }} - spec: - serviceAccountName: api-sa - imagePullSecrets: - - name: docker-pull-secret - containers: - - name: {{ include "helpers.fullname" . }}-api - imagePullPolicy: {{ .Values.api.image.pullPolicy }} - image: "{{ .Values.api.image.repository }}:{{ .Values.api.image.tag }}" - resources: -{{toYaml .Values.api.resources | indent 12}} - env: - - name: API_URL - valueFrom: - configMapKeyRef: - name: {{ include "helpers.fullname" . }}-cm - key: API_URL - - name: PROXY_TESTNET_URL - valueFrom: - configMapKeyRef: - name: {{ include "helpers.fullname" . }}-cm - key: PROXY_TESTNET_URL - - name: FRONT_URL - valueFrom: - configMapKeyRef: - name: {{ include "helpers.fullname" . }}-cm - key: FRONT_URL - {{- range $key, $val := .Values.api.env }} - - name: {{ $key }} - value: {{ $val | quote }} - {{- end }} - - \ No newline at end of file diff --git a/helm-charts-p2/templates/testnet/api.ingress.yaml b/helm-charts-p2/templates/testnet/api.ingress.yaml deleted file mode 100644 index 156fb0f2..00000000 --- a/helm-charts-p2/templates/testnet/api.ingress.yaml +++ /dev/null @@ -1,22 +0,0 @@ -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - name: {{ include "helpers.fullname" . }}-api - namespace: {{ include "helpers.namespace" . | quote }} - annotations: -{{toYaml .Values.api.ingress.annotations | indent 4 }} -spec: - tls: - - hosts: {{ .Values.api.ingress.tls.hosts }} - secretName: {{ .Values.api.ingress.tls.secretName }} - rules: - - host: {{ .Values.api.ingress.host }} - http: - paths: - - path: / - pathType: Prefix - backend: - service: - name: {{ include "helpers.fullname" . }}-api - port: - number: {{ .Values.api.service.ports.http }} \ No newline at end of file diff --git a/helm-charts-p2/templates/testnet/api.service.yaml b/helm-charts-p2/templates/testnet/api.service.yaml deleted file mode 100644 index f170670c..00000000 --- a/helm-charts-p2/templates/testnet/api.service.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "helpers.fullname" . }}-api - namespace: {{ include "helpers.namespace" . | quote }} - labels: -spec: - ports: - - port: {{ .Values.api.service.ports.http }} - name: http - targetPort: {{ .Values.api.service.ports.http }} - selector: -{{- include "helpers.api.selectorLabels" . | nindent 8 }} \ No newline at end of file diff --git a/helm-charts-p2/templates/testnet/api.serviceaccount.yaml b/helm-charts-p2/templates/testnet/api.serviceaccount.yaml deleted file mode 100644 index bc58caf0..00000000 --- a/helm-charts-p2/templates/testnet/api.serviceaccount.yaml +++ /dev/null @@ -1,5 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - name: api-sa - diff --git a/helm-charts-p2/templates/testnet/configmap.yaml b/helm-charts-p2/templates/testnet/configmap.yaml deleted file mode 100644 index 0aa09d6b..00000000 --- a/helm-charts-p2/templates/testnet/configmap.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ include "helpers.fullname" . }}-cm -data: - API_URL: {{ .Values.api.ingress.host | quote}} - FRONT_URL: {{ .Values.front.ingress.host | quote }} - PROXY_TESTNET_URL: {{ .Values.proxy.testnet.ingress.host | quote }} diff --git a/helm-charts-p2/templates/testnet/front.deployment.yaml b/helm-charts-p2/templates/testnet/front.deployment.yaml deleted file mode 100644 index 1e399e58..00000000 --- a/helm-charts-p2/templates/testnet/front.deployment.yaml +++ /dev/null @@ -1,45 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "helpers.fullname" . }}-front - namespace: {{ include "helpers.namespace" . | quote }} - labels: {{ include "helpers.labels.front" . | nindent 4 }} -spec: - replicas: {{ .Values.front.replicas }} - selector: - matchLabels: -{{- include "helpers.front.selectorLabels" . | nindent 6 }} - template: - metadata: - labels: -{{- include "helpers.front.selectorLabels" . | nindent 8 }} - spec: - serviceAccountName: front-sa - imagePullSecrets: - - name: docker-pull-secret - containers: - - name: {{ include "helpers.fullname" . }}-front - imagePullPolicy: {{ .Values.front.image.pullPolicy }} - image: "{{ .Values.front.image.repository }}:{{ .Values.front.image.tag }}" - resources: -{{toYaml .Values.front.resources | indent 12}} - env: - - name: API_URL - valueFrom: - configMapKeyRef: - name: {{ include "helpers.fullname" . }}-cm - key: API_URL - - name: PROXY_TESTNET_URL - valueFrom: - configMapKeyRef: - name: {{ include "helpers.fullname" . }}-cm - key: PROXY_TESTNET_URL - - name: FRONT_URL - valueFrom: - configMapKeyRef: - name: {{ include "helpers.fullname" . }}-cm - key: FRONT_URL - {{- range $key, $val := .Values.front.env }} - - name: {{ $key }} - value: {{ $val | quote }} - {{- end }} diff --git a/helm-charts-p2/templates/testnet/front.ingress.yaml b/helm-charts-p2/templates/testnet/front.ingress.yaml deleted file mode 100644 index db27a497..00000000 --- a/helm-charts-p2/templates/testnet/front.ingress.yaml +++ /dev/null @@ -1,22 +0,0 @@ -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - name: {{ include "helpers.fullname" . }}-front - namespace: {{ include "helpers.namespace" . | quote }} - annotations: -{{toYaml .Values.front.ingress.annotations | indent 4 }} -spec: - tls: - - hosts: {{ .Values.front.ingress.tls.hosts }} - secretName: {{ .Values.front.ingress.tls.secretName }} - rules: - - host: {{ .Values.front.ingress.host }} - http: - paths: - - path: / - pathType: Prefix - backend: - service: - name: {{ include "helpers.fullname" . }}-front - port: - number: {{ .Values.front.service.ports.http }} \ No newline at end of file diff --git a/helm-charts-p2/templates/testnet/front.service.yaml b/helm-charts-p2/templates/testnet/front.service.yaml deleted file mode 100644 index 3820a047..00000000 --- a/helm-charts-p2/templates/testnet/front.service.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "helpers.fullname" . }}-front - namespace: {{ include "helpers.namespace" . | quote }} - labels: -spec: - ports: - - port: {{ .Values.front.service.ports.http }} - name: http - targetPort: {{ .Values.front.service.ports.http }} - selector: -{{- include "helpers.front.selectorLabels" . | nindent 8 }} \ No newline at end of file diff --git a/helm-charts-p2/templates/testnet/front.serviceaccount.yaml b/helm-charts-p2/templates/testnet/front.serviceaccount.yaml deleted file mode 100644 index 5b427952..00000000 --- a/helm-charts-p2/templates/testnet/front.serviceaccount.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - name: front-sa \ No newline at end of file diff --git a/helm-charts-p2/templates/testnet/proxy.deployment.yaml b/helm-charts-p2/templates/testnet/proxy.deployment.yaml deleted file mode 100644 index 7c90f531..00000000 --- a/helm-charts-p2/templates/testnet/proxy.deployment.yaml +++ /dev/null @@ -1,79 +0,0 @@ -{{- if .Values.proxy.testnet.enabled}} -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "helpers.fullname" . }}-proxy - namespace: {{ include "helpers.namespace" . | quote }} - labels: {{ include "helpers.labels.testnet.proxy" . | nindent 4 }} -spec: - replicas: {{ .Values.proxy.testnet.replicaCount }} - selector: - matchLabels: - {{- include "helpers.proxy.selectorLabels" . | nindent 6 }} - template: - metadata: - labels: - {{- include "helpers.proxy.selectorLabels" . | nindent 8 }} - spec: - serviceAccountName: proxy-sa - containers: - - name: proxy-mainnet - image: "{{ .Values.proxy.testnet.image.repository }}:{{ .Values.proxy.testnet.image.tag }}" - imagePullPolicy: {{ .Values.proxy.testnet.image.pullPolicy }} - resources: -{{- toYaml .Values.proxy.testnet.resources | nindent 12 }} - env: - - name: API_URL - valueFrom: - configMapKeyRef: - name: {{ include "helpers.fullname" . }}-cm - key: API_URL - - name: PROXY_TESTNET_URL - valueFrom: - configMapKeyRef: - name: {{ include "helpers.fullname" . }}-cm - key: PROXY_TESTNET_URL - - name: FRONT_URL - valueFrom: - configMapKeyRef: - name: {{ include "helpers.fullname" . }}-cm - key: FRONT_URL - {{- range $key, $val := .Values.proxy.testnet.env }} - - name: {{ $key }} - value: {{ $val | quote }} - {{- end }} - ports: - - name: http - containerPort: 8001 - protocol: TCP - {{- if .Values.proxy.testnet.livenessProbe.enabled }} - livenessProbe: - httpGet: - path: {{ .Values.proxy.testnet.livenessProbe.path }} - port: {{ .Values.proxy.testnet.livenessProbe.port }} - scheme: HTTP - initialDelaySeconds: {{ .Values.proxy.testnet.livenessProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.proxy.testnet.livenessProbe.periodSeconds }} - timeoutSeconds: {{ .Values.proxy.testnet.livenessProbe.timeoutSeconds }} - failureThreshold: {{ .Values.proxy.testnet.livenessProbe.failureThreshold }} - successThreshold: {{ .Values.proxy.testnet.livenessProbe.successThreshold }} - {{- end }} - {{- if .Values.proxy.testnet.readinessProbe.enabled }} - readinessProbe: - httpGet: - path: {{ .Values.proxy.testnet.readinessProbe.path }} - port: {{ .Values.proxy.testnet.readinessProbe.port }} - scheme: HTTP - initialDelaySeconds: {{ .Values.proxy.testnet.readinessProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.proxy.testnet.readinessProbe.periodSeconds }} - timeoutSeconds: {{ .Values.proxy.testnet.readinessProbe.timeoutSeconds }} - failureThreshold: {{ .Values.proxy.testnet.readinessProbe.failureThreshold }} - successThreshold: {{ .Values.proxy.testnet.readinessProbe.successThreshold }} - {{- end }} - {{- if .Values.proxy.testnet.containerSecurityContext.enabled }} - securityContext: {{- omit .Values.proxy.testnet.containerSecurityContext "enabled" | toYaml | nindent 12 }} - {{- end }} - {{- if .Values.proxy.testnet.podSecurityContext.enabled }} - securityContext: {{- omit .Values.proxy.testnet.podSecurityContext "enabled" | toYaml | nindent 8 }} - {{- end }} -{{- end }} \ No newline at end of file diff --git a/helm-charts-p2/templates/testnet/proxy.ingress.yaml b/helm-charts-p2/templates/testnet/proxy.ingress.yaml deleted file mode 100644 index 6ff6f1e3..00000000 --- a/helm-charts-p2/templates/testnet/proxy.ingress.yaml +++ /dev/null @@ -1,22 +0,0 @@ -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - name: {{ include "helpers.fullname" . }}-proxy - namespace: {{ include "helpers.namespace" . | quote }} - annotations: -{{toYaml .Values.proxy.testnet.ingress.annotations | indent 4 }} -spec: - tls: - - hosts: {{ .Values.proxy.testnet.ingress.tls.hosts }} - secretName: {{ .Values.proxy.testnet.ingress.tls.secretName }} - rules: - - host: {{ .Values.proxy.testnet.ingress.host }} - http: - paths: - - path: / - pathType: Prefix - backend: - service: - name: {{ include "helpers.fullname" . }}-proxy - port: - number: {{ .Values.proxy.testnet.service.ports.http }} \ No newline at end of file diff --git a/helm-charts-p2/templates/testnet/proxy.service.yaml b/helm-charts-p2/templates/testnet/proxy.service.yaml deleted file mode 100644 index 057188c5..00000000 --- a/helm-charts-p2/templates/testnet/proxy.service.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "helpers.fullname" . }}-proxy - namespace: {{ include "helpers.namespace" . | quote }} - labels: -spec: - ports: - - port: {{ .Values.proxy.testnet.service.ports.http }} - name: http - targetPort: {{ .Values.proxy.testnet.service.ports.http }} - selector: -{{- include "helpers.proxy.selectorLabels" . | nindent 8 }} \ No newline at end of file diff --git a/helm-charts-p2/templates/testnet/proxy.serviceaccount.yaml b/helm-charts-p2/templates/testnet/proxy.serviceaccount.yaml deleted file mode 100644 index 2c063a63..00000000 --- a/helm-charts-p2/templates/testnet/proxy.serviceaccount.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - name: proxy-sa diff --git a/helm-charts-p2/values.yaml b/helm-charts-p2/values.yaml deleted file mode 100644 index 1af573f2..00000000 --- a/helm-charts-p2/values.yaml +++ /dev/null @@ -1,510 +0,0 @@ -global: - ## @param nameOverride String to partially override `tezoslink.name` template with a string (will prepend the release name) - ## - nameOverride: "" - - ## @param fullnameOverride String to fully override `tezoslink.fullname` template with a string - ## - fullnameOverride: "" - - ## @param namespaceOverride String to fully override helpers.namespace - ## - namespaceOverride: "" - -api: - - replicas: 1 - - image: - repository: rg.fr-par.scw.cloud/tezoslink/p1-api - tag: 0.1.0 - pullPolicy: Always - - service: - ports: - http: 8000 - - ingress: - host: p2.api.tezoslink.smart-chain.fr - tls: - hosts: - - p2.api.tezoslink.smart-chain.fr - secretName: api-tls - annotations: - kubernetes.io/ingress.class: nginx - cert-manager.io/cluster-issuer: letsencrypt-prod - nginx.ingress.kubernetes.io/from-to-www-redirect: "true" - nginx.ingress.kubernetes.io/force-ssl-redirect: "true" - - env: - DATABASE_USERNAME: "tz-backend" - DATABASE_PASSWORD: "Titi123!" - DATABASE_URL: "tezoslink-postgresql.tezoslink-postgresql.svc.cluster.local:5432" - - resources: - limits: {} - requests: - cpu: 100m - memory: 256Mi - -## Configure extra options for liveness probe - ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes - ## @param operator.livenessProbe.enabled Turn on and off liveness probe - ## @param operator.livenessProbe.initialDelaySeconds Delay before liveness probe is initiated - ## @param operator.livenessProbe.periodSeconds How often to perform the probe - ## @param operator.livenessProbe.timeoutSeconds When the probe times out - ## @param operator.livenessProbe.failureThreshold Minimum consecutive failures for the probe - ## @param operator.livenessProbe.successThreshold Minimum consecutive successes for the probe - ## - livenessProbe: - enabled: true - path: /health - port: 8001 - initialDelaySeconds: 5 - periodSeconds: 10 - timeoutSeconds: 5 - failureThreshold: 6 - successThreshold: 1 - ## Configure extra options for readiness probe - ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes - ## @param operator.readinessProbe.enabled Turn on and off readiness probe - ## @param operator.readinessProbe.initialDelaySeconds Delay before readiness probe is initiated - ## @param operator.readinessProbe.periodSeconds How often to perform the probe - ## @param operator.readinessProbe.timeoutSeconds When the probe times out - ## @param operator.readinessProbe.failureThreshold Minimum consecutive failures for the probe - ## @param operator.readinessProbe.successThreshold Minimum consecutive successes for the probe - ## - readinessProbe: - enabled: true - path: /health - port: 8001 - initialDelaySeconds: 5 - periodSeconds: 10 - timeoutSeconds: 5 - failureThreshold: 6 - successThreshold: 1 - - -front: - - replicas: 1 - - image: - repository: rg.fr-par.scw.cloud/tezoslink/p1-frontend - tag: 0.0.5 - pullPolicy: Always - - service: - ports: - http: 8080 - - ingress: - host: p2.front.tezoslink.smart-chain.fr - tls: - hosts: - - p2.front.tezoslink.smart-chain.fr - secretName: front-tls - annotations: - kubernetes.io/ingress.class: nginx - cert-manager.io/cluster-issuer: letsencrypt-prod - nginx.ingress.kubernetes.io/from-to-www-redirect: "true" - nginx.ingress.kubernetes.io/force-ssl-redirect: "true" - - env: - - resources: - limits: {} - requests: - cpu: 100m - memory: 256Mi - -## Configure extra options for liveness probe - ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes - ## @param operator.livenessProbe.enabled Turn on and off liveness probe - ## @param operator.livenessProbe.initialDelaySeconds Delay before liveness probe is initiated - ## @param operator.livenessProbe.periodSeconds How often to perform the probe - ## @param operator.livenessProbe.timeoutSeconds When the probe times out - ## @param operator.livenessProbe.failureThreshold Minimum consecutive failures for the probe - ## @param operator.livenessProbe.successThreshold Minimum consecutive successes for the probe - ## - livenessProbe: - enabled: true - path: /health - port: 8001 - initialDelaySeconds: 5 - periodSeconds: 10 - timeoutSeconds: 5 - failureThreshold: 6 - successThreshold: 1 - ## Configure extra options for readiness probe - ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes - ## @param operator.readinessProbe.enabled Turn on and off readiness probe - ## @param operator.readinessProbe.initialDelaySeconds Delay before readiness probe is initiated - ## @param operator.readinessProbe.periodSeconds How often to perform the probe - ## @param operator.readinessProbe.timeoutSeconds When the probe times out - ## @param operator.readinessProbe.failureThreshold Minimum consecutive failures for the probe - ## @param operator.readinessProbe.successThreshold Minimum consecutive successes for the probe - ## - readinessProbe: - enabled: true - path: /health - port: 8001 - initialDelaySeconds: 5 - periodSeconds: 10 - timeoutSeconds: 5 - failureThreshold: 6 - successThreshold: 1 - - -proxy: - testnet: - enabled : true - replicaCount: 1 - network: "mainnet" - image: - repository: rg.fr-par.scw.cloud/tezoslink/p1-proxy - pullPolicy: IfNotPresent - # Overrides the image tag whose default is the chart appVersion. - tag: "0.1.0" - - env: - DATABASE_USERNAME: "tz-backend" - DATABASE_PASSWORD: "Titi123!" - DATABASE_URL: "tezoslink-postgresql.tezoslink-postgresql.svc.cluster.local:5432" - ARCHIVE_NODES_URL: "archive-node.poc-tzk8s.svc.cluster.local" - TEZOS_ARCHIVE_PORT: "8732" - ROLLING_NODES_URL: "rolling-node.poc-tzk8s.svc.cluster.local" - TEZOS_ROLLING_PORT: "8732" - TEZOS_NETWORK: "mainnet" - serviceAccount: - # Specifies whether a service account should be created - create: true - # Annotations to add to the service account - annotations: {} - # The name of the service account to use. - # If not set and create is true, a name is generated using the fullname template - name: "" - ## @param Automount service account token for the server service account - ## - automountServiceAccountToken: true - - ## Proxy Service - ## - service: - ## @param proxy.service.type Kubernetes service type - ## - type: ClusterIP - ## @param proxy.service.ports.http proxy service port - ## - ports: - http: 8001 - ## @param proxy.service.clusterIP Specific cluster IP when service type is cluster IP. Use `None` for headless service - ## e.g: - ## clusterIP: None - ## - clusterIP: "" - ## @param proxy.service.nodePorts.http Kubernetes Service nodePort - ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport - ## e.g: - ## nodePort: 30080 - ## - nodePorts: - http: "" - ## @param proxy.service.loadBalancerIP `loadBalancerIP` if service type is `LoadBalancer` - ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer - ## - loadBalancerIP: "" - ## @param proxy.service.loadBalancerSourceRanges Address that are allowed when svc is `LoadBalancer` - ## Set the LoadBalancer service type to internal only - ## https://kubernetes.io/docs/tasks/access-application-cluster/configure-cloud-provider-firewall/#restrict-access-for-loadbalancer-service - ## e.g: - ## loadBalancerSourceRanges: - ## - 10.10.10.0/24 - ## - loadBalancerSourceRanges: [] - ## @param proxy.service.externalTrafficPolicy Enable client source IP preservation - ## Denotes if this Service desires to route external traffic to node-local or cluster-wide endpoints - ## There are two available options: Cluster (default) and Local. - ## ref: https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip - ## - externalTrafficPolicy: Cluster - ## @param proxy.service.healthCheckNodePort Specifies the health check node port (numeric port number) for the service if `externalTrafficPolicy` is set to Local. - ## ref: https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip - ## - healthCheckNodePort: "" - ## @param proxy.service.annotations Additional annotations for proxy service - ## - annotations: {} - ## @param proxy.service.extraPorts Extra ports to expose (normally used with the `sidecar` value) - ## - extraPorts: [] - ## @param proxy.service.sessionAffinity Session Affinity for Kubernetes service, can be "None" or "ClientIP" - ## If "ClientIP", consecutive client requests will be directed to the same Pod - ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies - ## - sessionAffinity: None - ## @param proxy.service.sessionAffinityConfig Additional settings for the sessionAffinity - ## sessionAffinityConfig: - ## clientIP: - ## timeoutSeconds: 300 - ## - sessionAffinityConfig: {} - - ingress: - host: p2.proxy.tezoslink.smart-chain.fr - tls: - hosts: - - p2.proxy.tezoslink.smart-chain.fr - secretName: proxy-tls - annotations: - kubernetes.io/ingress.class: nginx - cert-manager.io/cluster-issuer: letsencrypt-prod - nginx.ingress.kubernetes.io/from-to-www-redirect: "true" - nginx.ingress.kubernetes.io/force-ssl-redirect: "true" - - ## Proxy pods' Security Context - ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod - ## @param proxy.podSecurityContext.enabled Enable pod security context - ## @param proxy.podSecurityContext.runAsUser User ID for the container - ## @param proxy.podSecurityContext.fsGroup Group ID for the container filesystem - ## - podSecurityContext: - enabled: true - runAsUser: 1000 - ## Prometheus proxy containers' Security Context (only main container) - ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container - ## @param proxy.containerSecurityContext.enabled Enable container security context - ## @param proxy.containerSecurityContext.capabilities.drop [array] Linux Kernel capabilities which should be dropped - ## @param proxy.containerSecurityContext.runAsNonRoot Force the container to run as a non root user - ## @param proxy.containerSecurityContext.allowPrivilegeEscalation Switch privilegeEscalation possibility on or off - ## @param proxy.containerSecurityContext.readOnlyRootFilesystem Mount / (root) as a readonly filesystem - ## - containerSecurityContext: - enabled: true - capabilities: - drop: - - ALL - runAsNonRoot: true - allowPrivilegeEscalation: false - readOnlyRootFilesystem: false - - ## Configure extra options for liveness probe - ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes - ## @param operator.livenessProbe.enabled Turn on and off liveness probe - ## @param operator.livenessProbe.initialDelaySeconds Delay before liveness probe is initiated - ## @param operator.livenessProbe.periodSeconds How often to perform the probe - ## @param operator.livenessProbe.timeoutSeconds When the probe times out - ## @param operator.livenessProbe.failureThreshold Minimum consecutive failures for the probe - ## @param operator.livenessProbe.successThreshold Minimum consecutive successes for the probe - ## - livenessProbe: - enabled: true - path: /health - port: 8001 - initialDelaySeconds: 5 - periodSeconds: 10 - timeoutSeconds: 5 - failureThreshold: 6 - successThreshold: 1 - ## Configure extra options for readiness probe - ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes - ## @param operator.readinessProbe.enabled Turn on and off readiness probe - ## @param operator.readinessProbe.initialDelaySeconds Delay before readiness probe is initiated - ## @param operator.readinessProbe.periodSeconds How often to perform the probe - ## @param operator.readinessProbe.timeoutSeconds When the probe times out - ## @param operator.readinessProbe.failureThreshold Minimum consecutive failures for the probe - ## @param operator.readinessProbe.successThreshold Minimum consecutive successes for the probe - ## - readinessProbe: - enabled: true - path: /health - port: 8001 - initialDelaySeconds: 5 - periodSeconds: 10 - timeoutSeconds: 5 - failureThreshold: 6 - successThreshold: 1 - - ## Resource requests and limits - ## ref: https://kubernetes.io/docs/user-guide/compute-resources/ - ## choice for the user. This also increases chances charts run on environments with little - ## resources, such as Minikube. If you do want to specify resources, uncomment the following - ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. - ## @param resources.limits The resources limits for the container - ## @param resources.requests The requested resources for the container - ## - resources: - limits: {} - requests: - cpu: 100m - memory: 256Mi - - # mainnet: - # enabled : false - # replicaCount: 1 - # network: "mainnet" - # image: - # repository: rg.fr-par.scw.cloud/tezoslink/p1-proxy - # pullPolicy: IfNotPresent - # # Overrides the image tag whose default is the chart appVersion. - # tag: "0.1.0" - - # env: - # DATABASE_USERNAME: "tz-backend" - # DATABASE_PASSWORD: "Titi123!" - # DATABASE_URL: "tezoslink-postgresql.tezoslink-postgresql.svc.cluster.local:5432" - # ARCHIVE_NODES_URL: "archive-node.poc-tzk8s.svc.cluster.local" - # TEZOS_ARCHIVE_PORT: "8732" - # ROLLING_NODES_URL: "rolling-node.poc-tzk8s.svc.cluster.local" - # TEZOS_ROLLING_PORT: "8732" - # TEZOS_NETWORK: "mainnet" - # serviceAccount: - # # Specifies whether a service account should be created - # create: true - # # Annotations to add to the service account - # annotations: {} - # # The name of the service account to use. - # # If not set and create is true, a name is generated using the fullname template - # name: "" - # ## @param Automount service account token for the server service account - # ## - # automountServiceAccountToken: true - - # ## Proxy Service - # ## - # service: - # ## @param proxy.service.type Kubernetes service type - # ## - # type: ClusterIP - # ## @param proxy.service.ports.http proxy service port - # ## - # ports: - # http: 8001 - # ## @param proxy.service.clusterIP Specific cluster IP when service type is cluster IP. Use `None` for headless service - # ## e.g: - # ## clusterIP: None - # ## - # clusterIP: "" - # ## @param proxy.service.nodePorts.http Kubernetes Service nodePort - # ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport - # ## e.g: - # ## nodePort: 30080 - # ## - # nodePorts: - # http: "" - # ## @param proxy.service.loadBalancerIP `loadBalancerIP` if service type is `LoadBalancer` - # ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer - # ## - # loadBalancerIP: "" - # ## @param proxy.service.loadBalancerSourceRanges Address that are allowed when svc is `LoadBalancer` - # ## Set the LoadBalancer service type to internal only - # ## https://kubernetes.io/docs/tasks/access-application-cluster/configure-cloud-provider-firewall/#restrict-access-for-loadbalancer-service - # ## e.g: - # ## loadBalancerSourceRanges: - # ## - 10.10.10.0/24 - # ## - # loadBalancerSourceRanges: [] - # ## @param proxy.service.externalTrafficPolicy Enable client source IP preservation - # ## Denotes if this Service desires to route external traffic to node-local or cluster-wide endpoints - # ## There are two available options: Cluster (default) and Local. - # ## ref: https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip - # ## - # externalTrafficPolicy: Cluster - # ## @param proxy.service.healthCheckNodePort Specifies the health check node port (numeric port number) for the service if `externalTrafficPolicy` is set to Local. - # ## ref: https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip - # ## - # healthCheckNodePort: "" - # ## @param proxy.service.annotations Additional annotations for proxy service - # ## - # annotations: {} - # ## @param proxy.service.extraPorts Extra ports to expose (normally used with the `sidecar` value) - # ## - # extraPorts: [] - # ## @param proxy.service.sessionAffinity Session Affinity for Kubernetes service, can be "None" or "ClientIP" - # ## If "ClientIP", consecutive client requests will be directed to the same Pod - # ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies - # ## - # sessionAffinity: None - # ## @param proxy.service.sessionAffinityConfig Additional settings for the sessionAffinity - # ## sessionAffinityConfig: - # ## clientIP: - # ## timeoutSeconds: 300 - # ## - # sessionAffinityConfig: {} - - # ## Proxy pods' Security Context - # ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod - # ## @param proxy.podSecurityContext.enabled Enable pod security context - # ## @param proxy.podSecurityContext.runAsUser User ID for the container - # ## @param proxy.podSecurityContext.fsGroup Group ID for the container filesystem - # ## - # podSecurityContext: - # enabled: true - # runAsUser: 1000 - # ## Prometheus proxy containers' Security Context (only main container) - # ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container - # ## @param proxy.containerSecurityContext.enabled Enable container security context - # ## @param proxy.containerSecurityContext.capabilities.drop [array] Linux Kernel capabilities which should be dropped - # ## @param proxy.containerSecurityContext.runAsNonRoot Force the container to run as a non root user - # ## @param proxy.containerSecurityContext.allowPrivilegeEscalation Switch privilegeEscalation possibility on or off - # ## @param proxy.containerSecurityContext.readOnlyRootFilesystem Mount / (root) as a readonly filesystem - # ## - # containerSecurityContext: - # enabled: true - # capabilities: - # drop: - # - ALL - # runAsNonRoot: true - # allowPrivilegeEscalation: false - # readOnlyRootFilesystem: false - - # ## Configure extra options for liveness probe - # ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes - # ## @param operator.livenessProbe.enabled Turn on and off liveness probe - # ## @param operator.livenessProbe.initialDelaySeconds Delay before liveness probe is initiated - # ## @param operator.livenessProbe.periodSeconds How often to perform the probe - # ## @param operator.livenessProbe.timeoutSeconds When the probe times out - # ## @param operator.livenessProbe.failureThreshold Minimum consecutive failures for the probe - # ## @param operator.livenessProbe.successThreshold Minimum consecutive successes for the probe - # ## - # livenessProbe: - # enabled: true - # path: /health - # port: 8001 - # initialDelaySeconds: 5 - # periodSeconds: 10 - # timeoutSeconds: 5 - # failureThreshold: 6 - # successThreshold: 1 - # ## Configure extra options for readiness probe - # ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes - # ## @param operator.readinessProbe.enabled Turn on and off readiness probe - # ## @param operator.readinessProbe.initialDelaySeconds Delay before readiness probe is initiated - # ## @param operator.readinessProbe.periodSeconds How often to perform the probe - # ## @param operator.readinessProbe.timeoutSeconds When the probe times out - # ## @param operator.readinessProbe.failureThreshold Minimum consecutive failures for the probe - # ## @param operator.readinessProbe.successThreshold Minimum consecutive successes for the probe - # ## - # readinessProbe: - # enabled: true - # path: /health - # port: 8001 - # initialDelaySeconds: 5 - # periodSeconds: 10 - # timeoutSeconds: 5 - # failureThreshold: 6 - # successThreshold: 1 - - # ## Resource requests and limits - # ## ref: https://kubernetes.io/docs/user-guide/compute-resources/ - # ## choice for the user. This also increases chances charts run on environments with little - # ## resources, such as Minikube. If you do want to specify resources, uncomment the following - # ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # ## @param resources.limits The resources limits for the container - # ## @param resources.requests The requested resources for the container - # ## - # resources: - # limits: {} - # requests: - # cpu: 100m - # memory: 256Mi \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 4fb26d00..1cd68512 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "lecoffre", + "name": "lecoffre-back", "version": "1.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "lecoffre", + "name": "lecoffre-back", "version": "1.0.0", "license": "ISC", "dependencies": { @@ -20,6 +20,7 @@ "le-coffre-ressources": "github.com:smart-chain-fr/leCoffre-resources.git", "module-alias": "^2.2.2", "next": "^13.1.5", + "node-cache": "^5.1.2", "node-schedule": "^2.1.1", "prisma-query": "^2.0.0", "reflect-metadata": "^0.1.13", @@ -431,6 +432,14 @@ "version": "0.0.1", "license": "MIT" }, + "node_modules/clone": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", + "integrity": "sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==", + "engines": { + "node": ">=0.8" + } + }, "node_modules/combined-stream": { "version": "1.0.8", "license": "MIT", @@ -994,6 +1003,17 @@ } } }, + "node_modules/node-cache": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/node-cache/-/node-cache-5.1.2.tgz", + "integrity": "sha512-t1QzWwnk4sjLWaQAS8CHgOJ+RAfmHpxFWmc36IWTiWHQfs0w5JDMBS1b1ZxQteo0vVVuWJvIUKHDkkeK7vIGCg==", + "dependencies": { + "clone": "2.x" + }, + "engines": { + "node": ">= 8.0.0" + } + }, "node_modules/node-schedule": { "version": "2.1.1", "license": "MIT", @@ -1838,6 +1858,11 @@ "client-only": { "version": "0.0.1" }, + "clone": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", + "integrity": "sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==" + }, "combined-stream": { "version": "1.0.8", "requires": { @@ -2157,6 +2182,14 @@ "styled-jsx": "5.1.1" } }, + "node-cache": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/node-cache/-/node-cache-5.1.2.tgz", + "integrity": "sha512-t1QzWwnk4sjLWaQAS8CHgOJ+RAfmHpxFWmc36IWTiWHQfs0w5JDMBS1b1ZxQteo0vVVuWJvIUKHDkkeK7vIGCg==", + "requires": { + "clone": "2.x" + } + }, "node-schedule": { "version": "2.1.1", "requires": { diff --git a/package.json b/package.json index d0407373..bc3e47db 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "lecoffre", + "name": "lecoffre-back", "version": "1.0.0", "description": "lecoffre project", "_moduleAliases": { @@ -47,6 +47,7 @@ "le-coffre-ressources": "github.com:smart-chain-fr/leCoffre-resources.git", "module-alias": "^2.2.2", "next": "^13.1.5", + "node-cache": "^5.1.2", "node-schedule": "^2.1.1", "prisma-query": "^2.0.0", "reflect-metadata": "^0.1.13", diff --git a/temp.yaml b/temp.yaml new file mode 100644 index 00000000..a34b777c --- /dev/null +++ b/temp.yaml @@ -0,0 +1,124 @@ +--- +# Source: leCoffre-back/templates/service-account.yaml +apiVersion: v1 +kind: ServiceAccount +metadata: + name: lecoffre-back-sa +--- +# Source: leCoffre-back/templates/service-account.yaml +apiVersion: v1 +kind: Secret +metadata: + name: lecoffre-back-sa-token + annotations: + kubernetes.io/service-account.name: lecoffre-back-sa +type: kubernetes.io/service-account-token +--- +# Source: leCoffre-back/templates/lecoffre-back.yaml +apiVersion: v1 +kind: Service +metadata: + name: lecoffre-back-svc + namespace: lecoffre + labels: +spec: + ports: + - port: 80 + name: http + targetPort: 1337 + selector: + app: lecoffre-back +--- +# Source: leCoffre-back/templates/lecoffre-back.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: lecoffre-back + namespace: lecoffre + labels: + app: lecoffre-back +spec: + replicas: 1 + selector: + matchLabels: + app: lecoffre-back + template: + metadata: + annotations: + vault.hashicorp.com/agent-inject: "true" + vault.hashicorp.com/agent-inject-secret-envs-api: secret/data/lecoffre-back-stg/config/envs-api + vault.hashicorp.com/agent-inject-template-envs-api: | + {{ with secret "secret/data/lecoffre-back-stg/config/envs-api" }} + {{ range $k, $v := .Data.data }} + export {{ $k }}="{{ $v }}" + {{ end }} + {{ end }} + vault.hashicorp.com/agent-pre-populate-only: "true" + vault.hashicorp.com/role: custom_lecoffre-back_injector_rol + labels: + app: lecoffre-back + spec: + serviceAccountName: lecoffre-back-sa + imagePullSecrets: + - name: docker-pull-secret + containers: + - name: lecoffre-back + image: "rg.fr-par.scw.cloud/lecoffre/back:v0.3.2" + + resources: + limits: + memory: 2Gi + requests: + cpu: 200m + memory: 1Gi + + imagePullPolicy: Always + command: ['sh', '-c', '. /vault/secrets/envs-api && npm start'] +--- +# Source: leCoffre-back/templates/lecoffre-back.yaml +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: lecoffre-back + namespace: lecoffre + + annotations: + cert-manager.io/cluster-issuer: letsencrypt-prod + kubernetes.io/ingress.class: nginx + nginx.ingress.kubernetes.io/force-ssl-redirect: "true" + nginx.ingress.kubernetes.io/from-to-www-redirect: "true" + +spec: + + rules: + - host: api.stg.lecoffre.smart-chain.fr + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: lecoffre-back-svc + port: + number: 80 +--- +# Source: leCoffre-back/templates/docker-pull-secret.yaml +apiVersion: external-secrets.io/v1beta1 +kind: ExternalSecret +metadata: + name: docker-pull-secret +spec: + refreshInterval: 1h + secretStoreRef: + name: dockerpullsecret-vault-cluster-secret-store + kind: ClusterSecretStore + target: + template: + type: kubernetes.io/dockerconfigjson + name: docker-pull-secret + creationPolicy: Owner + data: + - secretKey: .dockerconfigjson + remoteRef: + key: secret/data/minteed-stg/config/dockerpullsecret + property: .dockerconfigjson From 4f863827fddfd73766a703ab9ff7a6370c05f535 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Afi=20Elolo=20Gis=C3=A8le=20Dekpe?= <49388828+gisele-igore@users.noreply.github.com> Date: Wed, 5 Apr 2023 16:27:37 +0200 Subject: [PATCH 02/72] Delete .ssh directory --- .ssh/id_rsa | 39 --------------------------------------- .ssh/id_rsa.pub | 1 - 2 files changed, 40 deletions(-) delete mode 100644 .ssh/id_rsa delete mode 100644 .ssh/id_rsa.pub diff --git a/.ssh/id_rsa b/.ssh/id_rsa deleted file mode 100644 index 7ce0a91c..00000000 --- a/.ssh/id_rsa +++ /dev/null @@ -1,39 +0,0 @@ ------BEGIN OPENSSH PRIVATE KEY----- -b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn -NhAAAAAwEAAQAAAYEAznzhT70DcOV4Lhbl9WDbxA/LpT/rSAP+ccOyx3ANIEY94cCCwgBA -I7g7Pndd8wrJxG9MnfpWk9z1PYkSCmtvE8p7vrE4xg8n8fDF/x4ybWxM8neoy5/O7k78P+ -pc4NsuWQxGujxKqzyL9ChIbquh7lPKgANJwabEyAFEyt10fKptyOifUbNScgY7yD+VHiAg -Kb6C5oB7s+pinb6EPKig1mprC+KUnOB6+x5UPCEzYZ8kvFzIECJ1PyNk80/yOA8ceSHhVE -OSjnySTYCtXfjwci0llK5/nkV5IvJtYYzIsBiHoVQK4hVtQt9PUhB8Sx40ClD1x0r+JB+8 -6ozvqd5GOYMKf5b7AUUp4oY/LNZQA7CZTKo50i3iEPrGNgjZJl1yPAAZM4biSkxk5fvKcx -hoSB83lO3u5aUp94C5+Kdte5CKaRzQK+nWR/VGmG4J8FaJ8K+XC22rUTxciNTX1yg8mbUm -JRkMS0FLfSg6zb1U2c2k7d2MDP2ArESAAwGoCqLDAAAFoN/WlNbf1pTWAAAAB3NzaC1yc2 -EAAAGBAM584U+9A3DleC4W5fVg28QPy6U/60gD/nHDssdwDSBGPeHAgsIAQCO4Oz53XfMK -ycRvTJ36VpPc9T2JEgprbxPKe76xOMYPJ/Hwxf8eMm1sTPJ3qMufzu5O/D/qXODbLlkMRr -o8Sqs8i/QoSG6roe5TyoADScGmxMgBRMrddHyqbcjon1GzUnIGO8g/lR4gICm+guaAe7Pq -Yp2+hDyooNZqawvilJzgevseVDwhM2GfJLxcyBAidT8jZPNP8jgPHHkh4VRDko58kk2ArV -348HItJZSuf55FeSLybWGMyLAYh6FUCuIVbULfT1IQfEseNApQ9cdK/iQfvOqM76neRjmD -Cn+W+wFFKeKGPyzWUAOwmUyqOdIt4hD6xjYI2SZdcjwAGTOG4kpMZOX7ynMYaEgfN5Tt7u -WlKfeAufinbXuQimkc0Cvp1kf1RphuCfBWifCvlwttq1E8XIjU19coPJm1JiUZDEtBS30o -Os29VNnNpO3djAz9gKxEgAMBqAqiwwAAAAMBAAEAAAGADtL2VgQq2BMRUrXAIqKmhGfh5e -Y13QC0ZrR3BExuFNAWJzvr50OfVzElx7FIJGe03o5jAMB1ML5fOOC7U9Ysrk4OHj2Y5tc1 -te/kNxGS6zooOAwRKTU65O70ux33NwllRW1VMo+biLmbDpdJw/A8euC3HAOgau+vFvDIYI -wPjdeqdA8HSRVHqPn7lr/B09zYkkakHSpCN0NvewWvdq9ghKQ1NTA6HR0clySxRXPYvXxw -Zbl/f3EJ29ONrs4hhJbJAn5chercEGHpCQyXlL+9M595XHPox7bAPCOu7JEZLdRsXfjhgL -5Hk1zK68f10K/P8HyMJGscP+wq7hyBWEFnqWmXbp86pNXZqSuFuyc9MCUGF1wzX0yKIMmD -98/EY1OZnPhZ9cvCKB8DhNMHeK/h1Sf0P4ON28N5KYKD0McG+8XOptX5zbkGXT4AI6BnW/ -8uon3JP4WVmUNR8S6vy+/+E6qSEvGmljHnjYwS/+84o7pG9S6pR5xBgwdfv+UNVHKpAAAA -wD4SYRQYWb594TFdGS3lAM3j7TIV1jEWy99QPbOSh477lIJE+ySXXEKp02M1OoWR7QFRNi -TwwIh/s7nRaLq9m1tXZF73Qm0FeX9vfiHXPL9u2dJMqjGSXVvjT8UhnEUWykZHV2VO6pk2 -q311zGc5M3vDsHzvTZV0XqfANIPFNqGMGCrPx/22rBkGJ8Ll/Y0v+7i3adqxfTOAl3/MWI -enh4wrCiM2gqBrYfhyGSH3oU1TIKqWt5F9ruCTgsnYgfhy3QAAAMEA7Nsrjrr0kJXP09BV -WI6B5TTU/w4ViWVxqrblt0sQwU3ntm/awdKOGHepvgvuKNN2CC5KlfXfnwt5uJEMJuTbo9 -hokYpgZFUw69VrBSQK3J/ged7Cp1sWOhCotvy0xuUaURKqsaJF7nlMI1BqnoTZrjoUhYP2 -B20dQ9uZnAGfT1Bv63tK9OMVwIVp4wz7yApxpgI5By2ryoL0KsEVXuIkkOnxUKlDZLGf/W -+Qreq8HCrYkodZiCZATaAZeGfbsZePAAAAwQDfLVqejh0Us1+rKwEp9kTMYCFcQ3gV4UiM -28O4ZvLq11iQcreE4KTbfXMpwtmC4+1iJJfhAmEdu0FicJLjgvhHW0Gqp0cXAcrErYPc/i -dejVznWJDSW3ORgak0MYLS7d9sJ1Pye6f0YavJHUsPpYndid56VzwaDVd2V6Dq1ICYRBtT -iadmpQbQABU04xiw8jqyXDOPVOKWnc+AfBCtf5rM9jRd1l+gEsIACne9b92EnlqPX6O7VK -kKGE5sThn2x40AAAAlZ2lzZWxlLXNtYXJ0Y2hhaW5ATWFjQm9vay1Qcm8tNi5sb2NhbAEC -AwQFBg== ------END OPENSSH PRIVATE KEY----- diff --git a/.ssh/id_rsa.pub b/.ssh/id_rsa.pub deleted file mode 100644 index e1327d66..00000000 --- a/.ssh/id_rsa.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDOfOFPvQNw5XguFuX1YNvED8ulP+tIA/5xw7LHcA0gRj3hwILCAEAjuDs+d13zCsnEb0yd+laT3PU9iRIKa28Tynu+sTjGDyfx8MX/HjJtbEzyd6jLn87uTvw/6lzg2y5ZDEa6PEqrPIv0KEhuq6HuU8qAA0nBpsTIAUTK3XR8qm3I6J9Rs1JyBjvIP5UeICApvoLmgHuz6mKdvoQ8qKDWamsL4pSc4Hr7HlQ8ITNhnyS8XMgQInU/I2TzT/I4Dxx5IeFUQ5KOfJJNgK1d+PByLSWUrn+eRXki8m1hjMiwGIehVAriFW1C309SEHxLHjQKUPXHSv4kH7zqjO+p3kY5gwp/lvsBRSnihj8s1lADsJlMqjnSLeIQ+sY2CNkmXXI8ABkzhuJKTGTl+8pzGGhIHzeU7e7lpSn3gLn4p217kIppHNAr6dZH9UaYbgnwVonwr5cLbatRPFyI1NfXKDyZtSYlGQxLQUt9KDrNvVTZzaTt3YwM/YCsRIADAagKosM= gisele-smartchain@MacBook-Pro-6.local From 3dc043e6c48d732ff0ecaa466e961d5a34638523 Mon Sep 17 00:00:00 2001 From: "Arnaud D. Natali" <79214488+0xSaitama@users.noreply.github.com> Date: Thu, 6 Apr 2023 18:43:13 +0200 Subject: [PATCH 03/72] Feature/services test (#17) controllers, repositories, services and associated tests for: Deed types, Deed, Document types, Users and Customers --------- Co-authored-by: Vincent Alamelle Co-authored-by: OxSaitama --- .env.test | 4 + docker-compose-test.yml | 12 + docker-compose.yml | 2 +- jest.config.js | 19 + package-lock.json | 2517 ----------------- package.json | 19 +- src/app/HomeController.ts | 3 - src/app/api/CustomersController.ts | 81 - src/app/api/DeedTypesController.ts | 81 - src/app/api/DeedsController.ts | 81 - src/app/api/DocumentTypesController.ts | 81 - src/app/api/FoldersController.ts | 81 - src/app/api/OfficesController.ts | 81 - src/app/api/UsersController.ts | 81 - src/app/api/projects/UserController.ts | 18 - .../api/super-admin/CustomersController.ts | 131 + .../api/super-admin/DeedTypesController.ts | 132 + src/app/api/super-admin/DeedsController.ts | 56 + .../super-admin/DocumentTypesController.ts | 131 + .../{ => super-admin}/DocumentsController.ts | 55 +- .../super-admin/OfficeFoldersController.ts | 97 + src/app/api/super-admin/OfficesController.ts | 114 + src/app/api/super-admin/UsersController.ts | 132 + src/app/index.ts | 16 +- src/app/middlewares/ErrorHandler.ts | 3 +- src/common/config/database/IDatabaseConfig.ts | 8 +- src/common/config/variables/Variables.ts | 1 - src/common/databases/database.ts | 1 - .../20230321102005_v0/migration.sql | 413 +++ .../migration.sql | 92 + .../20230324130335_20230324_v2/migration.sql | 2 + .../20230324171729_v3/migration.sql | 119 + .../20230328095747_v4/migration.sql | 8 + .../20230329084446_v5/migration.sql | 8 + .../20230329145139_v6/migration.sql | 15 + .../20230330150236_v8/migration.sql | 24 + src/common/databases/schema.prisma | 144 +- src/common/helpers/ObjectHydrate.ts | 26 +- .../repositories/AddressesRepository.ts | 35 + src/common/repositories/ContactRepository.ts | 26 + .../repositories/CustomersRepository.ts | 93 + .../DeedTypesHasDocumentTypesRepository.ts | 112 + .../repositories/DeedTypesRepository.ts | 117 + .../DeedsHasDocumentTypesRepository.ts | 112 + src/common/repositories/DeedsRepository.ts | 90 + .../repositories/DocumentTypesRepository.ts | 77 + .../repositories/DocumentsRepository.ts | 26 + .../repositories/OfficeFoldersRepository.ts | 107 + src/common/repositories/OfficesRepository.ts | 101 + src/common/repositories/UsersRepository.ts | 135 + .../_TemplateRepository.ts | 82 - src/common/system/ExpressServer.ts | 1 - src/common/system/ExpressServerTest.ts | 39 + src/common/system/ServerInterface.ts | 1 - .../controller-pattern/ApiController.ts | 1 - .../controller-pattern/BaseController.ts | 2 - .../system/controller-pattern/Controller.ts | 1 - .../system/controller-pattern/ErrorCatch.ts | 1 - .../system/controller-pattern/HttpCodes.ts | 20 +- .../system/controller-pattern/Methods.ts | 8 +- .../system/controller-pattern/StRoute.ts | 1 - .../exceptions/HttpException.ts | 14 +- src/common/system/database/DbProvider.ts | 68 +- .../database/exceptions/ORMBadQueryError.ts | 2 +- src/common/system/database/index.ts | 2 +- src/entries/App.ts | 3 +- src/services/BaseService.ts | 2 - .../CustomersService/CustomersService.ts | 57 - .../DeedTypesService/DeedTypesService.ts | 57 - src/services/DeedsService/DeedsService.ts | 57 - .../DocumentTypesService.ts | 57 - src/services/FoldersService/FoldersService.ts | 57 - src/services/OfficesService/OfficesService.ts | 58 - src/services/UsersService/UsersService.ts | 57 - .../AddressesService/AddressesService.ts | 28 +- .../ContactsService/ContactsService.ts | 2 +- .../FilesService/FilesService.ts | 2 +- .../NotificationsService.ts | 2 +- .../CustomersService/CustomersService.ts | 44 + .../DeedTypesService/DeedTypesService.ts | 78 + .../super-admin/DeedsService/DeedsService.ts | 89 + .../DocumentTypesService.ts | 45 + .../DocumentsService/DocumentsService.ts | 31 +- .../OfficeFoldersService.ts | 67 + .../OfficesService/OfficesService.ts | 46 + .../super-admin/UsersService/UsersService.ts | 45 + .../super-admin/CustomersService.test.ts | 167 ++ .../services/super-admin/DeedService.test.ts | 264 ++ .../super-admin/DeedTypesService.test.ts | 406 +++ .../super-admin/DocumentTypesService.test.ts | 299 ++ src/test/services/super-admin/MockedData.ts | 162 ++ .../services/super-admin/UsersService.test.ts | 226 ++ tsconfig.json | 7 +- 93 files changed, 4769 insertions(+), 3809 deletions(-) create mode 100644 .env.test create mode 100644 docker-compose-test.yml create mode 100644 jest.config.js delete mode 100644 package-lock.json delete mode 100644 src/app/api/CustomersController.ts delete mode 100644 src/app/api/DeedTypesController.ts delete mode 100644 src/app/api/DeedsController.ts delete mode 100644 src/app/api/DocumentTypesController.ts delete mode 100644 src/app/api/FoldersController.ts delete mode 100644 src/app/api/OfficesController.ts delete mode 100644 src/app/api/UsersController.ts delete mode 100644 src/app/api/projects/UserController.ts create mode 100644 src/app/api/super-admin/CustomersController.ts create mode 100644 src/app/api/super-admin/DeedTypesController.ts create mode 100644 src/app/api/super-admin/DeedsController.ts create mode 100644 src/app/api/super-admin/DocumentTypesController.ts rename src/app/api/{ => super-admin}/DocumentsController.ts (50%) create mode 100644 src/app/api/super-admin/OfficeFoldersController.ts create mode 100644 src/app/api/super-admin/OfficesController.ts create mode 100644 src/app/api/super-admin/UsersController.ts create mode 100644 src/common/databases/migrations/20230321102005_v0/migration.sql create mode 100644 src/common/databases/migrations/20230324125436_20230324102005_v1/migration.sql create mode 100644 src/common/databases/migrations/20230324130335_20230324_v2/migration.sql create mode 100644 src/common/databases/migrations/20230324171729_v3/migration.sql create mode 100644 src/common/databases/migrations/20230328095747_v4/migration.sql create mode 100644 src/common/databases/migrations/20230329084446_v5/migration.sql create mode 100644 src/common/databases/migrations/20230329145139_v6/migration.sql create mode 100644 src/common/databases/migrations/20230330150236_v8/migration.sql create mode 100644 src/common/repositories/AddressesRepository.ts create mode 100644 src/common/repositories/ContactRepository.ts create mode 100644 src/common/repositories/CustomersRepository.ts create mode 100644 src/common/repositories/DeedTypesHasDocumentTypesRepository.ts create mode 100644 src/common/repositories/DeedTypesRepository.ts create mode 100644 src/common/repositories/DeedsHasDocumentTypesRepository.ts create mode 100644 src/common/repositories/DeedsRepository.ts create mode 100644 src/common/repositories/DocumentTypesRepository.ts create mode 100644 src/common/repositories/DocumentsRepository.ts create mode 100644 src/common/repositories/OfficeFoldersRepository.ts create mode 100644 src/common/repositories/OfficesRepository.ts create mode 100644 src/common/repositories/UsersRepository.ts delete mode 100644 src/common/repositories/_TemplateRepository/_TemplateRepository.ts create mode 100644 src/common/system/ExpressServerTest.ts delete mode 100644 src/services/CustomersService/CustomersService.ts delete mode 100644 src/services/DeedTypesService/DeedTypesService.ts delete mode 100644 src/services/DeedsService/DeedsService.ts delete mode 100644 src/services/DocumentTypesService/DocumentTypesService.ts delete mode 100644 src/services/FoldersService/FoldersService.ts delete mode 100644 src/services/OfficesService/OfficesService.ts delete mode 100644 src/services/UsersService/UsersService.ts rename src/services/{ => private-services}/AddressesService/AddressesService.ts (66%) rename src/services/{ => private-services}/ContactsService/ContactsService.ts (99%) rename src/services/{ => private-services}/FilesService/FilesService.ts (99%) rename src/services/{ => private-services}/NotificationsService/NotificationsService.ts (99%) create mode 100644 src/services/super-admin/CustomersService/CustomersService.ts create mode 100644 src/services/super-admin/DeedTypesService/DeedTypesService.ts create mode 100644 src/services/super-admin/DeedsService/DeedsService.ts create mode 100644 src/services/super-admin/DocumentTypesService/DocumentTypesService.ts rename src/services/{ => super-admin}/DocumentsService/DocumentsService.ts (62%) create mode 100644 src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts create mode 100644 src/services/super-admin/OfficesService/OfficesService.ts create mode 100644 src/services/super-admin/UsersService/UsersService.ts create mode 100644 src/test/services/super-admin/CustomersService.test.ts create mode 100644 src/test/services/super-admin/DeedService.test.ts create mode 100644 src/test/services/super-admin/DeedTypesService.test.ts create mode 100644 src/test/services/super-admin/DocumentTypesService.test.ts create mode 100644 src/test/services/super-admin/MockedData.ts create mode 100644 src/test/services/super-admin/UsersService.test.ts diff --git a/.env.test b/.env.test new file mode 100644 index 00000000..0e84c552 --- /dev/null +++ b/.env.test @@ -0,0 +1,4 @@ +DATABASE_URL="postgresql://prisma:prisma@localhost:5433/tests" +POSTGRES_USER=prisma +POSTGRES_PASSWORD=prisma +POSTGRES_DB: tests \ No newline at end of file diff --git a/docker-compose-test.yml b/docker-compose-test.yml new file mode 100644 index 00000000..f5f56f3b --- /dev/null +++ b/docker-compose-test.yml @@ -0,0 +1,12 @@ +version: "3.8" +services: + db: + image: postgres:13 + restart: always + container_name: integration-tests-prisma + ports: + - '5433:5432' + environment: + POSTGRES_USER: prisma + POSTGRES_PASSWORD: prisma + POSTGRES_DB: tests \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 92f5eff6..b5a05009 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -46,4 +46,4 @@ services: test: ["CMD-SHELL", "pg_isready -h localhost -U ${DATABASE_USER} -d ${DATABASE_NAME}"] interval: 5s timeout: 5s - retries: 10 \ No newline at end of file + retries: 10 diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 00000000..6784f0af --- /dev/null +++ b/jest.config.js @@ -0,0 +1,19 @@ +/** @type {import('ts-jest').JestConfigWithTsJest} */ +module.exports = { + preset: 'ts-jest', + testEnvironment: 'node', + "moduleNameMapper": { + "@Services/(.*)": "/src/services/$1", + "@App/(.*)": "/src/app/$1", + "@Api/(.*)": "/src/app/api/$1", + "@Pages/(.*)": "/src/pages/$1", + "@Common/(.*)": "/src/common/$1", + "@Repositories/(.*)": "/src/common/repositories/$1", + "@Entries/(.*)": "/src/common/entries/$1", + "@Config/(.*)": "/src/common/config/$1", + "@Entities/(.*)": "/src/common/entities/$1", + "@System/(.*)": "/src/common/system/$1", + "@ControllerPattern/(.*)": "/src/common/system/controller-pattern/$1", + "@Test/(.*)": "/src/test/$1" + } +}; \ No newline at end of file diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 1cd68512..00000000 --- a/package-lock.json +++ /dev/null @@ -1,2517 +0,0 @@ -{ - "name": "lecoffre-back", - "version": "1.0.0", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "name": "lecoffre-back", - "version": "1.0.0", - "license": "ISC", - "dependencies": { - "@prisma/client": "^4.9.0", - "axios": "^1.3.3", - "class-transformer": "^0.5.1", - "class-validator": "^0.14.0", - "classnames": "^2.3.2", - "cors": "^2.8.5", - "dotenv": "^16.0.3", - "express": "^4.18.2", - "le-coffre-ressources": "github.com:smart-chain-fr/leCoffre-resources.git", - "module-alias": "^2.2.2", - "next": "^13.1.5", - "node-cache": "^5.1.2", - "node-schedule": "^2.1.1", - "prisma-query": "^2.0.0", - "reflect-metadata": "^0.1.13", - "ts-node": "^10.9.1", - "tslib": "^2.4.1", - "typedi": "^0.10.0", - "typescript": "^4.9.4", - "uuid": "^9.0.0" - }, - "devDependencies": { - "@types/cors": "^2.8.13", - "@types/express": "^4.17.16", - "@types/node": "^18.11.18", - "@types/node-schedule": "^2.1.0", - "@types/uuid": "^9.0.0", - "nodemon": "^2.0.20", - "prettier": "2.8.4", - "prisma": "^4.11.0" - } - }, - "github.com:smart-chain-fr/leCoffre-resources.git": {}, - "node_modules/@cspotcode/source-map-support": { - "version": "0.8.1", - "license": "MIT", - "dependencies": { - "@jridgewell/trace-mapping": "0.3.9" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.0", - "license": "MIT", - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.14", - "license": "MIT" - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.9", - "license": "MIT", - "dependencies": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" - } - }, - "node_modules/@next/env": { - "version": "13.2.4", - "license": "MIT" - }, - "node_modules/@next/swc-darwin-arm64": { - "version": "13.2.4", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@prisma/client": { - "version": "4.11.0", - "hasInstallScript": true, - "license": "Apache-2.0", - "dependencies": { - "@prisma/engines-version": "4.11.0-57.8fde8fef4033376662cad983758335009d522acb" - }, - "engines": { - "node": ">=14.17" - }, - "peerDependencies": { - "prisma": "*" - }, - "peerDependenciesMeta": { - "prisma": { - "optional": true - } - } - }, - "node_modules/@prisma/engines": { - "version": "4.11.0", - "devOptional": true, - "hasInstallScript": true, - "license": "Apache-2.0" - }, - "node_modules/@prisma/engines-version": { - "version": "4.11.0-57.8fde8fef4033376662cad983758335009d522acb", - "license": "Apache-2.0" - }, - "node_modules/@swc/helpers": { - "version": "0.4.14", - "license": "MIT", - "dependencies": { - "tslib": "^2.4.0" - } - }, - "node_modules/@tsconfig/node10": { - "version": "1.0.9", - "license": "MIT" - }, - "node_modules/@tsconfig/node12": { - "version": "1.0.11", - "license": "MIT" - }, - "node_modules/@tsconfig/node14": { - "version": "1.0.3", - "license": "MIT" - }, - "node_modules/@tsconfig/node16": { - "version": "1.0.3", - "license": "MIT" - }, - "node_modules/@types/body-parser": { - "version": "1.19.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/connect": "*", - "@types/node": "*" - } - }, - "node_modules/@types/connect": { - "version": "3.4.35", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/cors": { - "version": "2.8.13", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/express": { - "version": "4.17.17", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/body-parser": "*", - "@types/express-serve-static-core": "^4.17.33", - "@types/qs": "*", - "@types/serve-static": "*" - } - }, - "node_modules/@types/express-serve-static-core": { - "version": "4.17.33", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*", - "@types/qs": "*", - "@types/range-parser": "*" - } - }, - "node_modules/@types/mime": { - "version": "3.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/node": { - "version": "18.15.3", - "license": "MIT" - }, - "node_modules/@types/node-schedule": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/qs": { - "version": "6.9.7", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/range-parser": { - "version": "1.2.4", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/serve-static": { - "version": "1.15.1", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/mime": "*", - "@types/node": "*" - } - }, - "node_modules/@types/uuid": { - "version": "9.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/validator": { - "version": "13.7.14", - "license": "MIT" - }, - "node_modules/abbrev": { - "version": "1.1.1", - "dev": true, - "license": "ISC" - }, - "node_modules/accepts": { - "version": "1.3.8", - "license": "MIT", - "dependencies": { - "mime-types": "~2.1.34", - "negotiator": "0.6.3" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/acorn": { - "version": "8.8.2", - "license": "MIT", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-walk": { - "version": "8.2.0", - "license": "MIT", - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/anymatch": { - "version": "3.1.3", - "dev": true, - "license": "ISC", - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/arg": { - "version": "4.1.3", - "license": "MIT" - }, - "node_modules/array-flatten": { - "version": "1.1.1", - "license": "MIT" - }, - "node_modules/asynckit": { - "version": "0.4.0", - "license": "MIT" - }, - "node_modules/axios": { - "version": "1.3.4", - "license": "MIT", - "dependencies": { - "follow-redirects": "^1.15.0", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" - } - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "dev": true, - "license": "MIT" - }, - "node_modules/binary-extensions": { - "version": "2.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/body-parser": { - "version": "1.20.1", - "license": "MIT", - "dependencies": { - "bytes": "3.1.2", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "on-finished": "2.4.1", - "qs": "6.11.0", - "raw-body": "2.5.1", - "type-is": "~1.6.18", - "unpipe": "1.0.0" - }, - "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" - } - }, - "node_modules/brace-expansion": { - "version": "1.1.11", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/braces": { - "version": "3.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "fill-range": "^7.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/bytes": { - "version": "3.1.2", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/call-bind": { - "version": "1.0.2", - "license": "MIT", - "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/caniuse-lite": { - "version": "1.0.30001466", - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/caniuse-lite" - } - ], - "license": "CC-BY-4.0" - }, - "node_modules/chokidar": { - "version": "3.5.3", - "dev": true, - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ], - "license": "MIT", - "dependencies": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - }, - "engines": { - "node": ">= 8.10.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, - "node_modules/class-transformer": { - "version": "0.5.1", - "license": "MIT" - }, - "node_modules/class-validator": { - "version": "0.14.0", - "license": "MIT", - "dependencies": { - "@types/validator": "^13.7.10", - "libphonenumber-js": "^1.10.14", - "validator": "^13.7.0" - } - }, - "node_modules/classnames": { - "version": "2.3.2", - "license": "MIT" - }, - "node_modules/client-only": { - "version": "0.0.1", - "license": "MIT" - }, - "node_modules/clone": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", - "integrity": "sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==", - "engines": { - "node": ">=0.8" - } - }, - "node_modules/combined-stream": { - "version": "1.0.8", - "license": "MIT", - "dependencies": { - "delayed-stream": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/concat-map": { - "version": "0.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/content-disposition": { - "version": "0.5.4", - "license": "MIT", - "dependencies": { - "safe-buffer": "5.2.1" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/content-type": { - "version": "1.0.5", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/cookie": { - "version": "0.5.0", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/cookie-signature": { - "version": "1.0.6", - "license": "MIT" - }, - "node_modules/cors": { - "version": "2.8.5", - "license": "MIT", - "dependencies": { - "object-assign": "^4", - "vary": "^1" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/create-require": { - "version": "1.1.1", - "license": "MIT" - }, - "node_modules/cron-parser": { - "version": "4.8.1", - "license": "MIT", - "dependencies": { - "luxon": "^3.2.1" - }, - "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/debug": { - "version": "2.6.9", - "license": "MIT", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "license": "MIT", - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/depd": { - "version": "2.0.0", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/destroy": { - "version": "1.2.0", - "license": "MIT", - "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" - } - }, - "node_modules/diff": { - "version": "4.0.2", - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.3.1" - } - }, - "node_modules/dotenv": { - "version": "16.0.3", - "license": "BSD-2-Clause", - "engines": { - "node": ">=12" - } - }, - "node_modules/ee-first": { - "version": "1.1.1", - "license": "MIT" - }, - "node_modules/encodeurl": { - "version": "1.0.2", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/escape-html": { - "version": "1.0.3", - "license": "MIT" - }, - "node_modules/etag": { - "version": "1.8.1", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/express": { - "version": "4.18.2", - "license": "MIT", - "dependencies": { - "accepts": "~1.3.8", - "array-flatten": "1.1.1", - "body-parser": "1.20.1", - "content-disposition": "0.5.4", - "content-type": "~1.0.4", - "cookie": "0.5.0", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "2.0.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "1.2.0", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.7", - "qs": "6.11.0", - "range-parser": "~1.2.1", - "safe-buffer": "5.2.1", - "send": "0.18.0", - "serve-static": "1.15.0", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "type-is": "~1.6.18", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - }, - "engines": { - "node": ">= 0.10.0" - } - }, - "node_modules/fill-range": { - "version": "7.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/finalhandler": { - "version": "1.2.0", - "license": "MIT", - "dependencies": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "statuses": "2.0.1", - "unpipe": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/follow-redirects": { - "version": "1.15.2", - "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.0", - "license": "MIT", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/forwarded": { - "version": "0.2.0", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/fresh": { - "version": "0.5.2", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/fsevents": { - "version": "2.3.2", - "dev": 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.1", - "license": "MIT" - }, - "node_modules/get-intrinsic": { - "version": "1.2.0", - "license": "MIT", - "dependencies": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/glob-parent": { - "version": "5.1.2", - "dev": true, - "license": "ISC", - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/has": { - "version": "1.0.3", - "license": "MIT", - "dependencies": { - "function-bind": "^1.1.1" - }, - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/has-flag": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/has-symbols": { - "version": "1.0.3", - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/http-errors": { - "version": "2.0.0", - "license": "MIT", - "dependencies": { - "depd": "2.0.0", - "inherits": "2.0.4", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "toidentifier": "1.0.1" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/iconv-lite": { - "version": "0.4.24", - "license": "MIT", - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/ignore-by-default": { - "version": "1.0.1", - "dev": true, - "license": "ISC" - }, - "node_modules/inherits": { - "version": "2.0.4", - "license": "ISC" - }, - "node_modules/ipaddr.js": { - "version": "1.9.1", - "license": "MIT", - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-glob": { - "version": "4.0.3", - "dev": true, - "license": "MIT", - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-number": { - "version": "7.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/js-tokens": { - "version": "4.0.0", - "license": "MIT", - "peer": true - }, - "node_modules/le-coffre-ressources": { - "resolved": "github.com:smart-chain-fr/leCoffre-resources.git", - "link": true - }, - "node_modules/libphonenumber-js": { - "version": "1.10.24", - "license": "MIT" - }, - "node_modules/long-timeout": { - "version": "0.1.1", - "license": "MIT" - }, - "node_modules/loose-envify": { - "version": "1.4.0", - "license": "MIT", - "peer": true, - "dependencies": { - "js-tokens": "^3.0.0 || ^4.0.0" - }, - "bin": { - "loose-envify": "cli.js" - } - }, - "node_modules/luxon": { - "version": "3.3.0", - "license": "MIT", - "engines": { - "node": ">=12" - } - }, - "node_modules/make-error": { - "version": "1.3.6", - "license": "ISC" - }, - "node_modules/media-typer": { - "version": "0.3.0", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/merge-descriptors": { - "version": "1.0.1", - "license": "MIT" - }, - "node_modules/methods": { - "version": "1.1.2", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime": { - "version": "1.6.0", - "license": "MIT", - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/mime-db": { - "version": "1.52.0", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.35", - "license": "MIT", - "dependencies": { - "mime-db": "1.52.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/minimatch": { - "version": "3.1.2", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/module-alias": { - "version": "2.2.2", - "license": "MIT" - }, - "node_modules/ms": { - "version": "2.0.0", - "license": "MIT" - }, - "node_modules/nanoid": { - "version": "3.3.4", - "license": "MIT", - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, - "node_modules/negotiator": { - "version": "0.6.3", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/next": { - "version": "13.2.4", - "license": "MIT", - "dependencies": { - "@next/env": "13.2.4", - "@swc/helpers": "0.4.14", - "caniuse-lite": "^1.0.30001406", - "postcss": "8.4.14", - "styled-jsx": "5.1.1" - }, - "bin": { - "next": "dist/bin/next" - }, - "engines": { - "node": ">=14.6.0" - }, - "optionalDependencies": { - "@next/swc-android-arm-eabi": "13.2.4", - "@next/swc-android-arm64": "13.2.4", - "@next/swc-darwin-arm64": "13.2.4", - "@next/swc-darwin-x64": "13.2.4", - "@next/swc-freebsd-x64": "13.2.4", - "@next/swc-linux-arm-gnueabihf": "13.2.4", - "@next/swc-linux-arm64-gnu": "13.2.4", - "@next/swc-linux-arm64-musl": "13.2.4", - "@next/swc-linux-x64-gnu": "13.2.4", - "@next/swc-linux-x64-musl": "13.2.4", - "@next/swc-win32-arm64-msvc": "13.2.4", - "@next/swc-win32-ia32-msvc": "13.2.4", - "@next/swc-win32-x64-msvc": "13.2.4" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.4.0", - "fibers": ">= 3.1.0", - "node-sass": "^6.0.0 || ^7.0.0", - "react": "^18.2.0", - "react-dom": "^18.2.0", - "sass": "^1.3.0" - }, - "peerDependenciesMeta": { - "@opentelemetry/api": { - "optional": true - }, - "fibers": { - "optional": true - }, - "node-sass": { - "optional": true - }, - "sass": { - "optional": true - } - } - }, - "node_modules/node-cache": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/node-cache/-/node-cache-5.1.2.tgz", - "integrity": "sha512-t1QzWwnk4sjLWaQAS8CHgOJ+RAfmHpxFWmc36IWTiWHQfs0w5JDMBS1b1ZxQteo0vVVuWJvIUKHDkkeK7vIGCg==", - "dependencies": { - "clone": "2.x" - }, - "engines": { - "node": ">= 8.0.0" - } - }, - "node_modules/node-schedule": { - "version": "2.1.1", - "license": "MIT", - "dependencies": { - "cron-parser": "^4.2.0", - "long-timeout": "0.1.1", - "sorted-array-functions": "^1.3.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/nodemon": { - "version": "2.0.21", - "dev": true, - "license": "MIT", - "dependencies": { - "chokidar": "^3.5.2", - "debug": "^3.2.7", - "ignore-by-default": "^1.0.1", - "minimatch": "^3.1.2", - "pstree.remy": "^1.1.8", - "semver": "^5.7.1", - "simple-update-notifier": "^1.0.7", - "supports-color": "^5.5.0", - "touch": "^3.1.0", - "undefsafe": "^2.0.5" - }, - "bin": { - "nodemon": "bin/nodemon.js" - }, - "engines": { - "node": ">=8.10.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/nodemon" - } - }, - "node_modules/nodemon/node_modules/debug": { - "version": "3.2.7", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/nodemon/node_modules/ms": { - "version": "2.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/nopt": { - "version": "1.0.10", - "dev": true, - "license": "MIT", - "dependencies": { - "abbrev": "1" - }, - "bin": { - "nopt": "bin/nopt.js" - } - }, - "node_modules/normalize-path": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object-assign": { - "version": "4.1.1", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object-inspect": { - "version": "1.12.3", - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/on-finished": { - "version": "2.4.1", - "license": "MIT", - "dependencies": { - "ee-first": "1.1.1" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/parseurl": { - "version": "1.3.3", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/path-to-regexp": { - "version": "0.1.7", - "license": "MIT" - }, - "node_modules/picocolors": { - "version": "1.0.0", - "license": "ISC" - }, - "node_modules/picomatch": { - "version": "2.3.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/postcss": { - "version": "8.4.14", - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/postcss" - } - ], - "license": "MIT", - "dependencies": { - "nanoid": "^3.3.4", - "picocolors": "^1.0.0", - "source-map-js": "^1.0.2" - }, - "engines": { - "node": "^10 || ^12 || >=14" - } - }, - "node_modules/prettier": { - "version": "2.8.4", - "dev": true, - "license": "MIT", - "bin": { - "prettier": "bin-prettier.js" - }, - "engines": { - "node": ">=10.13.0" - }, - "funding": { - "url": "https://github.com/prettier/prettier?sponsor=1" - } - }, - "node_modules/prisma": { - "version": "4.11.0", - "devOptional": true, - "hasInstallScript": true, - "license": "Apache-2.0", - "dependencies": { - "@prisma/engines": "4.11.0" - }, - "bin": { - "prisma": "build/index.js", - "prisma2": "build/index.js" - }, - "engines": { - "node": ">=14.17" - } - }, - "node_modules/prisma-query": { - "version": "2.0.0", - "license": "MIT" - }, - "node_modules/proxy-addr": { - "version": "2.0.7", - "license": "MIT", - "dependencies": { - "forwarded": "0.2.0", - "ipaddr.js": "1.9.1" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/proxy-from-env": { - "version": "1.1.0", - "license": "MIT" - }, - "node_modules/pstree.remy": { - "version": "1.1.8", - "dev": true, - "license": "MIT" - }, - "node_modules/qs": { - "version": "6.11.0", - "license": "BSD-3-Clause", - "dependencies": { - "side-channel": "^1.0.4" - }, - "engines": { - "node": ">=0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/range-parser": { - "version": "1.2.1", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/raw-body": { - "version": "2.5.1", - "license": "MIT", - "dependencies": { - "bytes": "3.1.2", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/react": { - "version": "18.2.0", - "license": "MIT", - "peer": true, - "dependencies": { - "loose-envify": "^1.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/react-dom": { - "version": "18.2.0", - "license": "MIT", - "peer": true, - "dependencies": { - "loose-envify": "^1.1.0", - "scheduler": "^0.23.0" - }, - "peerDependencies": { - "react": "^18.2.0" - } - }, - "node_modules/readdirp": { - "version": "3.6.0", - "dev": true, - "license": "MIT", - "dependencies": { - "picomatch": "^2.2.1" - }, - "engines": { - "node": ">=8.10.0" - } - }, - "node_modules/reflect-metadata": { - "version": "0.1.13", - "license": "Apache-2.0" - }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "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/safer-buffer": { - "version": "2.1.2", - "license": "MIT" - }, - "node_modules/scheduler": { - "version": "0.23.0", - "license": "MIT", - "peer": true, - "dependencies": { - "loose-envify": "^1.1.0" - } - }, - "node_modules/semver": { - "version": "5.7.1", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/send": { - "version": "0.18.0", - "license": "MIT", - "dependencies": { - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "mime": "1.6.0", - "ms": "2.1.3", - "on-finished": "2.4.1", - "range-parser": "~1.2.1", - "statuses": "2.0.1" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/send/node_modules/ms": { - "version": "2.1.3", - "license": "MIT" - }, - "node_modules/serve-static": { - "version": "1.15.0", - "license": "MIT", - "dependencies": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.3", - "send": "0.18.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/setprototypeof": { - "version": "1.2.0", - "license": "ISC" - }, - "node_modules/side-channel": { - "version": "1.0.4", - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/simple-update-notifier": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "semver": "~7.0.0" - }, - "engines": { - "node": ">=8.10.0" - } - }, - "node_modules/simple-update-notifier/node_modules/semver": { - "version": "7.0.0", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/sorted-array-functions": { - "version": "1.3.0", - "license": "MIT" - }, - "node_modules/source-map-js": { - "version": "1.0.2", - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/statuses": { - "version": "2.0.1", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/styled-jsx": { - "version": "5.1.1", - "license": "MIT", - "dependencies": { - "client-only": "0.0.1" - }, - "engines": { - "node": ">= 12.0.0" - }, - "peerDependencies": { - "react": ">= 16.8.0 || 17.x.x || ^18.0.0-0" - }, - "peerDependenciesMeta": { - "@babel/core": { - "optional": true - }, - "babel-plugin-macros": { - "optional": true - } - } - }, - "node_modules/supports-color": { - "version": "5.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/toidentifier": { - "version": "1.0.1", - "license": "MIT", - "engines": { - "node": ">=0.6" - } - }, - "node_modules/touch": { - "version": "3.1.0", - "dev": true, - "license": "ISC", - "dependencies": { - "nopt": "~1.0.10" - }, - "bin": { - "nodetouch": "bin/nodetouch.js" - } - }, - "node_modules/ts-node": { - "version": "10.9.1", - "license": "MIT", - "dependencies": { - "@cspotcode/source-map-support": "^0.8.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.1", - "yn": "3.1.1" - }, - "bin": { - "ts-node": "dist/bin.js", - "ts-node-cwd": "dist/bin-cwd.js", - "ts-node-esm": "dist/bin-esm.js", - "ts-node-script": "dist/bin-script.js", - "ts-node-transpile-only": "dist/bin-transpile.js", - "ts-script": "dist/bin-script-deprecated.js" - }, - "peerDependencies": { - "@swc/core": ">=1.2.50", - "@swc/wasm": ">=1.2.50", - "@types/node": "*", - "typescript": ">=2.7" - }, - "peerDependenciesMeta": { - "@swc/core": { - "optional": true - }, - "@swc/wasm": { - "optional": true - } - } - }, - "node_modules/tslib": { - "version": "2.5.0", - "license": "0BSD" - }, - "node_modules/type-is": { - "version": "1.6.18", - "license": "MIT", - "dependencies": { - "media-typer": "0.3.0", - "mime-types": "~2.1.24" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/typedi": { - "version": "0.10.0", - "license": "MIT" - }, - "node_modules/typescript": { - "version": "4.9.5", - "license": "Apache-2.0", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } - }, - "node_modules/undefsafe": { - "version": "2.0.5", - "dev": true, - "license": "MIT" - }, - "node_modules/unpipe": { - "version": "1.0.0", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/utils-merge": { - "version": "1.0.1", - "license": "MIT", - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/uuid": { - "version": "9.0.0", - "license": "MIT", - "bin": { - "uuid": "dist/bin/uuid" - } - }, - "node_modules/v8-compile-cache-lib": { - "version": "3.0.1", - "license": "MIT" - }, - "node_modules/validator": { - "version": "13.9.0", - "license": "MIT", - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/vary": { - "version": "1.1.2", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/yn": { - "version": "3.1.1", - "license": "MIT", - "engines": { - "node": ">=6" - } - } - }, - "dependencies": { - "@cspotcode/source-map-support": { - "version": "0.8.1", - "requires": { - "@jridgewell/trace-mapping": "0.3.9" - } - }, - "@jridgewell/resolve-uri": { - "version": "3.1.0" - }, - "@jridgewell/sourcemap-codec": { - "version": "1.4.14" - }, - "@jridgewell/trace-mapping": { - "version": "0.3.9", - "requires": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" - } - }, - "@next/env": { - "version": "13.2.4" - }, - "@next/swc-darwin-arm64": { - "version": "13.2.4", - "optional": true - }, - "@prisma/client": { - "version": "4.11.0", - "requires": { - "@prisma/engines-version": "4.11.0-57.8fde8fef4033376662cad983758335009d522acb" - } - }, - "@prisma/engines": { - "version": "4.11.0", - "devOptional": true - }, - "@prisma/engines-version": { - "version": "4.11.0-57.8fde8fef4033376662cad983758335009d522acb" - }, - "@swc/helpers": { - "version": "0.4.14", - "requires": { - "tslib": "^2.4.0" - } - }, - "@tsconfig/node10": { - "version": "1.0.9" - }, - "@tsconfig/node12": { - "version": "1.0.11" - }, - "@tsconfig/node14": { - "version": "1.0.3" - }, - "@tsconfig/node16": { - "version": "1.0.3" - }, - "@types/body-parser": { - "version": "1.19.2", - "dev": true, - "requires": { - "@types/connect": "*", - "@types/node": "*" - } - }, - "@types/connect": { - "version": "3.4.35", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "@types/cors": { - "version": "2.8.13", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "@types/express": { - "version": "4.17.17", - "dev": true, - "requires": { - "@types/body-parser": "*", - "@types/express-serve-static-core": "^4.17.33", - "@types/qs": "*", - "@types/serve-static": "*" - } - }, - "@types/express-serve-static-core": { - "version": "4.17.33", - "dev": true, - "requires": { - "@types/node": "*", - "@types/qs": "*", - "@types/range-parser": "*" - } - }, - "@types/mime": { - "version": "3.0.1", - "dev": true - }, - "@types/node": { - "version": "18.15.3" - }, - "@types/node-schedule": { - "version": "2.1.0", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "@types/qs": { - "version": "6.9.7", - "dev": true - }, - "@types/range-parser": { - "version": "1.2.4", - "dev": true - }, - "@types/serve-static": { - "version": "1.15.1", - "dev": true, - "requires": { - "@types/mime": "*", - "@types/node": "*" - } - }, - "@types/uuid": { - "version": "9.0.1", - "dev": true - }, - "@types/validator": { - "version": "13.7.14" - }, - "abbrev": { - "version": "1.1.1", - "dev": true - }, - "accepts": { - "version": "1.3.8", - "requires": { - "mime-types": "~2.1.34", - "negotiator": "0.6.3" - } - }, - "acorn": { - "version": "8.8.2" - }, - "acorn-walk": { - "version": "8.2.0" - }, - "anymatch": { - "version": "3.1.3", - "dev": true, - "requires": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - } - }, - "arg": { - "version": "4.1.3" - }, - "array-flatten": { - "version": "1.1.1" - }, - "asynckit": { - "version": "0.4.0" - }, - "axios": { - "version": "1.3.4", - "requires": { - "follow-redirects": "^1.15.0", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" - } - }, - "balanced-match": { - "version": "1.0.2", - "dev": true - }, - "binary-extensions": { - "version": "2.2.0", - "dev": true - }, - "body-parser": { - "version": "1.20.1", - "requires": { - "bytes": "3.1.2", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "on-finished": "2.4.1", - "qs": "6.11.0", - "raw-body": "2.5.1", - "type-is": "~1.6.18", - "unpipe": "1.0.0" - } - }, - "brace-expansion": { - "version": "1.1.11", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "braces": { - "version": "3.0.2", - "dev": true, - "requires": { - "fill-range": "^7.0.1" - } - }, - "bytes": { - "version": "3.1.2" - }, - "call-bind": { - "version": "1.0.2", - "requires": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" - } - }, - "caniuse-lite": { - "version": "1.0.30001466" - }, - "chokidar": { - "version": "3.5.3", - "dev": true, - "requires": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "fsevents": "~2.3.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - } - }, - "class-transformer": { - "version": "0.5.1" - }, - "class-validator": { - "version": "0.14.0", - "requires": { - "@types/validator": "^13.7.10", - "libphonenumber-js": "^1.10.14", - "validator": "^13.7.0" - } - }, - "classnames": { - "version": "2.3.2" - }, - "client-only": { - "version": "0.0.1" - }, - "clone": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", - "integrity": "sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==" - }, - "combined-stream": { - "version": "1.0.8", - "requires": { - "delayed-stream": "~1.0.0" - } - }, - "concat-map": { - "version": "0.0.1", - "dev": true - }, - "content-disposition": { - "version": "0.5.4", - "requires": { - "safe-buffer": "5.2.1" - } - }, - "content-type": { - "version": "1.0.5" - }, - "cookie": { - "version": "0.5.0" - }, - "cookie-signature": { - "version": "1.0.6" - }, - "cors": { - "version": "2.8.5", - "requires": { - "object-assign": "^4", - "vary": "^1" - } - }, - "create-require": { - "version": "1.1.1" - }, - "cron-parser": { - "version": "4.8.1", - "requires": { - "luxon": "^3.2.1" - } - }, - "debug": { - "version": "2.6.9", - "requires": { - "ms": "2.0.0" - } - }, - "delayed-stream": { - "version": "1.0.0" - }, - "depd": { - "version": "2.0.0" - }, - "destroy": { - "version": "1.2.0" - }, - "diff": { - "version": "4.0.2" - }, - "dotenv": { - "version": "16.0.3" - }, - "ee-first": { - "version": "1.1.1" - }, - "encodeurl": { - "version": "1.0.2" - }, - "escape-html": { - "version": "1.0.3" - }, - "etag": { - "version": "1.8.1" - }, - "express": { - "version": "4.18.2", - "requires": { - "accepts": "~1.3.8", - "array-flatten": "1.1.1", - "body-parser": "1.20.1", - "content-disposition": "0.5.4", - "content-type": "~1.0.4", - "cookie": "0.5.0", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "2.0.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "1.2.0", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.7", - "qs": "6.11.0", - "range-parser": "~1.2.1", - "safe-buffer": "5.2.1", - "send": "0.18.0", - "serve-static": "1.15.0", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "type-is": "~1.6.18", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - } - }, - "fill-range": { - "version": "7.0.1", - "dev": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "finalhandler": { - "version": "1.2.0", - "requires": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "statuses": "2.0.1", - "unpipe": "~1.0.0" - } - }, - "follow-redirects": { - "version": "1.15.2" - }, - "form-data": { - "version": "4.0.0", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - } - }, - "forwarded": { - "version": "0.2.0" - }, - "fresh": { - "version": "0.5.2" - }, - "fsevents": { - "version": "2.3.2", - "dev": true, - "optional": true - }, - "function-bind": { - "version": "1.1.1" - }, - "get-intrinsic": { - "version": "1.2.0", - "requires": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.3" - } - }, - "glob-parent": { - "version": "5.1.2", - "dev": true, - "requires": { - "is-glob": "^4.0.1" - } - }, - "has": { - "version": "1.0.3", - "requires": { - "function-bind": "^1.1.1" - } - }, - "has-flag": { - "version": "3.0.0", - "dev": true - }, - "has-symbols": { - "version": "1.0.3" - }, - "http-errors": { - "version": "2.0.0", - "requires": { - "depd": "2.0.0", - "inherits": "2.0.4", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "toidentifier": "1.0.1" - } - }, - "iconv-lite": { - "version": "0.4.24", - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "ignore-by-default": { - "version": "1.0.1", - "dev": true - }, - "inherits": { - "version": "2.0.4" - }, - "ipaddr.js": { - "version": "1.9.1" - }, - "is-binary-path": { - "version": "2.1.0", - "dev": true, - "requires": { - "binary-extensions": "^2.0.0" - } - }, - "is-extglob": { - "version": "2.1.1", - "dev": true - }, - "is-glob": { - "version": "4.0.3", - "dev": true, - "requires": { - "is-extglob": "^2.1.1" - } - }, - "is-number": { - "version": "7.0.0", - "dev": true - }, - "js-tokens": { - "version": "4.0.0", - "peer": true - }, - "le-coffre-ressources": { - "version": "file:github.com:smart-chain-fr/leCoffre-resources.git" - }, - "libphonenumber-js": { - "version": "1.10.24" - }, - "long-timeout": { - "version": "0.1.1" - }, - "loose-envify": { - "version": "1.4.0", - "peer": true, - "requires": { - "js-tokens": "^3.0.0 || ^4.0.0" - } - }, - "luxon": { - "version": "3.3.0" - }, - "make-error": { - "version": "1.3.6" - }, - "media-typer": { - "version": "0.3.0" - }, - "merge-descriptors": { - "version": "1.0.1" - }, - "methods": { - "version": "1.1.2" - }, - "mime": { - "version": "1.6.0" - }, - "mime-db": { - "version": "1.52.0" - }, - "mime-types": { - "version": "2.1.35", - "requires": { - "mime-db": "1.52.0" - } - }, - "minimatch": { - "version": "3.1.2", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "module-alias": { - "version": "2.2.2" - }, - "ms": { - "version": "2.0.0" - }, - "nanoid": { - "version": "3.3.4" - }, - "negotiator": { - "version": "0.6.3" - }, - "next": { - "version": "13.2.4", - "requires": { - "@next/env": "13.2.4", - "@next/swc-android-arm-eabi": "13.2.4", - "@next/swc-android-arm64": "13.2.4", - "@next/swc-darwin-arm64": "13.2.4", - "@next/swc-darwin-x64": "13.2.4", - "@next/swc-freebsd-x64": "13.2.4", - "@next/swc-linux-arm-gnueabihf": "13.2.4", - "@next/swc-linux-arm64-gnu": "13.2.4", - "@next/swc-linux-arm64-musl": "13.2.4", - "@next/swc-linux-x64-gnu": "13.2.4", - "@next/swc-linux-x64-musl": "13.2.4", - "@next/swc-win32-arm64-msvc": "13.2.4", - "@next/swc-win32-ia32-msvc": "13.2.4", - "@next/swc-win32-x64-msvc": "13.2.4", - "@swc/helpers": "0.4.14", - "caniuse-lite": "^1.0.30001406", - "postcss": "8.4.14", - "styled-jsx": "5.1.1" - } - }, - "node-cache": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/node-cache/-/node-cache-5.1.2.tgz", - "integrity": "sha512-t1QzWwnk4sjLWaQAS8CHgOJ+RAfmHpxFWmc36IWTiWHQfs0w5JDMBS1b1ZxQteo0vVVuWJvIUKHDkkeK7vIGCg==", - "requires": { - "clone": "2.x" - } - }, - "node-schedule": { - "version": "2.1.1", - "requires": { - "cron-parser": "^4.2.0", - "long-timeout": "0.1.1", - "sorted-array-functions": "^1.3.0" - } - }, - "nodemon": { - "version": "2.0.21", - "dev": true, - "requires": { - "chokidar": "^3.5.2", - "debug": "^3.2.7", - "ignore-by-default": "^1.0.1", - "minimatch": "^3.1.2", - "pstree.remy": "^1.1.8", - "semver": "^5.7.1", - "simple-update-notifier": "^1.0.7", - "supports-color": "^5.5.0", - "touch": "^3.1.0", - "undefsafe": "^2.0.5" - }, - "dependencies": { - "debug": { - "version": "3.2.7", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "ms": { - "version": "2.1.3", - "dev": true - } - } - }, - "nopt": { - "version": "1.0.10", - "dev": true, - "requires": { - "abbrev": "1" - } - }, - "normalize-path": { - "version": "3.0.0", - "dev": true - }, - "object-assign": { - "version": "4.1.1" - }, - "object-inspect": { - "version": "1.12.3" - }, - "on-finished": { - "version": "2.4.1", - "requires": { - "ee-first": "1.1.1" - } - }, - "parseurl": { - "version": "1.3.3" - }, - "path-to-regexp": { - "version": "0.1.7" - }, - "picocolors": { - "version": "1.0.0" - }, - "picomatch": { - "version": "2.3.1", - "dev": true - }, - "postcss": { - "version": "8.4.14", - "requires": { - "nanoid": "^3.3.4", - "picocolors": "^1.0.0", - "source-map-js": "^1.0.2" - } - }, - "prettier": { - "version": "2.8.4", - "dev": true - }, - "prisma": { - "version": "4.11.0", - "devOptional": true, - "requires": { - "@prisma/engines": "4.11.0" - } - }, - "prisma-query": { - "version": "2.0.0" - }, - "proxy-addr": { - "version": "2.0.7", - "requires": { - "forwarded": "0.2.0", - "ipaddr.js": "1.9.1" - } - }, - "proxy-from-env": { - "version": "1.1.0" - }, - "pstree.remy": { - "version": "1.1.8", - "dev": true - }, - "qs": { - "version": "6.11.0", - "requires": { - "side-channel": "^1.0.4" - } - }, - "range-parser": { - "version": "1.2.1" - }, - "raw-body": { - "version": "2.5.1", - "requires": { - "bytes": "3.1.2", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - } - }, - "react": { - "version": "18.2.0", - "peer": true, - "requires": { - "loose-envify": "^1.1.0" - } - }, - "react-dom": { - "version": "18.2.0", - "peer": true, - "requires": { - "loose-envify": "^1.1.0", - "scheduler": "^0.23.0" - } - }, - "readdirp": { - "version": "3.6.0", - "dev": true, - "requires": { - "picomatch": "^2.2.1" - } - }, - "reflect-metadata": { - "version": "0.1.13" - }, - "safe-buffer": { - "version": "5.2.1" - }, - "safer-buffer": { - "version": "2.1.2" - }, - "scheduler": { - "version": "0.23.0", - "peer": true, - "requires": { - "loose-envify": "^1.1.0" - } - }, - "semver": { - "version": "5.7.1", - "dev": true - }, - "send": { - "version": "0.18.0", - "requires": { - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "mime": "1.6.0", - "ms": "2.1.3", - "on-finished": "2.4.1", - "range-parser": "~1.2.1", - "statuses": "2.0.1" - }, - "dependencies": { - "ms": { - "version": "2.1.3" - } - } - }, - "serve-static": { - "version": "1.15.0", - "requires": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.3", - "send": "0.18.0" - } - }, - "setprototypeof": { - "version": "1.2.0" - }, - "side-channel": { - "version": "1.0.4", - "requires": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" - } - }, - "simple-update-notifier": { - "version": "1.1.0", - "dev": true, - "requires": { - "semver": "~7.0.0" - }, - "dependencies": { - "semver": { - "version": "7.0.0", - "dev": true - } - } - }, - "sorted-array-functions": { - "version": "1.3.0" - }, - "source-map-js": { - "version": "1.0.2" - }, - "statuses": { - "version": "2.0.1" - }, - "styled-jsx": { - "version": "5.1.1", - "requires": { - "client-only": "0.0.1" - } - }, - "supports-color": { - "version": "5.5.0", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - }, - "to-regex-range": { - "version": "5.0.1", - "dev": true, - "requires": { - "is-number": "^7.0.0" - } - }, - "toidentifier": { - "version": "1.0.1" - }, - "touch": { - "version": "3.1.0", - "dev": true, - "requires": { - "nopt": "~1.0.10" - } - }, - "ts-node": { - "version": "10.9.1", - "requires": { - "@cspotcode/source-map-support": "^0.8.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.1", - "yn": "3.1.1" - } - }, - "tslib": { - "version": "2.5.0" - }, - "type-is": { - "version": "1.6.18", - "requires": { - "media-typer": "0.3.0", - "mime-types": "~2.1.24" - } - }, - "typedi": { - "version": "0.10.0" - }, - "typescript": { - "version": "4.9.5" - }, - "undefsafe": { - "version": "2.0.5", - "dev": true - }, - "unpipe": { - "version": "1.0.0" - }, - "utils-merge": { - "version": "1.0.1" - }, - "uuid": { - "version": "9.0.0" - }, - "v8-compile-cache-lib": { - "version": "3.0.1" - }, - "validator": { - "version": "13.9.0" - }, - "vary": { - "version": "1.1.2" - }, - "yn": { - "version": "3.1.1" - } - } -} diff --git a/package.json b/package.json index bc3e47db..0d33fc07 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,8 @@ "@Config": "./dist/common/config", "@Entities": "./dist/common/entities", "@System": "./dist/common/system", - "@ControllerPattern": "./dist/common/system/controller-pattern" + "@ControllerPattern": "./dist/common/system/controller-pattern", + "@Test": "./dist/test" }, "scripts": { "build": "tsc", @@ -23,7 +24,11 @@ "api:dev": "nodemon -V --exec 'tsc && npm run api:start'", "build:test": "tsc && mocha ./dist/entries/Test.js", "format": "prettier --write src", - "migrate": "npx prisma migrate deploy" + "migrate": "npx prisma migrate deploy", + "docker:up": "docker-compose up -d", + "docker:up:test": "docker-compose -f docker-compose-test.yml up -d", + "docker:down": "docker-compose -f docker-compose-test.yml down", + "test": "tsc && npm run docker:up:test && jest -i --verbose ./dist/test/* && npm run docker:down" }, "repository": { "type": "git", @@ -36,15 +41,14 @@ }, "homepage": "https://github.com/smart-chain-fr/leCoffre-back#readme", "dependencies": { - "@prisma/client": "^4.9.0", - "axios": "^1.3.3", + "@prisma/client": "^4.11.0", "class-transformer": "^0.5.1", "class-validator": "^0.14.0", "classnames": "^2.3.2", "cors": "^2.8.5", "dotenv": "^16.0.3", "express": "^4.18.2", - "le-coffre-ressources": "github.com:smart-chain-fr/leCoffre-resources.git", + "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.19", "module-alias": "^2.2.2", "next": "^13.1.5", "node-cache": "^5.1.2", @@ -60,12 +64,15 @@ "devDependencies": { "@types/cors": "^2.8.13", "@types/express": "^4.17.16", + "@types/jest": "^29.5.0", "@types/node": "^18.11.18", "@types/node-schedule": "^2.1.0", "@types/uuid": "^9.0.0", + "jest": "^29.5.0", "nodemon": "^2.0.20", "prettier": "2.8.4", - "prisma": "^4.11.0" + "prisma": "^4.11.0", + "ts-jest": "^29.0.5" }, "prisma": { "schema": "src/common/databases/schema.prisma" diff --git a/src/app/HomeController.ts b/src/app/HomeController.ts index ae366a0f..2d84c394 100644 --- a/src/app/HomeController.ts +++ b/src/app/HomeController.ts @@ -6,12 +6,9 @@ import ApiController from "@Common/system/controller-pattern/ApiController"; @Controller() @Service() export default class HomeController extends ApiController { - @Get("/") protected async get(req: Request, res: Response) { - // const query = processFindManyQuery(req.query); this.httpSuccess(res, "Welcome to the home page!"); } } - diff --git a/src/app/api/CustomersController.ts b/src/app/api/CustomersController.ts deleted file mode 100644 index 89aa15e5..00000000 --- a/src/app/api/CustomersController.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { type Response, type Request } from "express"; -import { Controller, Get, Post, Put } from "@ControllerPattern/index"; -import ApiController from "@Common/system/controller-pattern/ApiController"; -import CustomersService from "@Services/CustomersService/CustomersService"; -import { Service } from "typedi"; -// import { IsNotEmpty, IsString, IsUUID } from "class-validator"; - -// class Params { -// @IsString() -// @IsNotEmpty() -// @IsUUID() -// public uuid!: string; -// } - -@Controller() -@Service() -export default class CustomersController extends ApiController { - constructor(private customersService: CustomersService) { - super(); - } - - /** - * @description Get all customers - * @returns ICustomer[] list of customers - */ - @Get("/api/customers") - protected async get(req: Request, response: Response) { - try { - // TODO - } catch (error) { - this.httpBadRequest(response, error); - return; - } - this.httpSuccess(response, await this.customersService.get()); - } - - /** - * @description Create a new customer - * @returns ICustomer created - */ - @Post("/api/customers") - protected async post(req: Request, response: Response) { - try { - // TODO - } catch (error) { - this.httpBadRequest(response, error); - return; - } - this.httpSuccess(response, await this.customersService.create()); - } - - /** - * @description Modify a specific customer by uid - * @returns ICustomer modified - */ - @Put("/api/customers/:uid") - protected async put(req: Request, response: Response) { - try { - // TODO - } catch (error) { - this.httpBadRequest(response, error); - return; - } - this.httpSuccess(response, await this.customersService.put()); - } - - /** - * @description Get a specific customer by uid - * @returns ICustomer - */ - @Get("/api/customers/:uid") - protected async getOneByUid(req: Request, response: Response) { - try { - // TODO - } catch (error) { - this.httpBadRequest(response, error); - return; - } - this.httpSuccess(response, await this.customersService.getByUid("uid")); - } -} diff --git a/src/app/api/DeedTypesController.ts b/src/app/api/DeedTypesController.ts deleted file mode 100644 index 400649fa..00000000 --- a/src/app/api/DeedTypesController.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { type Response, type Request } from "express"; -import { Controller, Get, Post, Put } from "@ControllerPattern/index"; -import ApiController from "@Common/system/controller-pattern/ApiController"; -import { Service } from "typedi"; -import DeedTypesService from "@Services/DeedTypesService/DeedTypesService"; -// import { IsNotEmpty, IsString, IsUUID } from "class-validator"; - -// class Params { -// @IsString() -// @IsNotEmpty() -// @IsUUID() -// public uuid!: string; -// } - -@Controller() -@Service() -export default class DeedTypesController extends ApiController { - constructor(private deedTypesService: DeedTypesService) { - super(); - } - - /** - * @description Get all deedtypes - * @returns IDeedtype[] list of deedtypes - */ - @Get("/api/deed-types") - protected async get(req: Request, response: Response) { - try { - // TODO - } catch (error) { - this.httpBadRequest(response, error); - return; - } - this.httpSuccess(response, await this.deedTypesService.get()); - } - - /** - * @description Create a new deedtype - * @returns IDeedtype created - */ - @Post("/api/deed-types") - protected async post(req: Request, response: Response) { - try { - // TODO - } catch (error) { - this.httpBadRequest(response, error); - return; - } - this.httpSuccess(response, await this.deedTypesService.create()); - } - - /** - * @description Modify a specific deedtype by uid - * @returns IDeedtype modified - */ - @Put("/api/deed-types/:uid") - protected async put(req: Request, response: Response) { - try { - // TODO - } catch (error) { - this.httpBadRequest(response, error); - return; - } - this.httpSuccess(response, await this.deedTypesService.put()); - } - - /** - * @description Get a specific deedtype by uid - * @returns IDeedtype - */ - @Get("/api/deed-types/:uid") - protected async getOneByUid(req: Request, response: Response) { - try { - // TODO - } catch (error) { - this.httpBadRequest(response, error); - return; - } - this.httpSuccess(response, await this.deedTypesService.getByUid("uid")); - } -} diff --git a/src/app/api/DeedsController.ts b/src/app/api/DeedsController.ts deleted file mode 100644 index 264d943a..00000000 --- a/src/app/api/DeedsController.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { type Response, type Request } from "express"; -import { Controller, Get, Post, Put } from "@ControllerPattern/index"; -import ApiController from "@Common/system/controller-pattern/ApiController"; -import DeedsService from "@Services/DeedsService/DeedsService"; -import { Service } from "typedi"; -// import { IsNotEmpty, IsString, IsUUID } from "class-validator"; - -// class Params { -// @IsString() -// @IsNotEmpty() -// @IsUUID() -// public uuid!: string; -// } - -@Controller() -@Service() -export default class DeedsController extends ApiController { - constructor(private deedsService: DeedsService) { - super(); - } - - /** - * @description Get all deeds - * @returns IDeed[] list of deeds - */ - @Get("/api/deeds") - protected async get(req: Request, response: Response) { - try { - // TODO - } catch (error) { - this.httpBadRequest(response, error); - return; - } - this.httpSuccess(response, await this.deedsService.get()); - } - - /** - * @description Create a new deed - * @returns IDeed created - */ - @Post("/api/deeds") - protected async post(req: Request, response: Response) { - try { - // TODO - } catch (error) { - this.httpBadRequest(response, error); - return; - } - this.httpSuccess(response, await this.deedsService.create()); - } - - /** - * @description Modify a specific deed by uid - * @returns IDeed modified - */ - @Put("/api/deeds/:uid") - protected async put(req: Request, response: Response) { - try { - // TODO - } catch (error) { - this.httpBadRequest(response, error); - return; - } - this.httpSuccess(response, await this.deedsService.put()); - } - - /** - * @description Get a specific deed by uid - * @returns IDeed - */ - @Get("/api/deeds/:uid") - protected async getOneByUid(req: Request, response: Response) { - try { - // TODO - } catch (error) { - this.httpBadRequest(response, error); - return; - } - this.httpSuccess(response, await this.deedsService.getByUid("uid")); - } -} diff --git a/src/app/api/DocumentTypesController.ts b/src/app/api/DocumentTypesController.ts deleted file mode 100644 index bea1cd3d..00000000 --- a/src/app/api/DocumentTypesController.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { type Response, type Request } from "express"; -import { Controller, Get, Post, Put } from "@ControllerPattern/index"; -import ApiController from "@Common/system/controller-pattern/ApiController"; -import { Service } from "typedi"; -import DocumentTypesService from "@Services/DocumentTypesService/DocumentTypesService"; -// import { IsNotEmpty, IsString, IsUUID } from "class-validator"; - -// class Params { -// @IsString() -// @IsNotEmpty() -// @IsUUID() -// public uuid!: string; -// } - -@Controller() -@Service() -export default class DocumentTypesController extends ApiController { - constructor(private documentTypesService: DocumentTypesService) { - super(); - } - - /** - * @description Get all document-types - * @returns IFolder[] list of document-types - */ - @Get("/api/document-types") - protected async get(req: Request, response: Response) { - try { - // TODO - } catch (error) { - this.httpBadRequest(response, error); - return; - } - this.httpSuccess(response, await this.documentTypesService.get()); - } - - /** - * @description Create a new documentType - * @returns IFolder created - */ - @Post("/api/document-types") - protected async post(req: Request, response: Response) { - try { - // TODO - } catch (error) { - this.httpBadRequest(response, error); - return; - } - this.httpSuccess(response, await this.documentTypesService.create()); - } - - /** - * @description Modify a specific documentType by uid - * @returns IFolder modified - */ - @Put("/api/document-types/:uid") - protected async put(req: Request, response: Response) { - try { - // TODO - } catch (error) { - this.httpBadRequest(response, error); - return; - } - this.httpSuccess(response, await this.documentTypesService.put()); - } - - /** - * @description Get a specific documentType by uid - * @returns IFolder - */ - @Get("/api/document-types/:uid") - protected async getOneByUid(req: Request, response: Response) { - try { - // TODO - } catch (error) { - this.httpBadRequest(response, error); - return; - } - this.httpSuccess(response, await this.documentTypesService.getByUid("uid")); - } -} diff --git a/src/app/api/FoldersController.ts b/src/app/api/FoldersController.ts deleted file mode 100644 index 4b5200ab..00000000 --- a/src/app/api/FoldersController.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { type Response, type Request } from "express"; -import { Controller, Get, Post, Put } from "@ControllerPattern/index"; -import ApiController from "@Common/system/controller-pattern/ApiController"; -import FoldersService from "@Services/FoldersService/FoldersService"; -import { Service } from "typedi"; -// import { IsNotEmpty, IsString, IsUUID } from "class-validator"; - -// class Params { -// @IsString() -// @IsNotEmpty() -// @IsUUID() -// public uuid!: string; -// } - -@Controller() -@Service() -export default class FolderController extends ApiController { - constructor(private foldersService: FoldersService) { - super(); - } - - /** - * @description Get all folders - * @returns IFolder[] list of folders - */ - @Get("/api/folders") - protected async get(req: Request, response: Response) { - try { - // TODO - } catch (error) { - this.httpBadRequest(response, error); - return; - } - this.httpSuccess(response, await this.foldersService.get()); - } - - /** - * @description Create a new folder - * @returns IFolder created - */ - @Post("/api/folders") - protected async post(req: Request, response: Response) { - try { - // TODO - } catch (error) { - this.httpBadRequest(response, error); - return; - } - this.httpSuccess(response, await this.foldersService.create()); - } - - /** - * @description Modify a specific folder by uid - * @returns IFolder modified - */ - @Put("/api/folders/:uid") - protected async put(req: Request, response: Response) { - try { - // TODO - } catch (error) { - this.httpBadRequest(response, error); - return; - } - this.httpSuccess(response, await this.foldersService.put()); - } - - /** - * @description Get a specific folder by uid - * @returns IFolder - */ - @Get("/api/folders/:uid") - protected async getOneByUid(req: Request, response: Response) { - try { - // TODO - } catch (error) { - this.httpBadRequest(response, error); - return; - } - this.httpSuccess(response, await this.foldersService.getByUid("uid")); - } -} diff --git a/src/app/api/OfficesController.ts b/src/app/api/OfficesController.ts deleted file mode 100644 index 6cf6140d..00000000 --- a/src/app/api/OfficesController.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { type Response, type Request } from "express"; -import { Controller, Get, Post, Put } from "@ControllerPattern/index"; -import ApiController from "@Common/system/controller-pattern/ApiController"; -import OfficesService from "@Services/OfficesService/OfficesService"; -import { Service } from "typedi"; -// import { IsNotEmpty, IsString, IsUUID } from "class-validator"; - -// class Params { -// @IsString() -// @IsNotEmpty() -// @IsUUID() -// public uuid!: string; -// } - -@Controller() -@Service() -export default class OfficesController extends ApiController { - constructor(private officesService: OfficesService) { - super(); - } - - /** - * @description Get all offices - * @returns IOffice[] list of offices - */ - @Get("/api/offices") - protected async get(req: Request, response: Response) { - try { - // TODO - } catch (error) { - this.httpBadRequest(response, error); - return; - } - this.httpSuccess(response, await this.officesService.get()); - } - - /** - * @description Create a new office - * @returns IOffice created - */ - @Post("/api/offices") - protected async post(req: Request, response: Response) { - try { - // TODO - } catch (error) { - this.httpBadRequest(response, error); - return; - } - this.httpSuccess(response, await this.officesService.create()); - } - - /** - * @description Modify a specific office by uid - * @returns IOffice modified - */ - @Put("/api/offices/:uid") - protected async put(req: Request, response: Response) { - try { - // TODO - } catch (error) { - this.httpBadRequest(response, error); - return; - } - this.httpSuccess(response, await this.officesService.put()); - } - - /** - * @description Get a specific office by uid - * @returns IOffice - */ - @Get("/api/offices/:uid") - protected async getOneByUid(req: Request, response: Response) { - try { - // TODO - } catch (error) { - this.httpBadRequest(response, error); - return; - } - this.httpSuccess(response, await this.officesService.getByUid("uid")); - } -} diff --git a/src/app/api/UsersController.ts b/src/app/api/UsersController.ts deleted file mode 100644 index fb2f5450..00000000 --- a/src/app/api/UsersController.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { type Response, type Request } from "express"; -import { Controller, Get, Post, Put } from "@ControllerPattern/index"; -import ApiController from "@Common/system/controller-pattern/ApiController"; -import UsersService from "@Services/UsersService/UsersService"; -import { Service } from "typedi"; -// import { IsNotEmpty, IsString, IsUUID } from "class-validator"; - -// class Params { -// @IsString() -// @IsNotEmpty() -// @IsUUID() -// public uuid!: string; -// } - -@Controller() -@Service() -export default class UsersController extends ApiController { - constructor(private usersService: UsersService) { - super(); - } - - /** - * @description Get all users - * @returns IUser[] list of users - */ - @Get("/api/users") - protected async get(req: Request, response: Response) { - try { - // TODO - } catch (error) { - this.httpBadRequest(response, error); - return; - } - this.httpSuccess(response, await this.usersService.get()); - } - - /** - * @description Create a new user - * @returns IUser created - */ - @Post("/api/users") - protected async post(req: Request, response: Response) { - try { - // TODO - } catch (error) { - this.httpBadRequest(response, error); - return; - } - this.httpSuccess(response, await this.usersService.create()); - } - - /** - * @description Modify a specific user by uid - * @returns IUser modified - */ - @Put("/api/users/:uid") - protected async put(req: Request, response: Response) { - try { - // TODO - } catch (error) { - this.httpBadRequest(response, error); - return; - } - this.httpSuccess(response, await this.usersService.put()); - } - - /** - * @description Get a specific user by uid - * @returns IUser - */ - @Get("/api/users/:uid") - protected async getOneByUid(req: Request, response: Response) { - try { - // TODO - } catch (error) { - this.httpBadRequest(response, error); - return; - } - this.httpSuccess(response, await this.usersService.getByUid("uid")); - } -} diff --git a/src/app/api/projects/UserController.ts b/src/app/api/projects/UserController.ts deleted file mode 100644 index e9aff82a..00000000 --- a/src/app/api/projects/UserController.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { type Response, type Request } from "express"; -import { Controller, Get } from "@ControllerPattern/index"; -import { Service } from "typedi"; -import ApiController from "@Common/system/controller-pattern/ApiController"; - -@Controller() -@Service() -export default class ProjectController extends ApiController { - - @Get("/api/projects/users") - protected async get(req: Request, res: Response) { - - // const query = processFindManyQuery(req.query); - this.httpSuccess(res, { message: "get" }); - } - -} - diff --git a/src/app/api/super-admin/CustomersController.ts b/src/app/api/super-admin/CustomersController.ts new file mode 100644 index 00000000..cd24238d --- /dev/null +++ b/src/app/api/super-admin/CustomersController.ts @@ -0,0 +1,131 @@ +import { Response, Request } from "express"; +import { Controller, Get, Post, Put } from "@ControllerPattern/index"; +import ApiController from "@Common/system/controller-pattern/ApiController"; +import CustomersService from "@Services/super-admin/CustomersService/CustomersService"; +import { Service } from "typedi"; +import { processFindManyQuery } from "prisma-query"; +import ObjectHydrate from "@Common/helpers/ObjectHydrate"; +import { Customer } from "le-coffre-resources/dist/SuperAdmin"; +import { Customers } from "@prisma/client"; +import { validateOrReject } from "class-validator"; + +@Controller() +@Service() +export default class CustomersController extends ApiController { + constructor(private customersService: CustomersService) { + super(); + } + + /** + * @description Get all customers + * @returns ICustomer[] list of customers + */ + @Get("/api/v1/super-admin/customers") + protected async get(req: Request, response: Response) { + try { + //get query + const query = processFindManyQuery(req.query); + + //call service to get prisma entity + const customersEntity: Customers[] = await this.customersService.get(query); + + //Hydrate ressource with prisma entity + const customers = ObjectHydrate.map(Customer, customersEntity, { strategy: "exposeAll" }); + + //success + this.httpSuccess(response, customers); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } + + /** + * @description Create a new customer + * @returns ICustomer created + */ + @Post("/api/v1/super-admin/customers") + protected async post(req: Request, response: Response) { + try { + //init IUser resource with request body values + const customerEntity = new Customer(); + ObjectHydrate.hydrate(customerEntity, req.body); + + //validate user + await validateOrReject(customerEntity, { groups: ["create"] }); + + //call service to get prisma entity + const prismaEntityCreated = await this.customersService.create(customerEntity); + + //Hydrate ressource with prisma entity + const customerEntityCreated = ObjectHydrate.hydrate(new Customer(), prismaEntityCreated, { + strategy: "exposeAll", + }); + + //success + this.httpSuccess(response, customerEntityCreated); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } + + /** + * @description Modify a specific customer by uid + * @returns ICustomer modified + */ + @Put("/api/v1/super-admin/customers/:uid") + protected async put(req: Request, response: Response) { + try { + const uid = req.params["uid"]; + if (!uid) { + throw new Error("No uid provided"); + } + //init IUser resource with request body values + const customerEntity = new Customer(); + ObjectHydrate.hydrate(customerEntity, req.body); + //validate user + await validateOrReject(customerEntity, { groups: ["update"] }); + + //call service to get prisma entity + const prismaEntityUpdated = await this.customersService.update(uid, customerEntity); + + //Hydrate ressource with prisma entity + const customerEntityUpdated = ObjectHydrate.hydrate(new Customer(), prismaEntityUpdated, { + strategy: "exposeAll", + }); + + //success + this.httpSuccess(response, customerEntityUpdated); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } + + /** + * @description Get a specific customer by uid + * @returns ICustomer + */ + @Get("/api/v1/super-admin/customers/:uid") + protected async getOneByUid(req: Request, response: Response) { + try { + const uid = req.params["uid"]; + if (!uid) { + throw new Error("No uuid provided"); + } + + //call service to get prisma entity + const customerEntity: Customers = await this.customersService.getByUid(uid); + + //Hydrate ressource with prisma entity + const customer = ObjectHydrate.hydrate(new Customer(), customerEntity, { strategy: "exposeAll" }); + + //success + this.httpSuccess(response, customer); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } +} diff --git a/src/app/api/super-admin/DeedTypesController.ts b/src/app/api/super-admin/DeedTypesController.ts new file mode 100644 index 00000000..9bbfd160 --- /dev/null +++ b/src/app/api/super-admin/DeedTypesController.ts @@ -0,0 +1,132 @@ +import { Response, Request } from "express"; +import { Controller, Get, Post, Put } from "@ControllerPattern/index"; +import ApiController from "@Common/system/controller-pattern/ApiController"; +import { Service } from "typedi"; +import DeedTypesService from "@Services/super-admin/DeedTypesService/DeedTypesService"; +import { processFindManyQuery } from "prisma-query"; +import { DeedTypes } from "@prisma/client"; +import ObjectHydrate from "@Common/helpers/ObjectHydrate"; +import { DeedType } from "le-coffre-resources/dist/SuperAdmin"; +import { validateOrReject } from "class-validator"; + +@Controller() +@Service() +export default class DeedTypesController extends ApiController { + constructor(private deedTypesService: DeedTypesService) { + super(); + } + + /** + * @description Get all deedtypes + * @returns IDeedtype[] list of deedtypes + */ + @Get("/api/v1/super-admin/deed-types") + protected async get(req: Request, response: Response) { + try { + //get query + const query = processFindManyQuery(req.query); + + //call service to get prisma entity + const prismaEntity: DeedTypes[] = await this.deedTypesService.get(query); + + //Hydrate ressource with prisma entity + const DeedTypes = ObjectHydrate.map(DeedType, prismaEntity, { strategy: "exposeAll" }); + + //success + this.httpSuccess(response, DeedTypes); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } + + /** + * @description Create a new deedtype + * @returns IDeedtype created + */ + @Post("/api/v1/super-admin/deed-types") + protected async post(req: Request, response: Response) { + try { + //init DeedType resource with request body values + const deedTypeEntity = new DeedType(); + ObjectHydrate.hydrate(deedTypeEntity, req.body); + + //validate deed type + await validateOrReject(deedTypeEntity, { groups: ["create"] }); + + //call service to get prisma entity + const prismaEntityCreated = await this.deedTypesService.create(deedTypeEntity); + + //Hydrate ressource with prisma entity + const deedTypeEntityCreated = ObjectHydrate.hydrate(new DeedType(), prismaEntityCreated, { + strategy: "exposeAll", + }); + + //success + this.httpSuccess(response, deedTypeEntityCreated); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } + + /** + * @description Modify a specific deedtype by uid + * @returns IDeedtype modified + */ + @Put("/api/v1/super-admin/deed-types/:uid") + protected async put(req: Request, response: Response) { + try { + const uid = req.params["uid"]; + if (!uid) { + throw new Error("No uuid provided"); + } + //init DeedType resource with request body values + const deedTypeEntity = new DeedType(); + ObjectHydrate.hydrate(deedTypeEntity, req.body); + + //validate deed type + await validateOrReject(deedTypeEntity, { groups: ["update"] }); + + //call service to get prisma entity + const prismaEntityUpdated = await this.deedTypesService.update(uid, deedTypeEntity); + + //Hydrate ressource with prisma entity + const deedTypeEntityUpdated = ObjectHydrate.hydrate(new DeedType(), prismaEntityUpdated, { + strategy: "exposeAll", + }); + + //success + this.httpSuccess(response, deedTypeEntityUpdated); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } + + /** + * @description Get a specific deedtype by uid + * @returns IDeedtype + */ + @Get("/api/v1/super-admin/deed-types/:uid") + protected async getOneByUid(req: Request, response: Response) { + try { + const uid = req.params["uid"]; + if (!uid) { + throw new Error("No uuid provided"); + } + + //call service to get prisma entity + const userEntity: DeedTypes = await this.deedTypesService.getByUid(uid); + + //Hydrate ressource with prisma entity + const user = ObjectHydrate.hydrate(new DeedType(), userEntity, { strategy: "exposeAll" }); + + //success + this.httpSuccess(response, user); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } +} diff --git a/src/app/api/super-admin/DeedsController.ts b/src/app/api/super-admin/DeedsController.ts new file mode 100644 index 00000000..4a82bb3a --- /dev/null +++ b/src/app/api/super-admin/DeedsController.ts @@ -0,0 +1,56 @@ +import { Response, Request } from "express"; +import { Controller, Get } from "@ControllerPattern/index"; +import ApiController from "@Common/system/controller-pattern/ApiController"; +import DeedsService from "@Services/super-admin/DeedsService/DeedsService"; +import { Service } from "typedi"; +import { processFindManyQuery } from "prisma-query"; +import { Deeds } from "@prisma/client"; +import Deed from "le-coffre-resources/dist/SuperAdmin"; +import ObjectHydrate from "@Common/helpers/ObjectHydrate"; + +@Controller() +@Service() +export default class DeedsController extends ApiController { + constructor(private deedsService: DeedsService) { + super(); + } + + /** + * @description Get all deeds + * @returns IDeed[] list of deeds + */ + @Get("/api/v1/super-admin/deeds") + protected async get(req: Request, response: Response) { + try { + //get query + const query = processFindManyQuery(req.query); + + //call service to get prisma entity + const prismaEntity: Deeds[] = await this.deedsService.get(query); + + //Hydrate ressource with prisma entity + const deeds = ObjectHydrate.map(Deed, prismaEntity, { strategy: "exposeAll" }); + + //success + this.httpSuccess(response, deeds); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } + + /** + * @description Get a specific deed by uid + * @returns IDeed + */ + @Get("/api/v1/super-admin/deeds/:uid") + protected async getOneByUid(req: Request, response: Response) { + try { + // TODO + } catch (error) { + this.httpBadRequest(response, error); + return; + } + this.httpSuccess(response, await this.deedsService.getByUid("uid")); + } +} diff --git a/src/app/api/super-admin/DocumentTypesController.ts b/src/app/api/super-admin/DocumentTypesController.ts new file mode 100644 index 00000000..7567d216 --- /dev/null +++ b/src/app/api/super-admin/DocumentTypesController.ts @@ -0,0 +1,131 @@ +import { Response, Request } from "express"; +import { Controller, Get, Post, Put } from "@ControllerPattern/index"; +import ApiController from "@Common/system/controller-pattern/ApiController"; +import { Service } from "typedi"; +import DocumentTypesService from "@Services/super-admin/DocumentTypesService/DocumentTypesService"; +import { processFindManyQuery } from "prisma-query"; +import { DocumentTypes } from "@prisma/client"; +import ObjectHydrate from "@Common/helpers/ObjectHydrate"; +import { DocumentType } from "le-coffre-resources/dist/SuperAdmin"; +import { validateOrReject } from "class-validator"; +//import { validateOrReject } from "class-validator"; + +@Controller() +@Service() +export default class DocumentTypesController extends ApiController { + constructor(private documentTypesService: DocumentTypesService) { + super(); + } + + /** + * @description Get all document-types + * @returns DocumentType[] list of document-types + */ + @Get("/api/v1/super-admin/document-types") + protected async get(req: Request, response: Response) { + try { + //get query + const query = processFindManyQuery(req.query); + + //call service to get prisma entity + const prismaEntity: DocumentTypes[] = await this.documentTypesService.get(query); + + //Hydrate ressource with prisma entity + const documentTypes = ObjectHydrate.map(DocumentType, prismaEntity, { + strategy: "exposeAll", + }); + + //success + this.httpSuccess(response, documentTypes); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } + + /** + * @description Create a new documentType + * @returns DocumentType created + */ + @Post("/api/v1/super-admin/document-types") + protected async post(req: Request, response: Response) { + try { + //init DocumentType resource with request body values + const documentTypeEntity = new DocumentType(); + ObjectHydrate.hydrate(documentTypeEntity, req.body); + //validate user + await validateOrReject(documentTypeEntity, { groups: ["create"] }); + //call service to get prisma entity + const prismaEntityCreated = await this.documentTypesService.create(documentTypeEntity); + //Hydrate ressource with prisma entity + const userEntityCreated = ObjectHydrate.hydrate(new DocumentType(), prismaEntityCreated, { + strategy: "exposeAll", + }); + //success + this.httpSuccess(response, userEntityCreated); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } + + /** + * @description Modify a specific documentType by uid + * @returns DocumentType modified + */ + @Put("/api/v1/super-admin/document-types/:uid") + protected async put(req: Request, response: Response) { + try { + const uid = req.params["uid"]; + if (!uid) { + throw new Error("No uuid provided"); + } + //init DocumentType resource with request body values + const documentTypeEntity = new DocumentType(); + ObjectHydrate.hydrate(documentTypeEntity, req.body); + + //validate user + await validateOrReject(documentTypeEntity, { groups: ["update"] }); + + //call service to get prisma entity + const prismaEntityUpdated = await this.documentTypesService.update(uid, documentTypeEntity); + + //Hydrate ressource with prisma entity + const documentTypeEntityUpdated = ObjectHydrate.hydrate(new DocumentType(), prismaEntityUpdated, { + strategy: "exposeAll", + }); + + //success + this.httpSuccess(response, documentTypeEntityUpdated); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } + + /** + * @description Get a specific documentType by uid + * @returns DocumentType + */ + @Get("/api/v1/super-admin/document-types/:uid") + protected async getOneByUid(req: Request, response: Response) { + try { + const uid = req.params["uid"]; + if (!uid) { + throw new Error("No uuid provided"); + } + + //call service to get prisma entity + const documentTypeEntity: DocumentTypes = await this.documentTypesService.getByUid(uid); + + //Hydrate ressource with prisma entity + const user = ObjectHydrate.hydrate(new DocumentType(), documentTypeEntity, { strategy: "exposeAll" }); + + //success + this.httpSuccess(response, user); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } +} diff --git a/src/app/api/DocumentsController.ts b/src/app/api/super-admin/DocumentsController.ts similarity index 50% rename from src/app/api/DocumentsController.ts rename to src/app/api/super-admin/DocumentsController.ts index e23f2191..a7ef7de0 100644 --- a/src/app/api/DocumentsController.ts +++ b/src/app/api/super-admin/DocumentsController.ts @@ -1,16 +1,12 @@ -import { type Response, type Request } from "express"; +import { Response, Request } from "express"; import { Controller, Get, Post, Put } from "@ControllerPattern/index"; import ApiController from "@Common/system/controller-pattern/ApiController"; import { Service } from "typedi"; -import DocumentsService from "@Services/DocumentsService/DocumentsService"; -// import { IsNotEmpty, IsString, IsUUID } from "class-validator"; - -// class Params { -// @IsString() -// @IsNotEmpty() -// @IsUUID() -// public uuid!: string; -// } +import DocumentsService from "@Services/super-admin/DocumentsService/DocumentsService"; +// import { processFindManyQuery } from "prisma-query"; +// import { Documents } from "@prisma/client"; +// import ObjectHydrate from "@Common/helpers/ObjectHydrate"; +// import Document from "le-coffre-resources/dist/SuperAdmin"; @Controller() @Service() @@ -23,22 +19,31 @@ export default class DocumentsController extends ApiController { * @description Get all documents * @returns IDocument[] list of documents */ - @Get("/api/documents") - protected async get(req: Request, response: Response) { - try { - // TODO - } catch (error) { - this.httpBadRequest(response, error); - return; - } - this.httpSuccess(response, await this.documentsService.get()); - } + // @Get("/api/super-admin/documents") + // protected async get(req: Request, response: Response) { + // try { + // //get query + // const query = processFindManyQuery(req.query); + + // //call service to get prisma entity + // const prismaEntity: Documents[] = await this.documentsService.get(query); + + // //Hydrate ressource with prisma entity + // const documents = ObjectHydrate.map(Document, prismaEntity, { strategy: "exposeAll" }); + + // //success + // this.httpSuccess(response, documents); + // } catch (error) { + // this.httpBadRequest(response, error); + // return; + // } + // } /** * @description Create a new document * @returns IDocument created */ - @Post("/api/documents") + @Post("/api/v1/super-admin/documents") protected async post(req: Request, response: Response) { try { // TODO @@ -46,14 +51,14 @@ export default class DocumentsController extends ApiController { this.httpBadRequest(response, error); return; } - this.httpSuccess(response, await this.documentsService.create()); + // this.httpSuccess(response, await this.documentsService.create()); } /** * @description Modify a specific document by uid * @returns IDocument modified */ - @Put("/api/documents/:uid") + @Put("/api/v1/super-admin/documents/:uid") protected async put(req: Request, response: Response) { try { // TODO @@ -65,10 +70,10 @@ export default class DocumentsController extends ApiController { } /** - * @description Get a specific document by uid + * @description Get a specific document by uid * @returns IDocument */ - @Get("/api/documents/:uid") + @Get("/api/v1/super-admin/documents/:uid") protected async getOneByUid(req: Request, response: Response) { try { // TODO diff --git a/src/app/api/super-admin/OfficeFoldersController.ts b/src/app/api/super-admin/OfficeFoldersController.ts new file mode 100644 index 00000000..ea27229f --- /dev/null +++ b/src/app/api/super-admin/OfficeFoldersController.ts @@ -0,0 +1,97 @@ +import { Response, Request } from "express"; +import { Controller, Get, Post, Put } from "@ControllerPattern/index"; +import ApiController from "@Common/system/controller-pattern/ApiController"; +import OfficeFoldersService from "@Services/super-admin/OfficeFoldersService/OfficeFoldersService"; +import { Service } from "typedi"; +// import { processFindManyQuery } from "prisma-query"; +// import { OfficeFolders } from "@prisma/client"; +// import ObjectHydrate from "@Common/helpers/ObjectHydrate"; +// import { OfficeFolder } from "le-coffre-resources/dist/SuperAdmin"; +// import { validateOrReject } from "class-validator"; + +@Controller() +@Service() +export default class OfficeFoldersController extends ApiController { + constructor(private officeFoldersService: OfficeFoldersService) { + super(); + } + + /** + * @description Get all folders + * @returns IFolder[] list of folders + */ + @Get("/api/super-admin/folders") + protected async get(req: Request, response: Response) { + try { + //get query + // const query = processFindManyQuery(req.query); + // //call service to get prisma entity + // const prismaEntity: OfficeFolders[] = await this.officeFoldersService.get(query); + // //Hydrate ressource with prisma entity + // const officeFolders = ObjectHydrate.map(OfficeFolder, prismaEntity, { + // strategy: "exposeAll", + // }); + // //success + // this.httpSuccess(response, officeFolders); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } + + /** + * @description Create a new folder + * @returns IFolder created + */ + @Post("/api/super-admin/folders") + protected async post(req: Request, response: Response) { + try { + //init IOfficeFolder resource with request body values + // const officeFolderEntity = new OfficeFolder(); + // ObjectHydrate.hydrate(officeFolderEntity, req.body); + // //validate folder + // await validateOrReject(officeFolderEntity, { groups: ["create"] }); + // //call service to get prisma entity + // const prismaEntityCreated = await this.officeFoldersService.create(officeFolderEntity); + // //Hydrate ressource with prisma entity + // const officeFolderEntityCreated = ObjectHydrate.hydrate(new OfficeFolder(), prismaEntityCreated, { + // strategy: "exposeAll", + // }); + //success + //this.httpSuccess(response, officeFolderEntityCreated); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } + + /** + * @description Modify a specific folder by uid + * @returns IFolder modified + */ + @Put("/api/super-admin/folders/:uid") + protected async put(req: Request, response: Response) { + try { + // TODO + } catch (error) { + this.httpBadRequest(response, error); + return; + } + //this.httpSuccess(response, await this.officeFoldersService.update()); + } + + /** + * @description Get a specific folder by uid + * @returns IFolder + */ + @Get("/api/super-admin/folders/:uid") + protected async getOneByUid(req: Request, response: Response) { + try { + // TODO + } catch (error) { + this.httpBadRequest(response, error); + return; + } + this.httpSuccess(response, await this.officeFoldersService.getByUid("uid")); + } +} diff --git a/src/app/api/super-admin/OfficesController.ts b/src/app/api/super-admin/OfficesController.ts new file mode 100644 index 00000000..8604706f --- /dev/null +++ b/src/app/api/super-admin/OfficesController.ts @@ -0,0 +1,114 @@ +import { Response, Request } from "express"; +import { Controller, Get, Post, Put } from "@ControllerPattern/index"; +import ApiController from "@Common/system/controller-pattern/ApiController"; +import OfficesService from "@Services/super-admin/OfficesService/OfficesService"; +import { Service } from "typedi"; +import { processFindManyQuery } from "prisma-query"; +import { Offices } from "@prisma/client"; +import ObjectHydrate from "@Common/helpers/ObjectHydrate"; +import { Office as OfficeRessource } from "le-coffre-resources/dist/SuperAdmin"; +import { validateOrReject } from "class-validator"; + +@Controller() +@Service() +export default class OfficesController extends ApiController { + constructor(private officesService: OfficesService) { + super(); + } + /** + * @description Get all offices + * @returns IOffice[] list of offices + */ + @Get("/api/v1/super-admin/offices") + protected async get(req: Request, response: Response) { + try { + //get query + const query = processFindManyQuery(req.query); + //call service to get prisma entity + const officesEntity: Offices[] = await this.officesService.get(query); + //Hydrate ressource with prisma entity + const offices = ObjectHydrate.map(OfficeRessource, officesEntity, { strategy: "exposeAll" }); + //success + this.httpSuccess(response, offices); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } + /** + * @description Create a new office + * @returns IOffice created + */ + @Post("/api/v1/super-admin/offices") + protected async post(req: Request, response: Response) { + try { + //init IUser resource with request body values + const officeEntity = new OfficeRessource(); + ObjectHydrate.hydrate(officeEntity, req.body); + //validate user + await validateOrReject(officeEntity, { groups: ["create"] }); + //call service to get prisma entity + const prismaEntityCreated = await this.officesService.create(officeEntity); + //Hydrate ressource with prisma entity + const officeEntityCreated = ObjectHydrate.hydrate(new OfficeRessource(), prismaEntityCreated, { + strategy: "exposeAll", + }); + //success + this.httpSuccess(response, officeEntityCreated); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } + /** + * @description Modify a specific office by uid + * @returns IOffice modified + */ + @Put("/api/v1/super-admin/offices/:uid") + protected async put(req: Request, response: Response) { + try { + const uid = req.params["uid"]; + if (!uid) { + throw new Error("No uuid provided"); + } + //init IUser resource with request body values + const officeEntity = new OfficeRessource(); + ObjectHydrate.hydrate(officeEntity, req.body); + //validate user + await validateOrReject(officeEntity, { groups: ["update"] }); + //call service to get prisma entity + const prismaEntityUpdated = await this.officesService.update(uid, officeEntity); + //Hydrate ressource with prisma entity + const officeEntityUpdated = ObjectHydrate.hydrate(new OfficeRessource(), prismaEntityUpdated, { + strategy: "exposeAll", + }); + //success + this.httpSuccess(response, officeEntityUpdated); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } + /** + * @description Get a specific office by uid + * @returns IOffice + */ + @Get("/api/v1/super-admin/offices/:uid") + protected async getOneByUid(req: Request, response: Response) { + try { + const uid = req.params["uid"]; + if (!uid) { + throw new Error("No uuid provided"); + } + //call service to get prisma entity + const officeEntity: Offices = await this.officesService.getByUid(uid); + //Hydrate ressource with prisma entity + const office = ObjectHydrate.hydrate(new OfficeRessource(), officeEntity, { strategy: "exposeAll" }); + //success + this.httpSuccess(response, office); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } +} diff --git a/src/app/api/super-admin/UsersController.ts b/src/app/api/super-admin/UsersController.ts new file mode 100644 index 00000000..fdf2f2db --- /dev/null +++ b/src/app/api/super-admin/UsersController.ts @@ -0,0 +1,132 @@ +import { Response, Request } from "express"; +import { Controller, Get, Post, Put } from "@ControllerPattern/index"; +import ApiController from "@Common/system/controller-pattern/ApiController"; +import UsersService from "@Services/super-admin/UsersService/UsersService"; +import { Service } from "typedi"; +import ObjectHydrate from "@Common/helpers/ObjectHydrate"; +import { validateOrReject } from "class-validator"; +import User from "le-coffre-resources/dist/SuperAdmin"; +import { processFindManyQuery } from "prisma-query"; +import { Users } from "@prisma/client"; + +@Controller() +@Service() +export default class UsersController extends ApiController { + constructor(private usersService: UsersService) { + super(); + } + + /** + * @description Get all users + * @returns IUser[] list of users + */ + @Get("/api/v1/super-admin/users") + protected async get(req: Request, response: Response) { + try { + //get query + const query = processFindManyQuery(req.query); + + //call service to get prisma entity + const usersEntity: Users[] = await this.usersService.get(query); + + //Hydrate ressource with prisma entity + const users = ObjectHydrate.map(User, usersEntity, { strategy: "exposeAll" }); + + //success + this.httpSuccess(response, users); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } + + /** + * @description Get all users + * @returns IUser[] list of users + */ + @Post("/api/v1/super-admin/users") + protected async getAddresses(req: Request, response: Response) { + try { + //init IUser resource with request body values + const userEntity = new User(); + ObjectHydrate.hydrate(userEntity, req.body); + + //validate user + await validateOrReject(userEntity, { groups: ["create"] }); + + //call service to get prisma entity + const prismaEntityCreated = await this.usersService.create(userEntity); + + //Hydrate ressource with prisma entity + const userEntityCreated = ObjectHydrate.hydrate(new User(), prismaEntityCreated, { + strategy: "exposeAll", + }); + + //success + this.httpSuccess(response, userEntityCreated); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } + + /** + * @description Modify a specific user by uid + * @returns IUser modified + */ + @Put("/api/v1/super-admin/users/:uid") + protected async put(req: Request, response: Response) { + try { + const uid = req.params["uid"]; + if (!uid) { + throw new Error("No uuid provided"); + } + //init IUser resource with request body values + const userEntity = new User(); + ObjectHydrate.hydrate(userEntity, req.body); + + //validate user + await validateOrReject(userEntity, { groups: ["update"] }); + + //call service to get prisma entity + const prismaEntityUpdated = await this.usersService.update(uid, userEntity); + + //Hydrate ressource with prisma entity + const userEntityUpdated = ObjectHydrate.hydrate(new User(), prismaEntityUpdated, { + strategy: "exposeAll", + }); + + //success + this.httpSuccess(response, userEntityUpdated); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } + + /** + * @description Modify a specific user by uid + * @returns IUser modified + */ + @Get("/api/v1/super-admin/users/:uid") + protected async getOneByUid(req: Request, response: Response) { + try { + const uid = req.params["uid"]; + if (!uid) { + throw new Error("No uuid provided"); + } + + //call service to get prisma entity + const userEntity: Users = await this.usersService.getByUid(uid); + + //Hydrate ressource with prisma entity + const user = ObjectHydrate.hydrate(new User(), userEntity, { strategy: "exposeAll" }); + + //success + this.httpSuccess(response, user); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } +} diff --git a/src/app/index.ts b/src/app/index.ts index 303407ef..f9dded35 100644 --- a/src/app/index.ts +++ b/src/app/index.ts @@ -1,13 +1,13 @@ import { Container } from "typedi"; import HomeController from "./HomeController"; -import UsersController from "./api/UsersController"; -import FoldersController from "./api/FoldersController"; -import CustomersController from "./api/CustomersController"; -import OfficesController from "./api/OfficesController"; -import DeedsController from "./api/DeedsController"; -import DeedTypesController from "./api/DeedTypesController"; -import DocumentsController from "./api/DocumentsController"; -import DocumentTypesController from "./api/DocumentTypesController"; +import UsersController from "./api/super-admin/UsersController"; +import FoldersController from "./api/super-admin/OfficeFoldersController"; +import CustomersController from "./api/super-admin/CustomersController"; +import OfficesController from "./api/super-admin/OfficesController"; +import DeedsController from "./api/super-admin/DeedsController"; +import DeedTypesController from "./api/super-admin/DeedTypesController"; +import DocumentsController from "./api/super-admin/DocumentsController"; +import DocumentTypesController from "./api/super-admin/DocumentTypesController"; /** * @description This allow to declare all controllers used in the application diff --git a/src/app/middlewares/ErrorHandler.ts b/src/app/middlewares/ErrorHandler.ts index ac0b0f4d..274f5923 100644 --- a/src/app/middlewares/ErrorHandler.ts +++ b/src/app/middlewares/ErrorHandler.ts @@ -10,7 +10,7 @@ export default function errorHandler(error: any, req: Request, response: Respons if (error instanceof SyntaxError && errorStatus === 400 && "body" in error) { response.status(HttpCodes.BAD_REQUEST).send({ body: error["body"], - type: error as any ["type"], + type: error as any["type"], }); return; } @@ -22,4 +22,3 @@ export default function errorHandler(error: any, req: Request, response: Respons next(error); } - diff --git a/src/common/config/database/IDatabaseConfig.ts b/src/common/config/database/IDatabaseConfig.ts index 24796543..2b03000e 100644 --- a/src/common/config/database/IDatabaseConfig.ts +++ b/src/common/config/database/IDatabaseConfig.ts @@ -1,4 +1,4 @@ -export default interface IDatabaseConfig { - name: string; - url?: string; -} +export default interface IDatabaseConfig { + name: string; + url?: string; +} diff --git a/src/common/config/variables/Variables.ts b/src/common/config/variables/Variables.ts index 482a9dce..2ba6dbde 100644 --- a/src/common/config/variables/Variables.ts +++ b/src/common/config/variables/Variables.ts @@ -50,4 +50,3 @@ export class BackendVariables { return this; } } - diff --git a/src/common/databases/database.ts b/src/common/databases/database.ts index ecd8b810..9d8b85ac 100644 --- a/src/common/databases/database.ts +++ b/src/common/databases/database.ts @@ -27,4 +27,3 @@ export default class Database { return name; } } - diff --git a/src/common/databases/migrations/20230321102005_v0/migration.sql b/src/common/databases/migrations/20230321102005_v0/migration.sql new file mode 100644 index 00000000..0a36da48 --- /dev/null +++ b/src/common/databases/migrations/20230321102005_v0/migration.sql @@ -0,0 +1,413 @@ +-- CreateEnum +CREATE TYPE "ECivility" AS ENUM ('MALE', 'FEMALE', 'OTHERS'); + +-- CreateEnum +CREATE TYPE "EFolderStatus" AS ENUM ('LIVE', 'ARCHIVED'); + +-- CreateEnum +CREATE TYPE "EOfficeStatus" AS ENUM ('ACTIVATED', 'DESACTIVATED'); + +-- CreateEnum +CREATE TYPE "ENotificationStatus" AS ENUM ('READ', 'UNREAD'); + +-- CreateEnum +CREATE TYPE "ECustomerStatus" AS ENUM ('VALIDATED', 'PENDING', 'ERRONED'); + +-- CreateEnum +CREATE TYPE "EDocumentStatus" AS ENUM ('ASKED', 'DEPOSITED', 'VALIDATED', 'ANCHORED', 'REFUSED'); + +-- CreateTable +CREATE TABLE "addresses" ( + "uuid" TEXT NOT NULL, + "address" VARCHAR(255) NOT NULL, + "city" VARCHAR(255) NOT NULL, + "zip_code" INTEGER NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "addresses_pkey" PRIMARY KEY ("uuid") +); + +-- CreateTable +CREATE TABLE "contacts" ( + "uuid" TEXT NOT NULL, + "first_name" VARCHAR(255) NOT NULL, + "last_name" VARCHAR(255) NOT NULL, + "email" VARCHAR(255) NOT NULL, + "phone_number" VARCHAR(50), + "cell_phone_number" VARCHAR(50), + "civility" "ECivility" NOT NULL DEFAULT 'MALE', + "address_uuid" VARCHAR(255) NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "contacts_pkey" PRIMARY KEY ("uuid") +); + +-- CreateTable +CREATE TABLE "users" ( + "uuid" TEXT NOT NULL, + "idNot" VARCHAR(255) NOT NULL, + "contact_uuid" VARCHAR(255) NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL, + "office_uuid" VARCHAR(255) NOT NULL, + + CONSTRAINT "users_pkey" PRIMARY KEY ("uuid") +); + +-- CreateTable +CREATE TABLE "offices" ( + "uuid" TEXT NOT NULL, + "idNot" VARCHAR(255) NOT NULL, + "name" VARCHAR(255) NOT NULL, + "crpcen" VARCHAR(255) NOT NULL, + "address_uuid" VARCHAR(255) NOT NULL, + "office_status" "EOfficeStatus" NOT NULL DEFAULT 'DESACTIVATED', + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "offices_pkey" PRIMARY KEY ("uuid") +); + +-- CreateTable +CREATE TABLE "customers" ( + "uuid" TEXT NOT NULL, + "status" "ECustomerStatus" NOT NULL DEFAULT 'PENDING', + "contact_uuid" VARCHAR(255) NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "customers_pkey" PRIMARY KEY ("uuid") +); + +-- CreateTable +CREATE TABLE "user_has_notifications" ( + "uuid" TEXT NOT NULL, + "user_uuid" VARCHAR(255) NOT NULL, + "notification_uuid" VARCHAR(255) NOT NULL, + "notification_status" "ENotificationStatus" NOT NULL DEFAULT 'UNREAD', + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "user_has_notifications_pkey" PRIMARY KEY ("uuid") +); + +-- CreateTable +CREATE TABLE "notifications" ( + "uuid" TEXT NOT NULL, + "message" VARCHAR(255) NOT NULL, + "redirection_url" VARCHAR(255) NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "notifications_pkey" PRIMARY KEY ("uuid") +); + +-- CreateTable +CREATE TABLE "office_folders" ( + "uuid" TEXT NOT NULL, + "folder_number" VARCHAR(255) NOT NULL, + "name" VARCHAR(255) NOT NULL, + "description" VARCHAR(255), + "archived_description" VARCHAR(255), + "status" "EFolderStatus" NOT NULL DEFAULT 'LIVE', + "deed_uuid" VARCHAR(255) NOT NULL, + "office_uuid" VARCHAR(255) NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "office_folders_pkey" PRIMARY KEY ("uuid") +); + +-- CreateTable +CREATE TABLE "office_folder_has_customers" ( + "uuid" TEXT NOT NULL, + "customer_uuid" VARCHAR(255) NOT NULL, + "office_folder_uuid" VARCHAR(255) NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "office_folder_has_customers_pkey" PRIMARY KEY ("uuid") +); + +-- CreateTable +CREATE TABLE "office_folder_has_stakeholder" ( + "uuid" TEXT NOT NULL, + "office_folder_uuid" VARCHAR(255) NOT NULL, + "user_stakeholder_uuid" VARCHAR(255) NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "office_folder_has_stakeholder_pkey" PRIMARY KEY ("uuid") +); + +-- CreateTable +CREATE TABLE "documents" ( + "uuid" TEXT NOT NULL, + "document_status" "EDocumentStatus" NOT NULL DEFAULT 'ASKED', + "type_uuid" VARCHAR(255) NOT NULL, + "blockchain_anchor_uuid" VARCHAR(255), + "folder_uuid" VARCHAR(255) NOT NULL, + "depositor_uuid" VARCHAR(255) NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "documents_pkey" PRIMARY KEY ("uuid") +); + +-- CreateTable +CREATE TABLE "document_history" ( + "uuid" TEXT NOT NULL, + "document_status" "EDocumentStatus" NOT NULL DEFAULT 'ASKED', + "refused_reason" VARCHAR(255), + "document_uuid" VARCHAR(255) NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "document_history_pkey" PRIMARY KEY ("uuid") +); + +-- CreateTable +CREATE TABLE "files" ( + "uuid" TEXT NOT NULL, + "document_uuid" VARCHAR(255) NOT NULL, + "file_path" VARCHAR(255), + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "files_pkey" PRIMARY KEY ("uuid") +); + +-- CreateTable +CREATE TABLE "blockchain_anchors" ( + "uuid" TEXT NOT NULL, + "smartSigJobId" VARCHAR(255) NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "blockchain_anchors_pkey" PRIMARY KEY ("uuid") +); + +-- CreateTable +CREATE TABLE "document_types" ( + "uuid" TEXT NOT NULL, + "name" VARCHAR(255) NOT NULL, + "public_description" VARCHAR(255) NOT NULL, + "private_description" VARCHAR(255), + "archived_at" TIMESTAMP(3), + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "document_types_pkey" PRIMARY KEY ("uuid") +); + +-- CreateTable +CREATE TABLE "deed_has_document_types" ( + "uuid" TEXT NOT NULL, + "document_type_uuid" VARCHAR(255) NOT NULL, + "deed_uuid" VARCHAR(255) NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "deed_has_document_types_pkey" PRIMARY KEY ("uuid") +); + +-- CreateTable +CREATE TABLE "deed" ( + "uuid" TEXT NOT NULL, + "deed_type_uuid" VARCHAR(255) NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "deed_pkey" PRIMARY KEY ("uuid") +); + +-- CreateTable +CREATE TABLE "deed_types" ( + "uuid" TEXT NOT NULL, + "name" VARCHAR(255) NOT NULL, + "description" VARCHAR(255) NOT NULL, + "archived_at" TIMESTAMP(3), + "office_uuid" VARCHAR(255) NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "deed_types_pkey" PRIMARY KEY ("uuid") +); + +-- CreateTable +CREATE TABLE "deed_type_has_document_types" ( + "uuid" TEXT NOT NULL, + "document_type_uuid" VARCHAR(255) NOT NULL, + "deed_type_uuid" VARCHAR(255) NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "deed_type_has_document_types_pkey" PRIMARY KEY ("uuid") +); + +-- CreateIndex +CREATE UNIQUE INDEX "addresses_uuid_key" ON "addresses"("uuid"); + +-- CreateIndex +CREATE UNIQUE INDEX "contacts_uuid_key" ON "contacts"("uuid"); + +-- CreateIndex +CREATE UNIQUE INDEX "contacts_address_uuid_key" ON "contacts"("address_uuid"); + +-- CreateIndex +CREATE UNIQUE INDEX "users_uuid_key" ON "users"("uuid"); + +-- CreateIndex +CREATE UNIQUE INDEX "users_idNot_key" ON "users"("idNot"); + +-- CreateIndex +CREATE UNIQUE INDEX "users_contact_uuid_key" ON "users"("contact_uuid"); + +-- CreateIndex +CREATE UNIQUE INDEX "offices_uuid_key" ON "offices"("uuid"); + +-- CreateIndex +CREATE UNIQUE INDEX "offices_idNot_key" ON "offices"("idNot"); + +-- CreateIndex +CREATE UNIQUE INDEX "offices_crpcen_key" ON "offices"("crpcen"); + +-- CreateIndex +CREATE UNIQUE INDEX "offices_address_uuid_key" ON "offices"("address_uuid"); + +-- CreateIndex +CREATE UNIQUE INDEX "customers_uuid_key" ON "customers"("uuid"); + +-- CreateIndex +CREATE UNIQUE INDEX "customers_contact_uuid_key" ON "customers"("contact_uuid"); + +-- CreateIndex +CREATE UNIQUE INDEX "user_has_notifications_uuid_key" ON "user_has_notifications"("uuid"); + +-- CreateIndex +CREATE UNIQUE INDEX "notifications_uuid_key" ON "notifications"("uuid"); + +-- CreateIndex +CREATE UNIQUE INDEX "office_folders_uuid_key" ON "office_folders"("uuid"); + +-- CreateIndex +CREATE UNIQUE INDEX "office_folders_deed_uuid_key" ON "office_folders"("deed_uuid"); + +-- CreateIndex +CREATE UNIQUE INDEX "office_folder_has_customers_uuid_key" ON "office_folder_has_customers"("uuid"); + +-- CreateIndex +CREATE UNIQUE INDEX "office_folder_has_stakeholder_uuid_key" ON "office_folder_has_stakeholder"("uuid"); + +-- CreateIndex +CREATE UNIQUE INDEX "documents_uuid_key" ON "documents"("uuid"); + +-- CreateIndex +CREATE UNIQUE INDEX "document_history_uuid_key" ON "document_history"("uuid"); + +-- CreateIndex +CREATE UNIQUE INDEX "files_uuid_key" ON "files"("uuid"); + +-- CreateIndex +CREATE UNIQUE INDEX "files_file_path_key" ON "files"("file_path"); + +-- CreateIndex +CREATE UNIQUE INDEX "blockchain_anchors_uuid_key" ON "blockchain_anchors"("uuid"); + +-- CreateIndex +CREATE UNIQUE INDEX "blockchain_anchors_smartSigJobId_key" ON "blockchain_anchors"("smartSigJobId"); + +-- CreateIndex +CREATE UNIQUE INDEX "document_types_uuid_key" ON "document_types"("uuid"); + +-- CreateIndex +CREATE UNIQUE INDEX "deed_has_document_types_uuid_key" ON "deed_has_document_types"("uuid"); + +-- CreateIndex +CREATE UNIQUE INDEX "deed_uuid_key" ON "deed"("uuid"); + +-- CreateIndex +CREATE UNIQUE INDEX "deed_deed_type_uuid_key" ON "deed"("deed_type_uuid"); + +-- CreateIndex +CREATE UNIQUE INDEX "deed_types_uuid_key" ON "deed_types"("uuid"); + +-- CreateIndex +CREATE UNIQUE INDEX "deed_type_has_document_types_uuid_key" ON "deed_type_has_document_types"("uuid"); + +-- AddForeignKey +ALTER TABLE "contacts" ADD CONSTRAINT "contacts_address_uuid_fkey" FOREIGN KEY ("address_uuid") REFERENCES "addresses"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "users" ADD CONSTRAINT "users_contact_uuid_fkey" FOREIGN KEY ("contact_uuid") REFERENCES "contacts"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "users" ADD CONSTRAINT "users_office_uuid_fkey" FOREIGN KEY ("office_uuid") REFERENCES "offices"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "offices" ADD CONSTRAINT "offices_address_uuid_fkey" FOREIGN KEY ("address_uuid") REFERENCES "addresses"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "customers" ADD CONSTRAINT "customers_contact_uuid_fkey" FOREIGN KEY ("contact_uuid") REFERENCES "contacts"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "user_has_notifications" ADD CONSTRAINT "user_has_notifications_user_uuid_fkey" FOREIGN KEY ("user_uuid") REFERENCES "users"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "user_has_notifications" ADD CONSTRAINT "user_has_notifications_notification_uuid_fkey" FOREIGN KEY ("notification_uuid") REFERENCES "notifications"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "office_folders" ADD CONSTRAINT "office_folders_deed_uuid_fkey" FOREIGN KEY ("deed_uuid") REFERENCES "deed"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "office_folders" ADD CONSTRAINT "office_folders_office_uuid_fkey" FOREIGN KEY ("office_uuid") REFERENCES "offices"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "office_folder_has_customers" ADD CONSTRAINT "office_folder_has_customers_customer_uuid_fkey" FOREIGN KEY ("customer_uuid") REFERENCES "customers"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "office_folder_has_customers" ADD CONSTRAINT "office_folder_has_customers_office_folder_uuid_fkey" FOREIGN KEY ("office_folder_uuid") REFERENCES "office_folders"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "office_folder_has_stakeholder" ADD CONSTRAINT "office_folder_has_stakeholder_office_folder_uuid_fkey" FOREIGN KEY ("office_folder_uuid") REFERENCES "office_folders"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "office_folder_has_stakeholder" ADD CONSTRAINT "office_folder_has_stakeholder_user_stakeholder_uuid_fkey" FOREIGN KEY ("user_stakeholder_uuid") REFERENCES "users"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "documents" ADD CONSTRAINT "documents_type_uuid_fkey" FOREIGN KEY ("type_uuid") REFERENCES "document_types"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "documents" ADD CONSTRAINT "documents_blockchain_anchor_uuid_fkey" FOREIGN KEY ("blockchain_anchor_uuid") REFERENCES "blockchain_anchors"("uuid") ON DELETE SET NULL ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "documents" ADD CONSTRAINT "documents_folder_uuid_fkey" FOREIGN KEY ("folder_uuid") REFERENCES "office_folders"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "documents" ADD CONSTRAINT "documents_depositor_uuid_fkey" FOREIGN KEY ("depositor_uuid") REFERENCES "customers"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "document_history" ADD CONSTRAINT "document_history_document_uuid_fkey" FOREIGN KEY ("document_uuid") REFERENCES "documents"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "files" ADD CONSTRAINT "files_document_uuid_fkey" FOREIGN KEY ("document_uuid") REFERENCES "documents"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "deed_has_document_types" ADD CONSTRAINT "deed_has_document_types_document_type_uuid_fkey" FOREIGN KEY ("document_type_uuid") REFERENCES "document_types"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "deed_has_document_types" ADD CONSTRAINT "deed_has_document_types_deed_uuid_fkey" FOREIGN KEY ("deed_uuid") REFERENCES "deed"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "deed" ADD CONSTRAINT "deed_deed_type_uuid_fkey" FOREIGN KEY ("deed_type_uuid") REFERENCES "deed_types"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "deed_types" ADD CONSTRAINT "deed_types_office_uuid_fkey" FOREIGN KEY ("office_uuid") REFERENCES "offices"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "deed_type_has_document_types" ADD CONSTRAINT "deed_type_has_document_types_document_type_uuid_fkey" FOREIGN KEY ("document_type_uuid") REFERENCES "document_types"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "deed_type_has_document_types" ADD CONSTRAINT "deed_type_has_document_types_deed_type_uuid_fkey" FOREIGN KEY ("deed_type_uuid") REFERENCES "deed_types"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/src/common/databases/migrations/20230324125436_20230324102005_v1/migration.sql b/src/common/databases/migrations/20230324125436_20230324102005_v1/migration.sql new file mode 100644 index 00000000..decf61d6 --- /dev/null +++ b/src/common/databases/migrations/20230324125436_20230324102005_v1/migration.sql @@ -0,0 +1,92 @@ +/* + Warnings: + + - A unique constraint covering the columns `[address]` on the table `addresses` will be added. If there are existing duplicate values, this will fail. + - A unique constraint covering the columns `[email]` on the table `contacts` will be added. If there are existing duplicate values, this will fail. + - A unique constraint covering the columns `[cell_phone_number]` on the table `contacts` will be added. If there are existing duplicate values, this will fail. + +*/ +-- AlterTable +ALTER TABLE "addresses" ALTER COLUMN "created_at" DROP NOT NULL, +ALTER COLUMN "updated_at" DROP NOT NULL; + +-- AlterTable +ALTER TABLE "blockchain_anchors" ALTER COLUMN "created_at" DROP NOT NULL, +ALTER COLUMN "updated_at" DROP NOT NULL; + +-- AlterTable +ALTER TABLE "contacts" ALTER COLUMN "created_at" DROP NOT NULL, +ALTER COLUMN "updated_at" DROP NOT NULL; + +-- AlterTable +ALTER TABLE "customers" ALTER COLUMN "created_at" DROP NOT NULL, +ALTER COLUMN "updated_at" DROP NOT NULL; + +-- AlterTable +ALTER TABLE "deed" ALTER COLUMN "created_at" DROP NOT NULL, +ALTER COLUMN "updated_at" DROP NOT NULL; + +-- AlterTable +ALTER TABLE "deed_has_document_types" ALTER COLUMN "created_at" DROP NOT NULL, +ALTER COLUMN "updated_at" DROP NOT NULL; + +-- AlterTable +ALTER TABLE "deed_type_has_document_types" ALTER COLUMN "created_at" DROP NOT NULL, +ALTER COLUMN "updated_at" DROP NOT NULL; + +-- AlterTable +ALTER TABLE "deed_types" ALTER COLUMN "created_at" DROP NOT NULL, +ALTER COLUMN "updated_at" DROP NOT NULL; + +-- AlterTable +ALTER TABLE "document_history" ALTER COLUMN "created_at" DROP NOT NULL, +ALTER COLUMN "updated_at" DROP NOT NULL; + +-- AlterTable +ALTER TABLE "document_types" ALTER COLUMN "created_at" DROP NOT NULL, +ALTER COLUMN "updated_at" DROP NOT NULL; + +-- AlterTable +ALTER TABLE "documents" ALTER COLUMN "created_at" DROP NOT NULL, +ALTER COLUMN "updated_at" DROP NOT NULL; + +-- AlterTable +ALTER TABLE "files" ALTER COLUMN "created_at" DROP NOT NULL, +ALTER COLUMN "updated_at" DROP NOT NULL; + +-- AlterTable +ALTER TABLE "notifications" ALTER COLUMN "created_at" DROP NOT NULL, +ALTER COLUMN "updated_at" DROP NOT NULL; + +-- AlterTable +ALTER TABLE "office_folder_has_customers" ALTER COLUMN "created_at" DROP NOT NULL, +ALTER COLUMN "updated_at" DROP NOT NULL; + +-- AlterTable +ALTER TABLE "office_folder_has_stakeholder" ALTER COLUMN "created_at" DROP NOT NULL, +ALTER COLUMN "updated_at" DROP NOT NULL; + +-- AlterTable +ALTER TABLE "office_folders" ALTER COLUMN "created_at" DROP NOT NULL, +ALTER COLUMN "updated_at" DROP NOT NULL; + +-- AlterTable +ALTER TABLE "offices" ALTER COLUMN "created_at" DROP NOT NULL, +ALTER COLUMN "updated_at" DROP NOT NULL; + +-- AlterTable +ALTER TABLE "user_has_notifications" ALTER COLUMN "created_at" DROP NOT NULL, +ALTER COLUMN "updated_at" DROP NOT NULL; + +-- AlterTable +ALTER TABLE "users" ALTER COLUMN "created_at" DROP NOT NULL, +ALTER COLUMN "updated_at" DROP NOT NULL; + +-- CreateIndex +CREATE UNIQUE INDEX "addresses_address_key" ON "addresses"("address"); + +-- CreateIndex +CREATE UNIQUE INDEX "contacts_email_key" ON "contacts"("email"); + +-- CreateIndex +CREATE UNIQUE INDEX "contacts_cell_phone_number_key" ON "contacts"("cell_phone_number"); diff --git a/src/common/databases/migrations/20230324130335_20230324_v2/migration.sql b/src/common/databases/migrations/20230324130335_20230324_v2/migration.sql new file mode 100644 index 00000000..9fd68230 --- /dev/null +++ b/src/common/databases/migrations/20230324130335_20230324_v2/migration.sql @@ -0,0 +1,2 @@ +-- DropIndex +DROP INDEX "addresses_address_key"; diff --git a/src/common/databases/migrations/20230324171729_v3/migration.sql b/src/common/databases/migrations/20230324171729_v3/migration.sql new file mode 100644 index 00000000..0c38c4c9 --- /dev/null +++ b/src/common/databases/migrations/20230324171729_v3/migration.sql @@ -0,0 +1,119 @@ +-- DropForeignKey +ALTER TABLE "contacts" DROP CONSTRAINT "contacts_address_uuid_fkey"; + +-- DropForeignKey +ALTER TABLE "customers" DROP CONSTRAINT "customers_contact_uuid_fkey"; + +-- DropForeignKey +ALTER TABLE "deed" DROP CONSTRAINT "deed_deed_type_uuid_fkey"; + +-- DropForeignKey +ALTER TABLE "deed_has_document_types" DROP CONSTRAINT "deed_has_document_types_deed_uuid_fkey"; + +-- DropForeignKey +ALTER TABLE "deed_has_document_types" DROP CONSTRAINT "deed_has_document_types_document_type_uuid_fkey"; + +-- DropForeignKey +ALTER TABLE "deed_type_has_document_types" DROP CONSTRAINT "deed_type_has_document_types_deed_type_uuid_fkey"; + +-- DropForeignKey +ALTER TABLE "deed_type_has_document_types" DROP CONSTRAINT "deed_type_has_document_types_document_type_uuid_fkey"; + +-- DropForeignKey +ALTER TABLE "deed_types" DROP CONSTRAINT "deed_types_office_uuid_fkey"; + +-- DropForeignKey +ALTER TABLE "document_history" DROP CONSTRAINT "document_history_document_uuid_fkey"; + +-- DropForeignKey +ALTER TABLE "documents" DROP CONSTRAINT "documents_depositor_uuid_fkey"; + +-- DropForeignKey +ALTER TABLE "files" DROP CONSTRAINT "files_document_uuid_fkey"; + +-- DropForeignKey +ALTER TABLE "office_folder_has_customers" DROP CONSTRAINT "office_folder_has_customers_customer_uuid_fkey"; + +-- DropForeignKey +ALTER TABLE "office_folder_has_customers" DROP CONSTRAINT "office_folder_has_customers_office_folder_uuid_fkey"; + +-- DropForeignKey +ALTER TABLE "office_folder_has_stakeholder" DROP CONSTRAINT "office_folder_has_stakeholder_office_folder_uuid_fkey"; + +-- DropForeignKey +ALTER TABLE "office_folder_has_stakeholder" DROP CONSTRAINT "office_folder_has_stakeholder_user_stakeholder_uuid_fkey"; + +-- DropForeignKey +ALTER TABLE "office_folders" DROP CONSTRAINT "office_folders_deed_uuid_fkey"; + +-- DropForeignKey +ALTER TABLE "office_folders" DROP CONSTRAINT "office_folders_office_uuid_fkey"; + +-- DropForeignKey +ALTER TABLE "offices" DROP CONSTRAINT "offices_address_uuid_fkey"; + +-- DropForeignKey +ALTER TABLE "user_has_notifications" DROP CONSTRAINT "user_has_notifications_notification_uuid_fkey"; + +-- DropForeignKey +ALTER TABLE "users" DROP CONSTRAINT "users_contact_uuid_fkey"; + +-- AddForeignKey +ALTER TABLE "contacts" ADD CONSTRAINT "contacts_address_uuid_fkey" FOREIGN KEY ("address_uuid") REFERENCES "addresses"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "users" ADD CONSTRAINT "users_contact_uuid_fkey" FOREIGN KEY ("contact_uuid") REFERENCES "contacts"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "offices" ADD CONSTRAINT "offices_address_uuid_fkey" FOREIGN KEY ("address_uuid") REFERENCES "addresses"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "customers" ADD CONSTRAINT "customers_contact_uuid_fkey" FOREIGN KEY ("contact_uuid") REFERENCES "contacts"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "user_has_notifications" ADD CONSTRAINT "user_has_notifications_notification_uuid_fkey" FOREIGN KEY ("notification_uuid") REFERENCES "notifications"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "office_folders" ADD CONSTRAINT "office_folders_deed_uuid_fkey" FOREIGN KEY ("deed_uuid") REFERENCES "deed"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "office_folders" ADD CONSTRAINT "office_folders_office_uuid_fkey" FOREIGN KEY ("office_uuid") REFERENCES "offices"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "office_folder_has_customers" ADD CONSTRAINT "office_folder_has_customers_customer_uuid_fkey" FOREIGN KEY ("customer_uuid") REFERENCES "customers"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "office_folder_has_customers" ADD CONSTRAINT "office_folder_has_customers_office_folder_uuid_fkey" FOREIGN KEY ("office_folder_uuid") REFERENCES "office_folders"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "office_folder_has_stakeholder" ADD CONSTRAINT "office_folder_has_stakeholder_office_folder_uuid_fkey" FOREIGN KEY ("office_folder_uuid") REFERENCES "office_folders"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "office_folder_has_stakeholder" ADD CONSTRAINT "office_folder_has_stakeholder_user_stakeholder_uuid_fkey" FOREIGN KEY ("user_stakeholder_uuid") REFERENCES "users"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "documents" ADD CONSTRAINT "documents_depositor_uuid_fkey" FOREIGN KEY ("depositor_uuid") REFERENCES "customers"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "document_history" ADD CONSTRAINT "document_history_document_uuid_fkey" FOREIGN KEY ("document_uuid") REFERENCES "documents"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "files" ADD CONSTRAINT "files_document_uuid_fkey" FOREIGN KEY ("document_uuid") REFERENCES "documents"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "deed_has_document_types" ADD CONSTRAINT "deed_has_document_types_document_type_uuid_fkey" FOREIGN KEY ("document_type_uuid") REFERENCES "document_types"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "deed_has_document_types" ADD CONSTRAINT "deed_has_document_types_deed_uuid_fkey" FOREIGN KEY ("deed_uuid") REFERENCES "deed"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "deed" ADD CONSTRAINT "deed_deed_type_uuid_fkey" FOREIGN KEY ("deed_type_uuid") REFERENCES "deed_types"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "deed_types" ADD CONSTRAINT "deed_types_office_uuid_fkey" FOREIGN KEY ("office_uuid") REFERENCES "offices"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "deed_type_has_document_types" ADD CONSTRAINT "deed_type_has_document_types_document_type_uuid_fkey" FOREIGN KEY ("document_type_uuid") REFERENCES "document_types"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "deed_type_has_document_types" ADD CONSTRAINT "deed_type_has_document_types_deed_type_uuid_fkey" FOREIGN KEY ("deed_type_uuid") REFERENCES "deed_types"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/src/common/databases/migrations/20230328095747_v4/migration.sql b/src/common/databases/migrations/20230328095747_v4/migration.sql new file mode 100644 index 00000000..feb43abb --- /dev/null +++ b/src/common/databases/migrations/20230328095747_v4/migration.sql @@ -0,0 +1,8 @@ +-- DropForeignKey +ALTER TABLE "users" DROP CONSTRAINT "users_office_uuid_fkey"; + +-- DropIndex +DROP INDEX "deed_deed_type_uuid_key"; + +-- AddForeignKey +ALTER TABLE "users" ADD CONSTRAINT "users_office_uuid_fkey" FOREIGN KEY ("office_uuid") REFERENCES "offices"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/src/common/databases/migrations/20230329084446_v5/migration.sql b/src/common/databases/migrations/20230329084446_v5/migration.sql new file mode 100644 index 00000000..8671fd3a --- /dev/null +++ b/src/common/databases/migrations/20230329084446_v5/migration.sql @@ -0,0 +1,8 @@ +/* + Warnings: + + - A unique constraint covering the columns `[name,office_uuid]` on the table `deed_types` will be added. If there are existing duplicate values, this will fail. + +*/ +-- CreateIndex +CREATE UNIQUE INDEX "deed_types_name_office_uuid_key" ON "deed_types"("name", "office_uuid"); diff --git a/src/common/databases/migrations/20230329145139_v6/migration.sql b/src/common/databases/migrations/20230329145139_v6/migration.sql new file mode 100644 index 00000000..13597e8e --- /dev/null +++ b/src/common/databases/migrations/20230329145139_v6/migration.sql @@ -0,0 +1,15 @@ +/* + Warnings: + + - A unique constraint covering the columns `[name,office_uuid]` on the table `document_types` will be added. If there are existing duplicate values, this will fail. + - Added the required column `office_uuid` to the `document_types` table without a default value. This is not possible if the table is not empty. + +*/ +-- AlterTable +ALTER TABLE "document_types" ADD COLUMN "office_uuid" VARCHAR(255) NOT NULL; + +-- CreateIndex +CREATE UNIQUE INDEX "document_types_name_office_uuid_key" ON "document_types"("name", "office_uuid"); + +-- AddForeignKey +ALTER TABLE "document_types" ADD CONSTRAINT "document_types_office_uuid_fkey" FOREIGN KEY ("office_uuid") REFERENCES "offices"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/src/common/databases/migrations/20230330150236_v8/migration.sql b/src/common/databases/migrations/20230330150236_v8/migration.sql new file mode 100644 index 00000000..5bda5e34 --- /dev/null +++ b/src/common/databases/migrations/20230330150236_v8/migration.sql @@ -0,0 +1,24 @@ +/* + Warnings: + + - A unique constraint covering the columns `[deed_uuid,document_type_uuid]` on the table `deed_has_document_types` will be added. If there are existing duplicate values, this will fail. + - A unique constraint covering the columns `[deed_type_uuid,document_type_uuid]` on the table `deed_type_has_document_types` will be added. If there are existing duplicate values, this will fail. + - A unique constraint covering the columns `[customer_uuid,office_folder_uuid]` on the table `office_folder_has_customers` will be added. If there are existing duplicate values, this will fail. + - A unique constraint covering the columns `[office_folder_uuid,user_stakeholder_uuid]` on the table `office_folder_has_stakeholder` will be added. If there are existing duplicate values, this will fail. + - A unique constraint covering the columns `[notification_uuid,user_uuid]` on the table `user_has_notifications` will be added. If there are existing duplicate values, this will fail. + +*/ +-- CreateIndex +CREATE UNIQUE INDEX "deed_has_document_types_deed_uuid_document_type_uuid_key" ON "deed_has_document_types"("deed_uuid", "document_type_uuid"); + +-- CreateIndex +CREATE UNIQUE INDEX "deed_type_has_document_types_deed_type_uuid_document_type_u_key" ON "deed_type_has_document_types"("deed_type_uuid", "document_type_uuid"); + +-- CreateIndex +CREATE UNIQUE INDEX "office_folder_has_customers_customer_uuid_office_folder_uui_key" ON "office_folder_has_customers"("customer_uuid", "office_folder_uuid"); + +-- CreateIndex +CREATE UNIQUE INDEX "office_folder_has_stakeholder_office_folder_uuid_user_stake_key" ON "office_folder_has_stakeholder"("office_folder_uuid", "user_stakeholder_uuid"); + +-- CreateIndex +CREATE UNIQUE INDEX "user_has_notifications_notification_uuid_user_uuid_key" ON "user_has_notifications"("notification_uuid", "user_uuid"); diff --git a/src/common/databases/schema.prisma b/src/common/databases/schema.prisma index 8d670423..d6e1f3f7 100644 --- a/src/common/databases/schema.prisma +++ b/src/common/databases/schema.prisma @@ -2,6 +2,7 @@ generator client { provider = "prisma-client-js" + //binaryTargets = ["native"] } datasource db { @@ -21,10 +22,10 @@ model Addresses { address String @db.VarChar(255) city String @db.VarChar(255) zip_code Int - created_at DateTime @default(now()) - updated_at DateTime @updatedAt + created_at DateTime? @default(now()) + updated_at DateTime? @updatedAt contacts Contacts? - office Office? + office Offices? @@map("addresses") } @@ -33,14 +34,14 @@ model Contacts { uuid String @id @unique @default(uuid()) first_name String @db.VarChar(255) last_name String @db.VarChar(255) - email String @db.VarChar(255) + email String @unique @db.VarChar(255) phone_number String? @db.VarChar(50) - cell_phone_number String? @db.VarChar(50) + cell_phone_number String? @unique @db.VarChar(50) civility ECivility @default(MALE) - address Addresses @relation(fields: [address_uuid], references: [uuid]) + address Addresses @relation(fields: [address_uuid], references: [uuid], onDelete: Cascade) address_uuid String @unique @db.VarChar(255) - created_at DateTime @default(now()) - updated_at DateTime @updatedAt + created_at DateTime? @default(now()) + updated_at DateTime? @updatedAt users Users? customers Customers? @@ -50,11 +51,11 @@ model Contacts { model Users { uuid String @id @unique @default(uuid()) idNot String @unique @db.VarChar(255) - contact Contacts @relation(fields: [contact_uuid], references: [uuid]) + contact Contacts @relation(fields: [contact_uuid], references: [uuid], onDelete: Cascade) contact_uuid String @unique @db.VarChar(255) - created_at DateTime @default(now()) - updated_at DateTime @updatedAt - office_membership Office @relation(fields: [office_uuid], references: [uuid]) + created_at DateTime? @default(now()) + updated_at DateTime? @updatedAt + office_membership Offices @relation(fields: [office_uuid], references: [uuid], onDelete: Cascade) office_uuid String @db.VarChar(255) user_has_notifications UserHasNotifications[] office_folder_has_stakeholder OfficeFolderHasStakeholders[] @@ -62,19 +63,20 @@ model Users { @@map("users") } -model Office { +model Offices { uuid String @id @unique @default(uuid()) idNot String @unique @db.VarChar(255) name String @db.VarChar(255) crpcen String @unique @db.VarChar(255) - address Addresses @relation(fields: [address_uuid], references: [uuid]) + address Addresses @relation(fields: [address_uuid], references: [uuid], onDelete: Cascade) address_uuid String @unique @db.VarChar(255) office_status EOfficeStatus @default(DESACTIVATED) - created_at DateTime @default(now()) - updated_at DateTime @updatedAt + created_at DateTime? @default(now()) + updated_at DateTime? @updatedAt deed_types DeedTypes[] users Users[] office_folders OfficeFolders[] + document_types DocumentTypes[] @@map("offices") } @@ -82,10 +84,10 @@ model Office { model Customers { uuid String @id @unique @default(uuid()) status ECustomerStatus @default(PENDING) - contact Contacts @relation(fields: [contact_uuid], references: [uuid]) + contact Contacts @relation(fields: [contact_uuid], references: [uuid], onDelete: Cascade) contact_uuid String @unique @db.VarChar(255) - created_at DateTime @default(now()) - updated_at DateTime @updatedAt + created_at DateTime? @default(now()) + updated_at DateTime? @updatedAt office_folder_has_customers OfficeFolderHasCustomers[] documents Documents[] @@ -96,12 +98,13 @@ model UserHasNotifications { uuid String @id @unique @default(uuid()) user Users @relation(fields: [user_uuid], references: [uuid]) user_uuid String @db.VarChar(255) - notification Notifications @relation(fields: [notification_uuid], references: [uuid]) + notification Notifications @relation(fields: [notification_uuid], references: [uuid], onDelete: Cascade) notification_uuid String @db.VarChar(255) notification_status ENotificationStatus @default(UNREAD) - created_at DateTime @default(now()) - updated_at DateTime @updatedAt + created_at DateTime? @default(now()) + updated_at DateTime? @updatedAt + @@unique([notification_uuid, user_uuid]) @@map("user_has_notifications") } @@ -109,8 +112,8 @@ model Notifications { uuid String @id @unique @default(uuid()) message String @db.VarChar(255) redirection_url String @db.VarChar(255) - created_at DateTime @default(now()) - updated_at DateTime @updatedAt + created_at DateTime? @default(now()) + updated_at DateTime? @updatedAt user_has_notifications UserHasNotifications[] @@map("notifications") @@ -123,12 +126,12 @@ model OfficeFolders { description String? @db.VarChar(255) archived_description String? @db.VarChar(255) status EFolderStatus @default(LIVE) - deed Deed @relation(fields: [deed_uuid], references: [uuid]) + deed Deeds @relation(fields: [deed_uuid], references: [uuid], onDelete: Cascade) deed_uuid String @unique @db.VarChar(255) - office Office @relation(fields: [office_uuid], references: [uuid]) + office Offices @relation(fields: [office_uuid], references: [uuid], onDelete: Cascade) office_uuid String @db.VarChar(255) - created_at DateTime @default(now()) - updated_at DateTime @updatedAt + created_at DateTime? @default(now()) + updated_at DateTime? @updatedAt office_folder_has_customers OfficeFolderHasCustomers[] office_folder_has_stakeholder OfficeFolderHasStakeholders[] documents Documents[] @@ -138,25 +141,27 @@ model OfficeFolders { model OfficeFolderHasCustomers { uuid String @id @unique @default(uuid()) - customer Customers @relation(fields: [customer_uuid], references: [uuid]) + customer Customers @relation(fields: [customer_uuid], references: [uuid], onDelete: Cascade) customer_uuid String @db.VarChar(255) - office_folder OfficeFolders @relation(fields: [office_folder_uuid], references: [uuid]) + office_folder OfficeFolders @relation(fields: [office_folder_uuid], references: [uuid], onDelete: Cascade) office_folder_uuid String @db.VarChar(255) - created_at DateTime @default(now()) - updated_at DateTime @updatedAt + created_at DateTime? @default(now()) + updated_at DateTime? @updatedAt + @@unique([customer_uuid, office_folder_uuid]) @@map("office_folder_has_customers") } model OfficeFolderHasStakeholders { uuid String @id @unique @default(uuid()) - office_folder OfficeFolders @relation(fields: [office_folder_uuid], references: [uuid]) + office_folder OfficeFolders @relation(fields: [office_folder_uuid], references: [uuid], onDelete: Cascade) office_folder_uuid String @db.VarChar(255) - user_stakeholder Users @relation(fields: [user_stakeholder_uuid], references: [uuid]) + user_stakeholder Users @relation(fields: [user_stakeholder_uuid], references: [uuid], onDelete: Cascade) user_stakeholder_uuid String @db.VarChar(255) - created_at DateTime @default(now()) - updated_at DateTime @updatedAt + created_at DateTime? @default(now()) + updated_at DateTime? @updatedAt + @@unique([office_folder_uuid, user_stakeholder_uuid]) @@map("office_folder_has_stakeholder") } @@ -169,10 +174,10 @@ model Documents { blockchain_anchor_uuid String? @db.VarChar(255) folder OfficeFolders @relation(fields: [folder_uuid], references: [uuid]) folder_uuid String @db.VarChar(255) - depositor Customers @relation(fields: [depositor_uuid], references: [uuid]) + depositor Customers @relation(fields: [depositor_uuid], references: [uuid], onDelete: Cascade) depositor_uuid String @db.VarChar(255) - created_at DateTime @default(now()) - updated_at DateTime @updatedAt + created_at DateTime? @default(now()) + updated_at DateTime? @updatedAt files Files[] document_history DocumentHistory[] @@ -183,21 +188,21 @@ model DocumentHistory { uuid String @id @unique @default(uuid()) document_status EDocumentStatus @default(ASKED) refused_reason String? @db.VarChar(255) - document Documents @relation(fields: [document_uuid], references: [uuid]) + document Documents @relation(fields: [document_uuid], references: [uuid], onDelete: Cascade) document_uuid String @db.VarChar(255) - created_at DateTime @default(now()) - updated_at DateTime @updatedAt + created_at DateTime? @default(now()) + updated_at DateTime? @updatedAt @@map("document_history") } model Files { uuid String @id @unique @default(uuid()) - document Documents @relation(fields: [document_uuid], references: [uuid]) + document Documents @relation(fields: [document_uuid], references: [uuid], onDelete: Cascade) document_uuid String @db.VarChar(255) file_path String? @unique @db.VarChar(255) - created_at DateTime @default(now()) - updated_at DateTime @updatedAt + created_at DateTime? @default(now()) + updated_at DateTime? @updatedAt @@map("files") } @@ -205,8 +210,8 @@ model Files { model BlockchainAnchors { uuid String @id @unique @default(uuid()) smartSigJobId String @unique @db.VarChar(255) - created_at DateTime @default(now()) - updated_at DateTime @updatedAt + created_at DateTime? @default(now()) + updated_at DateTime? @updatedAt documents Documents[] @@map("blockchain_anchors") @@ -217,34 +222,38 @@ model DocumentTypes { name String @db.VarChar(255) public_description String @db.VarChar(255) private_description String? @db.VarChar(255) + office Offices @relation(fields: [office_uuid], references: [uuid], onDelete: Cascade) + office_uuid String @db.VarChar(255) archived_at DateTime? - created_at DateTime @default(now()) - updated_at DateTime @updatedAt + created_at DateTime? @default(now()) + updated_at DateTime? @updatedAt documents Documents[] deed_has_document_types DeedHasDocumentTypes[] deed_type_has_document_types DeedTypeHasDocumentTypes[] + @@unique([name, office_uuid]) @@map("document_types") } model DeedHasDocumentTypes { uuid String @id @unique @default(uuid()) - document_type DocumentTypes @relation(fields: [document_type_uuid], references: [uuid]) + document_type DocumentTypes @relation(fields: [document_type_uuid], references: [uuid], onDelete: Cascade) document_type_uuid String @db.VarChar(255) - deed Deed @relation(fields: [deed_uuid], references: [uuid]) + deed Deeds @relation(fields: [deed_uuid], references: [uuid], onDelete: Cascade) deed_uuid String @db.VarChar(255) - created_at DateTime @default(now()) - updated_at DateTime @updatedAt + created_at DateTime? @default(now()) + updated_at DateTime? @updatedAt + @@unique([deed_uuid, document_type_uuid]) @@map("deed_has_document_types") } -model Deed { +model Deeds { uuid String @id @unique @default(uuid()) - deed_type DeedTypes @relation(fields: [deed_type_uuid], references: [uuid]) - deed_type_uuid String @unique @db.VarChar(255) - created_at DateTime @default(now()) - updated_at DateTime @updatedAt + deed_type DeedTypes @relation(fields: [deed_type_uuid], references: [uuid], onDelete: Cascade) + deed_type_uuid String @db.VarChar(255) + created_at DateTime? @default(now()) + updated_at DateTime? @updatedAt deed_has_document_types DeedHasDocumentTypes[] office_folder OfficeFolders? @@ -256,29 +265,30 @@ model DeedTypes { name String @db.VarChar(255) description String @db.VarChar(255) archived_at DateTime? - office Office @relation(fields: [office_uuid], references: [uuid]) + office Offices @relation(fields: [office_uuid], references: [uuid], onDelete: Cascade) office_uuid String @db.VarChar(255) - created_at DateTime @default(now()) - updated_at DateTime @updatedAt - deed Deed? + created_at DateTime? @default(now()) + updated_at DateTime? @updatedAt + deed Deeds[] deed_type_has_document_types DeedTypeHasDocumentTypes[] + @@unique([name, office_uuid]) @@map("deed_types") } model DeedTypeHasDocumentTypes { uuid String @id @unique @default(uuid()) - document_type DocumentTypes @relation(fields: [document_type_uuid], references: [uuid]) + document_type DocumentTypes @relation(fields: [document_type_uuid], references: [uuid], onDelete: Cascade) document_type_uuid String @db.VarChar(255) - deed_type DeedTypes @relation(fields: [deed_type_uuid], references: [uuid]) + deed_type DeedTypes @relation(fields: [deed_type_uuid], references: [uuid], onDelete: Cascade) deed_type_uuid String @db.VarChar(255) - created_at DateTime @default(now()) - updated_at DateTime @updatedAt + created_at DateTime? @default(now()) + updated_at DateTime? @updatedAt + @@unique([deed_type_uuid, document_type_uuid]) @@map("deed_type_has_document_types") } -// TODO SE RENSEIGNER SUR LES ENUMS enum ECivility { MALE FEMALE diff --git a/src/common/helpers/ObjectHydrate.ts b/src/common/helpers/ObjectHydrate.ts index 5e220bd0..d8f3121c 100644 --- a/src/common/helpers/ObjectHydrate.ts +++ b/src/common/helpers/ObjectHydrate.ts @@ -1,13 +1,13 @@ -import { type ClassTransformOptions, plainToClass, plainToClassFromExist } from "class-transformer"; - -export default abstract class ObjectHydrate { - public static hydrate(object: T, from: Partial, options?: ClassTransformOptions): T { - return plainToClassFromExist(object, from, options); - } - - public static map(ClassEntity: { new (): T }, fromArray: Partial[], options?: ClassTransformOptions): T[] { - return fromArray.map((from) => { - return plainToClass(ClassEntity, from, options); - }); - } -} +import { type ClassTransformOptions, plainToClass, plainToClassFromExist } from "class-transformer"; + +export default abstract class ObjectHydrate { + public static hydrate(object: T, from: Partial, options?: ClassTransformOptions): T { + return plainToClassFromExist(object, from, options); + } + + public static map(ClassEntity: { new (): T }, fromArray: Partial[], options?: ClassTransformOptions): T[] { + return fromArray.map((from) => { + return plainToClass(ClassEntity, from, options); + }); + } +} diff --git a/src/common/repositories/AddressesRepository.ts b/src/common/repositories/AddressesRepository.ts new file mode 100644 index 00000000..6b2cf46d --- /dev/null +++ b/src/common/repositories/AddressesRepository.ts @@ -0,0 +1,35 @@ +import Database from "@Common/databases/database"; +import BaseRepository from "@Repositories/BaseRepository"; +import { Service } from "typedi"; +import { Addresses } from "@prisma/client"; + +@Service() +export default class AddressesRepository extends BaseRepository { + constructor(private database: Database) { + super(); + } + protected get model() { + return this.database.getClient().addresses; + } + protected get instanceDb() { + return this.database.getClient(); + } + + /** + * @description : Find many users + */ + public async findMany(query: any): Promise { + query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); + return this.model.findMany(query); + } + + public async create(address: Addresses): Promise { + return this.model.create({ + data: { + address: address.address, + city: address.city, + zip_code: address.zip_code, + }, + }); + } +} diff --git a/src/common/repositories/ContactRepository.ts b/src/common/repositories/ContactRepository.ts new file mode 100644 index 00000000..bb0496eb --- /dev/null +++ b/src/common/repositories/ContactRepository.ts @@ -0,0 +1,26 @@ +import Database from "@Common/databases/database"; +import BaseRepository from "@Repositories/BaseRepository"; +import { Service } from "typedi"; +import { processFindManyQuery } from "prisma-query"; +import { Addresses } from "@prisma/client"; + +@Service() +export default class AddressesRepository extends BaseRepository { + constructor(private database: Database) { + super(); + } + protected get model() { + return this.database.getClient().addresses; + } + protected get instanceDb() { + return this.database.getClient(); + } + + /** + * @description : Find many users + */ + public async findMany(query: ReturnType): Promise { + query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); + return this.model.findMany(query); + } +} diff --git a/src/common/repositories/CustomersRepository.ts b/src/common/repositories/CustomersRepository.ts new file mode 100644 index 00000000..af434c55 --- /dev/null +++ b/src/common/repositories/CustomersRepository.ts @@ -0,0 +1,93 @@ +import Database from "@Common/databases/database"; +import BaseRepository from "@Repositories/BaseRepository"; +import { Service } from "typedi"; +import { Customers, ECivility, ECustomerStatus } from "@prisma/client"; +import { Customer } from "le-coffre-resources/dist/SuperAdmin"; + +@Service() +export default class CustomersRepository extends BaseRepository { + constructor(private database: Database) { + super(); + } + protected get model() { + return this.database.getClient().customers; + } + protected get instanceDb() { + return this.database.getClient(); + } + + /** + * @description : Find many customers + */ + public async findMany(query: any): Promise { + query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); + return this.model.findMany(query); + } + + public async create(customer: Customer): Promise { + return this.model.create({ + data: { + status: ECustomerStatus.PENDING, + contact: { + create: { + first_name: customer.contact.first_name, + last_name: customer.contact.last_name, + email: customer.contact.email, + phone_number: customer.contact.phone_number, + cell_phone_number: customer.contact.cell_phone_number, + civility: ECivility[customer.contact.civility as keyof typeof ECivility], + address: { + create: { + address: customer.contact.address.address, + zip_code: customer.contact.address.zip_code, + city: customer.contact.address.city, + }, + }, + }, + }, + }, + }); + } + + public async update(uid: string, customer: Customer): Promise { + return this.model.update({ + where: { + uuid: uid, + }, + data: { + status: ECustomerStatus[customer.status as keyof typeof ECustomerStatus], + contact: { + update: { + first_name: customer.contact.first_name, + last_name: customer.contact.last_name, + email: customer.contact.email, + phone_number: customer.contact.phone_number, + cell_phone_number: customer.contact.cell_phone_number, + civility: ECivility[customer.contact.civility as keyof typeof ECivility], + address: { + update: { + address: customer.contact.address.address, + zip_code: customer.contact.address.zip_code, + city: customer.contact.address.city, + }, + }, + }, + }, + }, + }); + } + + public async findOneByUid(uid: string): Promise { + const customerEntity = await this.model.findUnique({ + where: { + uuid: uid, + }, + }); + + if (!customerEntity) { + throw new Error("Customer not found"); + } + + return customerEntity; + } +} diff --git a/src/common/repositories/DeedTypesHasDocumentTypesRepository.ts b/src/common/repositories/DeedTypesHasDocumentTypesRepository.ts new file mode 100644 index 00000000..21141db7 --- /dev/null +++ b/src/common/repositories/DeedTypesHasDocumentTypesRepository.ts @@ -0,0 +1,112 @@ +import Database from "@Common/databases/database"; +import { DeedTypeHasDocumentTypes, Prisma } from "@prisma/client"; +import BaseRepository from "@Repositories/BaseRepository"; +import { Service } from "typedi"; + +@Service() +export default class DeedTypeHasDocumentTypesRepository extends BaseRepository { + constructor(private database: Database) { + super(); + } + protected get model() { + return this.database.getClient().deedTypeHasDocumentTypes; + } + protected get instanceDb() { + return this.database.getClient(); + } + + /** + * @description : Find many users + */ + public async findMany(query: any): Promise { + query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); + return this.model.findMany(query); + } + + /** + * @description : Create new relation between deed type and a document type + */ + public async create(deedTypeUuid: string, documentTypesUuid: string): Promise { + return this.model.create({ + data: { + deed_type: { + connect: { + uuid: deedTypeUuid, + }, + }, + document_type: { + connect: { + uuid: documentTypesUuid, + }, + }, + }, + }); + } + + /** + * @description : Create new relation between deed type and a document type + */ + public async createMany(deedTypeUuid: string, documentTypesUuid: string[]): Promise { + let relationsToAdd: Prisma.DeedTypeHasDocumentTypesCreateManyInput[] = []; + documentTypesUuid.forEach((item) => { + relationsToAdd.push({ deed_type_uuid: deedTypeUuid, document_type_uuid: item }); + }); + + const numberOfRelationsAdded = ( + await this.model.createMany({ + data: relationsToAdd, + skipDuplicates: true, + }) + ).count; + + return this.findMany({ where: { deed_type_uuid: deedTypeUuid }, take: numberOfRelationsAdded }); + } + + /** + * @description : Create new relation between deed type and a document type + */ + public async delete(deedTypeUuid: string, documentTypesUuid: string): Promise { + return this.model.delete({ + where: { + deed_type_uuid_document_type_uuid: { + deed_type_uuid: deedTypeUuid, + document_type_uuid: documentTypesUuid, + }, + }, + }); + } + + /** + * @description : Create new relation between deed type and a document type + */ + public async deleteMany(deedTypeUuid: string, documentTypesUuids: string[]): Promise { + let relationsToRemove: any[] = []; + documentTypesUuids.forEach((relationUuid) => { + relationsToRemove.push( + this.model.delete({ + where: { + deed_type_uuid_document_type_uuid: { + deed_type_uuid: deedTypeUuid, + document_type_uuid: relationUuid, + }, + }, + }), + ); + }); + return this.instanceDb.$transaction(relationsToRemove); + } + + public async findOneByUid(uid: string): Promise { + const deedTypeHasDoculmentTypesEntity = await this.model.findUnique({ + where: { + uuid: uid, + }, + }); + + if (!deedTypeHasDoculmentTypesEntity) { + throw new Error("deed type not found"); + } + + return deedTypeHasDoculmentTypesEntity; + } +} diff --git a/src/common/repositories/DeedTypesRepository.ts b/src/common/repositories/DeedTypesRepository.ts new file mode 100644 index 00000000..eb60b8ed --- /dev/null +++ b/src/common/repositories/DeedTypesRepository.ts @@ -0,0 +1,117 @@ +import Database from "@Common/databases/database"; +import BaseRepository from "@Repositories/BaseRepository"; +import { Service } from "typedi"; +import { DeedTypes } from "@prisma/client"; +import { DeedType } from "le-coffre-resources/dist/SuperAdmin"; + +@Service() +export default class DeedTypesRepository extends BaseRepository { + constructor(private database: Database) { + super(); + } + protected get model() { + return this.database.getClient().deedTypes; + } + protected get instanceDb() { + return this.database.getClient(); + } + + /** + * @description : Find many users + */ + public async findMany(query: any): Promise { + query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); + return this.model.findMany(query); + } + + /** + * @description : Create new office folder wihtout customers nor stakeholders + */ + public async create(deedType: DeedType): Promise { + return this.model.create({ + data: { + name: deedType.name, + description: deedType.description, + office: { + connect: { + uuid: deedType.office.uid, + }, + }, + }, + }); + } + + /** + * @description : Create new office folder wihtout customers nor stakeholders + */ + public async update(uid: string, deedType: DeedType): Promise { + return this.model.update({ + where: { uuid: uid }, + data: { + name: deedType.name, + description: deedType.description, + archived_at: deedType.archived_at, + office: { + connect: { + uuid: deedType.office.uid, + }, + }, + }, + }); + } + + public async findOneByUid(uid: string): Promise { + const deedTypeEntity = await this.model.findUnique({ + where: { + uuid: uid, + }, + include: { + deed_type_has_document_types: true, + }, + }); + + if (!deedTypeEntity) { + throw new Error("deed type not found"); + } + + return deedTypeEntity; + } + + /** + * @description : update relations between document types and given deed type + */ + public async addDocumentType(uid: string, deedTypeHasDocumentTypeUuid: string): Promise { + return this.model.update({ + where: { uuid: uid }, + data: { + deed_type_has_document_types: { + connect: { + uuid: deedTypeHasDocumentTypeUuid, + }, + }, + }, + }); + } + + /** + * @description : update relations between document types and given deed type + */ + public async addDocumentTypes(uid: string, deedTypeHasDocumentTypeUuid: string[]): Promise { + let relationsToAdd: any[] = []; + deedTypeHasDocumentTypeUuid.forEach((relationUuid) => { + relationsToAdd.push( + this.model.update({ + where: { uuid: uid }, + data: { + deed_type_has_document_types: { + connect: { + uuid: relationUuid, + }, + }, + }, + }), + ); + }); + return this.instanceDb.$transaction(relationsToAdd); + } +} diff --git a/src/common/repositories/DeedsHasDocumentTypesRepository.ts b/src/common/repositories/DeedsHasDocumentTypesRepository.ts new file mode 100644 index 00000000..f9b6aa7b --- /dev/null +++ b/src/common/repositories/DeedsHasDocumentTypesRepository.ts @@ -0,0 +1,112 @@ +import Database from "@Common/databases/database"; +import { DeedHasDocumentTypes, Prisma } from "@prisma/client"; +import BaseRepository from "@Repositories/BaseRepository"; +import { Service } from "typedi"; + +@Service() +export default class DeedHasDocumentTypesRepository extends BaseRepository { + constructor(private database: Database) { + super(); + } + protected get model() { + return this.database.getClient().deedHasDocumentTypes; + } + protected get instanceDb() { + return this.database.getClient(); + } + + /** + * @description : Find many users + */ + public async findMany(query: any): Promise { + query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); + return this.model.findMany(query); + } + + /** + * @description : Create new relation between deed type and a document type + */ + public async create(deedUuid: string, documentTypesUuid: string): Promise { + return this.model.create({ + data: { + deed: { + connect: { + uuid: deedUuid, + }, + }, + document_type: { + connect: { + uuid: documentTypesUuid, + }, + }, + }, + }); + } + + /** + * @description : Create new relation between deed type and a document type + */ + public async createMany(deedUuid: string, documentTypesUuid: string[]): Promise { + let relationsToAdd: Prisma.DeedHasDocumentTypesCreateManyInput[] = []; + documentTypesUuid.forEach((item) => { + relationsToAdd.push({ deed_uuid: deedUuid, document_type_uuid: item }); + }); + + const numberOfRelationsAdded = ( + await this.model.createMany({ + data: relationsToAdd, + skipDuplicates: true, + }) + ).count; + + return this.findMany({ where: { deed_uuid: deedUuid }, take: numberOfRelationsAdded }); + } + + /** + * @description : Create new relation between deed type and a document type + */ + public async delete(deedUuid: string, documentTypesUuid: string): Promise { + return this.model.delete({ + where: { + deed_uuid_document_type_uuid: { + deed_uuid: deedUuid, + document_type_uuid: documentTypesUuid, + }, + }, + }); + } + + /** + * @description : Create new relation between deed type and a document type + */ + public async deleteMany(deedUuid: string, documentTypesUuids: string[]): Promise { + let relationsToRemove: any[] = []; + documentTypesUuids.forEach((relationUuid) => { + relationsToRemove.push( + this.model.delete({ + where: { + deed_uuid_document_type_uuid: { + deed_uuid: deedUuid, + document_type_uuid: relationUuid, + }, + }, + }), + ); + }); + return this.instanceDb.$transaction(relationsToRemove); + } + + public async findOneByUid(uid: string): Promise { + const deedHasDoculmentTypesEntity = await this.model.findUnique({ + where: { + uuid: uid, + }, + }); + + if (!deedHasDoculmentTypesEntity) { + throw new Error("relation between deed and document type not found"); + } + + return deedHasDoculmentTypesEntity; + } +} diff --git a/src/common/repositories/DeedsRepository.ts b/src/common/repositories/DeedsRepository.ts new file mode 100644 index 00000000..494dc60c --- /dev/null +++ b/src/common/repositories/DeedsRepository.ts @@ -0,0 +1,90 @@ +import Database from "@Common/databases/database"; +import BaseRepository from "@Repositories/BaseRepository"; +import { Service } from "typedi"; +import { Deeds } from "@prisma/client"; +import { DeedType } from "le-coffre-resources/dist/Customer"; + +@Service() +export default class DeedsRepository extends BaseRepository { + constructor(private database: Database) { + super(); + } + protected get model() { + return this.database.getClient().deeds; + } + protected get instanceDb() { + return this.database.getClient(); + } + + /** + * @description : Find many users + */ + public async findMany(query: any): Promise { + query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); + return this.model.findMany(query); + } + + public async create(deedType: DeedType): Promise { + return this.model.create({ + data: { + deed_type: { + connect: { + uuid: deedType.uid, + }, + }, + }, + }); + } + + public async findOneByUid(uid: string): Promise { + const deedTypeEntity = await this.model.findUnique({ + where: { + uuid: uid, + }, + }); + + if (!deedTypeEntity) { + throw new Error("deed type not found"); + } + + return deedTypeEntity; + } + + /** + * @description : update relations between document types and given deed type + */ + public async addDocumentType(uid: string, deedHasDocumentTypeUuid: string): Promise { + return this.model.update({ + where: { uuid: uid }, + data: { + deed_has_document_types: { + connect: { + uuid: deedHasDocumentTypeUuid, + }, + }, + }, + }); + } + + /** + * @description : update relations between document types and given deed type + */ + public async addDocumentTypes(uid: string, deedHasDocumentTypeUuid: string[]): Promise { + let relationsToAdd: any[] = []; + deedHasDocumentTypeUuid.forEach((relationUuid) => { + relationsToAdd.push( + this.model.update({ + where: { uuid: uid }, + data: { + deed_has_document_types: { + connect: { + uuid: relationUuid, + }, + }, + }, + }), + ); + }); + return this.instanceDb.$transaction(relationsToAdd); + } +} diff --git a/src/common/repositories/DocumentTypesRepository.ts b/src/common/repositories/DocumentTypesRepository.ts new file mode 100644 index 00000000..ca65f0ad --- /dev/null +++ b/src/common/repositories/DocumentTypesRepository.ts @@ -0,0 +1,77 @@ +import Database from "@Common/databases/database"; +import BaseRepository from "@Repositories/BaseRepository"; +import { Service } from "typedi"; +import { DocumentTypes } from "prisma/prisma-client"; +import { DocumentType } from "le-coffre-resources/dist/SuperAdmin"; + +@Service() +export default class DocumentTypesRepository extends BaseRepository { + constructor(private database: Database) { + super(); + } + protected get model() { + return this.database.getClient().documentTypes; + } + protected get instanceDb() { + return this.database.getClient(); + } + + /** + * @description : Find many users + */ + public async findMany(query: any): Promise { + query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); + return this.model.findMany(query); + } + + public async create(documentType: DocumentType): Promise { + return this.model.create({ + data: { + name: documentType.name, + public_description: documentType.public_description, + private_description: documentType.private_description, + office: { + connect: { + uuid: documentType.office.uid, + }, + }, + }, + }); + } + + /** + * @description : update given deed + */ + public async update(uuid: string, documentType: DocumentType): Promise { + return this.model.update({ + where: { + uuid: uuid, + }, + data: { + name: documentType.name, + public_description: documentType.public_description, + private_description: documentType.private_description, + archived_at: documentType.archived_at, + office: { + connect: { + uuid: documentType.office.uid, + }, + }, + }, + }); + } + + public async findOneByUid(uid: string): Promise { + const documentTypeEntity = await this.model.findUnique({ + where: { + uuid: uid, + }, + }); + + if (!documentTypeEntity) { + throw new Error("Document Type not found"); + } + + return documentTypeEntity; + } +} diff --git a/src/common/repositories/DocumentsRepository.ts b/src/common/repositories/DocumentsRepository.ts new file mode 100644 index 00000000..1f6b09e5 --- /dev/null +++ b/src/common/repositories/DocumentsRepository.ts @@ -0,0 +1,26 @@ +import Database from "@Common/databases/database"; +import BaseRepository from "@Repositories/BaseRepository"; +import { Service } from "typedi"; +import { processFindManyQuery } from "prisma-query"; +import { Documents } from "@prisma/client"; + +@Service() +export default class DocumentsRepository extends BaseRepository { + constructor(private database: Database) { + super(); + } + protected get model() { + return this.database.getClient().documents; + } + protected get instanceDb() { + return this.database.getClient(); + } + + /** + * @description : Find many users + */ + public async findMany(query: ReturnType): Promise { + query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); + return this.model.findMany(query); + } +} diff --git a/src/common/repositories/OfficeFoldersRepository.ts b/src/common/repositories/OfficeFoldersRepository.ts new file mode 100644 index 00000000..efb8f5d5 --- /dev/null +++ b/src/common/repositories/OfficeFoldersRepository.ts @@ -0,0 +1,107 @@ +import Database from "@Common/databases/database"; +import { ORMBadQueryError } from "@Common/system/database/exceptions/ORMBadQueryError"; +import BaseRepository from "@Repositories/BaseRepository"; +import { Service } from "typedi"; +import { processFindManyQuery } from "prisma-query"; +import { EFolderStatus, OfficeFolders } from "@prisma/client"; +import { OfficeFolder } from "le-coffre-resources/dist/SuperAdmin"; + +@Service() +export default class OfficeFoldersRepository extends BaseRepository { + constructor(private database: Database) { + super(); + } + protected get model() { + return this.database.getClient().officeFolders; + } + protected get instanceDb() { + return this.database.getClient(); + } + + /** + * @description : Find many office folders + */ + public async findMany(query: ReturnType): Promise { + try { + const limit = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); + + return await this.model.findMany({ ...query, take: limit }); + } catch (error) { + throw new ORMBadQueryError((error as Error).message, error as Error); + } + } + + /** + * @description : Create new office folder wihtout customers nor stakeholders + */ + public async create(officeFolder: OfficeFolder): Promise { + try { + const officeFolderEntityCreated = (await this.model.create({ + data: { + folder_number: officeFolder.folder_number, + name: officeFolder.name, + description: officeFolder.description, + status: EFolderStatus.LIVE, + deed: { + create: { + deed_type: { + connect: { + uuid: officeFolder.deed.deed_type.uid, + }, + }, + }, + }, + office: { + connect: { + idNot: officeFolder.office.idNot, + }, + }, + }, + })) as OfficeFolders; + + return officeFolderEntityCreated; + } catch (error) { + throw new ORMBadQueryError((error as Error).message, error as Error); + } + } + + public async update( + officeFolder: OfficeFolder, + officeFolderHasStakeholders_uuid?: string, + officeFolderHasCustomers_uuid?: string, + document_uuid?: string, + ): Promise { + try { + const officeFolderEntityUpdated = (await this.model.update({ + where: { + uuid: officeFolder.uid, + }, + data: { + folder_number: officeFolder.folder_number, + name: officeFolder.name, + description: officeFolder.description, + status: EFolderStatus.LIVE, + office_folder_has_stakeholder: { + connect: { + uuid: officeFolderHasStakeholders_uuid, + }, + }, + office_folder_has_customers: { + connect: { + uuid: officeFolderHasCustomers_uuid, + }, + }, + documents: { + connect: { + uuid: document_uuid, + }, + }, + }, + })) as OfficeFolders; + + return officeFolderEntityUpdated; + } catch (error) { + throw new ORMBadQueryError((error as Error).message, error as Error); + } + } +} diff --git a/src/common/repositories/OfficesRepository.ts b/src/common/repositories/OfficesRepository.ts new file mode 100644 index 00000000..5a9302e6 --- /dev/null +++ b/src/common/repositories/OfficesRepository.ts @@ -0,0 +1,101 @@ +import Database from "@Common/databases/database"; +import { ORMBadQueryError } from "@Common/system/database/exceptions/ORMBadQueryError"; +import BaseRepository from "@Repositories/BaseRepository"; +import { Service } from "typedi"; +import { processFindManyQuery } from "prisma-query"; +import { EOfficeStatus, Offices } from "@prisma/client"; +import { Office as OfficeRessource } from "le-coffre-resources/dist/SuperAdmin"; + +@Service() +export default class OfficesRepository extends BaseRepository { + constructor(private database: Database) { + super(); + } + protected get model() { + return this.database.getClient().offices; + } + protected get instanceDb() { + return this.database.getClient(); + } + + /** + * @description : Find many users + */ + public async findMany(query: ReturnType): Promise { + try { + const limit = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); + + return await this.model.findMany({ ...query, take: limit }); + } catch (error) { + throw new ORMBadQueryError((error as Error).message, error as Error); + } + } + + public async create(office: OfficeRessource): Promise { + try { + const officeEntityCreated = (await this.model.create({ + data: { + idNot: office.idNot, + name: office.name, + crpcen: office.crpcen, + address: { + create: { + address: office.address.address, + zip_code: office.address.zip_code, + city: office.address.city, + }, + }, + office_status: EOfficeStatus.DESACTIVATED, + }, + })) as Offices; + + return officeEntityCreated; + } catch (error) { + throw new ORMBadQueryError((error as Error).message, error as Error); + } + } + + public async update(uid: string, office: OfficeRessource): Promise { + try { + const officeEntityUpdated = (await this.model.update({ + where: { + uuid: uid, + }, + data: { + name: office.name, + address: { + create: { + address: office.address.address, + zip_code: office.address.zip_code, + city: office.address.city, + }, + }, + office_status: EOfficeStatus[office.office_status as keyof typeof EOfficeStatus], + }, + })) as Offices; + return officeEntityUpdated; + } catch (error) { + throw new ORMBadQueryError((error as Error).message, error as Error); + } + } + + public async findOneByUid(uid: string): Promise { + try { + const officeEntity = await this.model.findUnique({ + where: { + uuid: uid, + }, + }); + + if (!officeEntity) { + throw new Error("User not found"); + } + + return officeEntity; + + //return await this.model.find({ ...query, take: limit }); + } catch (error) { + throw new ORMBadQueryError((error as Error).message, error as Error); + } + } +} diff --git a/src/common/repositories/UsersRepository.ts b/src/common/repositories/UsersRepository.ts new file mode 100644 index 00000000..2c7ef00e --- /dev/null +++ b/src/common/repositories/UsersRepository.ts @@ -0,0 +1,135 @@ +import Database from "@Common/databases/database"; +import BaseRepository from "@Repositories/BaseRepository"; +import { Service } from "typedi"; +import { ECivility, Users } from "@prisma/client"; +import User from "le-coffre-resources/dist/SuperAdmin"; +import { processFindManyQuery } from "prisma-query"; + +@Service() +export default class UsersRepository extends BaseRepository { + constructor(private database: Database) { + super(); + } + protected get model() { + return this.database.getClient().users; + } + protected get instanceDb() { + return this.database.getClient(); + } + + /** + * @description : Find many users + */ + public async findMany(query: ReturnType): Promise { + query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); + return await this.model.findMany(query); + } + + public async create(user: User): Promise { + return this.model.create({ + data: { + idNot: user.idNot, + office_membership: { + connectOrCreate: { + where: { + idNot: user.office_membership.idNot, + }, + create: { + idNot: user.office_membership.idNot, + name: user.office_membership.name, + crpcen: user.office_membership.crpcen, + address: { + create: { + address: user.office_membership.address.address, + zip_code: user.office_membership.address.zip_code, + city: user.office_membership.address.city, + }, + }, + }, + }, + }, + contact: { + create: { + first_name: user.contact.first_name, + last_name: user.contact.last_name, + email: user.contact.email, + phone_number: user.contact.phone_number, + cell_phone_number: user.contact.cell_phone_number, + civility: ECivility[user.contact.civility as keyof typeof ECivility], + address: { + create: { + address: user.contact.address.address, + zip_code: user.contact.address.zip_code, + city: user.contact.address.city, + }, + }, + }, + }, + }, + }); + } + + public async update(uid: string, user: User): Promise { + return this.model.update({ + where: { + uuid: uid, + }, + data: { + idNot: user.idNot, + office_membership: { + connectOrCreate: { + where: { + idNot: user.office_membership.idNot, + }, + create: { + idNot: user.office_membership.idNot, + name: user.office_membership.name, + crpcen: user.office_membership.crpcen, + address: { + create: { + address: user.office_membership.address.address, + zip_code: user.office_membership.address.zip_code, + city: user.office_membership.address.city, + }, + }, + }, + }, + }, + contact: { + update: { + first_name: user.contact.first_name, + last_name: user.contact.last_name, + email: user.contact.email, + phone_number: user.contact.phone_number, + cell_phone_number: user.contact.cell_phone_number, + civility: ECivility[user.contact.civility as keyof typeof ECivility], + address: { + update: { + address: user.contact.address.address, + zip_code: user.contact.address.zip_code, + city: user.contact.address.city, + }, + }, + }, + }, + }, + }); + } + + /** + * @description : Find one user + */ + public async findOneByUid(uid: string): Promise { + const userEntity = await this.model.findUnique({ + where: { + uuid: uid, + }, + }); + + if (!userEntity) { + throw new Error("User not found"); + } + + return userEntity; + } +} diff --git a/src/common/repositories/_TemplateRepository/_TemplateRepository.ts b/src/common/repositories/_TemplateRepository/_TemplateRepository.ts deleted file mode 100644 index 8ea415db..00000000 --- a/src/common/repositories/_TemplateRepository/_TemplateRepository.ts +++ /dev/null @@ -1,82 +0,0 @@ -// import Database from "@Common/databases/Database"; -import { ORMBadQueryError } from "@Common/system/database/exceptions/ORMBadQueryError"; -import BaseRepository from "@Repositories/BaseRepository"; -import { Service } from "typedi"; - -export class RequestsByDayMetrics { - date_requested!: Date; - count!: number; -} - -export class CountRpcPathUsage { - path!: string; - count!: number; -} - -@Service() -export default class _TemplateRepository extends BaseRepository { - // TODO ? -> Injection private database: Database - constructor() { - super(); - } - // protected get model() { - // return this.database.getClient().metric; - // } - // protected get instanceDb() { - // return this.database.getClient(); - // } - - /** - * @description : Find many T - * @arguments : query: Prisma.TFindManyArgs - * @returns : Promise - */ - public async findMany() { - try { - // Query - } catch (error) { - throw new ORMBadQueryError((error as Error).message, error as Error); - } - } - - /** - * @description : Find many T - * @arguments : t : Partial - * @returns : Promise - */ - public async findOne() { - try { - // Query - } catch (error) { - throw new ORMBadQueryError((error as Error).message, error as Error); - } - } - - /** - * @description : Create T - * @arguments : t : Partial - * @returns : Promise - */ - public async create() { - try { - // Create a new T - // return T - } catch (error) { - throw new ORMBadQueryError((error as Error).message, error as Error); - } - } - - /** - * @description : Create bulk T - * @arguments : t : Partial - * @returns : Promise - */ - public async createMany() { - try { - // Create many new T - // return T[] - } catch (error) { - throw new ORMBadQueryError((error as Error).message, error as Error); - } - } -} diff --git a/src/common/system/ExpressServer.ts b/src/common/system/ExpressServer.ts index 8f381907..ec8e217b 100644 --- a/src/common/system/ExpressServer.ts +++ b/src/common/system/ExpressServer.ts @@ -31,4 +31,3 @@ export default class ExpressServer implements ServerInterface { return this; } } - diff --git a/src/common/system/ExpressServerTest.ts b/src/common/system/ExpressServerTest.ts new file mode 100644 index 00000000..abf20b60 --- /dev/null +++ b/src/common/system/ExpressServerTest.ts @@ -0,0 +1,39 @@ +import express, { Express, Router } from "express"; +import { Service } from "typedi"; +import ServerInterface, { IConfig } from "./ServerInterface"; + +@Service() +export default class ExpressServer implements ServerInterface { + public router: Express = express(); + private subRouter: Router = express.Router(); + + public getRouter(): Router { + return this.subRouter; + } + + protected getMainRouter(): Express { + return this.router; + } + + public init(config: IConfig) { + this.router.use(...config.middlwares); + this.router.use(config.rootUrl, this.subRouter); + if (config.errorHandler) this.router.use(config.errorHandler); + return this; + } + + public listen() { + return this.router.listen(3001, () => { + console.table( + [ + { + "Entry label": "le coffre API", + Port: 3001, + "Root url": "/api", + }, + ], + ["Entry label", "Port", "Root url"], + ); + }); + } +} diff --git a/src/common/system/ServerInterface.ts b/src/common/system/ServerInterface.ts index 15ea57f2..e3962a03 100644 --- a/src/common/system/ServerInterface.ts +++ b/src/common/system/ServerInterface.ts @@ -14,4 +14,3 @@ export default interface ServerInterface { init(config: IConfig): this; } - diff --git a/src/common/system/controller-pattern/ApiController.ts b/src/common/system/controller-pattern/ApiController.ts index f1159f3e..3f8458c7 100644 --- a/src/common/system/controller-pattern/ApiController.ts +++ b/src/common/system/controller-pattern/ApiController.ts @@ -6,4 +6,3 @@ import HttpCodes from "@Common/system/controller-pattern/HttpCodes"; export default abstract class ApiController extends BaseController {} export { HttpCodes as ResponseStatusCodes }; - diff --git a/src/common/system/controller-pattern/BaseController.ts b/src/common/system/controller-pattern/BaseController.ts index 516b7e66..3b128b1f 100644 --- a/src/common/system/controller-pattern/BaseController.ts +++ b/src/common/system/controller-pattern/BaseController.ts @@ -2,10 +2,8 @@ import { StRoute } from "./StRoute"; import { Response } from "express"; import HttpCodes from "@Common/system/controller-pattern/HttpCodes"; - type IResponseData = {} | string | number | boolean | null | unknown; - export default abstract class BaseController { public expressRoutes!: StRoute[]; public httpCode: typeof HttpCodes = HttpCodes; diff --git a/src/common/system/controller-pattern/Controller.ts b/src/common/system/controller-pattern/Controller.ts index 9a5c8d2e..91d5789f 100644 --- a/src/common/system/controller-pattern/Controller.ts +++ b/src/common/system/controller-pattern/Controller.ts @@ -34,4 +34,3 @@ function createRoute(controller: any, route: StRoute) { } export default Controller; - diff --git a/src/common/system/controller-pattern/ErrorCatch.ts b/src/common/system/controller-pattern/ErrorCatch.ts index d6bed57c..8dc0aea4 100644 --- a/src/common/system/controller-pattern/ErrorCatch.ts +++ b/src/common/system/controller-pattern/ErrorCatch.ts @@ -12,4 +12,3 @@ export default class ErrorCatch { next(args[args.length - 1] ?? "Unknown Error"); } } - diff --git a/src/common/system/controller-pattern/HttpCodes.ts b/src/common/system/controller-pattern/HttpCodes.ts index 433b5525..8ca2500b 100644 --- a/src/common/system/controller-pattern/HttpCodes.ts +++ b/src/common/system/controller-pattern/HttpCodes.ts @@ -1,10 +1,10 @@ -enum HttpCodes { - SUCCESS = 200, - CREATED = 201, - BAD_REQUEST = 400, - INTERNAL_ERROR = 500, - UNKNOWN_ERROR = 520, - NOT_IMPLEMENTED = 501, - NOT_FOUND = 404, -} -export default HttpCodes; +enum HttpCodes { + SUCCESS = 200, + CREATED = 201, + BAD_REQUEST = 400, + INTERNAL_ERROR = 500, + UNKNOWN_ERROR = 520, + NOT_IMPLEMENTED = 501, + NOT_FOUND = 404, +} +export default HttpCodes; diff --git a/src/common/system/controller-pattern/Methods.ts b/src/common/system/controller-pattern/Methods.ts index b0dd3729..43c0f6f0 100644 --- a/src/common/system/controller-pattern/Methods.ts +++ b/src/common/system/controller-pattern/Methods.ts @@ -1,7 +1,12 @@ import BaseController from "./BaseController"; import { StRoute } from "./StRoute"; -function MethodsAny(type: StRoute["type"], path: string, frontMiddlewares: StRoute["frontMiddlewares"] = [], backMiddlewares: StRoute["backMiddlewares"] = []) { +function MethodsAny( + type: StRoute["type"], + path: string, + frontMiddlewares: StRoute["frontMiddlewares"] = [], + backMiddlewares: StRoute["backMiddlewares"] = [], +) { return (target: any, memberName: string, propertyDescriptor: PropertyDescriptor) => { const func = propertyDescriptor.value; const constructor: typeof BaseController = target.constructor; @@ -29,4 +34,3 @@ export const Delete = MethodsAny.bind(null, "delete"); * @description Decorator Method PUT */ export const Put = MethodsAny.bind(null, "put"); - diff --git a/src/common/system/controller-pattern/StRoute.ts b/src/common/system/controller-pattern/StRoute.ts index f216112f..fe6ae78d 100644 --- a/src/common/system/controller-pattern/StRoute.ts +++ b/src/common/system/controller-pattern/StRoute.ts @@ -7,4 +7,3 @@ export interface StRoute { frontMiddlewares: ((requests: Request, response: Response, next: NextFunction) => void)[]; backMiddlewares: ((requests: Request, response: Response, next: NextFunction) => void)[]; } - diff --git a/src/common/system/controller-pattern/exceptions/HttpException.ts b/src/common/system/controller-pattern/exceptions/HttpException.ts index ceb49fa7..62a485b7 100644 --- a/src/common/system/controller-pattern/exceptions/HttpException.ts +++ b/src/common/system/controller-pattern/exceptions/HttpException.ts @@ -1,7 +1,7 @@ -import HttpCodes from "../HttpCodes"; - -export default class HttpException extends Error { - constructor(message: string, public httpCode: HttpCodes = HttpCodes.UNKNOWN_ERROR) { - super(message); - } -} +import HttpCodes from "../HttpCodes"; + +export default class HttpException extends Error { + constructor(message: string, public httpCode: HttpCodes = HttpCodes.UNKNOWN_ERROR) { + super(message); + } +} diff --git a/src/common/system/database/DbProvider.ts b/src/common/system/database/DbProvider.ts index 0037217b..1c5f9d69 100644 --- a/src/common/system/database/DbProvider.ts +++ b/src/common/system/database/DbProvider.ts @@ -1,34 +1,34 @@ -import dotenv from "dotenv"; -import { PrismaClient } from "@prisma/client"; -import IDatabaseConfig from "../../config/database/IDatabaseConfig"; -import { BackendVariables } from "@Common/config/variables/Variables"; -import Container from "typedi"; - -dotenv.config(); - -export default class DbProvider { - protected readonly variables = Container.get(BackendVariables); - protected client = new PrismaClient({ - datasources: { - db: { - url: `postgres://${this.variables.DATABASE_USER}:${this.variables.DATABASE_PASSWORD}@${this.variables.DATABASE_HOSTNAME}:${this.variables.DATABASE_PORT}/${this.variables.DATABASE_NAME}`, - }, - }, - }); - - constructor(protected config: IDatabaseConfig) {} - - public async connect(): Promise { - await this.client.$connect(); - console.info(`⚡️[Prisma]: Connected to ${this.config.name}`); // A Logger middleware is to be added here - } - - public getClient() { - return this.client; - } - - public async disconnect(): Promise { - await this.client.$disconnect(); - console.info(`⚡️[Prisma]: Disconnected from ${this.config.name}`); // A Logger middleware is to be added here - } -} +import dotenv from "dotenv"; +import { PrismaClient } from "@prisma/client"; +import IDatabaseConfig from "../../config/database/IDatabaseConfig"; +import { BackendVariables } from "@Common/config/variables/Variables"; +import Container from "typedi"; + +dotenv.config(); + +export default class DbProvider { + protected readonly variables = Container.get(BackendVariables); + protected client = new PrismaClient({ + datasources: { + db: { + url: `postgres://${this.variables.DATABASE_USER}:${this.variables.DATABASE_PASSWORD}@${this.variables.DATABASE_HOSTNAME}:${this.variables.DATABASE_PORT}/${this.variables.DATABASE_NAME}`, + }, + }, + }); + + constructor(protected config: IDatabaseConfig) {} + + public async connect(): Promise { + await this.client.$connect(); + console.info(`⚡️[Prisma]: Connected to ${this.config.name}`); // A Logger middleware is to be added here + } + + public getClient() { + return this.client; + } + + public async disconnect(): Promise { + await this.client.$disconnect(); + console.info(`⚡️[Prisma]: Disconnected from ${this.config.name}`); // A Logger middleware is to be added here + } +} diff --git a/src/common/system/database/exceptions/ORMBadQueryError.ts b/src/common/system/database/exceptions/ORMBadQueryError.ts index b61c4d15..89255e6a 100644 --- a/src/common/system/database/exceptions/ORMBadQueryError.ts +++ b/src/common/system/database/exceptions/ORMBadQueryError.ts @@ -2,4 +2,4 @@ export class ORMBadQueryError extends Error { constructor(message: string, public error: Error) { super(message); } -} \ No newline at end of file +} diff --git a/src/common/system/database/index.ts b/src/common/system/database/index.ts index 6f728469..943586b8 100644 --- a/src/common/system/database/index.ts +++ b/src/common/system/database/index.ts @@ -2,4 +2,4 @@ import IDatabaseConfig from "@Common/config/database/IDatabaseConfig"; import DbProvider from "./DbProvider"; export type { IDatabaseConfig }; -export default DbProvider; \ No newline at end of file +export default DbProvider; diff --git a/src/entries/App.ts b/src/entries/App.ts index 5db0695d..b520f7a0 100644 --- a/src/entries/App.ts +++ b/src/entries/App.ts @@ -16,7 +16,7 @@ import { BackendVariables } from "@Common/config/variables/Variables"; const port = variables.APP_PORT; const rootUrl = variables.APP_ROOT_URL; const label = variables.APP_LABEL ?? "Unknown Service"; - + // Container.get(TezosLink).connect(); Container.get(ExpressServer).init({ label, @@ -31,4 +31,3 @@ import { BackendVariables } from "@Common/config/variables/Variables"; console.error(e); } })(); - diff --git a/src/services/BaseService.ts b/src/services/BaseService.ts index 91aae64f..0ff263c1 100644 --- a/src/services/BaseService.ts +++ b/src/services/BaseService.ts @@ -1,8 +1,6 @@ - export default abstract class BaseService { /** @TODO place methods in a config file */ public static readonly whitelisted: string[] = ["/chains/main/blocks"]; public static readonly blacklisted: string[] = ["/context/contracts", "/monitor", "/network"]; public static readonly rollingPatterns: string[] = ["/head", "/injection/operation"]; } - diff --git a/src/services/CustomersService/CustomersService.ts b/src/services/CustomersService/CustomersService.ts deleted file mode 100644 index 89b01607..00000000 --- a/src/services/CustomersService/CustomersService.ts +++ /dev/null @@ -1,57 +0,0 @@ -import BaseService from "@Services/BaseService"; -import { Service } from "typedi"; - -@Service() -export default class CustomersService extends BaseService { - constructor() { - super(); - } - - /** - * @description : Get all Customers - * @returns : T - * @throws {Error} If Customers cannot be get - * @param : projectEntity: Partial - */ - public async get() { - // const customer = await this.customersRepository.findOne(uuid); - // if (!customer) Promise.reject(new Error("Cannot get customer by uuid")); - return { response: "/api/customers > GET : All customers > Not implemented yet" }; - } - - /** - * @description : Create a new customer - * @returns : T - * @throws {Error} If customer cannot be created - * @param : projectEntity: Partial - */ - public async create() { - // const customer = await this.projectRepository.create(projectEntity); - // if (!customer) Promise.reject(new Error("Cannot create project")); - return { response: "/api/customers > POST : Create customer > Not implemented yet" }; - } - - /** - * @description : Modify a customer - * @returns : T - * @throws {Error} If customer cannot be modified - * @param : projectEntity: Partial - */ - public async put() { - // const customer = await this.projectRepository.create(projectEntity); - // if (!customer) Promise.reject(new Error("Cannot create project")); - return { response: "/api/customers > PUT : Modified customer > Not implemented yet" }; - } - - /** - * @description : Get a customer by uid - * @returns : T - * @throws {Error} If customer cannot be get by uid - * @param : projectEntity: Partial - */ - public async getByUid(uid: string) { - // const customer = await this.customersRepository.findOne(uid); - // if (!customer) Promise.reject(new Error("Cannot get customer by uid")); - return { response: "/api/customers/:uid > GET : customer by uid > Not implemented yet" }; - } -} diff --git a/src/services/DeedTypesService/DeedTypesService.ts b/src/services/DeedTypesService/DeedTypesService.ts deleted file mode 100644 index a85eea94..00000000 --- a/src/services/DeedTypesService/DeedTypesService.ts +++ /dev/null @@ -1,57 +0,0 @@ -import BaseService from "@Services/BaseService"; -import { Service } from "typedi"; - -@Service() -export default class DeedTypesService extends BaseService { - constructor() { - super(); - } - - /** - * @description : Get all deed-types - * @returns : T - * @throws {Error} If deed-types cannot be get - * @param : projectEntity: Partial - */ - public async get() { - // const deedtype = await this.customersRepository.findOne(uuid); - // if (!deedtype) Promise.reject(new Error("Cannot get deedtype by uuid")); - return { response: "/api/deed-types > GET : All deed-types > Not implemented yet" }; - } - - /** - * @description : Create a new deed-type - * @returns : T - * @throws {Error} If deed-type cannot be created - * @param : projectEntity: Partial - */ - public async create() { - // const project = await this.projectRepository.create(projectEntity); - // if (!project) Promise.reject(new Error("Cannot create project")); - return { response: "/api/deed-types > POST : Create deed-type > Not implemented yet" }; - } - - /** - * @description : Modify a deed-type - * @returns : T - * @throws {Error} If deed-type cannot be modifified - * @param : projectEntity: Partial - */ - public async put() { - // const project = await this.projectRepository.create(projectEntity); - // if (!project) Promise.reject(new Error("Cannot create project")); - return { response: "/api/deed-types > PUT : Modified deed-type > Not implemented yet" }; - } - - /** - * @description : Get a deedtype by uid - * @returns : T - * @throws {Error} If deed-type cannot be get by uid - * @param : projectEntity: Partial - */ - public async getByUid(uid: string) { - // const deedtype = await this.customersRepository.findOne(uuid); - // if (!deedtype) Promise.reject(new Error("Cannot get deedtype by uid")); - return { response: "/api/deed-types/:uid > GET : deed-type by uid > Not implemented yet" }; - } -} diff --git a/src/services/DeedsService/DeedsService.ts b/src/services/DeedsService/DeedsService.ts deleted file mode 100644 index 09ca10fe..00000000 --- a/src/services/DeedsService/DeedsService.ts +++ /dev/null @@ -1,57 +0,0 @@ -import BaseService from "@Services/BaseService"; -import { Service } from "typedi"; - -@Service() -export default class DeedsService extends BaseService { - constructor() { - super(); - } - - /** - * @description : Get all deeds - * @returns : T - * @throws {Error} If deeds cannot be get - * @param : projectEntity: Partial - */ - public async get() { - // const deed = await this.usersRepository.findOne(uuid); - // if (!deed) Promise.reject(new Error("Cannot get deed by uuid")); - return { response: "/api/deeds > GET : All deeds > Not implemented yet" }; - } - - /** - * @description : Create a new deed - * @returns : T - * @throws {Error} If deeds cannot be created - * @param : projectEntity: Partial - */ - public async create() { - // const deeds = await this.projectRepository.create(projectEntity); - // if (!deeds) Promise.reject(new Error("Cannot create project")); - return { response: "/api/deeds > POST : Create deed > Not implemented yet" }; - } - - /** - * @description : Modify a new deed - * @returns : T - * @throws {Error} If deeds cannot be modified - * @param : projectEntity: Partial - */ - public async put() { - // const deeds = await this.projectRepository.create(projectEntity); - // if (!deeds) Promise.reject(new Error("Cannot create project")); - return { response: "/api/deeds > PUT : Modified deed > Not implemented yet" }; - } - - /** - * @description : Get a deed by uid - * @returns : T - * @throws {Error} If project cannot be created - * @param : projectEntity: Partial - */ - public async getByUid(uuid: string) { - // const deed = await this.usersRepository.findOne(uuid); - // if (!deed) Promise.reject(new Error("Cannot get deed by uuid")); - return { response: "/api/deeds/:uuid > GET : deed by uid > Not implemented yet" }; - } -} diff --git a/src/services/DocumentTypesService/DocumentTypesService.ts b/src/services/DocumentTypesService/DocumentTypesService.ts deleted file mode 100644 index 202074db..00000000 --- a/src/services/DocumentTypesService/DocumentTypesService.ts +++ /dev/null @@ -1,57 +0,0 @@ -import BaseService from "@Services/BaseService"; -import { Service } from "typedi"; - -@Service() -export default class DocumentTypesService extends BaseService { - constructor() { - super(); - } - - /** - * @description : Get all document-types - * @returns : T - * @throws {Error} If document-types cannot be get - * @param : projectEntity: Partial - */ - public async get() { - // const documentType = await this.foldersRepository.findOne(uuid); - // if (!documentType) Promise.reject(new Error("Cannot get document-type by uuid")); - return { response: "/api/document-types > GET : All document-types > Not implemented yet" }; - } - - /** - * @description : Create a new document-type - * @returns : T - * @throws {Error} If document-types cannot be created - * @param : projectEntity: Partial - */ - public async create() { - // const project = await this.projectRepository.create(projectEntity); - // if (!project) Promise.reject(new Error("Cannot create project")); - return { response: "/api/document-types > POST : Create document-type > Not implemented yet" }; - } - - /** - * @description : Modify a document-type - * @returns : T - * @throws {Error} If document-type cannot be modified - * @param : projectEntity: Partial - */ - public async put() { - // const documentType = await this.projectRepository.create(projectEntity); - // if (!documentType) Promise.reject(new Error("Cannot create documentType")); - return { response: "/api/document-types > PUT : Modified document-type > Not implemented yet" }; - } - - /** - * @description : Get a document-type by uid - * @returns : T - * @throws {Error} If document-type cannot be get bu uid - * @param : projectEntity: Partial - */ - public async getByUid(uid: string) { - // const documentType = await this.foldersRepository.findOne(uid); - // if (!documentType) Promise.reject(new Error("Cannot get document-type by uid")); - return { response: "/api/document-types/:uid > GET : document-type by uid > Not implemented yet" }; - } -} diff --git a/src/services/FoldersService/FoldersService.ts b/src/services/FoldersService/FoldersService.ts deleted file mode 100644 index 633f64b9..00000000 --- a/src/services/FoldersService/FoldersService.ts +++ /dev/null @@ -1,57 +0,0 @@ -import BaseService from "@Services/BaseService"; -import { Service } from "typedi"; - -@Service() -export default class FoldersService extends BaseService { - constructor() { - super(); - } - - /** - * @description : Get all folders - * @returns : T - * @throws {Error} If folders cannot be get - * @param : projectEntity: Partial - */ - public async get() { - // const folder = await this.foldersRepository.findOne(uuid); - // if (!folder) Promise.reject(new Error("Cannot get folder by uuid")); - return { response: "/api/folders > GET : All folders > Not implemented yet" }; - } - - /** - * @description : Create a new folder - * @returns : T - * @throws {Error} If folder cannot be created - * @param : projectEntity: Partial - */ - public async create() { - // const folder = await this.projectRepository.create(projectEntity); - // if (!folder) Promise.reject(new Error("Cannot create folder")); - return { response: "/api/folders > POST : Create folder > Not implemented yet" }; - } - - /** - * @description : Modify a folder - * @returns : T - * @throws {Error} If folder cannot be modified - * @param : projectEntity: Partial - */ - public async put() { - // const folder = await this.projectRepository.create(projectEntity); - // if (!folder) Promise.reject(new Error("Cannot create folder")); - return { response: "/api/folders > PUT : Modified folder > Not implemented yet" }; - } - - /** - * @description : Get a folder by uid - * @returns : T - * @throws {Error} If folder cannot be get by uid - * @param : projectEntity: Partial - */ - public async getByUid(uid: string) { - // const folder = await this.foldersRepository.findOne(uid); - // if (!folder) Promise.reject(new Error("Cannot get folder by uid")); - return { response: "/api/folders/:uid > GET : folder by uid > Not implemented yet" }; - } -} diff --git a/src/services/OfficesService/OfficesService.ts b/src/services/OfficesService/OfficesService.ts deleted file mode 100644 index 2b6d2ba8..00000000 --- a/src/services/OfficesService/OfficesService.ts +++ /dev/null @@ -1,58 +0,0 @@ -// import ProjectsRepository from "@Common/repositories/projects/ProjectsRepository"; -import BaseService from "@Services/BaseService"; -import { Service } from "typedi"; - -@Service() -export default class OfficesService extends BaseService { - constructor() { - super(); - } - - /** - * @description : Get all office - * @returns : T - * @throws {Error} If offices cannot be get - * @param : projectEntity: Partial - */ - public async get() { - // const office = await this.usersRepository.findOne(uuid); - // if (!office) Promise.reject(new Error("Cannot get office by uuid")); - return { response: "/api/office > GET : All office > Not implemented yet" }; - } - - /** - * @description : Create a new office - * @returns : T - * @throws {Error} If office cannot be created - * @param : projectEntity: Partial - */ - public async create() { - // const project = await this.projectRepository.create(projectEntity); - // if (!project) Promise.reject(new Error("Cannot create project")); - return { response: "/api/office > POST : Create office > Not implemented yet" }; - } - - /** - * @description : Modify an office - * @returns : T - * @throws {Error} If office cannot be modified - * @param : projectEntity: Partial - */ - public async put() { - // const project = await this.projectRepository.create(projectEntity); - // if (!project) Promise.reject(new Error("Cannot create project")); - return { response: "/api/office > PUT : Modified office > Not implemented yet" }; - } - - /** - * @description : Get a office by uid - * @returns : T - * @throws {Error} If office cannot be get - * @param : projectEntity: Partial - */ - public async getByUid(uid: string) { - // const office = await this.usersRepository.findOne(uuid); - // if (!office) Promise.reject(new Error("Cannot get office by uuid")); - return { response: "/api/office/:uid > GET : office by uid > Not implemented yet" }; - } -} diff --git a/src/services/UsersService/UsersService.ts b/src/services/UsersService/UsersService.ts deleted file mode 100644 index a1b12d29..00000000 --- a/src/services/UsersService/UsersService.ts +++ /dev/null @@ -1,57 +0,0 @@ -import BaseService from "@Services/BaseService"; -import { Service } from "typedi"; - -@Service() -export default class UsersService extends BaseService { - constructor() { - super(); - } - - /** - * @description : Get all users - * @returns : T - * @throws {Error} If users cannot be get - * @param : projectEntity: Partial - */ - public async get() { - // const user = await this.usersRepository.findOne(uuid); - // if (!user) Promise.reject(new Error("Cannot get user by uuid")); - return { response: "/api/users > GET : All users > Not implemented yet" }; - } - - /** - * @description : Create a new user - * @returns : T - * @throws {Error} If user cannot be created - * @param : projectEntity: Partial - */ - public async create() { - // const project = await this.projectRepository.create(projectEntity); - // if (!project) Promise.reject(new Error("Cannot create project")); - return { response: "/api/users > POST : Create user > Not implemented yet" }; - } - - /** - * @description : Modify a user - * @returns : T - * @throws {Error} If user cannot be modififed - * @param : projectEntity: Partial - */ - public async put() { - // const project = await this.projectRepository.create(projectEntity); - // if (!project) Promise.reject(new Error("Cannot create project")); - return { response: "/api/users > PUT : Modified user > Not implemented yet" }; - } - - /** - * @description : Get a user by uid - * @returns : T - * @throws {Error} If user cannot be get bu uid - * @param : projectEntity: Partial - */ - public async getByUid(uid: string) { - // const user = await this.usersRepository.findOne(uuid); - // if (!user) Promise.reject(new Error("Cannot get user by uuid")); - return { response: "/api/users/:uid > GET : user by uid > Not implemented yet" }; - } -} diff --git a/src/services/AddressesService/AddressesService.ts b/src/services/private-services/AddressesService/AddressesService.ts similarity index 66% rename from src/services/AddressesService/AddressesService.ts rename to src/services/private-services/AddressesService/AddressesService.ts index 8295b1a0..a9c04087 100644 --- a/src/services/AddressesService/AddressesService.ts +++ b/src/services/private-services/AddressesService/AddressesService.ts @@ -1,5 +1,9 @@ +// import { Addresses } from "@prisma/client"; +import { Addresses } from "@prisma/client"; +import AddressesRepository from "@Repositories/AddressesRepository"; import BaseService from "@Services/BaseService"; -import { Service } from "typedi"; +import { processFindManyQuery } from "prisma-query"; +import Container, { Service } from "typedi"; @Service() export default class AddressesService extends BaseService { @@ -13,22 +17,26 @@ export default class AddressesService extends BaseService { * @throws {Error} If addresses cannot be get * @param : projectEntity: Partial */ - public async get() { - // const address = await this.usersRepository.findOne(uuid); - // if (!address) Promise.reject(new Error("Cannot get address by uuid")); - return { response: "/api/addresses > GET : All addresses > Not implemented yet" }; + public async get(query: ReturnType) { + //init repo + const repo = Container.get(AddressesRepository); + + //call service to return prisma entity + return await repo.findMany(query); } - + /** * @description : Create a new address * @returns : T * @throws {Error} If address cannot be created * @param : projectEntity: Partial */ - public async create() { - // const address = await this.projectRepository.create(projectEntity); - // if (!address) Promise.reject(new Error("Cannot create project")); - return { response: "/api/addresses > POST : Create address > Not implemented yet" }; + public async create(address: Addresses): Promise { + //init repo + const repo = Container.get(AddressesRepository); + + // call service to return prisma entity + return await repo.create(address); } /** diff --git a/src/services/ContactsService/ContactsService.ts b/src/services/private-services/ContactsService/ContactsService.ts similarity index 99% rename from src/services/ContactsService/ContactsService.ts rename to src/services/private-services/ContactsService/ContactsService.ts index 02cde913..7976931c 100644 --- a/src/services/ContactsService/ContactsService.ts +++ b/src/services/private-services/ContactsService/ContactsService.ts @@ -18,7 +18,7 @@ export default class ContactsService extends BaseService { // if (!contact) Promise.reject(new Error("Cannot get contact by uuid")); return { response: "/api/contacts > GET : All contacts > Not implemented yet" }; } - + /** * @description : Create a new contact * @returns : T diff --git a/src/services/FilesService/FilesService.ts b/src/services/private-services/FilesService/FilesService.ts similarity index 99% rename from src/services/FilesService/FilesService.ts rename to src/services/private-services/FilesService/FilesService.ts index c4c1f6f8..3245f019 100644 --- a/src/services/FilesService/FilesService.ts +++ b/src/services/private-services/FilesService/FilesService.ts @@ -18,7 +18,7 @@ export default class FilesService extends BaseService { // if (!files) Promise.reject(new Error("Cannot get files")); return { response: "/api/files > GET : All files > Not implemented yet" }; } - + /** * @description : Create a new file * @returns : T diff --git a/src/services/NotificationsService/NotificationsService.ts b/src/services/private-services/NotificationsService/NotificationsService.ts similarity index 99% rename from src/services/NotificationsService/NotificationsService.ts rename to src/services/private-services/NotificationsService/NotificationsService.ts index 790e0bab..4187e937 100644 --- a/src/services/NotificationsService/NotificationsService.ts +++ b/src/services/private-services/NotificationsService/NotificationsService.ts @@ -18,7 +18,7 @@ export default class NotificationsService extends BaseService { // if (!notifications) Promise.reject(new Error("Cannot get notifications")); return { response: "/api/notifications > GET : All notifications > Not implemented yet" }; } - + /** * @description : Create a new notification * @returns : T diff --git a/src/services/super-admin/CustomersService/CustomersService.ts b/src/services/super-admin/CustomersService/CustomersService.ts new file mode 100644 index 00000000..f096654e --- /dev/null +++ b/src/services/super-admin/CustomersService/CustomersService.ts @@ -0,0 +1,44 @@ +import { Customers } from "@prisma/client"; +import CustomersRepository from "@Repositories/CustomersRepository"; +import BaseService from "@Services/BaseService"; +import { Customer } from "le-coffre-resources/dist/SuperAdmin"; +import { Service } from "typedi"; + +@Service() +export default class CustomersService extends BaseService { + constructor(private customerRepository: CustomersRepository) { + super(); + } + + /** + * @description : Get all Customers + * @throws {Error} If Customers cannot be get + */ + public async get(query: any) { + return this.customerRepository.findMany(query); + } + + /** + * @description : Create a new customer + * @throws {Error} If customer cannot be created + */ + public async create(customerEntity: Customer): Promise { + return this.customerRepository.create(customerEntity); + } + + /** + * @description : Modify a customer + * @throws {Error} If customer cannot be modified + */ + public async update(uid: string, customerEntity: Customer): Promise { + return this.customerRepository.update(uid, customerEntity); + } + + /** + * @description : Get a customer by uid + * @throws {Error} If customer cannot be get by uid + */ + public async getByUid(uid: string): Promise { + return this.customerRepository.findOneByUid(uid); + } +} diff --git a/src/services/super-admin/DeedTypesService/DeedTypesService.ts b/src/services/super-admin/DeedTypesService/DeedTypesService.ts new file mode 100644 index 00000000..1a92eb9b --- /dev/null +++ b/src/services/super-admin/DeedTypesService/DeedTypesService.ts @@ -0,0 +1,78 @@ +import { DeedTypes } from "@prisma/client"; +import DeedTypeHasDocumentTypesRepository from "@Repositories/DeedTypesHasDocumentTypesRepository"; +import DeedTypesRepository from "@Repositories/DeedTypesRepository"; +import BaseService from "@Services/BaseService"; +import { DeedType } from "le-coffre-resources/dist/SuperAdmin"; +import { Service } from "typedi"; + +@Service() +export default class DeedTypesService extends BaseService { + constructor( + private deedTypeRepository: DeedTypesRepository, + private deedTypeHasDocumentTypesRepository: DeedTypeHasDocumentTypesRepository, + ) { + super(); + } + + /** + * @description : Get all deed-types + * @throws {Error} If deed-types cannot be get + */ + public async get(query: any): Promise { + return this.deedTypeRepository.findMany(query); + } + + /** + * @description : Create a new deed-type + * @throws {Error} If deed-type cannot be created + * @param : deedTypesEntity: Partial + */ + public async create(deedTypeEntity: DeedType): Promise { + return this.deedTypeRepository.create(deedTypeEntity); + } + + /** + * @description : Modify a deed-type + * @throws {Error} If deed-type cannot be modifified + */ + public async update(uid: string, deedTypeEntity: DeedType): Promise { + return this.deedTypeRepository.update(uid, deedTypeEntity); + } + + /** + * @description : Get a deedtype by uid + * @throws {Error} If deed-type cannot be get by uid + */ + public async getByUid(uid: string) { + return this.deedTypeRepository.findOneByUid(uid); + } + + public async addDocumentTypes(deedTypeUuid: string, documentTypesUuidToAdd: string[]): Promise { + const relationsToDocumentTypes = await this.deedTypeHasDocumentTypesRepository.createMany(deedTypeUuid, documentTypesUuidToAdd); + + let deedTypeHasDocumentUuids: string[] = []; + relationsToDocumentTypes.forEach((item) => { + deedTypeHasDocumentUuids.push(item.uuid); + }); + + return this.deedTypeRepository.addDocumentTypes(deedTypeUuid, deedTypeHasDocumentUuids); + } + + public async addDocumentType(deedTypeUuid: string, documentTypesUuidToAdd: string): Promise { + const deedTypeHasDocumentType = await this.deedTypeHasDocumentTypesRepository.create(deedTypeUuid, documentTypesUuidToAdd); + + return this.deedTypeRepository.addDocumentType(deedTypeUuid, deedTypeHasDocumentType.uuid); + } + + public async removeDocumentType(deedTypeUuid: string, documentTypesUuidToRemove: string): Promise { + await this.deedTypeHasDocumentTypesRepository.delete(deedTypeUuid, documentTypesUuidToRemove); + + return this.get({ where: { uuid: deedTypeUuid }, include: { deed_type_has_document_types: true } }); + } + + public async removeDocumentTypes(deedTypeUuid: string, documentTypesUuidToRemove: string[]): Promise { + await this.deedTypeHasDocumentTypesRepository.deleteMany(deedTypeUuid, documentTypesUuidToRemove); + + return this.get({ where: { uuid: deedTypeUuid }, include: { deed_type_has_document_types: true } }); + } +} diff --git a/src/services/super-admin/DeedsService/DeedsService.ts b/src/services/super-admin/DeedsService/DeedsService.ts new file mode 100644 index 00000000..dbbdb171 --- /dev/null +++ b/src/services/super-admin/DeedsService/DeedsService.ts @@ -0,0 +1,89 @@ +import { Deeds } from "@prisma/client"; +import DeedHasDocumentTypesRepository from "@Repositories/DeedsHasDocumentTypesRepository"; +import DeedsRepository from "@Repositories/DeedsRepository"; +import DeedTypesHasDocumentTypesRepository from "@Repositories/DeedTypesHasDocumentTypesRepository"; +import DeedTypesRepository from "@Repositories/DeedTypesRepository"; +import BaseService from "@Services/BaseService"; +import { DeedType } from "le-coffre-resources/dist/Customer"; +import Container, { Service } from "typedi"; + +@Service() +export default class DeedsService extends BaseService { + constructor(private deedRepository: DeedsRepository, private deedHasDocumentTypesRepository: DeedHasDocumentTypesRepository) { + super(); + } + + /** + * @description : Get all deeds + * @throws {Error} If deeds cannot be get + */ + public async get(query: any) { + return this.deedRepository.findMany(query); + } + + /** + * @description : Create a new deed with document types + * @throws {Error} If deeds cannot be created + */ + public async create(deedType: DeedType): Promise { + let documentTypesToAdd: string[] = []; + const deedTypeHasDocumentTypesRepository = Container.get(DeedTypesHasDocumentTypesRepository); + const deedTypesRepository = Container.get(DeedTypesRepository); + + if ((await deedTypesRepository.findOneByUid(deedType.uid)).archived_at != null) throw new Error("deed type is archived"); + + const deedTypeHasDocumentTypes = await deedTypeHasDocumentTypesRepository.findMany({ where: { deed_type_uuid: deedType.uid } }); + deedTypeHasDocumentTypes.forEach((relation) => { + documentTypesToAdd.push(relation.document_type_uuid); + }); + + const deed = await this.deedRepository.create(deedType); + const relations = await this.deedHasDocumentTypesRepository.createMany(deed.uuid, documentTypesToAdd); + + let relationsToAdd: string[] = []; + relations.forEach((relation) => { + documentTypesToAdd.push(relation.uuid); + }); + + await this.deedRepository.addDocumentTypes(deed.uuid, relationsToAdd); + + return this.getByUid(deed.uuid); + } + + /** + * @description : Get a deed by uid + * @throws {Error} If deed-type cannot be get by uid + */ + public async getByUid(uid: string) { + return this.deedRepository.findOneByUid(uid); + } + + public async addDocumentTypes(deedTypeUuid: string, documentTypesUuidToAdd: string[]): Promise { + const relationsToDocumentTypes = await this.deedHasDocumentTypesRepository.createMany(deedTypeUuid, documentTypesUuidToAdd); + + let deedTypeHasDocumentUuids: string[] = []; + relationsToDocumentTypes.forEach((item) => { + deedTypeHasDocumentUuids.push(item.uuid); + }); + + return this.deedRepository.addDocumentTypes(deedTypeUuid, deedTypeHasDocumentUuids); + } + + public async addDocumentType(deedTypeUuid: string, documentTypesUuidToAdd: string): Promise { + const deedTypeHasDocumentType = await this.deedHasDocumentTypesRepository.create(deedTypeUuid, documentTypesUuidToAdd); + + return this.deedRepository.addDocumentType(deedTypeUuid, deedTypeHasDocumentType.uuid); + } + + public async removeDocumentType(deedTypeUuid: string, documentTypesUuidToRemove: string): Promise { + await this.deedHasDocumentTypesRepository.delete(deedTypeUuid, documentTypesUuidToRemove); + + return await this.get({ where: { uuid: deedTypeUuid }, include: { deed_has_document_types: true } }); + } + + public async removeDocumentTypes(deedTypeUuid: string, documentTypesUuidToRemove: string[]): Promise { + await this.deedHasDocumentTypesRepository.deleteMany(deedTypeUuid, documentTypesUuidToRemove); + + return await this.get({ where: { uuid: deedTypeUuid }, include: { deed_has_document_types: true } }); + } +} diff --git a/src/services/super-admin/DocumentTypesService/DocumentTypesService.ts b/src/services/super-admin/DocumentTypesService/DocumentTypesService.ts new file mode 100644 index 00000000..a3308ab5 --- /dev/null +++ b/src/services/super-admin/DocumentTypesService/DocumentTypesService.ts @@ -0,0 +1,45 @@ +import { DocumentTypes } from "@prisma/client"; +import DocumentTypesRepository from "@Repositories/DocumentTypesRepository"; +import BaseService from "@Services/BaseService"; +import { DocumentType } from "le-coffre-resources/dist/SuperAdmin"; +import { Service } from "typedi"; + +@Service() +export default class DocumentTypesService extends BaseService { + constructor(private documentTypeRepository: DocumentTypesRepository) { + super(); + } + + /** + * @description : Get all document-types + * @throws {Error} If document-types cannot be get + */ + public async get(query: any) { + return this.documentTypeRepository.findMany(query); + } + + /** + * @description : Create a new document-type + * @throws {Error} If document-types cannot be created + */ + public async create(documentTypeEntity: DocumentType): Promise { + return this.documentTypeRepository.create(documentTypeEntity); + } + + /** + * @description : Modify a document-type + * @throws {Error} If document-type cannot be modified + */ + public async update(uid: string, documentTypeEntity: DocumentType): Promise { + return this.documentTypeRepository.update(uid, documentTypeEntity); + } + + /** + * @description : Get a document-type by uid + * @returns : T + * @throws {Error} If document-type is not found + */ + public async getByUid(uid: string) { + return this.documentTypeRepository.findOneByUid(uid); + } +} diff --git a/src/services/DocumentsService/DocumentsService.ts b/src/services/super-admin/DocumentsService/DocumentsService.ts similarity index 62% rename from src/services/DocumentsService/DocumentsService.ts rename to src/services/super-admin/DocumentsService/DocumentsService.ts index 790f7843..cf19570f 100644 --- a/src/services/DocumentsService/DocumentsService.ts +++ b/src/services/super-admin/DocumentsService/DocumentsService.ts @@ -1,5 +1,8 @@ +import DocumentTypesRepository from "@Repositories/DocumentTypesRepository"; +//import { DocumentTypes } from "prisma/prisma-client"; import BaseService from "@Services/BaseService"; -import { Service } from "typedi"; +import { processFindManyQuery } from "prisma-query"; +import Container, { Service } from "typedi"; @Service() export default class DocumentsService extends BaseService { @@ -9,14 +12,16 @@ export default class DocumentsService extends BaseService { /** * @description : Get all documents - * @returns : T + * @returns : Document[] * @throws {Error} If documents cannot be get - * @param : projectEntity: Partial + * @param : ReturnType */ - public async get() { - // const document = await this.customersRepository.findOne(uuid); - // if (!document) Promise.reject(new Error("Cannot get documents")); - return { response: "/api/documents > GET : All documents > Not implemented yet" }; + public async get(query: ReturnType) { + //init repo + const repo = Container.get(DocumentTypesRepository); + + //call service to return prisma entity + return await repo.findMany(query); } /** @@ -25,11 +30,13 @@ export default class DocumentsService extends BaseService { * @throws {Error} If document cannot be created * @param : projectEntity: Partial */ - public async create() { - // const document = await this.projectRepository.create(projectEntity); - // if (!document) Promise.reject(new Error("Cannot create document")); - return { response: "/api/documents > POST : Create document > Not implemented yet" }; - } + // public async create(documentTypeEntity: DocumentTypes): Promise { + // //init repo + // const repo = Container.get(DocumentTypesRepository); + + // // call service to return prisma entity + // return await repo.create(documentTypeEntity); + // } /** * @description : Modify a document diff --git a/src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts b/src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts new file mode 100644 index 00000000..c630756a --- /dev/null +++ b/src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts @@ -0,0 +1,67 @@ +import { OfficeFolders } from ".prisma/client"; +import OfficeFoldersRepository from "@Repositories/OfficeFoldersRepository"; +import BaseService from "@Services/BaseService"; +import { OfficeFolder } from "le-coffre-resources/dist/SuperAdmin"; +import { processFindManyQuery } from "prisma-query"; +import Container, { Service } from "typedi"; + +@Service() +export default class OfficeFoldersService extends BaseService { + constructor() { + super(); + } + + /** + * @description : Get all folders + * @returns : OfficeFolders[] + * @throws {Error} If folders cannot be get + * @param : query: ReturnType + */ + public async get(query: ReturnType) { + //init repo + const repo = Container.get(OfficeFoldersRepository); + + //call service to return prisma entity + return await repo.findMany(query); + } + + /** + * @description : Create a new folder + * @returns : T + * @throws {Error} If folder cannot be created + * @param : projectEntity: Partial + */ + public async create(officeFolderEntity: OfficeFolder): Promise { + //init repo + const repo = Container.get(OfficeFoldersRepository); + + // call service to return prisma entity + return await repo.create(officeFolderEntity); + } + + /** + * @description : Modify a folder + * @returns : T + * @throws {Error} If folder cannot be modified + * @param : projectEntity: Partial + */ + public async update(officeFolderEntity: OfficeFolder): Promise { + //init repo + const repo = Container.get(OfficeFoldersRepository); + + // call service to return prisma entity + return await repo.update(officeFolderEntity); + } + + /** + * @description : Get a folder by uid + * @returns : T + * @throws {Error} If folder cannot be get by uid + * @param : projectEntity: Partial + */ + public async getByUid(uid: string) { + // const folder = await this.foldersRepository.findOne(uid); + // if (!folder) Promise.reject(new Error("Cannot get folder by uid")); + return { response: "/api/folders/:uid > GET : folder by uid > Not implemented yet" }; + } +} diff --git a/src/services/super-admin/OfficesService/OfficesService.ts b/src/services/super-admin/OfficesService/OfficesService.ts new file mode 100644 index 00000000..c9512c84 --- /dev/null +++ b/src/services/super-admin/OfficesService/OfficesService.ts @@ -0,0 +1,46 @@ +// import ProjectsRepository from "@Common/repositories/projects/ProjectsRepository"; +import { Offices } from "@prisma/client"; +import OfficesRepository from "@Repositories/OfficesRepository"; +import BaseService from "@Services/BaseService"; +import { Office as OfficeRessource } from "le-coffre-resources/dist/SuperAdmin"; +import { processFindManyQuery } from "prisma-query"; +import { Service } from "typedi"; + +@Service() +export default class OfficesService extends BaseService { + constructor(private officeRepository: OfficesRepository) { + super(); + } + + /** + * @description : Get all offices + * @throws {Error} If offices cannot be get + */ + public async get(query: ReturnType): Promise { + return this.officeRepository.findMany(query); + } + + /** + * @description : Create a new office + * @throws {Error} If office cannot be created + */ + public async create(officeEntity: OfficeRessource): Promise { + return this.officeRepository.create(officeEntity); + } + + /** + * @description : Modify an office + * @throws {Error} If office cannot be modified + */ + public async update(uid: string, officeEntity: OfficeRessource): Promise { + return this.officeRepository.update(uid, officeEntity); + } + + /** + * @description : Get a office by uid + * @throws {Error} If office cannot be get + */ + public async getByUid(uid: string): Promise { + return this.officeRepository.findOneByUid(uid); + } +} diff --git a/src/services/super-admin/UsersService/UsersService.ts b/src/services/super-admin/UsersService/UsersService.ts new file mode 100644 index 00000000..62e11871 --- /dev/null +++ b/src/services/super-admin/UsersService/UsersService.ts @@ -0,0 +1,45 @@ +import BaseService from "@Services/BaseService"; +import "reflect-metadata"; +import { Service } from "typedi"; +import UsersRepository from "@Repositories/UsersRepository"; +import User from "le-coffre-resources/dist/SuperAdmin"; +import { Users } from "@prisma/client"; + +@Service() +export default class UsersService extends BaseService { + constructor(private userRepository: UsersRepository) { + super(); + } + + /** + * @description : Get all users + * @throws {Error} If users cannot be get + */ + public get(query: any): Promise { + return this.userRepository.findMany(query); + } + + /** + * @description : Create a user + * @throws {Error} If user couldn't be created + */ + public create(userEntity: User): Promise { + return this.userRepository.create(userEntity); + } + + /** + * @description : Modify a user + * @throws {Error} If user modification failed + */ + public update(uuid: string, userEntity: User): Promise { + return this.userRepository.update(uuid, userEntity); + } + + /** + * @description : Get a user by uid + * @throws {Error} If user cannot be get by uid + */ + public getByUid(uid: string): Promise { + return this.userRepository.findOneByUid(uid); + } +} diff --git a/src/test/services/super-admin/CustomersService.test.ts b/src/test/services/super-admin/CustomersService.test.ts new file mode 100644 index 00000000..d2b5b74b --- /dev/null +++ b/src/test/services/super-admin/CustomersService.test.ts @@ -0,0 +1,167 @@ +import "module-alias/register"; +import "reflect-metadata"; +import { Customer } from "le-coffre-resources/dist/SuperAdmin"; +import CustomersService from "@Services/super-admin/CustomersService/CustomersService"; +import { processFindManyQuery } from "prisma-query"; +import { PrismaClient } from "@prisma/client"; +import { customer, customer_, userContact, userContact_ } from "./MockedData"; +import Container from "typedi"; +import CustomersRepository from "@Repositories/CustomersRepository"; + +const prisma = new PrismaClient(); + +const CustomersServiceTest = new CustomersService(Container.get(CustomersRepository)); + +afterAll(async () => { + /* + * Clean database after all tests execution. + * Due to cascade deletion, if addresses are deleted, all items following tables are dropped: contacts, customers, offices + */ + const deleteAddresses = prisma.addresses.deleteMany(); + await prisma.$transaction([deleteAddresses]); + await prisma.$disconnect(); +}); + +describe("test create function", () => { + it("should create a new customer", async () => { + const customerCreated = await CustomersServiceTest.create(customer); + + expect(customerCreated?.status).toEqual("PENDING"); + + // verify if customer contact is created in db + const contactCreated = await prisma.contacts.findUnique({ where: { uuid: customerCreated.contact_uuid } }); + expect(contactCreated?.first_name).toEqual(customer.contact.first_name); + expect(contactCreated?.last_name).toEqual(customer.contact.last_name); + expect(contactCreated?.cell_phone_number).toEqual(customer.contact.cell_phone_number); + expect(contactCreated?.phone_number).toEqual(customer.contact.phone_number); + expect(contactCreated?.civility).toEqual(customer.contact.civility); + expect(contactCreated?.email).toEqual(customer.contact.email); + + // verify if customer address is created in db + const addressForContactCreated = await prisma.addresses.findUnique({ where: { uuid: contactCreated?.address_uuid } }); + expect(addressForContactCreated?.address).toEqual(customer.contact.address.address); + expect(addressForContactCreated?.zip_code).toEqual(customer.contact.address.zip_code); + expect(addressForContactCreated?.city).toEqual(customer.contact.address.city); + }); + + it("should not create an customer already created", async () => { + // try to create the same customer + async function duplicateCustomer() { + await CustomersServiceTest.create(customer); + } + await expect(duplicateCustomer).rejects.toThrow(); + }); + + it("should not create an new customer with an email already created", async () => { + let newCustomer: Customer = JSON.parse(JSON.stringify(customer_)); + newCustomer.contact.email = userContact.email; + + // try to create a new customer with already used email + async function createCustomerWithDuplicateEmail() { + await CustomersServiceTest.create(newCustomer); + } + await expect(createCustomerWithDuplicateEmail).rejects.toThrow(); + }); + + it("should not create an customer with an phone number already created", async () => { + let newCustomer: Customer = JSON.parse(JSON.stringify(customer_)); + newCustomer.contact.cell_phone_number = userContact.cell_phone_number; + + // try to create a new customer with already used cellphone number + async function duplicateCustomer() { + await CustomersServiceTest.create(newCustomer); + } + await expect(duplicateCustomer).rejects.toThrow(); + }); + + it("should create an new customer if unique attributes differ from existing customers", async () => { + let newCustomer: Customer = JSON.parse(JSON.stringify(customer)); + newCustomer.contact.email = userContact_.email; + newCustomer.contact.cell_phone_number = userContact_.cell_phone_number; + + const customerCreated = await CustomersServiceTest.create(newCustomer); + + expect(customerCreated?.status).toEqual("PENDING"); + + // verify if customer_ contact is created in db + const contactCreated = await prisma.contacts.findUnique({ where: { uuid: customerCreated.contact_uuid } }); + expect(contactCreated?.first_name).toEqual(customer.contact.first_name); + expect(contactCreated?.last_name).toEqual(customer.contact.last_name); + expect(contactCreated?.cell_phone_number).toEqual(customer_.contact.cell_phone_number); + expect(contactCreated?.phone_number).toEqual(customer.contact.phone_number); + expect(contactCreated?.civility).toEqual(customer.contact.civility); + expect(contactCreated?.email).toEqual(customer_.contact.email); + + // verify if customer_ address is created in db + const addressForContactCreated = await prisma.addresses.findUnique({ where: { uuid: contactCreated?.address_uuid } }); + expect(addressForContactCreated?.address).toEqual(customer.contact.address.address); + expect(addressForContactCreated?.zip_code).toEqual(customer.contact.address.zip_code); + expect(addressForContactCreated?.city).toEqual(customer.contact.address.city); + }); +}); + +describe("test update function", () => { + it("should update an customer's data", async () => { + const customerCreated = await prisma.customers.findFirstOrThrow({ where: { contact: { email: customer_.contact.email } } }); + + // update the last customer created with his own new office and own contact + const updatedCustomer = await CustomersServiceTest.update(customerCreated.uuid, customer_); + + expect(updatedCustomer?.status).toEqual("ERRONED"); + + // verify if customer_ contact is created in db + const existingContact = await prisma.contacts.findUnique({ where: { uuid: updatedCustomer.contact_uuid } }); + expect(existingContact?.first_name).toEqual(customer_.contact.first_name); + expect(existingContact?.last_name).toEqual(customer_.contact.last_name); + expect(existingContact?.cell_phone_number).toEqual(customer_.contact.cell_phone_number); + expect(existingContact?.phone_number).toEqual(customer_.contact.phone_number); + expect(existingContact?.civility).toEqual(customer_.contact.civility); + expect(existingContact?.email).toEqual(customer_.contact.email); + + // verify if customer_ address is created in db + const addressForExistingContact = await prisma.addresses.findUnique({ where: { uuid: existingContact?.address_uuid } }); + expect(addressForExistingContact?.address).toEqual(customer_.contact.address.address); + expect(addressForExistingContact?.zip_code).toEqual(customer_.contact.address.zip_code); + expect(addressForExistingContact?.city).toEqual(customer_.contact.address.city); + }); + + it("should not update an customer with an email already used", async () => { + const customerUid = (await prisma.customers.findFirstOrThrow({ where: { contact: { email: customer_.contact.email } } })).uuid; + let updatedCustomer: Customer = JSON.parse(JSON.stringify(customer_)); + updatedCustomer.contact.email = userContact.email; + + // try to create a new customer with already used email + async function updateCustomerWithDuplicateEmail() { + await CustomersServiceTest.update(customerUid, updatedCustomer); + } + await expect(updateCustomerWithDuplicateEmail).rejects.toThrow(); + }); + + it("should not update an customer with an phone number already used", async () => { + const customerUid = (await prisma.customers.findFirstOrThrow({ where: { contact: { email: customer_.contact.email } } })).uuid; + let updatedCustomer: Customer = JSON.parse(JSON.stringify(customer_)); + updatedCustomer.contact.cell_phone_number = userContact.cell_phone_number; + + // try to create a new customer with already used email + async function updateCustomerWithDuplicateEmail() { + await CustomersServiceTest.update(customerUid, updatedCustomer); + } + await expect(updateCustomerWithDuplicateEmail).rejects.toThrow(); + }); +}); + +describe("test get function", () => { + it("should return an array of Customers", async () => { + const req = processFindManyQuery({}); + const customers = await CustomersServiceTest.get(req); + + // verify result typing + expect(customers).toBeInstanceOf(Array); + expect(customers.length).toEqual(2); + + // verify result content + const customersCreated = await prisma.customers.findMany(); + expect(customers).toContainEqual(customersCreated[0]); + expect(customers).toContainEqual(customersCreated[1]); + }); +}); diff --git a/src/test/services/super-admin/DeedService.test.ts b/src/test/services/super-admin/DeedService.test.ts new file mode 100644 index 00000000..be5b0775 --- /dev/null +++ b/src/test/services/super-admin/DeedService.test.ts @@ -0,0 +1,264 @@ +import "module-alias/register"; +import "reflect-metadata"; +import { Deed, DeedType } from "le-coffre-resources/dist/SuperAdmin"; +import DeedService from "@Services/super-admin/DeedsService/DeedsService"; +import { PrismaClient, Offices, DocumentTypes, DeedTypes, DeedTypeHasDocumentTypes } from "prisma/prisma-client"; +import { deedType, documentType, documentType_, office } from "./MockedData"; +import DeedsRepository from "@Repositories/DeedsRepository"; +import Container from "typedi"; +import DeedHasDocumentTypesRepository from "@Repositories/DeedsHasDocumentTypesRepository"; + +const prisma = new PrismaClient(); + +const DeedServiceTest = new DeedService(Container.get(DeedsRepository), Container.get(DeedHasDocumentTypesRepository)); + +let office1: Offices; + +let documentType1: DocumentTypes; +let documentType2: DocumentTypes; + +let deedType1: DeedTypes; + +let deedType1HasDocumentType1: DeedTypeHasDocumentTypes; + +beforeAll(async () => { + office1 = await prisma.offices.create({ + data: { + idNot: office.idNot, + name: office.name, + crpcen: office.crpcen, + address: { + create: { + address: office.address.address, + zip_code: office.address.zip_code, + city: office.address.city, + }, + }, + }, + }); + + documentType1 = await prisma.documentTypes.create({ + data: { + name: documentType.name, + public_description: documentType.public_description, + private_description: documentType.private_description, + archived_at: null, + office_uuid: office1.uuid, + }, + }); + + documentType2 = await prisma.documentTypes.create({ + data: { + name: documentType_.name, + public_description: documentType_.public_description, + private_description: documentType_.private_description, + archived_at: null, + office_uuid: office1.uuid, + }, + }); + + deedType1 = await prisma.deedTypes.create({ + data: { + name: deedType.name, + description: deedType.description, + archived_at: null, + office_uuid: office1.uuid, + }, + }); + + deedType1HasDocumentType1 = await prisma.deedTypeHasDocumentTypes.create({ + data: { + deed_type_uuid: deedType1.uuid, + document_type_uuid: documentType1.uuid, + }, + }); + + await prisma.deedTypes.update({ + where: { uuid: deedType1.uuid }, + data: { + deed_type_has_document_types: { + connect: { + uuid: deedType1HasDocumentType1.uuid, + }, + }, + }, + }); +}); + +afterAll(async () => { + const deleteDeedTypes = prisma.deedTypes.deleteMany(); + const deleteOffices = prisma.offices.deleteMany(); + await prisma.$transaction([deleteDeedTypes, deleteOffices]); + await prisma.$disconnect(); +}); + +describe("test create function", () => { + it("should not create a new deed if deed type is unknown", async () => { + // try to create a new deed with unknown deed type + async function createDeedWithUnknownDeedType() { + await DeedServiceTest.create(deedType); + } + await expect(createDeedWithUnknownDeedType).rejects.toThrow(); + }); + + it("should create a new deed based on existing deed type", async () => { + let deedTypeWithUid: DeedType = JSON.parse(JSON.stringify(deedType)); + deedTypeWithUid.uid = deedType1.uuid; + const deedCreated = await DeedServiceTest.create(deedTypeWithUid); + + expect(deedCreated.deed_type_uuid).toEqual(deedType1.uuid); + }); + + it("should have by default the same document types as its deed type ", async () => { + const deedWithDocumentTypes = await prisma.deeds.findFirstOrThrow({ include: { deed_has_document_types: true } }); + expect(deedWithDocumentTypes.deed_has_document_types.length).toEqual(1); + expect(deedWithDocumentTypes.deed_has_document_types[0]?.document_type_uuid).toEqual(documentType1.uuid); + }); + + it("should create a the same deed based on existing deed type", async () => { + let deedTypeWithUid: DeedType = JSON.parse(JSON.stringify(deedType)); + deedTypeWithUid.uid = deedType1.uuid; + const deedCreated = await DeedServiceTest.create(deedTypeWithUid); + + expect(deedCreated.deed_type_uuid).toEqual(deedType1.uuid); + }); + + it("should not create a new deed based on archivated deed type", async () => { + let deedTypeArchivated: DeedType = JSON.parse(JSON.stringify(deedType)); + deedTypeArchivated.uid = deedType1.uuid; + + await prisma.deedTypes.update({ + where: { uuid: deedType1.uuid }, + data: { + archived_at: new Date(Date.now()), + }, + }); + + // try to create a new deed with archivated deed type + async function createDeedWithArchivatedDeedType() { + await DeedServiceTest.create(deedTypeArchivated); + } + await expect(createDeedWithArchivatedDeedType).rejects.toThrow("deed type is archived"); + }); +}); + +describe("test addDocumentTypes function", () => { + it("should add document types to a deed", async () => { + const deedUid = (await prisma.deeds.findFirstOrThrow({ where: { deed_type_uuid: deedType1.uuid } })).uuid; + const documentsToAdd = [documentType1.uuid, documentType2.uuid]; + await DeedServiceTest.addDocumentTypes(deedUid, documentsToAdd); + + const deed = await prisma.deeds.findFirstOrThrow({ + where: { + uuid: deedUid, + }, + include: { + deed_has_document_types: true, + }, + }); + expect(deed.deed_has_document_types.length).toEqual(2); + }); + + it("should not add document types to a deed type that already has those document types ", async () => { + const deedUid = (await prisma.deeds.findFirstOrThrow({ where: { deed_type_uuid: deedType1.uuid } })).uuid; + let deedHasDocumentTypes = await prisma.deedHasDocumentTypes.findMany({ where: { deed_uuid: deedUid } }); + expect(deedHasDocumentTypes.length).toEqual(2); + + const documentsToAdd = [documentType1.uuid, documentType2.uuid]; + //we expect deedTypeHasDocumentTypes service to skip duplicates without throwing error + await DeedServiceTest.addDocumentTypes(deedUid, documentsToAdd); + + deedHasDocumentTypes = await prisma.deedHasDocumentTypes.findMany({ where: { deed_uuid: deedUid } }); + expect(deedHasDocumentTypes.length).toEqual(2); + }); +}); +describe("test removeDocumentTypes function", () => { + it("should remove document types from a deed type", async () => { + const deedUid = (await prisma.deeds.findFirstOrThrow({ where: { deed_type_uuid: deedType1.uuid } })).uuid; + const documentsToRemove = [documentType1.uuid]; + await DeedServiceTest.removeDocumentTypes(deedUid, documentsToRemove); + + const deedWithDocumentTypeRelations = await prisma.deeds.findFirstOrThrow({ + where: { + uuid: deedUid, + }, + include: { + deed_has_document_types: true, + }, + }); + expect(deedWithDocumentTypeRelations.deed_has_document_types.length).toEqual(1); + expect(deedWithDocumentTypeRelations.deed_has_document_types[0]?.document_type_uuid).toEqual(documentType2.uuid); + }); + it("should not remove document types from a deed type is they were not linked", async () => { + let deedWithOneDocumentType = await prisma.deeds.findFirstOrThrow({ + where: { deed_type_uuid: deedType1.uuid }, + include: { + deed_has_document_types: true, + }, + }); + expect(deedWithOneDocumentType.deed_has_document_types.length).toEqual(1); + + const documentsToRemove = [documentType1.uuid]; + + async function removeDocumentTypeNotLinkedToDeedType() { + await DeedServiceTest.removeDocumentTypes(deedWithOneDocumentType.uuid, documentsToRemove); + } + await expect(removeDocumentTypeNotLinkedToDeedType).rejects.toThrow(); + }); +}); +describe("test removeDocumentType function", () => { + it("should remove only one document type from a deed type", async () => { + let deedWithOneDocumentType = await prisma.deeds.findFirstOrThrow({ + where: { deed_type_uuid: deedType1.uuid }, + include: { + deed_has_document_types: true, + }, + }); + expect(deedWithOneDocumentType.deed_has_document_types.length).toEqual(1); + + const documentToRemove = documentType2.uuid; + await DeedServiceTest.removeDocumentType(deedWithOneDocumentType.uuid, documentToRemove); + + deedWithOneDocumentType = await prisma.deeds.findFirstOrThrow({ + where: { + uuid: deedWithOneDocumentType.uuid, + }, + include: { + deed_has_document_types: true, + }, + }); + expect(deedWithOneDocumentType.deed_has_document_types.length).toEqual(0); + }); +}); +describe("test addDocumentType function", () => { + it("should add only one document type to a deed type", async () => { + const deedUid = (await prisma.deeds.findFirstOrThrow({ where: { deed_type_uuid: deedType1.uuid } })).uuid; + const documentToAdd = documentType1.uuid; + await DeedServiceTest.addDocumentType(deedUid, documentToAdd); + + const deed = await prisma.deeds.findFirstOrThrow({ + where: { + uuid: deedUid, + }, + include: { + deed_has_document_types: true, + }, + }); + expect(deed.deed_has_document_types.length).toEqual(1); + expect(deed.deed_has_document_types[0]?.document_type_uuid).toEqual(documentType1.uuid); + }); +}); + +describe("test get function", () => { + it("should return an array of Deeds", async () => { + const deeds = await DeedServiceTest.get({}); + + // verify result typing + expect(deeds).toBeInstanceOf(Array); + expect(deeds.length).toEqual(2); + + // verify result content + expect(deeds[0]?.deed_type_uuid).toEqual(deedType1.uuid); + expect(deeds[1]?.deed_type_uuid).toEqual(deedType1.uuid); + }); +}); diff --git a/src/test/services/super-admin/DeedTypesService.test.ts b/src/test/services/super-admin/DeedTypesService.test.ts new file mode 100644 index 00000000..54d30f2f --- /dev/null +++ b/src/test/services/super-admin/DeedTypesService.test.ts @@ -0,0 +1,406 @@ +import "module-alias/register"; +import "reflect-metadata"; +import { DeedType } from "le-coffre-resources/dist/SuperAdmin"; +import DeedTypeService from "@Services/super-admin/DeedTypesService/DeedTypesService"; +import { PrismaClient, Offices, DocumentTypes } from "prisma/prisma-client"; +import { deedType, deedType_, documentType, documentType_, office, office_ } from "./MockedData"; +import DeedTypesRepository from "@Repositories/DeedTypesRepository"; +import Container from "typedi"; +import DeedTypeHasDocumentTypesRepository from "@Repositories/DeedTypesHasDocumentTypesRepository"; + +const prisma = new PrismaClient(); + +const DeedTypeServiceTest = new DeedTypeService(Container.get(DeedTypesRepository), Container.get(DeedTypeHasDocumentTypesRepository)); + +let office1: Offices; +let office2: Offices; + +let documentType1: DocumentTypes; +let documentType2: DocumentTypes; + +beforeAll(async () => { + office1 = await prisma.offices.create({ + data: { + idNot: office.idNot, + name: office.name, + crpcen: office.crpcen, + address: { + create: { + address: office.address.address, + zip_code: office.address.zip_code, + city: office.address.city, + }, + }, + }, + }); + + office2 = await prisma.offices.create({ + data: { + idNot: office_.idNot, + name: office_.name, + crpcen: office_.crpcen, + address: { + create: { + address: office_.address.address, + zip_code: office_.address.zip_code, + city: office_.address.city, + }, + }, + }, + }); + + documentType1 = await prisma.documentTypes.create({ + data: { + name: documentType.name, + public_description: documentType.public_description, + private_description: documentType.private_description, + archived_at: null, + office_uuid: office1.uuid, + }, + }); + + documentType2 = await prisma.documentTypes.create({ + data: { + name: documentType_.name, + public_description: documentType_.public_description, + private_description: documentType_.private_description, + archived_at: null, + office_uuid: office1.uuid, + }, + }); +}); + +afterAll(async () => { + const deleteDeedTypes = prisma.deedTypes.deleteMany(); + const deleteOffices = prisma.offices.deleteMany(); + await prisma.$transaction([deleteDeedTypes, deleteOffices]); + await prisma.$disconnect(); +}); + +describe("test create function", () => { + it("should not create a new deed type if office is unknown", async () => { + // try to create a new deed type with unknown office + async function createDeedTypeWithUnknownOffice() { + await DeedTypeServiceTest.create(deedType); + } + await expect(createDeedTypeWithUnknownOffice).rejects.toThrow(); + }); + + it("should create a new deed type", async () => { + let deedTypeWithOfficeUid: DeedType = JSON.parse(JSON.stringify(deedType)); + deedTypeWithOfficeUid.office.uid = office1.uuid; + const deedTypeCreated = await DeedTypeServiceTest.create(deedTypeWithOfficeUid); + + expect(deedTypeCreated.name).toEqual(deedType.name); + expect(deedTypeCreated.description).toEqual(deedType.description); + expect(deedTypeCreated.archived_at).toBeNull(); + expect(deedTypeCreated.office_uuid).toEqual(office1.uuid); + }); + + it("should not create a new deed type with a name already used for a given office", async () => { + let deedTypeWithSameNameAndOffice: DeedType = JSON.parse(JSON.stringify(deedType_)); + deedTypeWithSameNameAndOffice.office.uid = office1.uuid; + deedTypeWithSameNameAndOffice.name = deedType.name; + + async function createDeedTypeWithSameNameAndOffice() { + await DeedTypeServiceTest.create(deedTypeWithSameNameAndOffice); + } + await expect(createDeedTypeWithSameNameAndOffice).rejects.toThrow(); + }); + + it("should create the same deed type for a different office", async () => { + let deedTypeDuplicatedForNewOffice: DeedType = JSON.parse(JSON.stringify(deedType)); + deedTypeDuplicatedForNewOffice.office.uid = office2.uuid; + + const deedTypeCreated = await DeedTypeServiceTest.create(deedTypeDuplicatedForNewOffice); + + expect(deedTypeCreated.name).toEqual(deedType.name); + expect(deedTypeCreated.description).toEqual(deedType.description); + expect(deedTypeCreated.archived_at).toBeNull(); + expect(deedTypeCreated.office_uuid).toEqual(office2.uuid); + }); + + it("should create the a new deed type version with a different name for a given office", async () => { + let deedTypeWithSameDescription: DeedType = JSON.parse(JSON.stringify(deedType)); + deedTypeWithSameDescription.office.uid = office1.uuid; + deedTypeWithSameDescription.name = deedType_.name; + + const deedTypeCreated = await DeedTypeServiceTest.create(deedTypeWithSameDescription); + + expect(deedTypeCreated.name).toEqual(deedType_.name); + expect(deedTypeCreated.description).toEqual(deedType.description); + expect(deedTypeCreated.archived_at).toBeNull(); + expect(deedTypeCreated.office_uuid).toEqual(office1.uuid); + }); +}); + +describe("test update function", () => { + it("should update a deed type data", async () => { + const deedTypeCreated = await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType_.name, office_uuid: office1.uuid } }); + + expect(deedTypeCreated.name).toEqual(deedType_.name); + expect(deedTypeCreated.description).toEqual(deedType.description); + expect(deedTypeCreated.archived_at).toBeNull(); + expect(deedTypeCreated.office_uuid).toEqual(office1.uuid); + + let deedTypeWithNewDescription: DeedType = JSON.parse(JSON.stringify(deedType_)); + deedTypeWithNewDescription.office.uid = office1.uuid; + + // update the last deed type created with his the right description + const deedTypeUpdated = await DeedTypeServiceTest.update(deedTypeCreated.uuid, deedTypeWithNewDescription); + + expect(deedTypeUpdated.name).toEqual(deedType_.name); + expect(deedTypeUpdated.description).toEqual(deedType_.description); + expect(deedTypeUpdated.archived_at).toBeNull(); + expect(deedTypeUpdated.office_uuid).toEqual(office1.uuid); + }); + + it("should not update a deed type name with an already used name for given office", async () => { + const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType_.name, office_uuid: office1.uuid } })).uuid; + let deedTypeWithSameNameAndOffice: DeedType = JSON.parse(JSON.stringify(deedType_)); + deedTypeWithSameNameAndOffice.office.uid = office1.uuid; + deedTypeWithSameNameAndOffice.name = deedType.name; + + // update the last deed type created with his the right description + async function updateDocumentTypeWithSameName() { + await DeedTypeServiceTest.update(deedTypeUid, deedTypeWithSameNameAndOffice); + } + await expect(updateDocumentTypeWithSameName).rejects.toThrow(); + }); + + it("should not update a deed type office membership if the office already have this document type", async () => { + const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType_.name, office_uuid: office1.uuid } })).uuid; + let deedTypeWithSameNameAndOffice: DeedType = JSON.parse(JSON.stringify(deedType_)); + deedTypeWithSameNameAndOffice.office.uid = office1.uuid; + deedTypeWithSameNameAndOffice.name = deedType.name; + + // try to duplicate deed type in a given office + async function updateDocumentTypeWithduplicatedName() { + await DeedTypeServiceTest.update(deedTypeUid, deedTypeWithSameNameAndOffice); + } + await expect(updateDocumentTypeWithduplicatedName).rejects.toThrow(); + }); + + it("should update a deed type office membership", async () => { + const deedTypeCreated = await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType_.name, office_uuid: office1.uuid } }); + + expect(deedTypeCreated.name).toEqual(deedType_.name); + expect(deedTypeCreated.description).toEqual(deedType_.description); + expect(deedTypeCreated.archived_at).toBeNull(); + expect(deedTypeCreated.office_uuid).toEqual(office1.uuid); + + let deedTypeTransferedToNewOffice: DeedType = JSON.parse(JSON.stringify(deedType_)); + deedTypeTransferedToNewOffice.office.uid = office2.uuid; + + // update the last deed type updated with a new office membership + const deedTypeUpdated = await DeedTypeServiceTest.update(deedTypeCreated.uuid, deedTypeTransferedToNewOffice); + + expect(deedTypeUpdated.name).toEqual(deedType_.name); + expect(deedTypeUpdated.description).toEqual(deedType_.description); + expect(deedTypeUpdated.archived_at).toBeNull(); + expect(deedTypeUpdated.office_uuid).toEqual(office2.uuid); + }); + + it("should archivate a deed type", async () => { + const deedTypeCreated = await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType_.name, office_uuid: office2.uuid } }); + + expect(deedTypeCreated.name).toEqual(deedType_.name); + expect(deedTypeCreated.description).toEqual(deedType_.description); + expect(deedTypeCreated.archived_at).toBeNull(); + expect(deedTypeCreated.office_uuid).toEqual(office2.uuid); + + let deedTypeArchivated: DeedType = JSON.parse(JSON.stringify(deedType_)); + deedTypeArchivated.office.uid = office2.uuid; + const currentDate = new Date(Date.now()); + deedTypeArchivated.archived_at = currentDate; + + // archivate a deed type by giving a non null date for archivated_at attribute + const deedTypeUpdated = await DeedTypeServiceTest.update(deedTypeCreated.uuid, deedTypeArchivated); + + expect(deedTypeUpdated.name).toEqual(deedType_.name); + expect(deedTypeUpdated.description).toEqual(deedType_.description); + expect(deedTypeUpdated.archived_at).toEqual(currentDate); + expect(deedTypeUpdated.office_uuid).toEqual(office2.uuid); + }); + + it("should unarchivate a deed type", async () => { + const deedTypeCreated = await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType_.name, office_uuid: office2.uuid } }); + + expect(deedTypeCreated.name).toEqual(deedType_.name); + expect(deedTypeCreated.description).toEqual(deedType_.description); + expect(deedTypeCreated.archived_at).not.toBeNull(); + expect(deedTypeCreated.office_uuid).toEqual(office2.uuid); + + let deedTypeUnarchivated: DeedType = JSON.parse(JSON.stringify(deedType_)); + deedTypeUnarchivated.office.uid = office2.uuid; + + // unarchivate a deed type by giving a null date for archivated_at attribute + const deedTypeUpdated = await DeedTypeServiceTest.update(deedTypeCreated.uuid, deedTypeUnarchivated); + + expect(deedTypeUpdated.name).toEqual(deedType_.name); + expect(deedTypeUpdated.description).toEqual(deedType_.description); + expect(deedTypeUpdated.archived_at).toBeNull(); + expect(deedTypeUpdated.office_uuid).toEqual(office2.uuid); + }); +}); + +describe("test addDocumentTypes function", () => { + it("should add document types to a deed type", async () => { + const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType.name, office_uuid: office1.uuid } })).uuid; + const documentsToAdd = [documentType1.uuid, documentType2.uuid]; + await DeedTypeServiceTest.addDocumentTypes(deedTypeUid, documentsToAdd); + + const deedTypes = await prisma.deedTypes.findFirstOrThrow({ + where: { + uuid: deedTypeUid, + }, + include: { + deed_type_has_document_types: true, + }, + }); + expect(deedTypes.deed_type_has_document_types.length).toEqual(2); + }); + + it("should not add document types to a deed type that already has those document types ", async () => { + const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType.name, office_uuid: office1.uuid } })).uuid; + let deedTypeHasDocumentTypes = await prisma.deedTypeHasDocumentTypes.findMany({ where: { deed_type_uuid: deedTypeUid } }); + expect(deedTypeHasDocumentTypes.length).toEqual(2); + + const documentsToAdd = [documentType1.uuid, documentType2.uuid]; + //we expect deedTypeHasDocumentTypes service to skip duplicates without throwing error + await DeedTypeServiceTest.addDocumentTypes(deedTypeUid, documentsToAdd); + + deedTypeHasDocumentTypes = await prisma.deedTypeHasDocumentTypes.findMany({ where: { deed_type_uuid: deedTypeUid } }); + expect(deedTypeHasDocumentTypes.length).toEqual(2); + }); +}); +describe("test removeDocumentTypes function", () => { + it("should remove document types from a deed type", async () => { + const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType.name, office_uuid: office1.uuid } })).uuid; + const documentsToRemove = [documentType1.uuid]; + await DeedTypeServiceTest.removeDocumentTypes(deedTypeUid, documentsToRemove); + + const deedTypeWithDocumentTypeRelations = await prisma.deedTypes.findFirstOrThrow({ + where: { + uuid: deedTypeUid, + }, + include: { + deed_type_has_document_types: true, + }, + }); + expect(deedTypeWithDocumentTypeRelations.deed_type_has_document_types.length).toEqual(1); + expect(deedTypeWithDocumentTypeRelations.deed_type_has_document_types[0]?.document_type_uuid).toEqual(documentType2.uuid); + }); + it("should not remove document types from a deed type is they were not linked", async () => { + let deedTypeWithOneDocumentType = await prisma.deedTypes.findFirstOrThrow({ + where: { name: deedType.name, office_uuid: office1.uuid }, + include: { + deed_type_has_document_types: true, + }, + }); + expect(deedTypeWithOneDocumentType.deed_type_has_document_types.length).toEqual(1); + + const documentsToRemove = [documentType1.uuid]; + + // try to duplicate deed type in a given office + async function removeDocumentTypeNotLinkedToDeedType() { + await DeedTypeServiceTest.removeDocumentTypes(deedTypeWithOneDocumentType.uuid, documentsToRemove); + } + await expect(removeDocumentTypeNotLinkedToDeedType).rejects.toThrow(); + }); +}); +describe("test removeDocumentType function", () => { + it("should remove only one document type from a deed type", async () => { + let deedTypeWithOneDocumentType = await prisma.deedTypes.findFirstOrThrow({ + where: { name: deedType.name, office_uuid: office1.uuid }, + include: { + deed_type_has_document_types: true, + }, + }); + expect(deedTypeWithOneDocumentType.deed_type_has_document_types.length).toEqual(1); + + const documentToRemove = documentType2.uuid; + await DeedTypeServiceTest.removeDocumentType(deedTypeWithOneDocumentType.uuid, documentToRemove); + + deedTypeWithOneDocumentType = await prisma.deedTypes.findFirstOrThrow({ + where: { + uuid: deedTypeWithOneDocumentType.uuid, + }, + include: { + deed_type_has_document_types: true, + }, + }); + expect(deedTypeWithOneDocumentType.deed_type_has_document_types.length).toEqual(0); + }); +}); +describe("test addDocumentType function", () => { + it("should add only one document type to a deed type", async () => { + const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType.name, office_uuid: office1.uuid } })).uuid; + const documentToAdd = documentType1.uuid; + await DeedTypeServiceTest.addDocumentType(deedTypeUid, documentToAdd); + + const deedTypes = await prisma.deedTypes.findFirstOrThrow({ + where: { + uuid: deedTypeUid, + }, + include: { + deed_type_has_document_types: true, + }, + }); + expect(deedTypes.deed_type_has_document_types.length).toEqual(1); + expect(deedTypes.deed_type_has_document_types[0]?.document_type_uuid).toEqual(documentType1.uuid); + }); +}); + +describe("test get function", () => { + it("should return an array of DeedTypes", async () => { + const deedTypes = await DeedTypeServiceTest.get({ orderBy: [{ name: "asc" }, { created_at: "asc" }] }); + + // verify result typing + expect(deedTypes).toBeInstanceOf(Array); + expect(deedTypes.length).toEqual(3); + + // verify result content + expect(deedTypes[0]?.name).toEqual(deedType_.name); + expect(deedTypes[0]?.description).toEqual(deedType_.description); + expect(deedTypes[0]?.archived_at).toBeNull(); + expect(deedTypes[0]?.office_uuid).toEqual(office2.uuid); + + expect(deedTypes[1]?.name).toEqual(deedType.name); + expect(deedTypes[1]?.description).toEqual(deedType.description); + expect(deedTypes[1]?.archived_at).toBeNull(); + expect(deedTypes[1]?.office_uuid).toEqual(office1.uuid); + + expect(deedTypes[2]?.name).toEqual(deedType.name); + expect(deedTypes[2]?.description).toEqual(deedType.description); + expect(deedTypes[2]?.archived_at).toBeNull(); + expect(deedTypes[2]?.office_uuid).toEqual(office2.uuid); + }); + + it("should return an array of DeedTypes per offices", async () => { + const deedTypesForFirstOffice = await DeedTypeServiceTest.get({ where: { office: office1 }, orderBy: { name: "asc" } }); + + expect(deedTypesForFirstOffice.length).toEqual(1); + + // verify result content + expect(deedTypesForFirstOffice[0]?.name).toEqual(deedType.name); + expect(deedTypesForFirstOffice[0]?.description).toEqual(deedType.description); + expect(deedTypesForFirstOffice[0]?.archived_at).toBeNull(); + expect(deedTypesForFirstOffice[0]?.office_uuid).toEqual(office1.uuid); + + const deedTypesForSecondOffice = await DeedTypeServiceTest.get({ where: { office: office2 }, orderBy: { name: "asc" } }); + + expect(deedTypesForSecondOffice.length).toEqual(2); + + // verify result content + expect(deedTypesForSecondOffice[0]?.name).toEqual(deedType_.name); + expect(deedTypesForSecondOffice[0]?.description).toEqual(deedType_.description); + expect(deedTypesForSecondOffice[0]?.archived_at).toBeNull(); + expect(deedTypesForSecondOffice[0]?.office_uuid).toEqual(office2.uuid); + + expect(deedTypesForSecondOffice[1]?.name).toEqual(deedType.name); + expect(deedTypesForSecondOffice[1]?.description).toEqual(deedType.description); + expect(deedTypesForSecondOffice[1]?.archived_at).toBeNull(); + expect(deedTypesForSecondOffice[1]?.office_uuid).toEqual(office2.uuid); + }); +}); diff --git a/src/test/services/super-admin/DocumentTypesService.test.ts b/src/test/services/super-admin/DocumentTypesService.test.ts new file mode 100644 index 00000000..51460c70 --- /dev/null +++ b/src/test/services/super-admin/DocumentTypesService.test.ts @@ -0,0 +1,299 @@ +import "module-alias/register"; +import "reflect-metadata"; +import { DocumentType } from "le-coffre-resources/dist/SuperAdmin"; +import DocumentTypesService from "@Services/super-admin/DocumentTypesService/DocumentTypesService"; +import { PrismaClient, Offices } from "prisma/prisma-client"; +import { documentType, documentType_, office, office_ } from "./MockedData"; +import DocumentTypesRepository from "@Repositories/DocumentTypesRepository"; +import Container from "typedi"; + +const prisma = new PrismaClient(); + +const DocumentTypesServiceTest = new DocumentTypesService(Container.get(DocumentTypesRepository)); + +let office1: Offices; +let office2: Offices; + +beforeAll(async () => { + office1 = await prisma.offices.create({ + data: { + idNot: office.idNot, + name: office.name, + crpcen: office.crpcen, + address: { + create: { + address: office.address.address, + zip_code: office.address.zip_code, + city: office.address.city, + }, + }, + }, + }); + + office2 = await prisma.offices.create({ + data: { + idNot: office_.idNot, + name: office_.name, + crpcen: office_.crpcen, + address: { + create: { + address: office_.address.address, + zip_code: office_.address.zip_code, + city: office_.address.city, + }, + }, + }, + }); +}); + +afterAll(async () => { + const deleteDocumentTypes = prisma.documentTypes.deleteMany(); + const deleteOffices = prisma.offices.deleteMany(); + await prisma.$transaction([deleteDocumentTypes, deleteOffices]); + await prisma.$disconnect(); +}); + +describe("test create function", () => { + it("should not create a new document type if office is unknown", async () => { + // try to create a new document type with unknown office + async function createDocumentTypeWithUnknownOffice() { + await DocumentTypesServiceTest.create(documentType); + } + await expect(createDocumentTypeWithUnknownOffice).rejects.toThrow(); + }); + + it("should create a new document type", async () => { + let documentTypeWithOfficeUid: DocumentType = JSON.parse(JSON.stringify(documentType)); + documentTypeWithOfficeUid.office.uid = office1.uuid; + const documentTypeCreated = await DocumentTypesServiceTest.create(documentTypeWithOfficeUid); + + expect(documentTypeCreated.name).toEqual(documentType.name); + expect(documentTypeCreated.public_description).toEqual(documentType.public_description); + expect(documentTypeCreated.private_description).toEqual(documentType.private_description); + expect(documentTypeCreated.archived_at).toBeNull(); + expect(documentTypeCreated.office_uuid).toEqual(office1.uuid); + }); + + it("should not create a new document type with a name already used for a given office", async () => { + let documentTypeWithSameNameAndOffice: DocumentType = JSON.parse(JSON.stringify(documentType_)); + documentTypeWithSameNameAndOffice.office.uid = office1.uuid; + documentTypeWithSameNameAndOffice.name = documentType.name; + + async function createDocumentTypeWithSameNameAndOffice() { + await DocumentTypesServiceTest.create(documentTypeWithSameNameAndOffice); + } + await expect(createDocumentTypeWithSameNameAndOffice).rejects.toThrow(); + }); + + it("should create the same document type for a different office", async () => { + let documentTypeDuplicatedForNewOffice: DocumentType = JSON.parse(JSON.stringify(documentType)); + documentTypeDuplicatedForNewOffice.office.uid = office2.uuid; + + const documentTypeCreated = await DocumentTypesServiceTest.create(documentTypeDuplicatedForNewOffice); + + expect(documentTypeCreated.name).toEqual(documentType.name); + expect(documentTypeCreated.public_description).toEqual(documentType.public_description); + expect(documentTypeCreated.private_description).toEqual(documentType.private_description); + expect(documentTypeCreated.archived_at).toBeNull(); + expect(documentTypeCreated.office_uuid).toEqual(office2.uuid); + }); + + it("should create a new document type version with a different name for a given office", async () => { + let documentTypeWithSameDescription: DocumentType = JSON.parse(JSON.stringify(documentType)); + documentTypeWithSameDescription.office.uid = office1.uuid; + documentTypeWithSameDescription.name = documentType_.name; + + const documentTypeCreated = await DocumentTypesServiceTest.create(documentTypeWithSameDescription); + + expect(documentTypeCreated.name).toEqual(documentType_.name); + expect(documentTypeCreated.public_description).toEqual(documentType.public_description); + expect(documentTypeCreated.private_description).toEqual(documentType.private_description); + expect(documentTypeCreated.archived_at).toBeNull(); + expect(documentTypeCreated.office_uuid).toEqual(office1.uuid); + }); +}); + +describe("test update function", () => { + it("should update a document type", async () => { + const documentTypeCreated = await prisma.documentTypes.findFirstOrThrow({ + where: { name: documentType_.name, office_uuid: office1.uuid }, + }); + expect(documentTypeCreated.name).toEqual(documentType_.name); + expect(documentTypeCreated.public_description).toEqual(documentType.public_description); + expect(documentTypeCreated.private_description).toEqual(documentType.private_description); + expect(documentTypeCreated.archived_at).toBeNull(); + expect(documentTypeCreated.office_uuid).toEqual(office1.uuid); + + let documentTypeWithNewDescription: DocumentType = JSON.parse(JSON.stringify(documentType_)); + documentTypeWithNewDescription.office.uid = office1.uuid; + + // update the last document type created with his the right descriptions + const documentTypeUpdated = await DocumentTypesServiceTest.update(documentTypeCreated.uuid, documentTypeWithNewDescription); + expect(documentTypeUpdated.name).toEqual(documentType_.name); + expect(documentTypeUpdated.public_description).toEqual(documentType_.public_description); + expect(documentTypeUpdated.private_description).toEqual(documentType_.private_description); + expect(documentTypeUpdated.archived_at).toBeNull(); + expect(documentTypeUpdated.office_uuid).toEqual(office1.uuid); + }); + + it("should not update a document type name with an already used name for given office", async () => { + const documentTypeUid = ( + await prisma.documentTypes.findFirstOrThrow({ where: { name: documentType_.name, office_uuid: office1.uuid } }) + ).uuid; + let documentTypeWithSameNameAndOffice: DocumentType = JSON.parse(JSON.stringify(documentType_)); + documentTypeWithSameNameAndOffice.office.uid = office1.uuid; + documentTypeWithSameNameAndOffice.name = documentType.name; + + // update the last document type created with his the right description + async function updateDocumentTypeWithSameName() { + await DocumentTypesServiceTest.update(documentTypeUid, documentTypeWithSameNameAndOffice); + } + await expect(updateDocumentTypeWithSameName).rejects.toThrow(); + }); + + it("should not update a document type office membership if the office already has this document type", async () => { + const documentTypeUid = ( + await prisma.documentTypes.findFirstOrThrow({ where: { name: documentType_.name, office_uuid: office1.uuid } }) + ).uuid; + let documentTypeWithSameNameAndOffice: DocumentType = JSON.parse(JSON.stringify(documentType_)); + documentTypeWithSameNameAndOffice.office.uid = office1.uuid; + documentTypeWithSameNameAndOffice.name = documentType.name; + + // try to duplicate document type in a given office + async function updateDocumentTypeWithduplicatedName() { + await DocumentTypesServiceTest.update(documentTypeUid, documentTypeWithSameNameAndOffice); + } + await expect(updateDocumentTypeWithduplicatedName).rejects.toThrow(); + }); + + it("should update a document type office membership", async () => { + const documentTypeCreated = await prisma.documentTypes.findFirstOrThrow({ + where: { name: documentType_.name, office_uuid: office1.uuid }, + }); + + expect(documentTypeCreated.name).toEqual(documentType_.name); + expect(documentTypeCreated.public_description).toEqual(documentType_.public_description); + expect(documentTypeCreated.private_description).toEqual(documentType_.private_description); + expect(documentTypeCreated.archived_at).toBeNull(); + expect(documentTypeCreated.office_uuid).toEqual(office1.uuid); + + let documentTypeTransferedToNewOffice: DocumentType = JSON.parse(JSON.stringify(documentType_)); + documentTypeTransferedToNewOffice.office.uid = office2.uuid; + + // update the last document type updated with a new office membership + const documentTypeUpdated = await DocumentTypesServiceTest.update(documentTypeCreated.uuid, documentTypeTransferedToNewOffice); + + expect(documentTypeUpdated.name).toEqual(documentType_.name); + expect(documentTypeUpdated.public_description).toEqual(documentType_.public_description); + expect(documentTypeUpdated.private_description).toEqual(documentType_.private_description); + expect(documentTypeUpdated.archived_at).toBeNull(); + expect(documentTypeUpdated.office_uuid).toEqual(office2.uuid); + }); + + it("should archivate a document type", async () => { + const documentTypeCreated = await prisma.documentTypes.findFirstOrThrow({ + where: { name: documentType_.name, office_uuid: office2.uuid }, + }); + + expect(documentTypeCreated.name).toEqual(documentType_.name); + expect(documentTypeCreated.public_description).toEqual(documentType_.public_description); + expect(documentTypeCreated.private_description).toEqual(documentType_.private_description); + expect(documentTypeCreated.archived_at).toBeNull(); + expect(documentTypeCreated.office_uuid).toEqual(office2.uuid); + + let documentTypeArchivated: DocumentType = JSON.parse(JSON.stringify(documentType_)); + documentTypeArchivated.office.uid = office2.uuid; + const currentDate = new Date(Date.now()); + documentTypeArchivated.archived_at = currentDate; + // archivate a document type by giving a non null date for archivated_at attribute + const documentTypeUpdated = await DocumentTypesServiceTest.update(documentTypeCreated.uuid, documentTypeArchivated); + expect(documentTypeUpdated.name).toEqual(documentType_.name); + expect(documentTypeUpdated.public_description).toEqual(documentType_.public_description); + expect(documentTypeUpdated.private_description).toEqual(documentType_.private_description); + expect(documentTypeUpdated.archived_at).toEqual(currentDate); + expect(documentTypeUpdated.office_uuid).toEqual(office2.uuid); + }); + + it("should unarchivate a document type", async () => { + const documentTypeCreated = await prisma.documentTypes.findFirstOrThrow({ + where: { name: documentType_.name, office_uuid: office2.uuid }, + }); + + expect(documentTypeCreated.name).toEqual(documentType_.name); + expect(documentTypeCreated.public_description).toEqual(documentType_.public_description); + expect(documentTypeCreated.private_description).toEqual(documentType_.private_description); + expect(documentTypeCreated.archived_at).not.toBeNull(); + expect(documentTypeCreated.office_uuid).toEqual(office2.uuid); + + let documentTypeUnarchivated: DocumentType = JSON.parse(JSON.stringify(documentType_)); + documentTypeUnarchivated.office.uid = office2.uuid; + + // unarchivate a document type by giving a null date for archivated_at attribute + const documentTypeUpdated = await DocumentTypesServiceTest.update(documentTypeCreated.uuid, documentTypeUnarchivated); + + expect(documentTypeUpdated.name).toEqual(documentType_.name); + expect(documentTypeUpdated.public_description).toEqual(documentType_.public_description); + expect(documentTypeUpdated.private_description).toEqual(documentType_.private_description); + expect(documentTypeUpdated.archived_at).toBeNull(); + expect(documentTypeUpdated.office_uuid).toEqual(office2.uuid); + }); +}); + +describe("test get function", () => { + it("should return an array of DocumentTypes", async () => { + const documentTypes = await DocumentTypesServiceTest.get({ orderBy: [{ name: "asc" }, { created_at: "asc" }] }); + + // verify result typing + expect(documentTypes).toBeInstanceOf(Array); + expect(documentTypes.length).toEqual(3); + + // verify result content + expect(documentTypes[0]?.name).toEqual(documentType_.name); + expect(documentTypes[0]?.public_description).toEqual(documentType_.public_description); + expect(documentTypes[0]?.private_description).toEqual(documentType_.private_description); + expect(documentTypes[0]?.archived_at).toBeNull(); + expect(documentTypes[0]?.office_uuid).toEqual(office2.uuid); + + expect(documentTypes[1]?.name).toEqual(documentType.name); + expect(documentTypes[1]?.public_description).toEqual(documentType.public_description); + expect(documentTypes[1]?.private_description).toEqual(documentType.private_description); + expect(documentTypes[1]?.archived_at).toBeNull(); + expect(documentTypes[1]?.office_uuid).toEqual(office1.uuid); + + expect(documentTypes[2]?.name).toEqual(documentType.name); + expect(documentTypes[2]?.public_description).toEqual(documentType.public_description); + expect(documentTypes[2]?.private_description).toEqual(documentType.private_description); + expect(documentTypes[2]?.archived_at).toBeNull(); + expect(documentTypes[2]?.office_uuid).toEqual(office2.uuid); + }); + + it("should return an array of DocumentTypes per offices", async () => { + const documentTypesForFirstOffice = await DocumentTypesServiceTest.get({ where: { office: office1 }, orderBy: { name: "asc" } }); + + expect(documentTypesForFirstOffice.length).toEqual(1); + + // verify result content + expect(documentTypesForFirstOffice[0]?.name).toEqual(documentType.name); + expect(documentTypesForFirstOffice[0]?.public_description).toEqual(documentType.public_description); + expect(documentTypesForFirstOffice[0]?.private_description).toEqual(documentType.private_description); + expect(documentTypesForFirstOffice[0]?.archived_at).toBeNull(); + expect(documentTypesForFirstOffice[0]?.office_uuid).toEqual(office1.uuid); + + const documentTypesForSecondOffice = await DocumentTypesServiceTest.get({ where: { office: office2 }, orderBy: { name: "asc" } }); + + expect(documentTypesForSecondOffice.length).toEqual(2); + + // verify result content + expect(documentTypesForSecondOffice[0]?.name).toEqual(documentType_.name); + expect(documentTypesForSecondOffice[0]?.public_description).toEqual(documentType_.public_description); + expect(documentTypesForSecondOffice[0]?.private_description).toEqual(documentType_.private_description); + expect(documentTypesForSecondOffice[0]?.archived_at).toBeNull(); + expect(documentTypesForSecondOffice[0]?.office_uuid).toEqual(office2.uuid); + + expect(documentTypesForSecondOffice[1]?.name).toEqual(documentType.name); + expect(documentTypesForSecondOffice[1]?.public_description).toEqual(documentType.public_description); + expect(documentTypesForSecondOffice[1]?.private_description).toEqual(documentType.private_description); + expect(documentTypesForSecondOffice[1]?.archived_at).toBeNull(); + expect(documentTypesForSecondOffice[1]?.office_uuid).toEqual(office2.uuid); + }); +}); diff --git a/src/test/services/super-admin/MockedData.ts b/src/test/services/super-admin/MockedData.ts new file mode 100644 index 00000000..df44244d --- /dev/null +++ b/src/test/services/super-admin/MockedData.ts @@ -0,0 +1,162 @@ +import { EOfficeStatus } from "le-coffre-resources/dist/Customer/Office"; +import User, { Address, Contact, Office, DeedType, DocumentType, Customer } from "le-coffre-resources/dist/SuperAdmin"; + +export const userAddress: Address = { + uid: "", + address: "1 avenue des champs élysées", + zip_code: 75008, + city: "paris", + created_at: null, + updated_at: null, +}; + +export const userAddress_: Address = { + uid: "", + address: "1 rue Victor Hugo", + zip_code: 75001, + city: "paris", + created_at: null, + updated_at: null, +}; + +export const userContact: Contact = { + uid: "", + first_name: "Philippe", + last_name: "le Bel", + address: userAddress, + email: "philippe.lebel@notaires.fr", + phone_number: "+33101020304", + cell_phone_number: "+33605060708", + civility: "MALE", + created_at: null, + updated_at: null, +}; + +export const userContact_: Contact = { + uid: "", + first_name: "Saint", + last_name: "Louise", + address: userAddress_, + email: "saint.louise@notaires.fr", + phone_number: "+33105060708", + cell_phone_number: "+33601020304", + civility: "FEMALE", + created_at: null, + updated_at: null, +}; + +export const officeAddress: Address = { + uid: "", + address: "1 rue Rivoli", + zip_code: 75001, + city: "paris", + created_at: null, + updated_at: null, +}; + +export const officeAddress_: Address = { + uid: "", + address: "1 rue de la paix", + zip_code: 75008, + city: "paris", + created_at: null, + updated_at: null, +}; + +export const office: Office = { + uid: "", + idNot: "123456789", + name: "first office", + crpcen: "0123456789CRPCEN", + office_status: EOfficeStatus.ACTIVATED, + address: officeAddress, + created_at: null, + updated_at: null, +}; + +export const office_: Office = { + uid: "", + idNot: "789101112", + name: "second office", + crpcen: "987654321CRPCEN", + office_status: EOfficeStatus.DESACTIVATED, + address: officeAddress_, + created_at: null, + updated_at: null, +}; + +export const user: User = { + uid: "", + idNot: "123456_123456789", + contact: userContact, + office_membership: office, + created_at: null, + updated_at: null, +}; + +export const user_: User = { + uid: "", + idNot: "654321_789101112", + contact: userContact_, + office_membership: office_, + created_at: null, + updated_at: null, +}; + +export const deedType: DeedType = { + uid: "", + name: "Wedding", + description: "we assume wedding involve two people", + archived_at: null, + office: office, + created_at: null, + updated_at: null, +}; + +export const deedType_: DeedType = { + uid: "", + name: "Inheritance", + description: "we assume inheritance involve two people", + archived_at: null, + office: office, + created_at: null, + updated_at: null, +}; + +export const documentType: DocumentType = { + uid: "", + name: "Identity card", + public_description: "your ID card delivered by your country of residence", + private_description: "verify if this ID card is legit", + archived_at: null, + office: office, + created_at: null, + updated_at: null, +}; + +export const documentType_: DocumentType = { + uid: "", + name: "Electricity bill", + public_description: "an electricity bill payed within the last 3 months", + private_description: "verify if this electricity company is legit", + archived_at: null, + office: office, + created_at: null, + updated_at: null, +}; + +export const customer: Customer = { + uid: "", + contact: userContact, + status: "PENDING", + created_at: null, + updated_at: null, +}; + +export const customer_: Customer = { + uid: "", + contact: userContact_, + status: "ERRONED", + created_at: null, + updated_at: null, +}; diff --git a/src/test/services/super-admin/UsersService.test.ts b/src/test/services/super-admin/UsersService.test.ts new file mode 100644 index 00000000..f58b4c8c --- /dev/null +++ b/src/test/services/super-admin/UsersService.test.ts @@ -0,0 +1,226 @@ +import "module-alias/register"; +import "reflect-metadata"; +import User from "le-coffre-resources/dist/SuperAdmin"; +import UsersService from "@Services/super-admin/UsersService/UsersService"; +import { processFindManyQuery } from "prisma-query"; +import { PrismaClient } from "@prisma/client"; +import { user, userContact, userContact_, user_ } from "./MockedData"; +import UsersRepository from "@Repositories/UsersRepository"; +import Container from "typedi"; + +const prisma = new PrismaClient(); + +const UsersServiceTest = new UsersService(Container.get(UsersRepository)); + +afterAll(async () => { + /* + * Clean database after all tests execution. + * Due to cascade deletion, if addresses are deleted, all items following tables are dropped: contacts, users, offices + */ + const deleteAddresses = prisma.addresses.deleteMany(); + await prisma.$transaction([deleteAddresses]); + await prisma.$disconnect(); +}); + +describe("test create function", () => { + it("should create a new user", async () => { + const userCreated = await UsersServiceTest.create(user); + + expect(userCreated?.idNot).toEqual(user.idNot); + + // verify if user contact is created in db + const contactCreated = await prisma.contacts.findUnique({ where: { uuid: userCreated.contact_uuid } }); + expect(contactCreated?.first_name).toEqual(user.contact.first_name); + expect(contactCreated?.last_name).toEqual(user.contact.last_name); + expect(contactCreated?.cell_phone_number).toEqual(user.contact.cell_phone_number); + expect(contactCreated?.phone_number).toEqual(user.contact.phone_number); + expect(contactCreated?.civility).toEqual(user.contact.civility); + expect(contactCreated?.email).toEqual(user.contact.email); + + // verify if user address is created in db + const addressForContactCreated = await prisma.addresses.findUnique({ where: { uuid: contactCreated?.address_uuid } }); + expect(addressForContactCreated?.address).toEqual(user.contact.address.address); + expect(addressForContactCreated?.zip_code).toEqual(user.contact.address.zip_code); + expect(addressForContactCreated?.city).toEqual(user.contact.address.city); + + // verify if user office is created in db + const officeCreated = await prisma.offices.findUnique({ where: { uuid: userCreated.office_uuid } }); + expect(officeCreated?.idNot).toEqual(user.office_membership.idNot); + expect(officeCreated?.name).toEqual(user.office_membership.name); + expect(officeCreated?.crpcen).toEqual(user.office_membership.crpcen); + expect(officeCreated?.office_status).toEqual("DESACTIVATED"); + + // verify if user office's address is created in db + const addressForOfficeCreated = await prisma.addresses.findUnique({ where: { uuid: officeCreated?.address_uuid } }); + expect(addressForOfficeCreated?.address).toEqual(user.office_membership.address.address); + expect(addressForOfficeCreated?.zip_code).toEqual(user.office_membership.address.zip_code); + expect(addressForOfficeCreated?.city).toEqual(user.office_membership.address.city); + }); + + it("should not create an user already created", async () => { + // try to create the same user + async function duplicateUser() { + await UsersServiceTest.create(user); + } + await expect(duplicateUser).rejects.toThrow(); + }); + + it("should not create an new user with an email already created", async () => { + let newUser: User = JSON.parse(JSON.stringify(user_)); + newUser.contact.email = userContact.email; + + // try to create a new user with already used email + async function createUserWithDuplicateEmail() { + await UsersServiceTest.create(newUser); + } + await expect(createUserWithDuplicateEmail).rejects.toThrow(); + }); + + it("should not create an user with an phone number already created", async () => { + let newUser: User = JSON.parse(JSON.stringify(user_)); + newUser.contact.cell_phone_number = userContact.cell_phone_number; + + // try to create a new user with already used cellphone number + async function duplicateUser() { + await UsersServiceTest.create(newUser); + } + await expect(duplicateUser).rejects.toThrow(); + }); + + it("should create an new user if unique attributes differ from existing users", async () => { + let newUser: User = JSON.parse(JSON.stringify(user)); + newUser.idNot = user_.idNot; + newUser.contact.email = userContact_.email; + newUser.contact.cell_phone_number = userContact_.cell_phone_number; + + const userCreated = await UsersServiceTest.create(newUser); + + expect(userCreated?.idNot).toEqual(user_.idNot); + + // verify if user_ contact is created in db + const contactCreated = await prisma.contacts.findUnique({ where: { uuid: userCreated.contact_uuid } }); + expect(contactCreated?.first_name).toEqual(user.contact.first_name); + expect(contactCreated?.last_name).toEqual(user.contact.last_name); + expect(contactCreated?.cell_phone_number).toEqual(user_.contact.cell_phone_number); + expect(contactCreated?.phone_number).toEqual(user.contact.phone_number); + expect(contactCreated?.civility).toEqual(user.contact.civility); + expect(contactCreated?.email).toEqual(user_.contact.email); + + // verify if user_ address is created in db + const addressForContactCreated = await prisma.addresses.findUnique({ where: { uuid: contactCreated?.address_uuid } }); + expect(addressForContactCreated?.address).toEqual(user.contact.address.address); + expect(addressForContactCreated?.zip_code).toEqual(user.contact.address.zip_code); + expect(addressForContactCreated?.city).toEqual(user.contact.address.city); + + // verify if user joined the existing office + const officeJoined = await prisma.offices.findUnique({ where: { uuid: userCreated.office_uuid } }); + expect(officeJoined?.idNot).toEqual(user.office_membership.idNot); + expect(officeJoined?.name).toEqual(user.office_membership.name); + expect(officeJoined?.crpcen).toEqual(user.office_membership.crpcen); + expect(officeJoined?.office_status).toEqual("DESACTIVATED"); + }); +}); + +describe("test update function", () => { + it("should update an user's data", async () => { + const userCreated = await prisma.users.findFirstOrThrow({ where: { idNot: user_.idNot } }); + + const officeJoined = await prisma.offices.findUnique({ where: { uuid: userCreated.office_uuid } }); + expect(officeJoined?.idNot).toEqual(user.office_membership.idNot); + expect(officeJoined?.name).toEqual(user.office_membership.name); + expect(officeJoined?.crpcen).toEqual(user.office_membership.crpcen); + expect(officeJoined?.office_status).toEqual("DESACTIVATED"); + + // update the last user created with his own new office and own contact + const updatedUser = await UsersServiceTest.update(userCreated.uuid, user_); + + expect(updatedUser?.idNot).toEqual(user_.idNot); + + // verify if user_ contact is created in db + const existingContact = await prisma.contacts.findUnique({ where: { uuid: updatedUser.contact_uuid } }); + expect(existingContact?.first_name).toEqual(user_.contact.first_name); + expect(existingContact?.last_name).toEqual(user_.contact.last_name); + expect(existingContact?.cell_phone_number).toEqual(user_.contact.cell_phone_number); + expect(existingContact?.phone_number).toEqual(user_.contact.phone_number); + expect(existingContact?.civility).toEqual(user_.contact.civility); + expect(existingContact?.email).toEqual(user_.contact.email); + + // verify if user_ address is created in db + const addressForExistingContact = await prisma.addresses.findUnique({ where: { uuid: existingContact?.address_uuid } }); + expect(addressForExistingContact?.address).toEqual(user_.contact.address.address); + expect(addressForExistingContact?.zip_code).toEqual(user_.contact.address.zip_code); + expect(addressForExistingContact?.city).toEqual(user_.contact.address.city); + + // verify if user_ joined the new office + const officeCreated = await prisma.offices.findUnique({ where: { uuid: updatedUser.office_uuid } }); + expect(officeCreated?.idNot).toEqual(user_.office_membership.idNot); + expect(officeCreated?.name).toEqual(user_.office_membership.name); + expect(officeCreated?.crpcen).toEqual(user_.office_membership.crpcen); + expect(officeCreated?.office_status).toEqual("DESACTIVATED"); + + // verify is user_ office's address is created in db + const addressForOfficeCreated = await prisma.addresses.findUnique({ where: { uuid: officeCreated?.address_uuid } }); + expect(addressForOfficeCreated?.address).toEqual(user_.office_membership.address.address); + expect(addressForOfficeCreated?.zip_code).toEqual(user_.office_membership.address.zip_code); + expect(addressForOfficeCreated?.city).toEqual(user_.office_membership.address.city); + }); + + it("should not update an user with an email already used", async () => { + const userUid = (await prisma.users.findFirstOrThrow({ where: { idNot: user_.idNot } })).uuid; + let updatedUser: User = JSON.parse(JSON.stringify(user_)); + updatedUser.contact.email = userContact.email; + + // try to create a new user with already used email + async function updateUserWithDuplicateEmail() { + await UsersServiceTest.update(userUid, updatedUser); + } + await expect(updateUserWithDuplicateEmail).rejects.toThrow(); + }); + + it("should not update an user with an phone number already used", async () => { + const userUid = (await prisma.users.findFirstOrThrow({ where: { idNot: user_.idNot } })).uuid; + let updatedUser: User = JSON.parse(JSON.stringify(user_)); + updatedUser.contact.cell_phone_number = userContact.cell_phone_number; + + // try to create a new user with already used email + async function updateUserWithDuplicateEmail() { + await UsersServiceTest.update(userUid, updatedUser); + } + await expect(updateUserWithDuplicateEmail).rejects.toThrow(); + }); +}); + +describe("test get function", () => { + it("should return an array of Users", async () => { + const req = processFindManyQuery({}); + const users = await UsersServiceTest.get(req); + + // verify result typing + expect(users).toBeInstanceOf(Array); + expect(users.length).toEqual(2); + + // verify result content + const usersCreated = await prisma.users.findMany(); + expect(users).toContainEqual(usersCreated[0]); + expect(users).toContainEqual(usersCreated[1]); + }); + + it("should return an array of Users per offices", async () => { + const officesCreated = await prisma.offices.findMany(); + const reqForFirstOffice = { where: { office_uuid: officesCreated[0]?.uuid } }; + const usersForFirstOffice = await UsersServiceTest.get(reqForFirstOffice); + + expect(usersForFirstOffice.length).toEqual(1); + + // verify result content + expect(usersForFirstOffice[0]?.idNot).toEqual(user.idNot); + + const reqForSecondOffice = { where: { office_uuid: officesCreated[1]?.uuid } }; + const usersForSecondOffice = await UsersServiceTest.get(reqForSecondOffice); + + expect(usersForSecondOffice.length).toEqual(1); + + // verify result content + expect(usersForSecondOffice[0]?.idNot).toEqual(user_.idNot); + }); +}); diff --git a/tsconfig.json b/tsconfig.json index 0d461c21..0a55fb94 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -67,7 +67,10 @@ ], "@ControllerPattern/*": [ "src/common/system/controller-pattern/*" - ] + ], + "@Test/*":[ + "src/test/*" + ], }, // "rootDirs": [], // "typeRoots": [], @@ -91,7 +94,7 @@ "include": [ "**/*.ts", "**/*.tsx", - "src/app/api/UsersController.ts" + "src/app/api/admin/UsersController.ts" ], "exclude": [ "node_modules" From 1051ed71e25f0445725cd6a93a60e2873f325eef Mon Sep 17 00:00:00 2001 From: Hugo Lextrait Date: Fri, 7 Apr 2023 11:53:36 +0200 Subject: [PATCH 04/72] fix dockerfile and docker compose --- Dockerfile | 2 +- README.md | 4 ++-- docker-compose.yml | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 44a1c26d..73744f6c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,7 +25,6 @@ COPY --from=deps leCoffre/package.json package.json COPY tsconfig.json tsconfig.json COPY src src -COPY src/common/databases/schema.prisma ./src/common/databases/schema.prisma RUN npx prisma generate RUN npm run build @@ -39,6 +38,7 @@ RUN adduser -D lecoffreuser --uid 10000 && chown -R lecoffreuser . COPY --from=builder --chown=lecoffreuser leCoffre/node_modules ./node_modules COPY --from=builder --chown=lecoffreuser leCoffre/dist dist COPY --from=builder --chown=lecoffreuser leCoffre/package.json ./package.json +COPY --from=builder --chown=lecoffreuser leCoffre/src/common/databases ./src/common/databases USER lecoffreuser diff --git a/README.md b/README.md index f5a7b54b..74a53441 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ### A. Docker Launch application #### 1) Local RSA Key for docker build -1) Create a file named : `id_rsa` in /src +1) Create a file named : `id_rsa` in /src/.ssh 2) Get the RSA Private key on Keeper who is allowed to read the `leCoffre-ressources repo` 3) You can find Key on Keeper inside the folder **LeCoffre project > SSH Key** 4) Copy past in the `id_rsa` that you created step 1 @@ -16,7 +16,7 @@ #### 2) Build images ###### a- Back end -`docker build -t "le-coffre-back" -f Dockerfiles/Dockerfile.api .` +`docker build -t "le-coffre-back" -f Dockerfile .` ###### b- Front end `docker build -t "le-coffre-front" -f Dockerfiles/Dockerfile.front .` diff --git a/docker-compose.yml b/docker-compose.yml index b5a05009..db79baf2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,13 +7,13 @@ services: front-end: image: "le-coffre-front" ports: - - 3000:${FRONT_PORT} + - ${FRONT_PORT}:${FRONT_PORT} environment: - FRONT_PORT backend: image: "le-coffre-back" ports: - - 3001:${APP_PORT} + - ${APP_PORT}:${APP_PORT} environment: - DATABASE_HOSTNAME - DATABASE_PORT @@ -37,7 +37,7 @@ services: - DATABASE_NAME - POSTGRES_PASSWORD ports: - - ${DATABASE_PORT}:5432 + - ${DATABASE_PORT}:${DATABASE_PORT} volumes: - db_storage:/var/lib/postgresql/data - ./init-data.sh:/docker-entrypoint-initdb.d/init-data.sh From 3041c6c06217c4ef90e1de543789848caa845997 Mon Sep 17 00:00:00 2001 From: Hugo Lextrait Date: Wed, 12 Apr 2023 11:51:53 +0200 Subject: [PATCH 05/72] docker seeding --- README.md | 10 +- package.json | 6 +- src/common/databases/seeders/seeder.ts | 450 +++++++++++++++++++++++++ tsconfig.json | 7 +- 4 files changed, 462 insertions(+), 11 deletions(-) create mode 100644 src/common/databases/seeders/seeder.ts diff --git a/README.md b/README.md index 74a53441..98e7cf4a 100644 --- a/README.md +++ b/README.md @@ -18,13 +18,9 @@ ###### a- Back end `docker build -t "le-coffre-back" -f Dockerfile .` ###### b- Front end -`docker build -t "le-coffre-front" -f Dockerfiles/Dockerfile.front .` +`docker build -t "le-coffre-front" -f Dockerfile .` -#### 3) Docker Run - -`docker run --env-file .env -p 3000:3000 le-coffre-back` - -#### 4) Docker Compose +#### 3) Docker Compose Docker compose allow to launch multiples images 1) **le-coffre-front** @@ -33,4 +29,6 @@ Docker compose allow to launch multiples images > Launch your docker container with following command : +`docker compose up` -> Logs in terminal + `docker compose up -d` \ No newline at end of file diff --git a/package.json b/package.json index 0d33fc07..ae9bf458 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ }, "scripts": { "build": "tsc", - "api:start": "npm run migrate && node ./dist/entries/App.js", + "api:start": "npm run migrate && npx prisma db seed && node ./dist/entries/App.js", "start": "tsc && npm run api:start", "dev": "nodemon -V", "api:dev": "nodemon -V --exec 'tsc && npm run api:start'", @@ -75,6 +75,8 @@ "ts-jest": "^29.0.5" }, "prisma": { - "schema": "src/common/databases/schema.prisma" + "schema": "src/common/databases/schema.prisma", + "seed": "ts-node src/common/databases/seeders/seeder.ts" + } } diff --git a/src/common/databases/seeders/seeder.ts b/src/common/databases/seeders/seeder.ts new file mode 100644 index 00000000..8455479a --- /dev/null +++ b/src/common/databases/seeders/seeder.ts @@ -0,0 +1,450 @@ +import { + Addresses, + Contacts, + Customers, + DeedHasDocumentTypes, + DeedTypeHasDocumentTypes, + DeedTypes, + Deeds, + DocumentHistory, + DocumentTypes, + Documents, + EDocumentStatus, + EFolderStatus, + EOfficeStatus, + Files, + OfficeFolderHasCustomers, + OfficeFolders, + Offices, + Users, + ECivility, + ECustomerStatus, + PrismaClient +} from "@prisma/client"; + +(async () => { + + const prisma = new PrismaClient(); + + const existingData = await prisma.contacts.findFirst({ where: { email: "john.doe@example.com" } }); + if (existingData) { + console.log('Seed data already exists. Skipping seeding process.'); + return; + } + + const randomString = () => { + const chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; + let result = ""; + for (let i = 10; i > 0; --i) result += chars[Math.floor(Math.random() * chars.length)]; + return result; + }; + const uuidCustomer1: string = randomString(); + const uuidCustomer2: string = randomString(); + + const uuidContact1: string = randomString(); + const uuidContact2: string = randomString(); + + const uuidAddress1: string = randomString(); + const uuidAddress2: string = randomString(); + + const uuidOffice1: string = randomString(); + const uuidOffice2: string = randomString(); + + const uuidUser1: string = randomString(); + const uuidUser2: string = randomString(); + + const uuidOfficeFolder1: string = randomString(); + const uuidOfficeFolder2: string = randomString(); + + const uuidDeed1: string = randomString(); + const uuidDeed2: string = randomString(); + + const uuidDeedType1: string = randomString(); + const uuidDeedType2: string = randomString(); + + const uuidDocument1: string = randomString(); + const uuidDocument2: string = randomString(); + + const uuidDocumentType1: string = randomString(); + const uuidDocumentType2: string = randomString(); + + const uuidOfficeFolderHasCustomer1: string = randomString(); + const uuidOfficeFolderHasCustomer2: string = randomString(); + + const uuidFiles1: string = randomString(); + const uuidFiles2: string = randomString(); + + const uuidDeedHasDocumentType1: string = randomString(); + const uuidDeedHasDocumentType2: string = randomString(); + + const uuidDeedTypeHasDocumentType1: string = randomString(); + const uuidDeedTypeHasDocumentType2: string = randomString(); + + const uuidDocumentHistory1: string = randomString(); + const uuidDocumentHistory2: string = randomString(); + + const customers: Customers[] = [ + { + uuid: uuidCustomer1, + contact_uuid: uuidContact1, + created_at: new Date(), + updated_at: new Date(), + status: ECustomerStatus.PENDING, + }, + { + uuid: uuidCustomer2, + contact_uuid: uuidContact2, + created_at: new Date(), + updated_at: new Date(), + status: ECustomerStatus.PENDING, + }, + ]; + + const addresses: Addresses[] = [ + { + uuid: uuidAddress1, + address: "123 Main St", + city: "Los Angeles", + zip_code: 90001, + created_at: new Date(), + updated_at: new Date(), + }, + { + uuid: uuidAddress2, + address: "Rue Pierre Emillion", + city: "Paris", + zip_code: 75003, + created_at: new Date(), + updated_at: new Date(), + }, + ]; + + const contacts: Contacts[] = [ + { + uuid: uuidContact1, + address_uuid: uuidAddress1, + first_name: "John", + last_name: "Doe", + email: "john.doe@example.com", + phone_number: randomString(), + cell_phone_number: randomString(), + created_at: new Date(), + updated_at: new Date(), + civility: ECivility.MALE, + }, + { + uuid: uuidContact2, + address_uuid: uuidAddress2, + first_name: "Jane", + last_name: "Doe", + email: "jane.doe@example.com", + phone_number: randomString(), + created_at: new Date(), + updated_at: new Date(), + cell_phone_number: randomString(), + civility: ECivility.FEMALE, + }, + ]; + + const offices: Offices[] = [ + { + uuid: uuidOffice1, + idNot: randomString(), + name: "LA Office", + crpcen: randomString(), + address_uuid: uuidAddress1, + created_at: new Date(), + updated_at: new Date(), + office_status: EOfficeStatus.ACTIVATED, + }, + { + uuid: uuidOffice2, + idNot: randomString(), + name: "NYC Office", + crpcen: randomString(), + address_uuid: uuidAddress2, + created_at: new Date(), + updated_at: new Date(), + office_status: EOfficeStatus.DESACTIVATED, + }, + ]; + + const users: Users[] = [ + { + uuid: uuidUser1, + created_at: new Date(), + updated_at: new Date(), + idNot: randomString(), + contact_uuid: uuidContact1, + office_uuid: uuidOffice1, + }, + { + uuid: uuidUser2, + created_at: new Date(), + updated_at: new Date(), + idNot: randomString(), + contact_uuid: uuidContact2, + office_uuid: uuidOffice2, + }, + ]; + + const officeFolders: OfficeFolders[] = [ + { + uuid: uuidOfficeFolder1, + folder_number: randomString(), + name: "0001", + deed_uuid: uuidDeed1, + status: EFolderStatus.LIVE, + created_at: new Date(), + updated_at: new Date(), + office_uuid: uuidOffice1, + description: null, + archived_description: null, + }, + { + uuid: uuidOfficeFolder2, + folder_number: randomString(), + name: "0001", + deed_uuid: uuidDeed2, + status: EFolderStatus.LIVE, + created_at: new Date(), + updated_at: new Date(), + office_uuid: uuidOffice2, + description: null, + archived_description: null, + }, + ]; + + const deeds: Deeds[] = [ + { + uuid: uuidDeed1, + deed_type_uuid: uuidDeedType1, + created_at: new Date(), + updated_at: new Date(), + }, + { + uuid: uuidDeed2, + deed_type_uuid: uuidDeedType2, + created_at: new Date(), + updated_at: new Date(), + }, + ]; + + const deedTypes: DeedTypes[] = [ + { + uuid: uuidDeedType1, + name: "Acte de mariage", + archived_at: null, + description: "Acte regroupant deux personnes en mariage", + office_uuid: uuidOffice1, + created_at: new Date(), + updated_at: new Date(), + }, + { + uuid: uuidDeedType2, + name: "Vente d'un bien immobilier", + archived_at: null, + description: "Permet de vendre un bien immobilier à une entité ou une personne physique", + office_uuid: uuidOffice2, + created_at: new Date(), + updated_at: new Date(), + }, + ]; + + const documents: Documents[] = [ + { + uuid: uuidDocument1, + blockchain_anchor_uuid: null, + depositor_uuid: uuidCustomer1, + document_status: EDocumentStatus.ASKED, + folder_uuid: uuidOfficeFolder1, + type_uuid: uuidDocumentType1, + created_at: new Date(), + updated_at: new Date(), + }, + { + uuid: uuidDocument2, + blockchain_anchor_uuid: null, + depositor_uuid: uuidCustomer2, + document_status: EDocumentStatus.ASKED, + folder_uuid: uuidOfficeFolder2, + type_uuid: uuidDocumentType2, + created_at: new Date(), + updated_at: new Date(), + }, + ]; + + const documentTypes: DocumentTypes[] = [ + { + uuid: uuidDocumentType1, + archived_at: null, + name: "Acte de naissance", + office_uuid: uuidOffice1, + private_description: "Ce document est confidentiel, et ne doit pas être divulgué", + public_description: "Acte de naissance est un document officiel qui atteste de la naissance d'une personne", + created_at: new Date(), + updated_at: new Date(), + }, + { + uuid: uuidDocumentType2, + archived_at: null, + name: "Carte d'identité", + office_uuid: uuidOffice2, + private_description: "Ce document est confidentiel, demander un recto-verso au client", + public_description: "Carte d'identité est un document officiel qui atteste de l'identité d'une personne", + created_at: new Date(), + updated_at: new Date(), + }, + ]; + + const officeFolderHasCustomers: OfficeFolderHasCustomers[] = [ + { + uuid: uuidOfficeFolderHasCustomer1, + customer_uuid: uuidCustomer1, + office_folder_uuid: uuidOfficeFolder1, + created_at: new Date(), + updated_at: new Date(), + }, + { + uuid: uuidOfficeFolderHasCustomer2, + customer_uuid: uuidCustomer2, + office_folder_uuid: uuidOfficeFolder2, + created_at: new Date(), + updated_at: new Date(), + }, + ]; + + const files: Files[] = [ + { + uuid: uuidFiles1, + document_uuid: uuidDocument1, + file_path: "https://www.google1.com", + created_at: new Date(), + updated_at: new Date(), + }, + { + uuid: uuidFiles2, + document_uuid: uuidDocument2, + file_path: "https://www.google2.com", + created_at: new Date(), + updated_at: new Date(), + }, + ]; + + const deedHasDocumentTypes: DeedHasDocumentTypes[] = [ + { + uuid: uuidDeedHasDocumentType1, + deed_uuid: uuidDeed1, + document_type_uuid: uuidDocumentType1, + created_at: new Date(), + updated_at: new Date(), + }, + { + uuid: uuidDeedHasDocumentType2, + deed_uuid: uuidDeed2, + document_type_uuid: uuidDocumentType2, + created_at: new Date(), + updated_at: new Date(), + }, + ]; + + const deedTypeHasDocumentTypes: DeedTypeHasDocumentTypes[] = [ + { + uuid: uuidDeedTypeHasDocumentType1, + deed_type_uuid: uuidDeedType1, + document_type_uuid: uuidDocumentType1, + created_at: new Date(), + updated_at: new Date(), + }, + { + uuid: uuidDeedTypeHasDocumentType2, + deed_type_uuid: uuidDeedType2, + document_type_uuid: uuidDocumentType2, + created_at: new Date(), + updated_at: new Date(), + }, + ]; + + const documentHistories: DocumentHistory[] = [ + { + uuid: uuidDocumentHistory1, + document_status: EDocumentStatus.ASKED, + document_uuid: uuidDocument1, + refused_reason: "Le document n'est pas conforme", + created_at: new Date(), + updated_at: new Date(), + }, + { + uuid: uuidDocumentHistory2, + document_status: EDocumentStatus.DEPOSITED, + document_uuid: uuidDocument1, + refused_reason: "Le document n'est pas conforme", + created_at: new Date(), + updated_at: new Date(), + }, + ]; + + + for (const address of addresses) { + await prisma.addresses.create({data: address}); + } + + for (const contact of contacts) { + await prisma.contacts.create({ data: contact }); + } + + for (const office of offices) { + await prisma.offices.create({ data: office }); + } + + for (const user of users) { + await prisma.users.create({ data: user }); + } + + + for (const customer of customers) { + await prisma.customers.create({ data: customer }); + } + + for (const deedType of deedTypes) { + await prisma.deedTypes.create({ data: deedType }); + } + + for (const deed of deeds) { + await prisma.deeds.create({ data: deed }); + + } + for (const officeFolder of officeFolders) { + await prisma.officeFolders.create({ data: officeFolder }); + } + + for (const documentType of documentTypes) { + await prisma.documentTypes.create({ data: documentType }); + } + + for (const document of documents) { + await prisma.documents.create({ data: document }); + } + + for (const file of files) { + await prisma.files.create({ data: file }); + } + + for (const documentHistory of documentHistories) { + await prisma.documentHistory.create({ data: documentHistory }); + } + + for (const officeFolderHasCustomer of officeFolderHasCustomers) { + await prisma.officeFolderHasCustomers.create({ data: officeFolderHasCustomer }); + } + + for (const deedHasDocumentType of deedHasDocumentTypes) { + await prisma.deedHasDocumentTypes.create({ data: deedHasDocumentType }); + } + + for (const deedTypeHasDocumentType of deedTypeHasDocumentTypes) { + await prisma.deedTypeHasDocumentTypes.create({ data: deedTypeHasDocumentType }); + } + + console.log(">MOCK DATA - Seeding completed!"); +})(); \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 0a55fb94..b0dd3f39 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,8 +1,9 @@ { "compilerOptions": { "incremental": false, - "target": "es5", - "module": "CommonJS", + // "module": "es2022", + "target": "es2017", + "module": "commonjs", "lib": [ "dom", "dom.iterable", @@ -95,7 +96,7 @@ "**/*.ts", "**/*.tsx", "src/app/api/admin/UsersController.ts" - ], +, "src/common/databases/seeders/seeder.ts" ], "exclude": [ "node_modules" ] From 04420ab5ed64c6dbaf264f3a3b84cb8fb91486cd Mon Sep 17 00:00:00 2001 From: OxSaitama Date: Wed, 12 Apr 2023 15:13:17 +0200 Subject: [PATCH 06/72] add user auth from idNot --- src/app/api/idnot-user/UserInfoController.ts | 32 ++++++++++++ src/app/index.ts | 2 + src/common/config/variables/Variables.ts | 16 ++++++ .../AuthService/AuthService.ts | 52 +++++++++++++++++++ 4 files changed, 102 insertions(+) create mode 100644 src/app/api/idnot-user/UserInfoController.ts create mode 100644 src/services/private-services/AuthService/AuthService.ts diff --git a/src/app/api/idnot-user/UserInfoController.ts b/src/app/api/idnot-user/UserInfoController.ts new file mode 100644 index 00000000..f3854a1d --- /dev/null +++ b/src/app/api/idnot-user/UserInfoController.ts @@ -0,0 +1,32 @@ +import { Response, Request } from "express"; + import { Controller,Post } from "@ControllerPattern/index"; + import ApiController from "@Common/system/controller-pattern/ApiController"; + import { Service } from "typedi"; +import AuthService from "@Services/private-services/AuthService/AuthService"; +//import User from "le-coffre-resources/dist/Notary"; + + @Controller() + @Service() + export default class UserInfoController extends ApiController { + constructor(private authService: AuthService) { + super(); + } + + /** + * @description Get user created from IdNot authentification + * @returns User + */ + @Post("/api/v1/idnot-user/:code") + protected async getUserInfosFromIdnot(req: Request, response: Response) { + try { + const code = req.params["code"]; + const user = await this.authService.getUserFromIdNotTokens(code!); + //success + this.httpSuccess(response, user); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } + +} \ No newline at end of file diff --git a/src/app/index.ts b/src/app/index.ts index f9dded35..d81c7281 100644 --- a/src/app/index.ts +++ b/src/app/index.ts @@ -8,6 +8,7 @@ import DeedsController from "./api/super-admin/DeedsController"; import DeedTypesController from "./api/super-admin/DeedTypesController"; import DocumentsController from "./api/super-admin/DocumentsController"; import DocumentTypesController from "./api/super-admin/DocumentTypesController"; +import IdNotUserInfoController from "./api/idnot-user/UserInfoController"; /** * @description This allow to declare all controllers used in the application @@ -23,5 +24,6 @@ export default { Container.get(DeedTypesController); Container.get(DocumentsController); Container.get(DocumentTypesController); + Container.get(IdNotUserInfoController); }, }; diff --git a/src/common/config/variables/Variables.ts b/src/common/config/variables/Variables.ts index 2ba6dbde..b6432b98 100644 --- a/src/common/config/variables/Variables.ts +++ b/src/common/config/variables/Variables.ts @@ -33,6 +33,18 @@ export class BackendVariables { public readonly NODE_ENV = process.env.NODE_ENV; + @IsNotEmpty() + public readonly IDNOT_CONNEXION_URL!: string; + + @IsNotEmpty() + public readonly IDNOT_CLIENT_ID!: string; + + @IsNotEmpty() + public readonly IDNOT_CLIENT_SECRET!: string; + + @IsNotEmpty() + public readonly IDNOT_REDIRECT_URL!: string; + public constructor() { dotenv.config(); this.DATABASE_PORT = process.env["DATABASE_PORT"]!; @@ -44,6 +56,10 @@ export class BackendVariables { this.APP_PORT = process.env["APP_PORT"]!; this.APP_ROOT_URL = process.env["APP_ROOT_URL"]!; this.APP_LABEL = process.env["APP_LABEL"]!; + this.IDNOT_CONNEXION_URL = process.env["IDNOT_CONNEXION_URL"]!; + this.IDNOT_CLIENT_ID = process.env["IDNOT_CLIENT_ID"]!; + this.IDNOT_CLIENT_SECRET = process.env["IDNOT_CLIENT_SECRET"]!; + this.IDNOT_REDIRECT_URL = process.env["IDNOT_REDIRECT_URL"]!; } public async validate() { await validateOrReject(this); diff --git a/src/services/private-services/AuthService/AuthService.ts b/src/services/private-services/AuthService/AuthService.ts new file mode 100644 index 00000000..8ea6d527 --- /dev/null +++ b/src/services/private-services/AuthService/AuthService.ts @@ -0,0 +1,52 @@ +import jwt from "jsonwebtoken"; +import BaseService from "@Services/BaseService"; +import "reflect-metadata"; +import { BackendVariables } from "@Common/config/variables/Variables"; +import Container, { Service } from "typedi"; + +type IdNotTokens = { + access_token: string, + id_token: string +} + +@Service() +export default class AuthService extends BaseService { + protected readonly variables = Container.get(BackendVariables); + private constructor() { + super(); + } + + /** + * @description : Get IdNot id_token and access_token + * @throws {Error} If jwt pair cannot be get + */ + public async getUserFromIdNotTokens(code: string) { + const tokens = await this.getIdNotTokens(code); + return jwt.decode(tokens.id_token); + } + + private async getIdNotTokens(code: string): Promise { + const url = new URL(this.variables.IDNOT_CONNEXION_URL.concat("?") + new URLSearchParams({ + client_id: this.variables.IDNOT_CLIENT_ID, + client_secret: this.variables.IDNOT_CLIENT_SECRET, + redirect_uri: this.variables.IDNOT_REDIRECT_URL, + code: code, + grant_type: "authorization_code", + })); + console.log(url.toString()); + try { + const headers = new Headers({ + "Content-Type": "application/x-www-form-urlencoded", + }); + const res = await fetch(url, { + method: "POST", + headers: headers, + }); + const data = await res.json() + return data as IdNotTokens; + } catch (error) { + console.log(error) + throw new Error(); + } + } +} From d0050cf615504779f85ce3c673201b8b095ce3a1 Mon Sep 17 00:00:00 2001 From: OxSaitama Date: Wed, 12 Apr 2023 17:21:36 +0200 Subject: [PATCH 07/72] refacto logs --- src/services/private-services/AuthService/AuthService.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/services/private-services/AuthService/AuthService.ts b/src/services/private-services/AuthService/AuthService.ts index 8ea6d527..c9ab60e9 100644 --- a/src/services/private-services/AuthService/AuthService.ts +++ b/src/services/private-services/AuthService/AuthService.ts @@ -33,7 +33,6 @@ export default class AuthService extends BaseService { code: code, grant_type: "authorization_code", })); - console.log(url.toString()); try { const headers = new Headers({ "Content-Type": "application/x-www-form-urlencoded", From 2e26e1196afe8fb6aa4ad8e4df5537ab335fa6be Mon Sep 17 00:00:00 2001 From: OxSaitama Date: Wed, 12 Apr 2023 17:25:37 +0200 Subject: [PATCH 08/72] add new env variables for IdNot --- docker-compose.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index db79baf2..c96ee682 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,6 +10,11 @@ services: - ${FRONT_PORT}:${FRONT_PORT} environment: - FRONT_PORT + - BACK_API_PROTOCOL + - BACK_API_HOST + - BACK_API_PORT + - BACK_API_ROOT_URL + - BACK_API_VERSION backend: image: "le-coffre-back" ports: @@ -25,6 +30,10 @@ services: - APP_ROOT_URL - API_ROOT_URL - DEV_PRISMA_STUDIO_DB_URL + - IDNOT_CONNEXION_URL + - IDNOT_CLIENT_ID + - IDNOT_CLIENT_SECRET + - IDNOT_REDIRECT_URL postgres: image: postgres @@ -46,4 +55,4 @@ services: test: ["CMD-SHELL", "pg_isready -h localhost -U ${DATABASE_USER} -d ${DATABASE_NAME}"] interval: 5s timeout: 5s - retries: 10 + retries: 10 \ No newline at end of file From 2ff3d44cc441eae18c10f3278ef29637cfca0fff Mon Sep 17 00:00:00 2001 From: OxSaitama Date: Thu, 13 Apr 2023 14:34:53 +0200 Subject: [PATCH 09/72] add env var for Idnot --- devops/Chart.yaml | 2 +- docker-compose.yml | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/devops/Chart.yaml b/devops/Chart.yaml index 811868f9..88e0a620 100644 --- a/devops/Chart.yaml +++ b/devops/Chart.yaml @@ -21,5 +21,5 @@ version: 0.0.1 # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. -appVersion: 0.4.4 +appVersion: 0.5.2 diff --git a/docker-compose.yml b/docker-compose.yml index c96ee682..5de7b1cd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,6 +15,11 @@ services: - BACK_API_PORT - BACK_API_ROOT_URL - BACK_API_VERSION + - FRONT_APP_HOST + - FRONT_APP_PORT + - IDNOT_AUTHORIZE_ENDPOINT + - IDNOT_CLIENT_ID + backend: image: "le-coffre-back" ports: From 6007ba9c6796cb4817a7c4ba23ba3977fbead5f6 Mon Sep 17 00:00:00 2001 From: OxSaitama Date: Thu, 13 Apr 2023 14:48:44 +0200 Subject: [PATCH 10/72] update dockerfile with ssh key import --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 73744f6c..85e1458c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ COPY package.json ./ RUN apk update && apk add openssh-client git -COPY .ssh/id_rsa /root/.ssh/id_rsa +COPY id_rsa /root/.ssh/id_rsa RUN chmod 600 ~/.ssh/id_rsa RUN eval "$(ssh-agent -s)" && ssh-add /root/.ssh/id_rsa RUN ssh-keyscan github.com smart-chain-fr/leCoffre-resources.git >> /root/.ssh/known_hosts From da087610f28859d1a5ba67f9884c583d271a5d77 Mon Sep 17 00:00:00 2001 From: OxSaitama Date: Thu, 13 Apr 2023 14:49:47 +0200 Subject: [PATCH 11/72] update app version --- devops/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devops/Chart.yaml b/devops/Chart.yaml index 88e0a620..1d79c091 100644 --- a/devops/Chart.yaml +++ b/devops/Chart.yaml @@ -21,5 +21,5 @@ version: 0.0.1 # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. -appVersion: 0.5.2 +appVersion: 0.5.4 From 786660446eafd66f01ca0df2c9abc5b16fee2601 Mon Sep 17 00:00:00 2001 From: OxSaitama Date: Thu, 13 Apr 2023 14:55:34 +0200 Subject: [PATCH 12/72] add jsonwebtoken package --- devops/Chart.yaml | 2 +- package.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/devops/Chart.yaml b/devops/Chart.yaml index 1d79c091..208511fb 100644 --- a/devops/Chart.yaml +++ b/devops/Chart.yaml @@ -21,5 +21,5 @@ version: 0.0.1 # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. -appVersion: 0.5.4 +appVersion: 0.5.6 diff --git a/package.json b/package.json index ae9bf458..d046166f 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,7 @@ "cors": "^2.8.5", "dotenv": "^16.0.3", "express": "^4.18.2", + "jsonwebtoken": "^9.0.0", "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.19", "module-alias": "^2.2.2", "next": "^13.1.5", @@ -65,6 +66,7 @@ "@types/cors": "^2.8.13", "@types/express": "^4.17.16", "@types/jest": "^29.5.0", + "@types/jsonwebtoken": "^9.0.1", "@types/node": "^18.11.18", "@types/node-schedule": "^2.1.0", "@types/uuid": "^9.0.0", @@ -77,6 +79,5 @@ "prisma": { "schema": "src/common/databases/schema.prisma", "seed": "ts-node src/common/databases/seeders/seeder.ts" - } } From 06bd4f1a612b0e538f2c5dc844a340e4fefb6bae Mon Sep 17 00:00:00 2001 From: Vincent Alamelle Date: Mon, 17 Apr 2023 17:30:55 +0200 Subject: [PATCH 13/72] package lock --- package-lock.json | 9225 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 9225 insertions(+) create mode 100644 package-lock.json diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..91a8b846 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,9225 @@ +{ + "name": "lecoffre-back", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "lecoffre-back", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "@prisma/client": "^4.11.0", + "class-transformer": "^0.5.1", + "class-validator": "^0.14.0", + "classnames": "^2.3.2", + "cors": "^2.8.5", + "dotenv": "^16.0.3", + "express": "^4.18.2", + "jsonwebtoken": "^9.0.0", + "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.19", + "module-alias": "^2.2.2", + "next": "^13.1.5", + "node-cache": "^5.1.2", + "node-schedule": "^2.1.1", + "prisma-query": "^2.0.0", + "reflect-metadata": "^0.1.13", + "ts-node": "^10.9.1", + "tslib": "^2.4.1", + "typedi": "^0.10.0", + "typescript": "^4.9.4", + "uuid": "^9.0.0" + }, + "devDependencies": { + "@types/cors": "^2.8.13", + "@types/express": "^4.17.16", + "@types/jest": "^29.5.0", + "@types/jsonwebtoken": "^9.0.1", + "@types/node": "^18.11.18", + "@types/node-schedule": "^2.1.0", + "@types/uuid": "^9.0.0", + "jest": "^29.5.0", + "nodemon": "^2.0.20", + "prettier": "2.8.4", + "prisma": "^4.11.0", + "ts-jest": "^29.0.5" + } + }, + "node_modules/@ampproject/remapping": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz", + "integrity": "sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==", + "dev": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.0", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.21.4.tgz", + "integrity": "sha512-LYvhNKfwWSPpocw8GI7gpK2nq3HSDuEPC/uSYaALSJu9xjsalaaYFOq0Pwt5KmVqwEbZlDu81aLXwBOmD/Fv9g==", + "dev": true, + "dependencies": { + "@babel/highlight": "^7.18.6" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.21.4.tgz", + "integrity": "sha512-/DYyDpeCfaVinT40FPGdkkb+lYSKvsVuMjDAG7jPOWWiM1ibOaB9CXJAlc4d1QpP/U2q2P9jbrSlClKSErd55g==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.21.4.tgz", + "integrity": "sha512-qt/YV149Jman/6AfmlxJ04LMIu8bMoyl3RB91yTFrxQmgbrSvQMy7cI8Q62FHx1t8wJ8B5fu0UDoLwHAhUo1QA==", + "dev": true, + "dependencies": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.21.4", + "@babel/generator": "^7.21.4", + "@babel/helper-compilation-targets": "^7.21.4", + "@babel/helper-module-transforms": "^7.21.2", + "@babel/helpers": "^7.21.0", + "@babel/parser": "^7.21.4", + "@babel/template": "^7.20.7", + "@babel/traverse": "^7.21.4", + "@babel/types": "^7.21.4", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.2", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/core/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==", + "dev": true + }, + "node_modules/@babel/core/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@babel/core/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/@babel/generator": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.21.4.tgz", + "integrity": "sha512-NieM3pVIYW2SwGzKoqfPrQsf4xGs9M9AIG3ThppsSRmO+m7eQhmI6amajKMUeIO37wFfsvnvcxQFx6x6iqxDnA==", + "dev": true, + "dependencies": { + "@babel/types": "^7.21.4", + "@jridgewell/gen-mapping": "^0.3.2", + "@jridgewell/trace-mapping": "^0.3.17", + "jsesc": "^2.5.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.21.4.tgz", + "integrity": "sha512-Fa0tTuOXZ1iL8IeDFUWCzjZcn+sJGd9RZdH9esYVjEejGmzf+FFYQpMi/kZUk2kPy/q1H3/GPw7np8qar/stfg==", + "dev": true, + "dependencies": { + "@babel/compat-data": "^7.21.4", + "@babel/helper-validator-option": "^7.21.0", + "browserslist": "^4.21.3", + "lru-cache": "^5.1.1", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-environment-visitor": { + "version": "7.18.9", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz", + "integrity": "sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-function-name": { + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.21.0.tgz", + "integrity": "sha512-HfK1aMRanKHpxemaY2gqBmL04iAPOPRj7DxtNbiDOrJK+gdwkiNRVpCpUJYbUT+aZyemKN8brqTOxzCaG6ExRg==", + "dev": true, + "dependencies": { + "@babel/template": "^7.20.7", + "@babel/types": "^7.21.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-hoist-variables": { + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz", + "integrity": "sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==", + "dev": true, + "dependencies": { + "@babel/types": "^7.18.6" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.21.4.tgz", + "integrity": "sha512-orajc5T2PsRYUN3ZryCEFeMDYwyw09c/pZeaQEZPH0MpKzSvn3e0uXsDBu3k03VI+9DBiRo+l22BfKTpKwa/Wg==", + "dev": true, + "dependencies": { + "@babel/types": "^7.21.4" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.21.2", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.21.2.tgz", + "integrity": "sha512-79yj2AR4U/Oqq/WOV7Lx6hUjau1Zfo4cI+JLAVYeMV5XIlbOhmjEk5ulbTc9fMpmlojzZHkUUxAiK+UKn+hNQQ==", + "dev": true, + "dependencies": { + "@babel/helper-environment-visitor": "^7.18.9", + "@babel/helper-module-imports": "^7.18.6", + "@babel/helper-simple-access": "^7.20.2", + "@babel/helper-split-export-declaration": "^7.18.6", + "@babel/helper-validator-identifier": "^7.19.1", + "@babel/template": "^7.20.7", + "@babel/traverse": "^7.21.2", + "@babel/types": "^7.21.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.20.2.tgz", + "integrity": "sha512-8RvlJG2mj4huQ4pZ+rU9lqKi9ZKiRmuvGuM2HlWmkmgOhbs6zEAw6IEiJ5cQqGbDzGZOhwuOQNtZMi/ENLjZoQ==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-simple-access": { + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.20.2.tgz", + "integrity": "sha512-+0woI/WPq59IrqDYbVGfshjT5Dmk/nnbdpcF8SnMhhXObpTq2KNBdLFRFrkVdbDOyUmHBCxzm5FHV1rACIkIbA==", + "dev": true, + "dependencies": { + "@babel/types": "^7.20.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-split-export-declaration": { + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz", + "integrity": "sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==", + "dev": true, + "dependencies": { + "@babel/types": "^7.18.6" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.19.4", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz", + "integrity": "sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", + "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.21.0.tgz", + "integrity": "sha512-rmL/B8/f0mKS2baE9ZpyTcTavvEuWhTTW8amjzXNvYG4AwBsqTLikfXsEofsJEfKHf+HQVQbFOHy6o+4cnC/fQ==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.21.0.tgz", + "integrity": "sha512-XXve0CBtOW0pd7MRzzmoyuSj0e3SEzj8pgyFxnTT1NJZL38BD1MK7yYrm8yefRPIDvNNe14xR4FdbHwpInD4rA==", + "dev": true, + "dependencies": { + "@babel/template": "^7.20.7", + "@babel/traverse": "^7.21.0", + "@babel/types": "^7.21.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", + "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.18.6", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@babel/highlight/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "node_modules/@babel/highlight/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@babel/highlight/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/parser": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.21.4.tgz", + "integrity": "sha512-alVJj7k7zIxqBZ7BTRhz0IqJFxW1VJbm6N8JbcYhQ186df9ZBPbZBmWSqAMXwHGsCJdYks7z/voa3ibiS5bCIw==", + "dev": true, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-syntax-async-generators": { + "version": "7.8.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", + "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-bigint": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", + "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-class-properties": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", + "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.12.13" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-import-meta": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", + "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-json-strings": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", + "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-jsx": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.21.4.tgz", + "integrity": "sha512-5hewiLct5OKyh6PLKEYaFclcqtIgCb6bmELouxjF6up5q3Sov7rOayW4RwhbaBL0dit8rA80GNfY+UuDp2mBbQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.20.2" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-logical-assignment-operators": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", + "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-nullish-coalescing-operator": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", + "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-numeric-separator": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", + "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", + "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-catch-binding": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", + "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-chaining": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", + "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-top-level-await": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", + "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-typescript": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.21.4.tgz", + "integrity": "sha512-xz0D39NvhQn4t4RNsHmDnnsaQizIlUkdtYvLs8La1BlfjQ6JEwxkJGeqJMW2tAXx+q6H+WFuUTXNdYVpEya0YA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.20.2" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/template": { + "version": "7.20.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.20.7.tgz", + "integrity": "sha512-8SegXApWe6VoNw0r9JHpSteLKTpTiLZ4rMlGIm9JQ18KiCtyQiAMEazujAHrUS5flrcqYZa75ukev3P6QmUwUw==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.18.6", + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.21.4.tgz", + "integrity": "sha512-eyKrRHKdyZxqDm+fV1iqL9UAHMoIg0nDaGqfIOd8rKH17m5snv7Gn4qgjBoFfLz9APvjFU/ICT00NVCv1Epp8Q==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.21.4", + "@babel/generator": "^7.21.4", + "@babel/helper-environment-visitor": "^7.18.9", + "@babel/helper-function-name": "^7.21.0", + "@babel/helper-hoist-variables": "^7.18.6", + "@babel/helper-split-export-declaration": "^7.18.6", + "@babel/parser": "^7.21.4", + "@babel/types": "^7.21.4", + "debug": "^4.1.0", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@babel/traverse/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/@babel/types": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.21.4.tgz", + "integrity": "sha512-rU2oY501qDxE8Pyo7i/Orqma4ziCOrby0/9mvbDUGEfvZjb279Nk9k19e2fiCxHbRRpY2ZyrgW1eq22mvmOIzA==", + "dev": true, + "dependencies": { + "@babel/helper-string-parser": "^7.19.4", + "@babel/helper-validator-identifier": "^7.19.1", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@bcoe/v8-coverage": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", + "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", + "dev": true + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "node_modules/@istanbuljs/load-nyc-config": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", + "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", + "dev": true, + "dependencies": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "get-package-type": "^0.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/console": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.5.0.tgz", + "integrity": "sha512-NEpkObxPwyw/XxZVLPmAGKE89IQRp4puc6IQRPru6JKd1M3fW9v1xM1AnzIJE65hbCkzQAdnL8P47e9hzhiYLQ==", + "dev": true, + "dependencies": { + "@jest/types": "^29.5.0", + "@types/node": "*", + "chalk": "^4.0.0", + "jest-message-util": "^29.5.0", + "jest-util": "^29.5.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/core": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.5.0.tgz", + "integrity": "sha512-28UzQc7ulUrOQw1IsN/kv1QES3q2kkbl/wGslyhAclqZ/8cMdB5M68BffkIdSJgKBUt50d3hbwJ92XESlE7LiQ==", + "dev": true, + "dependencies": { + "@jest/console": "^29.5.0", + "@jest/reporters": "^29.5.0", + "@jest/test-result": "^29.5.0", + "@jest/transform": "^29.5.0", + "@jest/types": "^29.5.0", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-changed-files": "^29.5.0", + "jest-config": "^29.5.0", + "jest-haste-map": "^29.5.0", + "jest-message-util": "^29.5.0", + "jest-regex-util": "^29.4.3", + "jest-resolve": "^29.5.0", + "jest-resolve-dependencies": "^29.5.0", + "jest-runner": "^29.5.0", + "jest-runtime": "^29.5.0", + "jest-snapshot": "^29.5.0", + "jest-util": "^29.5.0", + "jest-validate": "^29.5.0", + "jest-watcher": "^29.5.0", + "micromatch": "^4.0.4", + "pretty-format": "^29.5.0", + "slash": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/@jest/environment": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.5.0.tgz", + "integrity": "sha512-5FXw2+wD29YU1d4I2htpRX7jYnAyTRjP2CsXQdo9SAM8g3ifxWPSV0HnClSn71xwctr0U3oZIIH+dtbfmnbXVQ==", + "dev": true, + "dependencies": { + "@jest/fake-timers": "^29.5.0", + "@jest/types": "^29.5.0", + "@types/node": "*", + "jest-mock": "^29.5.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/expect": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.5.0.tgz", + "integrity": "sha512-PueDR2HGihN3ciUNGr4uelropW7rqUfTiOn+8u0leg/42UhblPxHkfoh0Ruu3I9Y1962P3u2DY4+h7GVTSVU6g==", + "dev": true, + "dependencies": { + "expect": "^29.5.0", + "jest-snapshot": "^29.5.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/expect-utils": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.5.0.tgz", + "integrity": "sha512-fmKzsidoXQT2KwnrwE0SQq3uj8Z763vzR8LnLBwC2qYWEFpjX8daRsk6rHUM1QvNlEW/UJXNXm59ztmJJWs2Mg==", + "dev": true, + "dependencies": { + "jest-get-type": "^29.4.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/fake-timers": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.5.0.tgz", + "integrity": "sha512-9ARvuAAQcBwDAqOnglWq2zwNIRUDtk/SCkp/ToGEhFv5r86K21l+VEs0qNTaXtyiY0lEePl3kylijSYJQqdbDg==", + "dev": true, + "dependencies": { + "@jest/types": "^29.5.0", + "@sinonjs/fake-timers": "^10.0.2", + "@types/node": "*", + "jest-message-util": "^29.5.0", + "jest-mock": "^29.5.0", + "jest-util": "^29.5.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/globals": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.5.0.tgz", + "integrity": "sha512-S02y0qMWGihdzNbUiqSAiKSpSozSuHX5UYc7QbnHP+D9Lyw8DgGGCinrN9uSuHPeKgSSzvPom2q1nAtBvUsvPQ==", + "dev": true, + "dependencies": { + "@jest/environment": "^29.5.0", + "@jest/expect": "^29.5.0", + "@jest/types": "^29.5.0", + "jest-mock": "^29.5.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/reporters": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.5.0.tgz", + "integrity": "sha512-D05STXqj/M8bP9hQNSICtPqz97u7ffGzZu+9XLucXhkOFBqKcXe04JLZOgIekOxdb73MAoBUFnqvf7MCpKk5OA==", + "dev": true, + "dependencies": { + "@bcoe/v8-coverage": "^0.2.3", + "@jest/console": "^29.5.0", + "@jest/test-result": "^29.5.0", + "@jest/transform": "^29.5.0", + "@jest/types": "^29.5.0", + "@jridgewell/trace-mapping": "^0.3.15", + "@types/node": "*", + "chalk": "^4.0.0", + "collect-v8-coverage": "^1.0.0", + "exit": "^0.1.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-instrument": "^5.1.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.1.3", + "jest-message-util": "^29.5.0", + "jest-util": "^29.5.0", + "jest-worker": "^29.5.0", + "slash": "^3.0.0", + "string-length": "^4.0.1", + "strip-ansi": "^6.0.0", + "v8-to-istanbul": "^9.0.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/@jest/schemas": { + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.4.3.tgz", + "integrity": "sha512-VLYKXQmtmuEz6IxJsrZwzG9NvtkQsWNnWMsKxqWNu3+CnfzJQhp0WDDKWLVV9hLKr0l3SLLFRqcYHjhtyuDVxg==", + "dev": true, + "dependencies": { + "@sinclair/typebox": "^0.25.16" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/source-map": { + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.4.3.tgz", + "integrity": "sha512-qyt/mb6rLyd9j1jUts4EQncvS6Yy3PM9HghnNv86QBlV+zdL2inCdK1tuVlL+J+lpiw2BI67qXOrX3UurBqQ1w==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.15", + "callsites": "^3.0.0", + "graceful-fs": "^4.2.9" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/test-result": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.5.0.tgz", + "integrity": "sha512-fGl4rfitnbfLsrfx1uUpDEESS7zM8JdgZgOCQuxQvL1Sn/I6ijeAVQWGfXI9zb1i9Mzo495cIpVZhA0yr60PkQ==", + "dev": true, + "dependencies": { + "@jest/console": "^29.5.0", + "@jest/types": "^29.5.0", + "@types/istanbul-lib-coverage": "^2.0.0", + "collect-v8-coverage": "^1.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/test-sequencer": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.5.0.tgz", + "integrity": "sha512-yPafQEcKjkSfDXyvtgiV4pevSeyuA6MQr6ZIdVkWJly9vkqjnFfcfhRQqpD5whjoU8EORki752xQmjaqoFjzMQ==", + "dev": true, + "dependencies": { + "@jest/test-result": "^29.5.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.5.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/transform": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.5.0.tgz", + "integrity": "sha512-8vbeZWqLJOvHaDfeMuoHITGKSz5qWc9u04lnWrQE3VyuSw604PzQM824ZeX9XSjUCeDiE3GuxZe5UKa8J61NQw==", + "dev": true, + "dependencies": { + "@babel/core": "^7.11.6", + "@jest/types": "^29.5.0", + "@jridgewell/trace-mapping": "^0.3.15", + "babel-plugin-istanbul": "^6.1.1", + "chalk": "^4.0.0", + "convert-source-map": "^2.0.0", + "fast-json-stable-stringify": "^2.1.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.5.0", + "jest-regex-util": "^29.4.3", + "jest-util": "^29.5.0", + "micromatch": "^4.0.4", + "pirates": "^4.0.4", + "slash": "^3.0.0", + "write-file-atomic": "^4.0.2" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/types": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.5.0.tgz", + "integrity": "sha512-qbu7kN6czmVRc3xWFQcAN03RAUamgppVUdXrvl1Wr3jlNF93o9mJbGcDWrwGB6ht44u7efB1qCFgVQmca24Uog==", + "dev": true, + "dependencies": { + "@jest/schemas": "^29.4.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^17.0.8", + "chalk": "^4.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", + "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "dev": true, + "dependencies": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", + "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.18", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz", + "integrity": "sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "3.1.0", + "@jridgewell/sourcemap-codec": "1.4.14" + } + }, + "node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.14", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", + "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", + "dev": true + }, + "node_modules/@next/env": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/@next/env/-/env-13.3.0.tgz", + "integrity": "sha512-AjppRV4uG3No7L1plinoTQETH+j2F10TEnrMfzbTUYwze5sBUPveeeBAPZPm8OkJZ1epq9OyYKhZrvbD6/9HCQ==" + }, + "node_modules/@next/swc-darwin-arm64": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.3.0.tgz", + "integrity": "sha512-DmIQCNq6JtccLPPBzf0dgh2vzMWt5wjxbP71pCi5EWpWYE3MsP6FcRXi4MlAmFNDQOfcFXR2r7kBeG1LpZUh1w==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-darwin-x64": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.3.0.tgz", + "integrity": "sha512-oQoqFa88OGgwnYlnAGHVct618FRI/749se0N3S8t9Bzdv5CRbscnO0RcX901+YnNK4Q6yeiizfgO3b7kogtsZg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-gnu": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.3.0.tgz", + "integrity": "sha512-Wzz2p/WqAJUqTVoLo6H18WMeAXo3i+9DkPDae4oQG8LMloJ3if4NEZTnOnTUlro6cq+S/W4pTGa97nWTrOjbGw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-musl": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.3.0.tgz", + "integrity": "sha512-xPVrIQOQo9WXJYgmoTlMnAD/HlR/1e1ZIWGbwIzEirXBVBqMARUulBEIKdC19zuvoJ477qZJgBDCKtKEykCpyQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-gnu": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.3.0.tgz", + "integrity": "sha512-jOFlpGuPD7W2tuXVJP4wt9a3cpNxWAPcloq5EfMJRiXsBBOjLVFZA7boXYxEBzSVgUiVVr1V9T0HFM7pULJ1qA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-musl": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.3.0.tgz", + "integrity": "sha512-2OwKlzaBgmuet9XYHc3KwsEilzb04F540rlRXkAcjMHL7eCxB7uZIGtsVvKOnQLvC/elrUegwSw1+5f7WmfyOw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-arm64-msvc": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.3.0.tgz", + "integrity": "sha512-OeHiA6YEvndxT46g+rzFK/MQTfftKxJmzslERMu9LDdC6Kez0bdrgEYed5eXFK2Z1viKZJCGRlhd06rBusyztA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-ia32-msvc": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.3.0.tgz", + "integrity": "sha512-4aB7K9mcVK1lYEzpOpqWrXHEZympU3oK65fnNcY1Qc4HLJFLJj8AViuqQd4jjjPNuV4sl8jAwTz3gN5VNGWB7w==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-x64-msvc": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.3.0.tgz", + "integrity": "sha512-Reer6rkLLcoOvB0dd66+Y7WrWVFH7sEEkF/4bJCIfsSKnTStTYaHtwIJAwbqnt9I392Tqvku0KkoqZOryWV9LQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@prisma/client": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@prisma/client/-/client-4.12.0.tgz", + "integrity": "sha512-j9/ighfWwux97J2dS15nqhl60tYoH8V0IuSsgZDb6bCFcQD3fXbXmxjYC8GHhIgOk3lB7Pq+8CwElz2MiDpsSg==", + "hasInstallScript": true, + "dependencies": { + "@prisma/engines-version": "4.12.0-67.659ef412370fa3b41cd7bf6e94587c1dfb7f67e7" + }, + "engines": { + "node": ">=14.17" + }, + "peerDependencies": { + "prisma": "*" + }, + "peerDependenciesMeta": { + "prisma": { + "optional": true + } + } + }, + "node_modules/@prisma/engines": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-4.12.0.tgz", + "integrity": "sha512-0alKtnxhNB5hYU+ymESBlGI4b9XrGGSdv7Ud+8TE/fBNOEhIud0XQsAR+TrvUZgS4na5czubiMsODw0TUrgkIA==", + "devOptional": true, + "hasInstallScript": true + }, + "node_modules/@prisma/engines-version": { + "version": "4.12.0-67.659ef412370fa3b41cd7bf6e94587c1dfb7f67e7", + "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-4.12.0-67.659ef412370fa3b41cd7bf6e94587c1dfb7f67e7.tgz", + "integrity": "sha512-JIHNj5jlXb9mcaJwakM0vpgRYJIAurxTUqM0iX0tfEQA5XLZ9ONkIckkhuAKdAzocZ+80GYg7QSsfpjg7OxbOA==" + }, + "node_modules/@sinclair/typebox": { + "version": "0.25.24", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.25.24.tgz", + "integrity": "sha512-XJfwUVUKDHF5ugKwIcxEgc9k8b7HbznCp6eUfWgu710hMPNIO4aw4/zB5RogDQz8nd6gyCDpU9O/m6qYEWY6yQ==", + "dev": true + }, + "node_modules/@sinonjs/commons": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-2.0.0.tgz", + "integrity": "sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==", + "dev": true, + "dependencies": { + "type-detect": "4.0.8" + } + }, + "node_modules/@sinonjs/fake-timers": { + "version": "10.0.2", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.0.2.tgz", + "integrity": "sha512-SwUDyjWnah1AaNl7kxsa7cfLhlTYoiyhDAIgyh+El30YvXs/o7OLXpYH88Zdhyx9JExKrmHDJ+10bwIcY80Jmw==", + "dev": true, + "dependencies": { + "@sinonjs/commons": "^2.0.0" + } + }, + "node_modules/@swc/helpers": { + "version": "0.4.14", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.4.14.tgz", + "integrity": "sha512-4C7nX/dvpzB7za4Ql9K81xK3HPxCpHMgwTZVyf+9JQ6VUbn9jjZVN7/Nkdz/Ugzs2CSjqnL/UPXroiVBVHUWUw==", + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@tsconfig/node10": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", + "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==" + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==" + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==" + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz", + "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==" + }, + "node_modules/@types/babel__core": { + "version": "7.20.0", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.0.tgz", + "integrity": "sha512-+n8dL/9GWblDO0iU6eZAwEIJVr5DWigtle+Q6HLOrh/pdbXOhOtqzq8VPPE2zvNJzSKY4vH/z3iT3tn0A3ypiQ==", + "dev": true, + "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.4", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.4.tgz", + "integrity": "sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg==", + "dev": true, + "dependencies": { + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__template": { + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.1.tgz", + "integrity": "sha512-azBFKemX6kMg5Io+/rdGT0dkGreboUVR0Cdm3fz9QJWpaQGJRQXl7C+6hOTCZcMll7KFyEQpgbYI2lHdsS4U7g==", + "dev": true, + "dependencies": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__traverse": { + "version": "7.18.3", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.18.3.tgz", + "integrity": "sha512-1kbcJ40lLB7MHsj39U4Sh1uTd2E7rLEa79kmDpI6cy+XiXsteB3POdQomoq4FxszMrO3ZYchkhYJw7A2862b3w==", + "dev": true, + "dependencies": { + "@babel/types": "^7.3.0" + } + }, + "node_modules/@types/body-parser": { + "version": "1.19.2", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz", + "integrity": "sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==", + "dev": true, + "dependencies": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "node_modules/@types/connect": { + "version": "3.4.35", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", + "integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/cors": { + "version": "2.8.13", + "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.13.tgz", + "integrity": "sha512-RG8AStHlUiV5ysZQKq97copd2UmVYw3/pRMLefISZ3S1hK104Cwm7iLQ3fTKx+lsUH2CE8FlLaYeEA2LSeqYUA==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/express": { + "version": "4.17.17", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.17.tgz", + "integrity": "sha512-Q4FmmuLGBG58btUnfS1c1r/NQdlp3DMfGDGig8WhfpA2YRUtEkxAjkZb0yvplJGYdF1fsQ81iMDcH24sSCNC/Q==", + "dev": true, + "dependencies": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^4.17.33", + "@types/qs": "*", + "@types/serve-static": "*" + } + }, + "node_modules/@types/express-serve-static-core": { + "version": "4.17.33", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.33.tgz", + "integrity": "sha512-TPBqmR/HRYI3eC2E5hmiivIzv+bidAfXofM+sbonAGvyDhySGw9/PQZFt2BLOrjUUR++4eJVpx6KnLQK1Fk9tA==", + "dev": true, + "dependencies": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*" + } + }, + "node_modules/@types/graceful-fs": { + "version": "4.1.6", + "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.6.tgz", + "integrity": "sha512-Sig0SNORX9fdW+bQuTEovKj3uHcUL6LQKbCrrqb1X7J6/ReAbhCXRAhc+SMejhLELFj2QcyuxmUooZ4bt5ReSw==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/istanbul-lib-coverage": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", + "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", + "dev": true + }, + "node_modules/@types/istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", + "dev": true, + "dependencies": { + "@types/istanbul-lib-coverage": "*" + } + }, + "node_modules/@types/istanbul-reports": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz", + "integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==", + "dev": true, + "dependencies": { + "@types/istanbul-lib-report": "*" + } + }, + "node_modules/@types/jest": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.0.tgz", + "integrity": "sha512-3Emr5VOl/aoBwnWcH/EFQvlSAmjV+XtV9GGu5mwdYew5vhQh0IUZx/60x0TzHDu09Bi7HMx10t/namdJw5QIcg==", + "dev": true, + "dependencies": { + "expect": "^29.0.0", + "pretty-format": "^29.0.0" + } + }, + "node_modules/@types/jsonwebtoken": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-9.0.1.tgz", + "integrity": "sha512-c5ltxazpWabia/4UzhIoaDcIza4KViOQhdbjRlfcIGVnsE3c3brkz9Z+F/EeJIECOQP7W7US2hNE930cWWkPiw==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/mime": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-3.0.1.tgz", + "integrity": "sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA==", + "dev": true + }, + "node_modules/@types/node": { + "version": "18.15.11", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.11.tgz", + "integrity": "sha512-E5Kwq2n4SbMzQOn6wnmBjuK9ouqlURrcZDVfbo9ftDDTFt3nk7ZKK4GMOzoYgnpQJKcxwQw+lGaBvvlMo0qN/Q==" + }, + "node_modules/@types/node-schedule": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/node-schedule/-/node-schedule-2.1.0.tgz", + "integrity": "sha512-NiTwl8YN3v/1YCKrDFSmCTkVxFDylueEqsOFdgF+vPsm+AlyJKGAo5yzX1FiOxPsZiN6/r8gJitYx2EaSuBmmg==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/prettier": { + "version": "2.7.2", + "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.2.tgz", + "integrity": "sha512-KufADq8uQqo1pYKVIYzfKbJfBAc0sOeXqGbFaSpv8MRmC/zXgowNZmFcbngndGk922QDmOASEXUZCaY48gs4cg==", + "dev": true + }, + "node_modules/@types/qs": { + "version": "6.9.7", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", + "integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==", + "dev": true + }, + "node_modules/@types/range-parser": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz", + "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==", + "dev": true + }, + "node_modules/@types/serve-static": { + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.1.tgz", + "integrity": "sha512-NUo5XNiAdULrJENtJXZZ3fHtfMolzZwczzBbnAeBbqBwG+LaG6YaJtuwzwGSQZ2wsCrxjEhNNjAkKigy3n8teQ==", + "dev": true, + "dependencies": { + "@types/mime": "*", + "@types/node": "*" + } + }, + "node_modules/@types/stack-utils": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", + "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==", + "dev": true + }, + "node_modules/@types/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-rFT3ak0/2trgvp4yYZo5iKFEPsET7vKydKF+VRCxlQ9bpheehyAJH89dAkaLEq/j/RZXJIqcgsmPJKUP1Z28HA==", + "dev": true + }, + "node_modules/@types/validator": { + "version": "13.7.15", + "resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.7.15.tgz", + "integrity": "sha512-yeinDVQunb03AEP8luErFcyf/7Lf7AzKCD0NXfgVoGCCQDNpZET8Jgq74oBgqKld3hafLbfzt/3inUdQvaFeXQ==" + }, + "node_modules/@types/yargs": { + "version": "17.0.24", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.24.tgz", + "integrity": "sha512-6i0aC7jV6QzQB8ne1joVZ0eSFIstHsCrobmOtghM11yGlH0j43FKL2UhWdELkyps0zuf7qVTUVCCR+tgSlyLLw==", + "dev": true, + "dependencies": { + "@types/yargs-parser": "*" + } + }, + "node_modules/@types/yargs-parser": { + "version": "21.0.0", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz", + "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==", + "dev": true + }, + "node_modules/abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "dev": true + }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/acorn": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "dev": true, + "dependencies": { + "type-fest": "^0.21.3" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "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, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" + }, + "node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" + }, + "node_modules/babel-jest": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.5.0.tgz", + "integrity": "sha512-mA4eCDh5mSo2EcA9xQjVTpmbbNk32Zb3Q3QFQsNhaK56Q+yoXowzFodLux30HRgyOho5rsQ6B0P9QpMkvvnJ0Q==", + "dev": true, + "dependencies": { + "@jest/transform": "^29.5.0", + "@types/babel__core": "^7.1.14", + "babel-plugin-istanbul": "^6.1.1", + "babel-preset-jest": "^29.5.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.8.0" + } + }, + "node_modules/babel-plugin-istanbul": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", + "integrity": "sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.0.0", + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-instrument": "^5.0.4", + "test-exclude": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/babel-plugin-jest-hoist": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.5.0.tgz", + "integrity": "sha512-zSuuuAlTMT4mzLj2nPnUm6fsE6270vdOfnpbJ+RmruU75UhLFvL0N2NgI7xpeS7NaB6hGqmd5pVpGTDYvi4Q3w==", + "dev": true, + "dependencies": { + "@babel/template": "^7.3.3", + "@babel/types": "^7.3.3", + "@types/babel__core": "^7.1.14", + "@types/babel__traverse": "^7.0.6" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/babel-preset-current-node-syntax": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz", + "integrity": "sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ==", + "dev": true, + "dependencies": { + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-bigint": "^7.8.3", + "@babel/plugin-syntax-class-properties": "^7.8.3", + "@babel/plugin-syntax-import-meta": "^7.8.3", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.8.3", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.8.3", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-top-level-await": "^7.8.3" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/babel-preset-jest": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.5.0.tgz", + "integrity": "sha512-JOMloxOqdiBSxMAzjRaH023/vvcaSaec49zvg+2LmNsktC7ei39LTJGw02J+9uUtTZUq6xbLyJ4dxe9sSmIuAg==", + "dev": true, + "dependencies": { + "babel-plugin-jest-hoist": "^29.5.0", + "babel-preset-current-node-syntax": "^1.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "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 + }, + "node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/body-parser": { + "version": "1.20.1", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", + "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", + "dependencies": { + "bytes": "3.1.2", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.11.0", + "raw-body": "2.5.1", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "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, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browserslist": { + "version": "4.21.5", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.5.tgz", + "integrity": "sha512-tUkiguQGW7S3IhB7N+c2MV/HZPSCPAAiYBZXLsBhFB/PCy6ZKKsZrmBayHV9fdGV/ARIfJ14NkxKzRDjvp7L6w==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + } + ], + "dependencies": { + "caniuse-lite": "^1.0.30001449", + "electron-to-chromium": "^1.4.284", + "node-releases": "^2.0.8", + "update-browserslist-db": "^1.0.10" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/bs-logger": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz", + "integrity": "sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==", + "dev": true, + "dependencies": { + "fast-json-stable-stringify": "2.x" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/bser": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", + "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", + "dev": true, + "dependencies": { + "node-int64": "^0.4.0" + } + }, + "node_modules/buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==" + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, + "node_modules/busboy": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", + "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", + "dependencies": { + "streamsearch": "^1.1.0" + }, + "engines": { + "node": ">=10.16.0" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001480", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001480.tgz", + "integrity": "sha512-q7cpoPPvZYgtyC4VaBSN0Bt+PJ4c4EYRf0DrduInOz2SkFpHD5p3LnvEpqBp7UnJn+8x1Ogl1s38saUxe+ihQQ==", + "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" + } + ] + }, + "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, + "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/char-regex": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz", + "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/ci-info": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.8.0.tgz", + "integrity": "sha512-eXTggHWSooYhq49F2opQhuHWgzucfF2YgODK4e1566GQs5BIfP30B0oenwBJHfWxAs2fyPB1s7Mg949zLf61Yw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "engines": { + "node": ">=8" + } + }, + "node_modules/cjs-module-lexer": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.2.tgz", + "integrity": "sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA==", + "dev": true + }, + "node_modules/class-transformer": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/class-transformer/-/class-transformer-0.5.1.tgz", + "integrity": "sha512-SQa1Ws6hUbfC98vKGxZH3KFY0Y1lm5Zm0SY8XX9zbK7FJCyVEac3ATW0RIpwzW+oOfmHE5PMPufDG9hCfoEOMw==" + }, + "node_modules/class-validator": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/class-validator/-/class-validator-0.14.0.tgz", + "integrity": "sha512-ct3ltplN8I9fOwUd8GrP8UQixwff129BkEtuWDKL5W45cQuLd19xqmTLu5ge78YDm/fdje6FMt0hGOhl0lii3A==", + "dependencies": { + "@types/validator": "^13.7.10", + "libphonenumber-js": "^1.10.14", + "validator": "^13.7.0" + } + }, + "node_modules/classnames": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.3.2.tgz", + "integrity": "sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw==" + }, + "node_modules/client-only": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", + "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==" + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/clone": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", + "integrity": "sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==", + "dev": true, + "engines": { + "iojs": ">= 1.0.0", + "node": ">= 0.12.0" + } + }, + "node_modules/collect-v8-coverage": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz", + "integrity": "sha512-iBPtljfCNcTKNAto0KEtDfZ3qzjJvqE3aTGZsbhjSBlorqpXJlaWWtPO35D+ZImoC3KWejX64o+yPGxhWSTzfg==", + "dev": true + }, + "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, + "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 + }, + "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 + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "engines": { + "node": ">= 0.6" + } + }, + "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 + }, + "node_modules/cookie": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", + "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" + }, + "node_modules/cors": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==" + }, + "node_modules/cron-parser": { + "version": "4.8.1", + "resolved": "https://registry.npmjs.org/cron-parser/-/cron-parser-4.8.1.tgz", + "integrity": "sha512-jbokKWGcyU4gl6jAfX97E1gDpY12DJ1cLJZmoDzaAln/shZ+S3KBFBuA2Q6WeUN4gJf/8klnV1EfvhA2lK5IRQ==", + "dependencies": { + "luxon": "^3.2.1" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/dedent": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz", + "integrity": "sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA==", + "dev": true + }, + "node_modules/deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/detect-newline": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", + "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/diff-sequences": { + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.4.3.tgz", + "integrity": "sha512-ofrBgwpPhCD85kMKtE9RYFFq6OC1A89oW2vvgWZNCwxrUpRUILopY7lsYyMDSjc8g6U6aiO0Qubg6r4Wgt5ZnA==", + "dev": true, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/dotenv": { + "version": "16.0.3", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz", + "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==", + "engines": { + "node": ">=12" + } + }, + "node_modules/ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" + }, + "node_modules/electron-to-chromium": { + "version": "1.4.365", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.365.tgz", + "integrity": "sha512-FRHZO+1tUNO4TOPXmlxetkoaIY8uwHzd1kKopK/Gx2SKn1L47wJXWD44wxP5CGRyyP98z/c8e1eBzJrgPeiBOg==", + "dev": true + }, + "node_modules/emittery": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.13.1.tgz", + "integrity": "sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sindresorhus/emittery?sponsor=1" + } + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "engines": { + "node": ">= 0.8" + } + }, + "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==", + "dev": true, + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" + }, + "node_modules/escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/expect": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-29.5.0.tgz", + "integrity": "sha512-yM7xqUrCO2JdpFo4XpM82t+PJBFybdqoQuJLDGeDX2ij8NZzqRHyu3Hp188/JX7SWqud+7t4MUdvcgGBICMHZg==", + "dev": true, + "dependencies": { + "@jest/expect-utils": "^29.5.0", + "jest-get-type": "^29.4.3", + "jest-matcher-utils": "^29.5.0", + "jest-message-util": "^29.5.0", + "jest-util": "^29.5.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/express": { + "version": "4.18.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", + "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==", + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.1", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.5.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.2.0", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.7", + "qs": "6.11.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.18.0", + "serve-static": "1.15.0", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "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 + }, + "node_modules/fb-watchman": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", + "integrity": "sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==", + "dev": true, + "dependencies": { + "bser": "2.1.1" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/finalhandler": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", + "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "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, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-intrinsic": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz", + "integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==", + "dependencies": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-package-type": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", + "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", + "dev": true, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "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, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "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==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "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, + "engines": { + "node": ">=8" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true + }, + "node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true, + "engines": { + "node": ">=10.17.0" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "dev": true + }, + "node_modules/import-local": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", + "integrity": "sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==", + "dev": true, + "dependencies": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + }, + "bin": { + "import-local-fixture": "fixtures/cli.js" + }, + "engines": { + "node": ">=8" + }, + "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, + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "engines": { + "node": ">= 0.10" + } + }, + "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==", + "dev": true + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-core-module": { + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.0.tgz", + "integrity": "sha512-RECHCBCd/viahWmwj6enj19sKbHfJrddi/6cBDsNTKbNq0f7VeaUkBo60BqzvPqo/W54ChS62Z5qyun7cfOMqQ==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + }, + "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, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-generator-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", + "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "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, + "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, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "node_modules/istanbul-lib-coverage": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", + "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-instrument": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz", + "integrity": "sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==", + "dev": true, + "dependencies": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", + "dev": true, + "dependencies": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^3.0.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-source-maps": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", + "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", + "dev": true, + "dependencies": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-source-maps/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/istanbul-lib-source-maps/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/istanbul-reports": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.5.tgz", + "integrity": "sha512-nUsEMa9pBt/NOHqbcbeJEgqIlY/K7rVWUX6Lql2orY5e9roQOthbR3vtY4zzf2orPELg80fnxxk9zUyPlgwD1w==", + "dev": true, + "dependencies": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest/-/jest-29.5.0.tgz", + "integrity": "sha512-juMg3he2uru1QoXX078zTa7pO85QyB9xajZc6bU+d9yEGwrKX6+vGmJQ3UdVZsvTEUARIdObzH68QItim6OSSQ==", + "dev": true, + "dependencies": { + "@jest/core": "^29.5.0", + "@jest/types": "^29.5.0", + "import-local": "^3.0.2", + "jest-cli": "^29.5.0" + }, + "bin": { + "jest": "bin/jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/jest-changed-files": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.5.0.tgz", + "integrity": "sha512-IFG34IUMUaNBIxjQXF/iu7g6EcdMrGRRxaUSw92I/2g2YC6vCdTltl4nHvt7Ci5nSJwXIkCu8Ka1DKF+X7Z1Ag==", + "dev": true, + "dependencies": { + "execa": "^5.0.0", + "p-limit": "^3.1.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-circus": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.5.0.tgz", + "integrity": "sha512-gq/ongqeQKAplVxqJmbeUOJJKkW3dDNPY8PjhJ5G0lBRvu0e3EWGxGy5cI4LAGA7gV2UHCtWBI4EMXK8c9nQKA==", + "dev": true, + "dependencies": { + "@jest/environment": "^29.5.0", + "@jest/expect": "^29.5.0", + "@jest/test-result": "^29.5.0", + "@jest/types": "^29.5.0", + "@types/node": "*", + "chalk": "^4.0.0", + "co": "^4.6.0", + "dedent": "^0.7.0", + "is-generator-fn": "^2.0.0", + "jest-each": "^29.5.0", + "jest-matcher-utils": "^29.5.0", + "jest-message-util": "^29.5.0", + "jest-runtime": "^29.5.0", + "jest-snapshot": "^29.5.0", + "jest-util": "^29.5.0", + "p-limit": "^3.1.0", + "pretty-format": "^29.5.0", + "pure-rand": "^6.0.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-cli": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.5.0.tgz", + "integrity": "sha512-L1KcP1l4HtfwdxXNFCL5bmUbLQiKrakMUriBEcc1Vfz6gx31ORKdreuWvmQVBit+1ss9NNR3yxjwfwzZNdQXJw==", + "dev": true, + "dependencies": { + "@jest/core": "^29.5.0", + "@jest/test-result": "^29.5.0", + "@jest/types": "^29.5.0", + "chalk": "^4.0.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "import-local": "^3.0.2", + "jest-config": "^29.5.0", + "jest-util": "^29.5.0", + "jest-validate": "^29.5.0", + "prompts": "^2.0.1", + "yargs": "^17.3.1" + }, + "bin": { + "jest": "bin/jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/jest-config": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.5.0.tgz", + "integrity": "sha512-kvDUKBnNJPNBmFFOhDbm59iu1Fii1Q6SxyhXfvylq3UTHbg6o7j/g8k2dZyXWLvfdKB1vAPxNZnMgtKJcmu3kA==", + "dev": true, + "dependencies": { + "@babel/core": "^7.11.6", + "@jest/test-sequencer": "^29.5.0", + "@jest/types": "^29.5.0", + "babel-jest": "^29.5.0", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "deepmerge": "^4.2.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-circus": "^29.5.0", + "jest-environment-node": "^29.5.0", + "jest-get-type": "^29.4.3", + "jest-regex-util": "^29.4.3", + "jest-resolve": "^29.5.0", + "jest-runner": "^29.5.0", + "jest-util": "^29.5.0", + "jest-validate": "^29.5.0", + "micromatch": "^4.0.4", + "parse-json": "^5.2.0", + "pretty-format": "^29.5.0", + "slash": "^3.0.0", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@types/node": "*", + "ts-node": ">=9.0.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "ts-node": { + "optional": true + } + } + }, + "node_modules/jest-diff": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.5.0.tgz", + "integrity": "sha512-LtxijLLZBduXnHSniy0WMdaHjmQnt3g5sa16W4p0HqukYTTsyTW3GD1q41TyGl5YFXj/5B2U6dlh5FM1LIMgxw==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^29.4.3", + "jest-get-type": "^29.4.3", + "pretty-format": "^29.5.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-docblock": { + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.4.3.tgz", + "integrity": "sha512-fzdTftThczeSD9nZ3fzA/4KkHtnmllawWrXO69vtI+L9WjEIuXWs4AmyME7lN5hU7dB0sHhuPfcKofRsUb/2Fg==", + "dev": true, + "dependencies": { + "detect-newline": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-each": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.5.0.tgz", + "integrity": "sha512-HM5kIJ1BTnVt+DQZ2ALp3rzXEl+g726csObrW/jpEGl+CDSSQpOJJX2KE/vEg8cxcMXdyEPu6U4QX5eruQv5hA==", + "dev": true, + "dependencies": { + "@jest/types": "^29.5.0", + "chalk": "^4.0.0", + "jest-get-type": "^29.4.3", + "jest-util": "^29.5.0", + "pretty-format": "^29.5.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-environment-node": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.5.0.tgz", + "integrity": "sha512-ExxuIK/+yQ+6PRGaHkKewYtg6hto2uGCgvKdb2nfJfKXgZ17DfXjvbZ+jA1Qt9A8EQSfPnt5FKIfnOO3u1h9qw==", + "dev": true, + "dependencies": { + "@jest/environment": "^29.5.0", + "@jest/fake-timers": "^29.5.0", + "@jest/types": "^29.5.0", + "@types/node": "*", + "jest-mock": "^29.5.0", + "jest-util": "^29.5.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-get-type": { + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.4.3.tgz", + "integrity": "sha512-J5Xez4nRRMjk8emnTpWrlkyb9pfRQQanDrvWHhsR1+VUfbwxi30eVcZFlcdGInRibU4G5LwHXpI7IRHU0CY+gg==", + "dev": true, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-haste-map": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.5.0.tgz", + "integrity": "sha512-IspOPnnBro8YfVYSw6yDRKh/TiCdRngjxeacCps1cQ9cgVN6+10JUcuJ1EabrgYLOATsIAigxA0rLR9x/YlrSA==", + "dev": true, + "dependencies": { + "@jest/types": "^29.5.0", + "@types/graceful-fs": "^4.1.3", + "@types/node": "*", + "anymatch": "^3.0.3", + "fb-watchman": "^2.0.0", + "graceful-fs": "^4.2.9", + "jest-regex-util": "^29.4.3", + "jest-util": "^29.5.0", + "jest-worker": "^29.5.0", + "micromatch": "^4.0.4", + "walker": "^1.0.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "optionalDependencies": { + "fsevents": "^2.3.2" + } + }, + "node_modules/jest-leak-detector": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.5.0.tgz", + "integrity": "sha512-u9YdeeVnghBUtpN5mVxjID7KbkKE1QU4f6uUwuxiY0vYRi9BUCLKlPEZfDGR67ofdFmDz9oPAy2G92Ujrntmow==", + "dev": true, + "dependencies": { + "jest-get-type": "^29.4.3", + "pretty-format": "^29.5.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-matcher-utils": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.5.0.tgz", + "integrity": "sha512-lecRtgm/rjIK0CQ7LPQwzCs2VwW6WAahA55YBuI+xqmhm7LAaxokSB8C97yJeYyT+HvQkH741StzpU41wohhWw==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "jest-diff": "^29.5.0", + "jest-get-type": "^29.4.3", + "pretty-format": "^29.5.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-message-util": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.5.0.tgz", + "integrity": "sha512-Kijeg9Dag6CKtIDA7O21zNTACqD5MD/8HfIV8pdD94vFyFuer52SigdC3IQMhab3vACxXMiFk+yMHNdbqtyTGA==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.12.13", + "@jest/types": "^29.5.0", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "micromatch": "^4.0.4", + "pretty-format": "^29.5.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-mock": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.5.0.tgz", + "integrity": "sha512-GqOzvdWDE4fAV2bWQLQCkujxYWL7RxjCnj71b5VhDAGOevB3qj3Ovg26A5NI84ZpODxyzaozXLOh2NCgkbvyaw==", + "dev": true, + "dependencies": { + "@jest/types": "^29.5.0", + "@types/node": "*", + "jest-util": "^29.5.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-pnp-resolver": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz", + "integrity": "sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==", + "dev": true, + "engines": { + "node": ">=6" + }, + "peerDependencies": { + "jest-resolve": "*" + }, + "peerDependenciesMeta": { + "jest-resolve": { + "optional": true + } + } + }, + "node_modules/jest-regex-util": { + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.4.3.tgz", + "integrity": "sha512-O4FglZaMmWXbGHSQInfXewIsd1LMn9p3ZXB/6r4FOkyhX2/iP/soMG98jGvk/A3HAN78+5VWcBGO0BJAPRh4kg==", + "dev": true, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-resolve": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.5.0.tgz", + "integrity": "sha512-1TzxJ37FQq7J10jPtQjcc+MkCkE3GBpBecsSUWJ0qZNJpmg6m0D9/7II03yJulm3H/fvVjgqLh/k2eYg+ui52w==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.5.0", + "jest-pnp-resolver": "^1.2.2", + "jest-util": "^29.5.0", + "jest-validate": "^29.5.0", + "resolve": "^1.20.0", + "resolve.exports": "^2.0.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-resolve-dependencies": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.5.0.tgz", + "integrity": "sha512-sjV3GFr0hDJMBpYeUuGduP+YeCRbd7S/ck6IvL3kQ9cpySYKqcqhdLLC2rFwrcL7tz5vYibomBrsFYWkIGGjOg==", + "dev": true, + "dependencies": { + "jest-regex-util": "^29.4.3", + "jest-snapshot": "^29.5.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-runner": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.5.0.tgz", + "integrity": "sha512-m7b6ypERhFghJsslMLhydaXBiLf7+jXy8FwGRHO3BGV1mcQpPbwiqiKUR2zU2NJuNeMenJmlFZCsIqzJCTeGLQ==", + "dev": true, + "dependencies": { + "@jest/console": "^29.5.0", + "@jest/environment": "^29.5.0", + "@jest/test-result": "^29.5.0", + "@jest/transform": "^29.5.0", + "@jest/types": "^29.5.0", + "@types/node": "*", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "graceful-fs": "^4.2.9", + "jest-docblock": "^29.4.3", + "jest-environment-node": "^29.5.0", + "jest-haste-map": "^29.5.0", + "jest-leak-detector": "^29.5.0", + "jest-message-util": "^29.5.0", + "jest-resolve": "^29.5.0", + "jest-runtime": "^29.5.0", + "jest-util": "^29.5.0", + "jest-watcher": "^29.5.0", + "jest-worker": "^29.5.0", + "p-limit": "^3.1.0", + "source-map-support": "0.5.13" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-runtime": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.5.0.tgz", + "integrity": "sha512-1Hr6Hh7bAgXQP+pln3homOiEZtCDZFqwmle7Ew2j8OlbkIu6uE3Y/etJQG8MLQs3Zy90xrp2C0BRrtPHG4zryw==", + "dev": true, + "dependencies": { + "@jest/environment": "^29.5.0", + "@jest/fake-timers": "^29.5.0", + "@jest/globals": "^29.5.0", + "@jest/source-map": "^29.4.3", + "@jest/test-result": "^29.5.0", + "@jest/transform": "^29.5.0", + "@jest/types": "^29.5.0", + "@types/node": "*", + "chalk": "^4.0.0", + "cjs-module-lexer": "^1.0.0", + "collect-v8-coverage": "^1.0.0", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.5.0", + "jest-message-util": "^29.5.0", + "jest-mock": "^29.5.0", + "jest-regex-util": "^29.4.3", + "jest-resolve": "^29.5.0", + "jest-snapshot": "^29.5.0", + "jest-util": "^29.5.0", + "slash": "^3.0.0", + "strip-bom": "^4.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-snapshot": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.5.0.tgz", + "integrity": "sha512-x7Wolra5V0tt3wRs3/ts3S6ciSQVypgGQlJpz2rsdQYoUKxMxPNaoHMGJN6qAuPJqS+2iQ1ZUn5kl7HCyls84g==", + "dev": true, + "dependencies": { + "@babel/core": "^7.11.6", + "@babel/generator": "^7.7.2", + "@babel/plugin-syntax-jsx": "^7.7.2", + "@babel/plugin-syntax-typescript": "^7.7.2", + "@babel/traverse": "^7.7.2", + "@babel/types": "^7.3.3", + "@jest/expect-utils": "^29.5.0", + "@jest/transform": "^29.5.0", + "@jest/types": "^29.5.0", + "@types/babel__traverse": "^7.0.6", + "@types/prettier": "^2.1.5", + "babel-preset-current-node-syntax": "^1.0.0", + "chalk": "^4.0.0", + "expect": "^29.5.0", + "graceful-fs": "^4.2.9", + "jest-diff": "^29.5.0", + "jest-get-type": "^29.4.3", + "jest-matcher-utils": "^29.5.0", + "jest-message-util": "^29.5.0", + "jest-util": "^29.5.0", + "natural-compare": "^1.4.0", + "pretty-format": "^29.5.0", + "semver": "^7.3.5" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-snapshot/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jest-snapshot/node_modules/semver": { + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz", + "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jest-snapshot/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/jest-util": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.5.0.tgz", + "integrity": "sha512-RYMgG/MTadOr5t8KdhejfvUU82MxsCu5MF6KuDUHl+NuwzUt+Sm6jJWxTJVrDR1j5M/gJVCPKQEpWXY+yIQ6lQ==", + "dev": true, + "dependencies": { + "@jest/types": "^29.5.0", + "@types/node": "*", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "graceful-fs": "^4.2.9", + "picomatch": "^2.2.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-validate": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.5.0.tgz", + "integrity": "sha512-pC26etNIi+y3HV8A+tUGr/lph9B18GnzSRAkPaaZJIE1eFdiYm6/CewuiJQ8/RlfHd1u/8Ioi8/sJ+CmbA+zAQ==", + "dev": true, + "dependencies": { + "@jest/types": "^29.5.0", + "camelcase": "^6.2.0", + "chalk": "^4.0.0", + "jest-get-type": "^29.4.3", + "leven": "^3.1.0", + "pretty-format": "^29.5.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-validate/node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/jest-watcher": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.5.0.tgz", + "integrity": "sha512-KmTojKcapuqYrKDpRwfqcQ3zjMlwu27SYext9pt4GlF5FUgB+7XE1mcCnSm6a4uUpFyQIkb6ZhzZvHl+jiBCiA==", + "dev": true, + "dependencies": { + "@jest/test-result": "^29.5.0", + "@jest/types": "^29.5.0", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "jest-util": "^29.5.0", + "string-length": "^4.0.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-worker": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.5.0.tgz", + "integrity": "sha512-NcrQnevGoSp4b5kg+akIpthoAFHxPBcb5P6mYPY0fUNT+sSvmtu6jlkEle3anczUKIKEbMxFimk9oTP/tpIPgA==", + "dev": true, + "dependencies": { + "@types/node": "*", + "jest-util": "^29.5.0", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-worker/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "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==" + }, + "node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "dev": true, + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=4" + } + }, + "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==", + "dev": true + }, + "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, + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/jsonwebtoken": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.0.tgz", + "integrity": "sha512-tuGfYXxkQGDPnLJ7SibiQgVgeDgfbPq2k2ICcbgqW8WxWLBAxKQM/ZCu/IT8SOSwmaYl4dpTFCW5xZv7YbbWUw==", + "dependencies": { + "jws": "^3.2.2", + "lodash": "^4.17.21", + "ms": "^2.1.1", + "semver": "^7.3.8" + }, + "engines": { + "node": ">=12", + "npm": ">=6" + } + }, + "node_modules/jsonwebtoken/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jsonwebtoken/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==" + }, + "node_modules/jsonwebtoken/node_modules/semver": { + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz", + "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jsonwebtoken/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, + "node_modules/jwa": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", + "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", + "dependencies": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/jws": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", + "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", + "dependencies": { + "jwa": "^1.4.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/kleur": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", + "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/le-coffre-resources": { + "resolved": "git+ssh://git@github.com/smart-chain-fr/leCoffre-resources.git#22f4851fa87489634ea0a629ec040a44e7aa5fb9", + "license": "MIT", + "dependencies": { + "class-transformer": "^0.5.1", + "class-validator": "^0.14.0" + } + }, + "node_modules/leven": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", + "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/libphonenumber-js": { + "version": "1.10.26", + "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.10.26.tgz", + "integrity": "sha512-oB3l4J5gEhMV+ymmlIjWedsbCpsNRqbEZ/E/MpN2QVyinKNra6DcuXywxSk/72M3DZDoH/6kzurOq1erznBMwQ==" + }, + "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==", + "dev": true + }, + "node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "node_modules/lodash.memoize": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", + "integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==", + "dev": true + }, + "node_modules/long-timeout": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/long-timeout/-/long-timeout-0.1.1.tgz", + "integrity": "sha512-BFRuQUqc7x2NWxfJBCyUrN8iYUYznzL9JROmRz1gZ6KlOIgmoD+njPVbb+VNn2nGMKggMsK79iUNErillsrx7w==" + }, + "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==", + "peer": true, + "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, + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/luxon": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/luxon/-/luxon-3.3.0.tgz", + "integrity": "sha512-An0UCfG/rSiqtAIiBPO0Y9/zAnHUZxAMiCpTd5h2smgsj7GGmcenvrvww2cqNA8/4A5ZrD1gJpHN2mIHZQF+Mg==", + "engines": { + "node": ">=12" + } + }, + "node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" + }, + "node_modules/makeerror": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", + "integrity": "sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==", + "dev": true, + "dependencies": { + "tmpl": "1.0.5" + } + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "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==", + "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==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "engines": { + "node": ">=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, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/module-alias": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/module-alias/-/module-alias-2.2.2.tgz", + "integrity": "sha512-A/78XjoX2EmNvppVWEhM2oGk3x4lLxnkEA4jTbaK97QKSDjkIoOsKQlfylt/d3kKKi596Qy3NP5XrXJ6fZIC9Q==" + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, + "node_modules/nanoid": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", + "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "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 + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/next": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/next/-/next-13.3.0.tgz", + "integrity": "sha512-OVTw8MpIPa12+DCUkPqRGPS3thlJPcwae2ZL4xti3iBff27goH024xy4q2lhlsdoYiKOi8Kz6uJoLW/GXwgfOA==", + "dependencies": { + "@next/env": "13.3.0", + "@swc/helpers": "0.4.14", + "busboy": "1.6.0", + "caniuse-lite": "^1.0.30001406", + "postcss": "8.4.14", + "styled-jsx": "5.1.1" + }, + "bin": { + "next": "dist/bin/next" + }, + "engines": { + "node": ">=14.6.0" + }, + "optionalDependencies": { + "@next/swc-darwin-arm64": "13.3.0", + "@next/swc-darwin-x64": "13.3.0", + "@next/swc-linux-arm64-gnu": "13.3.0", + "@next/swc-linux-arm64-musl": "13.3.0", + "@next/swc-linux-x64-gnu": "13.3.0", + "@next/swc-linux-x64-musl": "13.3.0", + "@next/swc-win32-arm64-msvc": "13.3.0", + "@next/swc-win32-ia32-msvc": "13.3.0", + "@next/swc-win32-x64-msvc": "13.3.0" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.1.0", + "fibers": ">= 3.1.0", + "node-sass": "^6.0.0 || ^7.0.0", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "sass": "^1.3.0" + }, + "peerDependenciesMeta": { + "@opentelemetry/api": { + "optional": true + }, + "fibers": { + "optional": true + }, + "node-sass": { + "optional": true + }, + "sass": { + "optional": true + } + } + }, + "node_modules/node-cache": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/node-cache/-/node-cache-5.1.2.tgz", + "integrity": "sha512-t1QzWwnk4sjLWaQAS8CHgOJ+RAfmHpxFWmc36IWTiWHQfs0w5JDMBS1b1ZxQteo0vVVuWJvIUKHDkkeK7vIGCg==", + "dependencies": { + "clone": "2.x" + }, + "engines": { + "node": ">= 8.0.0" + } + }, + "node_modules/node-int64": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", + "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==", + "dev": true + }, + "node_modules/node-releases": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.10.tgz", + "integrity": "sha512-5GFldHPXVG/YZmFzJvKK2zDSzPKhEp0+ZR5SVaoSag9fsL5YgHbUHDfnG5494ISANDcK4KwPXAx2xqVEydmd7w==", + "dev": true + }, + "node_modules/node-schedule": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/node-schedule/-/node-schedule-2.1.1.tgz", + "integrity": "sha512-OXdegQq03OmXEjt2hZP33W2YPs/E5BcFQks46+G2gAxs4gHOIVD1u7EqlYLYSKsaIpyKCK9Gbk0ta1/gjRSMRQ==", + "dependencies": { + "cron-parser": "^4.2.0", + "long-timeout": "0.1.1", + "sorted-array-functions": "^1.3.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/nodemon": { + "version": "2.0.22", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.22.tgz", + "integrity": "sha512-B8YqaKMmyuCO7BowF1Z1/mkPqLk6cs/l63Ojtd6otKjMx47Dq1utxfRxcavH1I7VSaL8n5BUaoutadnsX3AAVQ==", + "dev": true, + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^3.2.7", + "ignore-by-default": "^1.0.1", + "minimatch": "^3.1.2", + "pstree.remy": "^1.1.8", + "semver": "^5.7.1", + "simple-update-notifier": "^1.0.7", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=8.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/nodemon/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/nodemon/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/nodemon/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==", + "dev": true + }, + "node_modules/nodemon/node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/nodemon/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/nopt": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", + "integrity": "sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==", + "dev": true, + "dependencies": { + "abbrev": "1" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": "*" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "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==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.12.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", + "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "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, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-locate/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "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==", + "dev": true, + "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/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "engines": { + "node": ">= 0.8" + } + }, + "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, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "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, + "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==", + "dev": true + }, + "node_modules/path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" + }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pirates": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.5.tgz", + "integrity": "sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/postcss": { + "version": "8.4.14", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.14.tgz", + "integrity": "sha512-E398TUmfAYFPBSdzgeieK2Y1+1cpdxJx8yXbK/m57nRhKSmk1GB2tO4lbLBtlkfPQTDKfe4Xqv1ASWPpayPEig==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + } + ], + "dependencies": { + "nanoid": "^3.3.4", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/prettier": { + "version": "2.8.4", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.4.tgz", + "integrity": "sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw==", + "dev": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/pretty-format": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.5.0.tgz", + "integrity": "sha512-V2mGkI31qdttvTFX7Mt4efOqHXqJWMu4/r66Xh3Z3BwZaPfPJgp6/gbwoujRpPUtfEF6AUUWx3Jim3GCw5g/Qw==", + "dev": true, + "dependencies": { + "@jest/schemas": "^29.4.3", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/pretty-format/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/prisma": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/prisma/-/prisma-4.12.0.tgz", + "integrity": "sha512-xqVper4mbwl32BWzLpdznHAYvYDWQQWK2tBfXjdUD397XaveRyAP7SkBZ6kFlIg8kKayF4hvuaVtYwXd9BodAg==", + "devOptional": true, + "hasInstallScript": true, + "dependencies": { + "@prisma/engines": "4.12.0" + }, + "bin": { + "prisma": "build/index.js", + "prisma2": "build/index.js" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/prisma-query": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/prisma-query/-/prisma-query-2.0.0.tgz", + "integrity": "sha512-+5eneJrgTFxW48j4JaWJ8iBwFSH+YQRtA1N+QEzqsREnTEAbs1Bq85xoZP7ZNEXDsoLOoIo4rYfCYRozuVOB9Q==" + }, + "node_modules/prompts": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", + "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", + "dev": true, + "dependencies": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.5" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true + }, + "node_modules/pure-rand": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.0.1.tgz", + "integrity": "sha512-t+x1zEHDjBwkDGY5v5ApnZ/utcd4XYDiJsaQQoptTXgUXX95sDg1elCdJghzicm7n2mbCBJ3uYWr6M22SO19rg==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/dubzzz" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fast-check" + } + ] + }, + "node_modules/qs": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", + "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "dependencies": { + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", + "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/react": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", + "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", + "peer": true, + "dependencies": { + "loose-envify": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", + "integrity": "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==", + "peer": true, + "dependencies": { + "loose-envify": "^1.1.0", + "scheduler": "^0.23.0" + }, + "peerDependencies": { + "react": "^18.2.0" + } + }, + "node_modules/react-is": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", + "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", + "dev": true + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/reflect-metadata": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", + "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==" + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve": { + "version": "1.22.3", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.3.tgz", + "integrity": "sha512-P8ur/gp/AmbEzjr729bZnLjXK5Z+4P0zhIJgBgzqRih7hL7BOukHGtSTA3ACMY467GRFz3duQsi0bDZdR7DKdw==", + "dev": true, + "dependencies": { + "is-core-module": "^2.12.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "dev": true, + "dependencies": { + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve.exports": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz", + "integrity": "sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/scheduler": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", + "integrity": "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==", + "peer": true, + "dependencies": { + "loose-envify": "^1.1.0" + } + }, + "node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/send": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", + "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/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==" + }, + "node_modules/serve-static": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", + "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "dependencies": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.18.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + }, + "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, + "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, + "engines": { + "node": ">=8" + } + }, + "node_modules/side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dependencies": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "node_modules/simple-update-notifier": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-1.1.0.tgz", + "integrity": "sha512-VpsrsJSUcJEseSbMHkrsrAVSdvVS5I96Qo1QAQ4FxQ9wXFcB+pjj7FB7/us9+GcgfW4ziHtYMc1J0PLczb55mg==", + "dev": true, + "dependencies": { + "semver": "~7.0.0" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/simple-update-notifier/node_modules/semver": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz", + "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/sisteransi": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", + "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", + "dev": true + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/sorted-array-functions": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/sorted-array-functions/-/sorted-array-functions-1.3.0.tgz", + "integrity": "sha512-2sqgzeFlid6N4Z2fUQ1cvFmTOLRi/sEDzSQ0OKYchqgoPmQBVyM3959qYx3fpS6Esef80KjmpgPeEr028dP3OA==" + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-js": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.13", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", + "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==", + "dev": true, + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "dev": true + }, + "node_modules/stack-utils": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", + "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", + "dev": true, + "dependencies": { + "escape-string-regexp": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/streamsearch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", + "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/string-length": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", + "integrity": "sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==", + "dev": true, + "dependencies": { + "char-regex": "^1.0.2", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-bom": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", + "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "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, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/styled-jsx": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.1.tgz", + "integrity": "sha512-pW7uC1l4mBZ8ugbiZrcIsiIvVx1UmTfw7UkC3Um2tmfUq9Bhk8IiyEIPl6F8agHgjzku6j0xQEZbfA5uSgSaCw==", + "dependencies": { + "client-only": "0.0.1" + }, + "engines": { + "node": ">= 12.0.0" + }, + "peerDependencies": { + "react": ">= 16.8.0 || 17.x.x || ^18.0.0-0" + }, + "peerDependenciesMeta": { + "@babel/core": { + "optional": true + }, + "babel-plugin-macros": { + "optional": true + } + } + }, + "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, + "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==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "dev": true, + "dependencies": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/tmpl": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", + "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", + "dev": true + }, + "node_modules/to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/touch": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", + "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", + "dev": true, + "dependencies": { + "nopt": "~1.0.10" + }, + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, + "node_modules/ts-jest": { + "version": "29.1.0", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.0.tgz", + "integrity": "sha512-ZhNr7Z4PcYa+JjMl62ir+zPiNJfXJN6E8hSLnaUKhOgqcn8vb3e537cpkd0FuAfRK3sR1LSqM1MOhliXNgOFPA==", + "dev": true, + "dependencies": { + "bs-logger": "0.x", + "fast-json-stable-stringify": "2.x", + "jest-util": "^29.0.0", + "json5": "^2.2.3", + "lodash.memoize": "4.x", + "make-error": "1.x", + "semver": "7.x", + "yargs-parser": "^21.0.1" + }, + "bin": { + "ts-jest": "cli.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@babel/core": ">=7.0.0-beta.0 <8", + "@jest/types": "^29.0.0", + "babel-jest": "^29.0.0", + "jest": "^29.0.0", + "typescript": ">=4.3 <6" + }, + "peerDependenciesMeta": { + "@babel/core": { + "optional": true + }, + "@jest/types": { + "optional": true + }, + "babel-jest": { + "optional": true + }, + "esbuild": { + "optional": true + } + } + }, + "node_modules/ts-jest/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ts-jest/node_modules/semver": { + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz", + "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ts-jest/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/ts-node": { + "version": "10.9.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", + "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", + "dependencies": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/tslib": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", + "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==" + }, + "node_modules/type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/typedi": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/typedi/-/typedi-0.10.0.tgz", + "integrity": "sha512-v3UJF8xm68BBj6AF4oQML3ikrfK2c9EmZUyLOfShpJuItAqVBHWP/KtpGinkSsIiP6EZyyb6Z3NXyW9dgS9X1w==" + }, + "node_modules/typescript": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/update-browserslist-db": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz", + "integrity": "sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==", + "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" + } + ], + "dependencies": { + "escalade": "^3.1.1", + "picocolors": "^1.0.0" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/uuid": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", + "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==" + }, + "node_modules/v8-to-istanbul": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.1.0.tgz", + "integrity": "sha512-6z3GW9x8G1gd+JIIgQQQxXuiJtCXeAjp6RaPEPLv62mH3iPHPxV6W3robxtCzNErRo6ZwTmzWhsbNvjyEBKzKA==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.12", + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^1.6.0" + }, + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/v8-to-istanbul/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==", + "dev": true + }, + "node_modules/validator": { + "version": "13.9.0", + "resolved": "https://registry.npmjs.org/validator/-/validator-13.9.0.tgz", + "integrity": "sha512-B+dGG8U3fdtM0/aNK4/X8CXq/EcxU2WPrPEkJGslb47qyHsxmbggTWK0yEA4qnYVNF+nxNlN88o14hIcPmSIEA==", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/walker": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", + "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==", + "dev": true, + "dependencies": { + "makeerror": "1.0.12" + } + }, + "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, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + }, + "node_modules/write-file-atomic": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", + "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", + "dev": true, + "dependencies": { + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.7" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + }, + "node_modules/yargs": { + "version": "17.7.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.1.tgz", + "integrity": "sha512-cwiTb08Xuv5fqF4AovYacTFNxk62th7LKJ6BL9IGUpTJrWoU7/7WdQGTP2SjKf1dUNBGzDd28p/Yfs/GI6JrLw==", + "dev": true, + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "engines": { + "node": ">=6" + } + }, + "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, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + }, + "dependencies": { + "@ampproject/remapping": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz", + "integrity": "sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==", + "dev": true, + "requires": { + "@jridgewell/gen-mapping": "^0.3.0", + "@jridgewell/trace-mapping": "^0.3.9" + } + }, + "@babel/code-frame": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.21.4.tgz", + "integrity": "sha512-LYvhNKfwWSPpocw8GI7gpK2nq3HSDuEPC/uSYaALSJu9xjsalaaYFOq0Pwt5KmVqwEbZlDu81aLXwBOmD/Fv9g==", + "dev": true, + "requires": { + "@babel/highlight": "^7.18.6" + } + }, + "@babel/compat-data": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.21.4.tgz", + "integrity": "sha512-/DYyDpeCfaVinT40FPGdkkb+lYSKvsVuMjDAG7jPOWWiM1ibOaB9CXJAlc4d1QpP/U2q2P9jbrSlClKSErd55g==", + "dev": true + }, + "@babel/core": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.21.4.tgz", + "integrity": "sha512-qt/YV149Jman/6AfmlxJ04LMIu8bMoyl3RB91yTFrxQmgbrSvQMy7cI8Q62FHx1t8wJ8B5fu0UDoLwHAhUo1QA==", + "dev": true, + "requires": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.21.4", + "@babel/generator": "^7.21.4", + "@babel/helper-compilation-targets": "^7.21.4", + "@babel/helper-module-transforms": "^7.21.2", + "@babel/helpers": "^7.21.0", + "@babel/parser": "^7.21.4", + "@babel/template": "^7.20.7", + "@babel/traverse": "^7.21.4", + "@babel/types": "^7.21.4", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.2", + "semver": "^6.3.0" + }, + "dependencies": { + "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==", + "dev": true + }, + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } + } + }, + "@babel/generator": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.21.4.tgz", + "integrity": "sha512-NieM3pVIYW2SwGzKoqfPrQsf4xGs9M9AIG3ThppsSRmO+m7eQhmI6amajKMUeIO37wFfsvnvcxQFx6x6iqxDnA==", + "dev": true, + "requires": { + "@babel/types": "^7.21.4", + "@jridgewell/gen-mapping": "^0.3.2", + "@jridgewell/trace-mapping": "^0.3.17", + "jsesc": "^2.5.1" + } + }, + "@babel/helper-compilation-targets": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.21.4.tgz", + "integrity": "sha512-Fa0tTuOXZ1iL8IeDFUWCzjZcn+sJGd9RZdH9esYVjEejGmzf+FFYQpMi/kZUk2kPy/q1H3/GPw7np8qar/stfg==", + "dev": true, + "requires": { + "@babel/compat-data": "^7.21.4", + "@babel/helper-validator-option": "^7.21.0", + "browserslist": "^4.21.3", + "lru-cache": "^5.1.1", + "semver": "^6.3.0" + } + }, + "@babel/helper-environment-visitor": { + "version": "7.18.9", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz", + "integrity": "sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==", + "dev": true + }, + "@babel/helper-function-name": { + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.21.0.tgz", + "integrity": "sha512-HfK1aMRanKHpxemaY2gqBmL04iAPOPRj7DxtNbiDOrJK+gdwkiNRVpCpUJYbUT+aZyemKN8brqTOxzCaG6ExRg==", + "dev": true, + "requires": { + "@babel/template": "^7.20.7", + "@babel/types": "^7.21.0" + } + }, + "@babel/helper-hoist-variables": { + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz", + "integrity": "sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==", + "dev": true, + "requires": { + "@babel/types": "^7.18.6" + } + }, + "@babel/helper-module-imports": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.21.4.tgz", + "integrity": "sha512-orajc5T2PsRYUN3ZryCEFeMDYwyw09c/pZeaQEZPH0MpKzSvn3e0uXsDBu3k03VI+9DBiRo+l22BfKTpKwa/Wg==", + "dev": true, + "requires": { + "@babel/types": "^7.21.4" + } + }, + "@babel/helper-module-transforms": { + "version": "7.21.2", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.21.2.tgz", + "integrity": "sha512-79yj2AR4U/Oqq/WOV7Lx6hUjau1Zfo4cI+JLAVYeMV5XIlbOhmjEk5ulbTc9fMpmlojzZHkUUxAiK+UKn+hNQQ==", + "dev": true, + "requires": { + "@babel/helper-environment-visitor": "^7.18.9", + "@babel/helper-module-imports": "^7.18.6", + "@babel/helper-simple-access": "^7.20.2", + "@babel/helper-split-export-declaration": "^7.18.6", + "@babel/helper-validator-identifier": "^7.19.1", + "@babel/template": "^7.20.7", + "@babel/traverse": "^7.21.2", + "@babel/types": "^7.21.2" + } + }, + "@babel/helper-plugin-utils": { + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.20.2.tgz", + "integrity": "sha512-8RvlJG2mj4huQ4pZ+rU9lqKi9ZKiRmuvGuM2HlWmkmgOhbs6zEAw6IEiJ5cQqGbDzGZOhwuOQNtZMi/ENLjZoQ==", + "dev": true + }, + "@babel/helper-simple-access": { + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.20.2.tgz", + "integrity": "sha512-+0woI/WPq59IrqDYbVGfshjT5Dmk/nnbdpcF8SnMhhXObpTq2KNBdLFRFrkVdbDOyUmHBCxzm5FHV1rACIkIbA==", + "dev": true, + "requires": { + "@babel/types": "^7.20.2" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz", + "integrity": "sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==", + "dev": true, + "requires": { + "@babel/types": "^7.18.6" + } + }, + "@babel/helper-string-parser": { + "version": "7.19.4", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz", + "integrity": "sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==", + "dev": true + }, + "@babel/helper-validator-identifier": { + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", + "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", + "dev": true + }, + "@babel/helper-validator-option": { + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.21.0.tgz", + "integrity": "sha512-rmL/B8/f0mKS2baE9ZpyTcTavvEuWhTTW8amjzXNvYG4AwBsqTLikfXsEofsJEfKHf+HQVQbFOHy6o+4cnC/fQ==", + "dev": true + }, + "@babel/helpers": { + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.21.0.tgz", + "integrity": "sha512-XXve0CBtOW0pd7MRzzmoyuSj0e3SEzj8pgyFxnTT1NJZL38BD1MK7yYrm8yefRPIDvNNe14xR4FdbHwpInD4rA==", + "dev": true, + "requires": { + "@babel/template": "^7.20.7", + "@babel/traverse": "^7.21.0", + "@babel/types": "^7.21.0" + } + }, + "@babel/highlight": { + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", + "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.18.6", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "@babel/parser": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.21.4.tgz", + "integrity": "sha512-alVJj7k7zIxqBZ7BTRhz0IqJFxW1VJbm6N8JbcYhQ186df9ZBPbZBmWSqAMXwHGsCJdYks7z/voa3ibiS5bCIw==", + "dev": true + }, + "@babel/plugin-syntax-async-generators": { + "version": "7.8.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", + "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-bigint": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", + "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-class-properties": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", + "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.12.13" + } + }, + "@babel/plugin-syntax-import-meta": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", + "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.4" + } + }, + "@babel/plugin-syntax-json-strings": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", + "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-jsx": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.21.4.tgz", + "integrity": "sha512-5hewiLct5OKyh6PLKEYaFclcqtIgCb6bmELouxjF6up5q3Sov7rOayW4RwhbaBL0dit8rA80GNfY+UuDp2mBbQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.20.2" + } + }, + "@babel/plugin-syntax-logical-assignment-operators": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", + "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.4" + } + }, + "@babel/plugin-syntax-nullish-coalescing-operator": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", + "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-numeric-separator": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", + "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.4" + } + }, + "@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", + "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-optional-catch-binding": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", + "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-optional-chaining": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", + "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-top-level-await": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", + "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-syntax-typescript": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.21.4.tgz", + "integrity": "sha512-xz0D39NvhQn4t4RNsHmDnnsaQizIlUkdtYvLs8La1BlfjQ6JEwxkJGeqJMW2tAXx+q6H+WFuUTXNdYVpEya0YA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.20.2" + } + }, + "@babel/template": { + "version": "7.20.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.20.7.tgz", + "integrity": "sha512-8SegXApWe6VoNw0r9JHpSteLKTpTiLZ4rMlGIm9JQ18KiCtyQiAMEazujAHrUS5flrcqYZa75ukev3P6QmUwUw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.18.6", + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7" + } + }, + "@babel/traverse": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.21.4.tgz", + "integrity": "sha512-eyKrRHKdyZxqDm+fV1iqL9UAHMoIg0nDaGqfIOd8rKH17m5snv7Gn4qgjBoFfLz9APvjFU/ICT00NVCv1Epp8Q==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.21.4", + "@babel/generator": "^7.21.4", + "@babel/helper-environment-visitor": "^7.18.9", + "@babel/helper-function-name": "^7.21.0", + "@babel/helper-hoist-variables": "^7.18.6", + "@babel/helper-split-export-declaration": "^7.18.6", + "@babel/parser": "^7.21.4", + "@babel/types": "^7.21.4", + "debug": "^4.1.0", + "globals": "^11.1.0" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } + } + }, + "@babel/types": { + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.21.4.tgz", + "integrity": "sha512-rU2oY501qDxE8Pyo7i/Orqma4ziCOrby0/9mvbDUGEfvZjb279Nk9k19e2fiCxHbRRpY2ZyrgW1eq22mvmOIzA==", + "dev": true, + "requires": { + "@babel/helper-string-parser": "^7.19.4", + "@babel/helper-validator-identifier": "^7.19.1", + "to-fast-properties": "^2.0.0" + } + }, + "@bcoe/v8-coverage": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", + "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", + "dev": true + }, + "@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "requires": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "dependencies": { + "@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "requires": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + } + } + }, + "@istanbuljs/load-nyc-config": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", + "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", + "dev": true, + "requires": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "get-package-type": "^0.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + } + }, + "@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "dev": true + }, + "@jest/console": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.5.0.tgz", + "integrity": "sha512-NEpkObxPwyw/XxZVLPmAGKE89IQRp4puc6IQRPru6JKd1M3fW9v1xM1AnzIJE65hbCkzQAdnL8P47e9hzhiYLQ==", + "dev": true, + "requires": { + "@jest/types": "^29.5.0", + "@types/node": "*", + "chalk": "^4.0.0", + "jest-message-util": "^29.5.0", + "jest-util": "^29.5.0", + "slash": "^3.0.0" + } + }, + "@jest/core": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.5.0.tgz", + "integrity": "sha512-28UzQc7ulUrOQw1IsN/kv1QES3q2kkbl/wGslyhAclqZ/8cMdB5M68BffkIdSJgKBUt50d3hbwJ92XESlE7LiQ==", + "dev": true, + "requires": { + "@jest/console": "^29.5.0", + "@jest/reporters": "^29.5.0", + "@jest/test-result": "^29.5.0", + "@jest/transform": "^29.5.0", + "@jest/types": "^29.5.0", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-changed-files": "^29.5.0", + "jest-config": "^29.5.0", + "jest-haste-map": "^29.5.0", + "jest-message-util": "^29.5.0", + "jest-regex-util": "^29.4.3", + "jest-resolve": "^29.5.0", + "jest-resolve-dependencies": "^29.5.0", + "jest-runner": "^29.5.0", + "jest-runtime": "^29.5.0", + "jest-snapshot": "^29.5.0", + "jest-util": "^29.5.0", + "jest-validate": "^29.5.0", + "jest-watcher": "^29.5.0", + "micromatch": "^4.0.4", + "pretty-format": "^29.5.0", + "slash": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "@jest/environment": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.5.0.tgz", + "integrity": "sha512-5FXw2+wD29YU1d4I2htpRX7jYnAyTRjP2CsXQdo9SAM8g3ifxWPSV0HnClSn71xwctr0U3oZIIH+dtbfmnbXVQ==", + "dev": true, + "requires": { + "@jest/fake-timers": "^29.5.0", + "@jest/types": "^29.5.0", + "@types/node": "*", + "jest-mock": "^29.5.0" + } + }, + "@jest/expect": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.5.0.tgz", + "integrity": "sha512-PueDR2HGihN3ciUNGr4uelropW7rqUfTiOn+8u0leg/42UhblPxHkfoh0Ruu3I9Y1962P3u2DY4+h7GVTSVU6g==", + "dev": true, + "requires": { + "expect": "^29.5.0", + "jest-snapshot": "^29.5.0" + } + }, + "@jest/expect-utils": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.5.0.tgz", + "integrity": "sha512-fmKzsidoXQT2KwnrwE0SQq3uj8Z763vzR8LnLBwC2qYWEFpjX8daRsk6rHUM1QvNlEW/UJXNXm59ztmJJWs2Mg==", + "dev": true, + "requires": { + "jest-get-type": "^29.4.3" + } + }, + "@jest/fake-timers": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.5.0.tgz", + "integrity": "sha512-9ARvuAAQcBwDAqOnglWq2zwNIRUDtk/SCkp/ToGEhFv5r86K21l+VEs0qNTaXtyiY0lEePl3kylijSYJQqdbDg==", + "dev": true, + "requires": { + "@jest/types": "^29.5.0", + "@sinonjs/fake-timers": "^10.0.2", + "@types/node": "*", + "jest-message-util": "^29.5.0", + "jest-mock": "^29.5.0", + "jest-util": "^29.5.0" + } + }, + "@jest/globals": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.5.0.tgz", + "integrity": "sha512-S02y0qMWGihdzNbUiqSAiKSpSozSuHX5UYc7QbnHP+D9Lyw8DgGGCinrN9uSuHPeKgSSzvPom2q1nAtBvUsvPQ==", + "dev": true, + "requires": { + "@jest/environment": "^29.5.0", + "@jest/expect": "^29.5.0", + "@jest/types": "^29.5.0", + "jest-mock": "^29.5.0" + } + }, + "@jest/reporters": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.5.0.tgz", + "integrity": "sha512-D05STXqj/M8bP9hQNSICtPqz97u7ffGzZu+9XLucXhkOFBqKcXe04JLZOgIekOxdb73MAoBUFnqvf7MCpKk5OA==", + "dev": true, + "requires": { + "@bcoe/v8-coverage": "^0.2.3", + "@jest/console": "^29.5.0", + "@jest/test-result": "^29.5.0", + "@jest/transform": "^29.5.0", + "@jest/types": "^29.5.0", + "@jridgewell/trace-mapping": "^0.3.15", + "@types/node": "*", + "chalk": "^4.0.0", + "collect-v8-coverage": "^1.0.0", + "exit": "^0.1.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-instrument": "^5.1.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.1.3", + "jest-message-util": "^29.5.0", + "jest-util": "^29.5.0", + "jest-worker": "^29.5.0", + "slash": "^3.0.0", + "string-length": "^4.0.1", + "strip-ansi": "^6.0.0", + "v8-to-istanbul": "^9.0.1" + } + }, + "@jest/schemas": { + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.4.3.tgz", + "integrity": "sha512-VLYKXQmtmuEz6IxJsrZwzG9NvtkQsWNnWMsKxqWNu3+CnfzJQhp0WDDKWLVV9hLKr0l3SLLFRqcYHjhtyuDVxg==", + "dev": true, + "requires": { + "@sinclair/typebox": "^0.25.16" + } + }, + "@jest/source-map": { + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.4.3.tgz", + "integrity": "sha512-qyt/mb6rLyd9j1jUts4EQncvS6Yy3PM9HghnNv86QBlV+zdL2inCdK1tuVlL+J+lpiw2BI67qXOrX3UurBqQ1w==", + "dev": true, + "requires": { + "@jridgewell/trace-mapping": "^0.3.15", + "callsites": "^3.0.0", + "graceful-fs": "^4.2.9" + } + }, + "@jest/test-result": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.5.0.tgz", + "integrity": "sha512-fGl4rfitnbfLsrfx1uUpDEESS7zM8JdgZgOCQuxQvL1Sn/I6ijeAVQWGfXI9zb1i9Mzo495cIpVZhA0yr60PkQ==", + "dev": true, + "requires": { + "@jest/console": "^29.5.0", + "@jest/types": "^29.5.0", + "@types/istanbul-lib-coverage": "^2.0.0", + "collect-v8-coverage": "^1.0.0" + } + }, + "@jest/test-sequencer": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.5.0.tgz", + "integrity": "sha512-yPafQEcKjkSfDXyvtgiV4pevSeyuA6MQr6ZIdVkWJly9vkqjnFfcfhRQqpD5whjoU8EORki752xQmjaqoFjzMQ==", + "dev": true, + "requires": { + "@jest/test-result": "^29.5.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.5.0", + "slash": "^3.0.0" + } + }, + "@jest/transform": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.5.0.tgz", + "integrity": "sha512-8vbeZWqLJOvHaDfeMuoHITGKSz5qWc9u04lnWrQE3VyuSw604PzQM824ZeX9XSjUCeDiE3GuxZe5UKa8J61NQw==", + "dev": true, + "requires": { + "@babel/core": "^7.11.6", + "@jest/types": "^29.5.0", + "@jridgewell/trace-mapping": "^0.3.15", + "babel-plugin-istanbul": "^6.1.1", + "chalk": "^4.0.0", + "convert-source-map": "^2.0.0", + "fast-json-stable-stringify": "^2.1.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.5.0", + "jest-regex-util": "^29.4.3", + "jest-util": "^29.5.0", + "micromatch": "^4.0.4", + "pirates": "^4.0.4", + "slash": "^3.0.0", + "write-file-atomic": "^4.0.2" + } + }, + "@jest/types": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.5.0.tgz", + "integrity": "sha512-qbu7kN6czmVRc3xWFQcAN03RAUamgppVUdXrvl1Wr3jlNF93o9mJbGcDWrwGB6ht44u7efB1qCFgVQmca24Uog==", + "dev": true, + "requires": { + "@jest/schemas": "^29.4.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^17.0.8", + "chalk": "^4.0.0" + } + }, + "@jridgewell/gen-mapping": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", + "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "dev": true, + "requires": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + } + }, + "@jridgewell/resolve-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", + "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==" + }, + "@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "dev": true + }, + "@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==" + }, + "@jridgewell/trace-mapping": { + "version": "0.3.18", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz", + "integrity": "sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==", + "dev": true, + "requires": { + "@jridgewell/resolve-uri": "3.1.0", + "@jridgewell/sourcemap-codec": "1.4.14" + }, + "dependencies": { + "@jridgewell/sourcemap-codec": { + "version": "1.4.14", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", + "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", + "dev": true + } + } + }, + "@next/env": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/@next/env/-/env-13.3.0.tgz", + "integrity": "sha512-AjppRV4uG3No7L1plinoTQETH+j2F10TEnrMfzbTUYwze5sBUPveeeBAPZPm8OkJZ1epq9OyYKhZrvbD6/9HCQ==" + }, + "@next/swc-darwin-arm64": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.3.0.tgz", + "integrity": "sha512-DmIQCNq6JtccLPPBzf0dgh2vzMWt5wjxbP71pCi5EWpWYE3MsP6FcRXi4MlAmFNDQOfcFXR2r7kBeG1LpZUh1w==", + "optional": true + }, + "@next/swc-darwin-x64": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.3.0.tgz", + "integrity": "sha512-oQoqFa88OGgwnYlnAGHVct618FRI/749se0N3S8t9Bzdv5CRbscnO0RcX901+YnNK4Q6yeiizfgO3b7kogtsZg==", + "optional": true + }, + "@next/swc-linux-arm64-gnu": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.3.0.tgz", + "integrity": "sha512-Wzz2p/WqAJUqTVoLo6H18WMeAXo3i+9DkPDae4oQG8LMloJ3if4NEZTnOnTUlro6cq+S/W4pTGa97nWTrOjbGw==", + "optional": true + }, + "@next/swc-linux-arm64-musl": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.3.0.tgz", + "integrity": "sha512-xPVrIQOQo9WXJYgmoTlMnAD/HlR/1e1ZIWGbwIzEirXBVBqMARUulBEIKdC19zuvoJ477qZJgBDCKtKEykCpyQ==", + "optional": true + }, + "@next/swc-linux-x64-gnu": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.3.0.tgz", + "integrity": "sha512-jOFlpGuPD7W2tuXVJP4wt9a3cpNxWAPcloq5EfMJRiXsBBOjLVFZA7boXYxEBzSVgUiVVr1V9T0HFM7pULJ1qA==", + "optional": true + }, + "@next/swc-linux-x64-musl": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.3.0.tgz", + "integrity": "sha512-2OwKlzaBgmuet9XYHc3KwsEilzb04F540rlRXkAcjMHL7eCxB7uZIGtsVvKOnQLvC/elrUegwSw1+5f7WmfyOw==", + "optional": true + }, + "@next/swc-win32-arm64-msvc": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.3.0.tgz", + "integrity": "sha512-OeHiA6YEvndxT46g+rzFK/MQTfftKxJmzslERMu9LDdC6Kez0bdrgEYed5eXFK2Z1viKZJCGRlhd06rBusyztA==", + "optional": true + }, + "@next/swc-win32-ia32-msvc": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.3.0.tgz", + "integrity": "sha512-4aB7K9mcVK1lYEzpOpqWrXHEZympU3oK65fnNcY1Qc4HLJFLJj8AViuqQd4jjjPNuV4sl8jAwTz3gN5VNGWB7w==", + "optional": true + }, + "@next/swc-win32-x64-msvc": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.3.0.tgz", + "integrity": "sha512-Reer6rkLLcoOvB0dd66+Y7WrWVFH7sEEkF/4bJCIfsSKnTStTYaHtwIJAwbqnt9I392Tqvku0KkoqZOryWV9LQ==", + "optional": true + }, + "@prisma/client": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@prisma/client/-/client-4.12.0.tgz", + "integrity": "sha512-j9/ighfWwux97J2dS15nqhl60tYoH8V0IuSsgZDb6bCFcQD3fXbXmxjYC8GHhIgOk3lB7Pq+8CwElz2MiDpsSg==", + "requires": { + "@prisma/engines-version": "4.12.0-67.659ef412370fa3b41cd7bf6e94587c1dfb7f67e7" + } + }, + "@prisma/engines": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-4.12.0.tgz", + "integrity": "sha512-0alKtnxhNB5hYU+ymESBlGI4b9XrGGSdv7Ud+8TE/fBNOEhIud0XQsAR+TrvUZgS4na5czubiMsODw0TUrgkIA==", + "devOptional": true + }, + "@prisma/engines-version": { + "version": "4.12.0-67.659ef412370fa3b41cd7bf6e94587c1dfb7f67e7", + "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-4.12.0-67.659ef412370fa3b41cd7bf6e94587c1dfb7f67e7.tgz", + "integrity": "sha512-JIHNj5jlXb9mcaJwakM0vpgRYJIAurxTUqM0iX0tfEQA5XLZ9ONkIckkhuAKdAzocZ+80GYg7QSsfpjg7OxbOA==" + }, + "@sinclair/typebox": { + "version": "0.25.24", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.25.24.tgz", + "integrity": "sha512-XJfwUVUKDHF5ugKwIcxEgc9k8b7HbznCp6eUfWgu710hMPNIO4aw4/zB5RogDQz8nd6gyCDpU9O/m6qYEWY6yQ==", + "dev": true + }, + "@sinonjs/commons": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-2.0.0.tgz", + "integrity": "sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==", + "dev": true, + "requires": { + "type-detect": "4.0.8" + } + }, + "@sinonjs/fake-timers": { + "version": "10.0.2", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.0.2.tgz", + "integrity": "sha512-SwUDyjWnah1AaNl7kxsa7cfLhlTYoiyhDAIgyh+El30YvXs/o7OLXpYH88Zdhyx9JExKrmHDJ+10bwIcY80Jmw==", + "dev": true, + "requires": { + "@sinonjs/commons": "^2.0.0" + } + }, + "@swc/helpers": { + "version": "0.4.14", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.4.14.tgz", + "integrity": "sha512-4C7nX/dvpzB7za4Ql9K81xK3HPxCpHMgwTZVyf+9JQ6VUbn9jjZVN7/Nkdz/Ugzs2CSjqnL/UPXroiVBVHUWUw==", + "requires": { + "tslib": "^2.4.0" + } + }, + "@tsconfig/node10": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", + "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==" + }, + "@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==" + }, + "@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==" + }, + "@tsconfig/node16": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz", + "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==" + }, + "@types/babel__core": { + "version": "7.20.0", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.0.tgz", + "integrity": "sha512-+n8dL/9GWblDO0iU6eZAwEIJVr5DWigtle+Q6HLOrh/pdbXOhOtqzq8VPPE2zvNJzSKY4vH/z3iT3tn0A3ypiQ==", + "dev": true, + "requires": { + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "@types/babel__generator": { + "version": "7.6.4", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.4.tgz", + "integrity": "sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg==", + "dev": true, + "requires": { + "@babel/types": "^7.0.0" + } + }, + "@types/babel__template": { + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.1.tgz", + "integrity": "sha512-azBFKemX6kMg5Io+/rdGT0dkGreboUVR0Cdm3fz9QJWpaQGJRQXl7C+6hOTCZcMll7KFyEQpgbYI2lHdsS4U7g==", + "dev": true, + "requires": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "@types/babel__traverse": { + "version": "7.18.3", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.18.3.tgz", + "integrity": "sha512-1kbcJ40lLB7MHsj39U4Sh1uTd2E7rLEa79kmDpI6cy+XiXsteB3POdQomoq4FxszMrO3ZYchkhYJw7A2862b3w==", + "dev": true, + "requires": { + "@babel/types": "^7.3.0" + } + }, + "@types/body-parser": { + "version": "1.19.2", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz", + "integrity": "sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==", + "dev": true, + "requires": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "@types/connect": { + "version": "3.4.35", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", + "integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@types/cors": { + "version": "2.8.13", + "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.13.tgz", + "integrity": "sha512-RG8AStHlUiV5ysZQKq97copd2UmVYw3/pRMLefISZ3S1hK104Cwm7iLQ3fTKx+lsUH2CE8FlLaYeEA2LSeqYUA==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@types/express": { + "version": "4.17.17", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.17.tgz", + "integrity": "sha512-Q4FmmuLGBG58btUnfS1c1r/NQdlp3DMfGDGig8WhfpA2YRUtEkxAjkZb0yvplJGYdF1fsQ81iMDcH24sSCNC/Q==", + "dev": true, + "requires": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^4.17.33", + "@types/qs": "*", + "@types/serve-static": "*" + } + }, + "@types/express-serve-static-core": { + "version": "4.17.33", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.33.tgz", + "integrity": "sha512-TPBqmR/HRYI3eC2E5hmiivIzv+bidAfXofM+sbonAGvyDhySGw9/PQZFt2BLOrjUUR++4eJVpx6KnLQK1Fk9tA==", + "dev": true, + "requires": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*" + } + }, + "@types/graceful-fs": { + "version": "4.1.6", + "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.6.tgz", + "integrity": "sha512-Sig0SNORX9fdW+bQuTEovKj3uHcUL6LQKbCrrqb1X7J6/ReAbhCXRAhc+SMejhLELFj2QcyuxmUooZ4bt5ReSw==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@types/istanbul-lib-coverage": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", + "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", + "dev": true + }, + "@types/istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "*" + } + }, + "@types/istanbul-reports": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz", + "integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==", + "dev": true, + "requires": { + "@types/istanbul-lib-report": "*" + } + }, + "@types/jest": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.0.tgz", + "integrity": "sha512-3Emr5VOl/aoBwnWcH/EFQvlSAmjV+XtV9GGu5mwdYew5vhQh0IUZx/60x0TzHDu09Bi7HMx10t/namdJw5QIcg==", + "dev": true, + "requires": { + "expect": "^29.0.0", + "pretty-format": "^29.0.0" + } + }, + "@types/jsonwebtoken": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-9.0.1.tgz", + "integrity": "sha512-c5ltxazpWabia/4UzhIoaDcIza4KViOQhdbjRlfcIGVnsE3c3brkz9Z+F/EeJIECOQP7W7US2hNE930cWWkPiw==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@types/mime": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-3.0.1.tgz", + "integrity": "sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA==", + "dev": true + }, + "@types/node": { + "version": "18.15.11", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.11.tgz", + "integrity": "sha512-E5Kwq2n4SbMzQOn6wnmBjuK9ouqlURrcZDVfbo9ftDDTFt3nk7ZKK4GMOzoYgnpQJKcxwQw+lGaBvvlMo0qN/Q==" + }, + "@types/node-schedule": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/node-schedule/-/node-schedule-2.1.0.tgz", + "integrity": "sha512-NiTwl8YN3v/1YCKrDFSmCTkVxFDylueEqsOFdgF+vPsm+AlyJKGAo5yzX1FiOxPsZiN6/r8gJitYx2EaSuBmmg==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@types/prettier": { + "version": "2.7.2", + "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.2.tgz", + "integrity": "sha512-KufADq8uQqo1pYKVIYzfKbJfBAc0sOeXqGbFaSpv8MRmC/zXgowNZmFcbngndGk922QDmOASEXUZCaY48gs4cg==", + "dev": true + }, + "@types/qs": { + "version": "6.9.7", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", + "integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==", + "dev": true + }, + "@types/range-parser": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz", + "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==", + "dev": true + }, + "@types/serve-static": { + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.1.tgz", + "integrity": "sha512-NUo5XNiAdULrJENtJXZZ3fHtfMolzZwczzBbnAeBbqBwG+LaG6YaJtuwzwGSQZ2wsCrxjEhNNjAkKigy3n8teQ==", + "dev": true, + "requires": { + "@types/mime": "*", + "@types/node": "*" + } + }, + "@types/stack-utils": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", + "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==", + "dev": true + }, + "@types/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-rFT3ak0/2trgvp4yYZo5iKFEPsET7vKydKF+VRCxlQ9bpheehyAJH89dAkaLEq/j/RZXJIqcgsmPJKUP1Z28HA==", + "dev": true + }, + "@types/validator": { + "version": "13.7.15", + "resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.7.15.tgz", + "integrity": "sha512-yeinDVQunb03AEP8luErFcyf/7Lf7AzKCD0NXfgVoGCCQDNpZET8Jgq74oBgqKld3hafLbfzt/3inUdQvaFeXQ==" + }, + "@types/yargs": { + "version": "17.0.24", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.24.tgz", + "integrity": "sha512-6i0aC7jV6QzQB8ne1joVZ0eSFIstHsCrobmOtghM11yGlH0j43FKL2UhWdELkyps0zuf7qVTUVCCR+tgSlyLLw==", + "dev": true, + "requires": { + "@types/yargs-parser": "*" + } + }, + "@types/yargs-parser": { + "version": "21.0.0", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz", + "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==", + "dev": true + }, + "abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "dev": true + }, + "accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "requires": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + } + }, + "acorn": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==" + }, + "acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==" + }, + "ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "dev": true, + "requires": { + "type-fest": "^0.21.3" + } + }, + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + }, + "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, + "requires": { + "color-convert": "^2.0.1" + } + }, + "anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" + }, + "babel-jest": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.5.0.tgz", + "integrity": "sha512-mA4eCDh5mSo2EcA9xQjVTpmbbNk32Zb3Q3QFQsNhaK56Q+yoXowzFodLux30HRgyOho5rsQ6B0P9QpMkvvnJ0Q==", + "dev": true, + "requires": { + "@jest/transform": "^29.5.0", + "@types/babel__core": "^7.1.14", + "babel-plugin-istanbul": "^6.1.1", + "babel-preset-jest": "^29.5.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "slash": "^3.0.0" + } + }, + "babel-plugin-istanbul": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", + "integrity": "sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-instrument": "^5.0.4", + "test-exclude": "^6.0.0" + } + }, + "babel-plugin-jest-hoist": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.5.0.tgz", + "integrity": "sha512-zSuuuAlTMT4mzLj2nPnUm6fsE6270vdOfnpbJ+RmruU75UhLFvL0N2NgI7xpeS7NaB6hGqmd5pVpGTDYvi4Q3w==", + "dev": true, + "requires": { + "@babel/template": "^7.3.3", + "@babel/types": "^7.3.3", + "@types/babel__core": "^7.1.14", + "@types/babel__traverse": "^7.0.6" + } + }, + "babel-preset-current-node-syntax": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz", + "integrity": "sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ==", + "dev": true, + "requires": { + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-bigint": "^7.8.3", + "@babel/plugin-syntax-class-properties": "^7.8.3", + "@babel/plugin-syntax-import-meta": "^7.8.3", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.8.3", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.8.3", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-top-level-await": "^7.8.3" + } + }, + "babel-preset-jest": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.5.0.tgz", + "integrity": "sha512-JOMloxOqdiBSxMAzjRaH023/vvcaSaec49zvg+2LmNsktC7ei39LTJGw02J+9uUtTZUq6xbLyJ4dxe9sSmIuAg==", + "dev": true, + "requires": { + "babel-plugin-jest-hoist": "^29.5.0", + "babel-preset-current-node-syntax": "^1.0.0" + } + }, + "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 + }, + "binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true + }, + "body-parser": { + "version": "1.20.1", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", + "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", + "requires": { + "bytes": "3.1.2", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.11.0", + "raw-body": "2.5.1", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + } + }, + "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, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "browserslist": { + "version": "4.21.5", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.5.tgz", + "integrity": "sha512-tUkiguQGW7S3IhB7N+c2MV/HZPSCPAAiYBZXLsBhFB/PCy6ZKKsZrmBayHV9fdGV/ARIfJ14NkxKzRDjvp7L6w==", + "dev": true, + "requires": { + "caniuse-lite": "^1.0.30001449", + "electron-to-chromium": "^1.4.284", + "node-releases": "^2.0.8", + "update-browserslist-db": "^1.0.10" + } + }, + "bs-logger": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz", + "integrity": "sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==", + "dev": true, + "requires": { + "fast-json-stable-stringify": "2.x" + } + }, + "bser": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", + "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", + "dev": true, + "requires": { + "node-int64": "^0.4.0" + } + }, + "buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==" + }, + "buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, + "busboy": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", + "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", + "requires": { + "streamsearch": "^1.1.0" + } + }, + "bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==" + }, + "call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } + }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true + }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + }, + "caniuse-lite": { + "version": "1.0.30001480", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001480.tgz", + "integrity": "sha512-q7cpoPPvZYgtyC4VaBSN0Bt+PJ4c4EYRf0DrduInOz2SkFpHD5p3LnvEpqBp7UnJn+8x1Ogl1s38saUxe+ihQQ==" + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "char-regex": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz", + "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", + "dev": true + }, + "chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "requires": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "fsevents": "~2.3.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + } + }, + "ci-info": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.8.0.tgz", + "integrity": "sha512-eXTggHWSooYhq49F2opQhuHWgzucfF2YgODK4e1566GQs5BIfP30B0oenwBJHfWxAs2fyPB1s7Mg949zLf61Yw==", + "dev": true + }, + "cjs-module-lexer": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.2.tgz", + "integrity": "sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA==", + "dev": true + }, + "class-transformer": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/class-transformer/-/class-transformer-0.5.1.tgz", + "integrity": "sha512-SQa1Ws6hUbfC98vKGxZH3KFY0Y1lm5Zm0SY8XX9zbK7FJCyVEac3ATW0RIpwzW+oOfmHE5PMPufDG9hCfoEOMw==" + }, + "class-validator": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/class-validator/-/class-validator-0.14.0.tgz", + "integrity": "sha512-ct3ltplN8I9fOwUd8GrP8UQixwff129BkEtuWDKL5W45cQuLd19xqmTLu5ge78YDm/fdje6FMt0hGOhl0lii3A==", + "requires": { + "@types/validator": "^13.7.10", + "libphonenumber-js": "^1.10.14", + "validator": "^13.7.0" + } + }, + "classnames": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.3.2.tgz", + "integrity": "sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw==" + }, + "client-only": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", + "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==" + }, + "cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + } + }, + "clone": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", + "integrity": "sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==" + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==", + "dev": true + }, + "collect-v8-coverage": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz", + "integrity": "sha512-iBPtljfCNcTKNAto0KEtDfZ3qzjJvqE3aTGZsbhjSBlorqpXJlaWWtPO35D+ZImoC3KWejX64o+yPGxhWSTzfg==", + "dev": true + }, + "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, + "requires": { + "color-name": "~1.1.4" + } + }, + "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 + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "requires": { + "safe-buffer": "5.2.1" + } + }, + "content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==" + }, + "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 + }, + "cookie": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", + "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==" + }, + "cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" + }, + "cors": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "requires": { + "object-assign": "^4", + "vary": "^1" + } + }, + "create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==" + }, + "cron-parser": { + "version": "4.8.1", + "resolved": "https://registry.npmjs.org/cron-parser/-/cron-parser-4.8.1.tgz", + "integrity": "sha512-jbokKWGcyU4gl6jAfX97E1gDpY12DJ1cLJZmoDzaAln/shZ+S3KBFBuA2Q6WeUN4gJf/8klnV1EfvhA2lK5IRQ==", + "requires": { + "luxon": "^3.2.1" + } + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "dedent": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz", + "integrity": "sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA==", + "dev": true + }, + "deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "dev": true + }, + "depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==" + }, + "destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==" + }, + "detect-newline": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", + "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", + "dev": true + }, + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==" + }, + "diff-sequences": { + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.4.3.tgz", + "integrity": "sha512-ofrBgwpPhCD85kMKtE9RYFFq6OC1A89oW2vvgWZNCwxrUpRUILopY7lsYyMDSjc8g6U6aiO0Qubg6r4Wgt5ZnA==", + "dev": true + }, + "dotenv": { + "version": "16.0.3", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz", + "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==" + }, + "ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" + }, + "electron-to-chromium": { + "version": "1.4.365", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.365.tgz", + "integrity": "sha512-FRHZO+1tUNO4TOPXmlxetkoaIY8uwHzd1kKopK/Gx2SKn1L47wJXWD44wxP5CGRyyP98z/c8e1eBzJrgPeiBOg==", + "dev": true + }, + "emittery": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.13.1.tgz", + "integrity": "sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==", + "dev": true + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==" + }, + "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==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" + }, + "escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "dev": true + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==" + }, + "execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + } + }, + "exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==", + "dev": true + }, + "expect": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-29.5.0.tgz", + "integrity": "sha512-yM7xqUrCO2JdpFo4XpM82t+PJBFybdqoQuJLDGeDX2ij8NZzqRHyu3Hp188/JX7SWqud+7t4MUdvcgGBICMHZg==", + "dev": true, + "requires": { + "@jest/expect-utils": "^29.5.0", + "jest-get-type": "^29.4.3", + "jest-matcher-utils": "^29.5.0", + "jest-message-util": "^29.5.0", + "jest-util": "^29.5.0" + } + }, + "express": { + "version": "4.18.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", + "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==", + "requires": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.1", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.5.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.2.0", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.7", + "qs": "6.11.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.18.0", + "serve-static": "1.15.0", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + } + }, + "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 + }, + "fb-watchman": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", + "integrity": "sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==", + "dev": true, + "requires": { + "bser": "2.1.1" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "finalhandler": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", + "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" + } + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==" + }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==" + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "optional": true + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "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 + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true + }, + "get-intrinsic": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz", + "integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==", + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.3" + } + }, + "get-package-type": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", + "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", + "dev": true + }, + "get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true + }, + "glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "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, + "requires": { + "is-glob": "^4.0.1" + } + }, + "globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true + }, + "graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "requires": { + "function-bind": "^1.1.1" + } + }, + "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 + }, + "has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" + }, + "html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true + }, + "http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "requires": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + } + }, + "human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true + }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "dev": true + }, + "import-local": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", + "integrity": "sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==", + "dev": true, + "requires": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "dev": true + }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "is-core-module": { + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.0.tgz", + "integrity": "sha512-RECHCBCd/viahWmwj6enj19sKbHfJrddi/6cBDsNTKbNq0f7VeaUkBo60BqzvPqo/W54ChS62Z5qyun7cfOMqQ==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "is-generator-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", + "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", + "dev": true + }, + "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, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "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 + }, + "is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "istanbul-lib-coverage": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", + "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==", + "dev": true + }, + "istanbul-lib-instrument": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz", + "integrity": "sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==", + "dev": true, + "requires": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^6.3.0" + } + }, + "istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", + "dev": true, + "requires": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^3.0.0", + "supports-color": "^7.1.0" + } + }, + "istanbul-lib-source-maps": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", + "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } + } + }, + "istanbul-reports": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.5.tgz", + "integrity": "sha512-nUsEMa9pBt/NOHqbcbeJEgqIlY/K7rVWUX6Lql2orY5e9roQOthbR3vtY4zzf2orPELg80fnxxk9zUyPlgwD1w==", + "dev": true, + "requires": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + } + }, + "jest": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest/-/jest-29.5.0.tgz", + "integrity": "sha512-juMg3he2uru1QoXX078zTa7pO85QyB9xajZc6bU+d9yEGwrKX6+vGmJQ3UdVZsvTEUARIdObzH68QItim6OSSQ==", + "dev": true, + "requires": { + "@jest/core": "^29.5.0", + "@jest/types": "^29.5.0", + "import-local": "^3.0.2", + "jest-cli": "^29.5.0" + } + }, + "jest-changed-files": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.5.0.tgz", + "integrity": "sha512-IFG34IUMUaNBIxjQXF/iu7g6EcdMrGRRxaUSw92I/2g2YC6vCdTltl4nHvt7Ci5nSJwXIkCu8Ka1DKF+X7Z1Ag==", + "dev": true, + "requires": { + "execa": "^5.0.0", + "p-limit": "^3.1.0" + } + }, + "jest-circus": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.5.0.tgz", + "integrity": "sha512-gq/ongqeQKAplVxqJmbeUOJJKkW3dDNPY8PjhJ5G0lBRvu0e3EWGxGy5cI4LAGA7gV2UHCtWBI4EMXK8c9nQKA==", + "dev": true, + "requires": { + "@jest/environment": "^29.5.0", + "@jest/expect": "^29.5.0", + "@jest/test-result": "^29.5.0", + "@jest/types": "^29.5.0", + "@types/node": "*", + "chalk": "^4.0.0", + "co": "^4.6.0", + "dedent": "^0.7.0", + "is-generator-fn": "^2.0.0", + "jest-each": "^29.5.0", + "jest-matcher-utils": "^29.5.0", + "jest-message-util": "^29.5.0", + "jest-runtime": "^29.5.0", + "jest-snapshot": "^29.5.0", + "jest-util": "^29.5.0", + "p-limit": "^3.1.0", + "pretty-format": "^29.5.0", + "pure-rand": "^6.0.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + } + }, + "jest-cli": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.5.0.tgz", + "integrity": "sha512-L1KcP1l4HtfwdxXNFCL5bmUbLQiKrakMUriBEcc1Vfz6gx31ORKdreuWvmQVBit+1ss9NNR3yxjwfwzZNdQXJw==", + "dev": true, + "requires": { + "@jest/core": "^29.5.0", + "@jest/test-result": "^29.5.0", + "@jest/types": "^29.5.0", + "chalk": "^4.0.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "import-local": "^3.0.2", + "jest-config": "^29.5.0", + "jest-util": "^29.5.0", + "jest-validate": "^29.5.0", + "prompts": "^2.0.1", + "yargs": "^17.3.1" + } + }, + "jest-config": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.5.0.tgz", + "integrity": "sha512-kvDUKBnNJPNBmFFOhDbm59iu1Fii1Q6SxyhXfvylq3UTHbg6o7j/g8k2dZyXWLvfdKB1vAPxNZnMgtKJcmu3kA==", + "dev": true, + "requires": { + "@babel/core": "^7.11.6", + "@jest/test-sequencer": "^29.5.0", + "@jest/types": "^29.5.0", + "babel-jest": "^29.5.0", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "deepmerge": "^4.2.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-circus": "^29.5.0", + "jest-environment-node": "^29.5.0", + "jest-get-type": "^29.4.3", + "jest-regex-util": "^29.4.3", + "jest-resolve": "^29.5.0", + "jest-runner": "^29.5.0", + "jest-util": "^29.5.0", + "jest-validate": "^29.5.0", + "micromatch": "^4.0.4", + "parse-json": "^5.2.0", + "pretty-format": "^29.5.0", + "slash": "^3.0.0", + "strip-json-comments": "^3.1.1" + } + }, + "jest-diff": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.5.0.tgz", + "integrity": "sha512-LtxijLLZBduXnHSniy0WMdaHjmQnt3g5sa16W4p0HqukYTTsyTW3GD1q41TyGl5YFXj/5B2U6dlh5FM1LIMgxw==", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "diff-sequences": "^29.4.3", + "jest-get-type": "^29.4.3", + "pretty-format": "^29.5.0" + } + }, + "jest-docblock": { + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.4.3.tgz", + "integrity": "sha512-fzdTftThczeSD9nZ3fzA/4KkHtnmllawWrXO69vtI+L9WjEIuXWs4AmyME7lN5hU7dB0sHhuPfcKofRsUb/2Fg==", + "dev": true, + "requires": { + "detect-newline": "^3.0.0" + } + }, + "jest-each": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.5.0.tgz", + "integrity": "sha512-HM5kIJ1BTnVt+DQZ2ALp3rzXEl+g726csObrW/jpEGl+CDSSQpOJJX2KE/vEg8cxcMXdyEPu6U4QX5eruQv5hA==", + "dev": true, + "requires": { + "@jest/types": "^29.5.0", + "chalk": "^4.0.0", + "jest-get-type": "^29.4.3", + "jest-util": "^29.5.0", + "pretty-format": "^29.5.0" + } + }, + "jest-environment-node": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.5.0.tgz", + "integrity": "sha512-ExxuIK/+yQ+6PRGaHkKewYtg6hto2uGCgvKdb2nfJfKXgZ17DfXjvbZ+jA1Qt9A8EQSfPnt5FKIfnOO3u1h9qw==", + "dev": true, + "requires": { + "@jest/environment": "^29.5.0", + "@jest/fake-timers": "^29.5.0", + "@jest/types": "^29.5.0", + "@types/node": "*", + "jest-mock": "^29.5.0", + "jest-util": "^29.5.0" + } + }, + "jest-get-type": { + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.4.3.tgz", + "integrity": "sha512-J5Xez4nRRMjk8emnTpWrlkyb9pfRQQanDrvWHhsR1+VUfbwxi30eVcZFlcdGInRibU4G5LwHXpI7IRHU0CY+gg==", + "dev": true + }, + "jest-haste-map": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.5.0.tgz", + "integrity": "sha512-IspOPnnBro8YfVYSw6yDRKh/TiCdRngjxeacCps1cQ9cgVN6+10JUcuJ1EabrgYLOATsIAigxA0rLR9x/YlrSA==", + "dev": true, + "requires": { + "@jest/types": "^29.5.0", + "@types/graceful-fs": "^4.1.3", + "@types/node": "*", + "anymatch": "^3.0.3", + "fb-watchman": "^2.0.0", + "fsevents": "^2.3.2", + "graceful-fs": "^4.2.9", + "jest-regex-util": "^29.4.3", + "jest-util": "^29.5.0", + "jest-worker": "^29.5.0", + "micromatch": "^4.0.4", + "walker": "^1.0.8" + } + }, + "jest-leak-detector": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.5.0.tgz", + "integrity": "sha512-u9YdeeVnghBUtpN5mVxjID7KbkKE1QU4f6uUwuxiY0vYRi9BUCLKlPEZfDGR67ofdFmDz9oPAy2G92Ujrntmow==", + "dev": true, + "requires": { + "jest-get-type": "^29.4.3", + "pretty-format": "^29.5.0" + } + }, + "jest-matcher-utils": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.5.0.tgz", + "integrity": "sha512-lecRtgm/rjIK0CQ7LPQwzCs2VwW6WAahA55YBuI+xqmhm7LAaxokSB8C97yJeYyT+HvQkH741StzpU41wohhWw==", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "jest-diff": "^29.5.0", + "jest-get-type": "^29.4.3", + "pretty-format": "^29.5.0" + } + }, + "jest-message-util": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.5.0.tgz", + "integrity": "sha512-Kijeg9Dag6CKtIDA7O21zNTACqD5MD/8HfIV8pdD94vFyFuer52SigdC3IQMhab3vACxXMiFk+yMHNdbqtyTGA==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.12.13", + "@jest/types": "^29.5.0", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "micromatch": "^4.0.4", + "pretty-format": "^29.5.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + } + }, + "jest-mock": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.5.0.tgz", + "integrity": "sha512-GqOzvdWDE4fAV2bWQLQCkujxYWL7RxjCnj71b5VhDAGOevB3qj3Ovg26A5NI84ZpODxyzaozXLOh2NCgkbvyaw==", + "dev": true, + "requires": { + "@jest/types": "^29.5.0", + "@types/node": "*", + "jest-util": "^29.5.0" + } + }, + "jest-pnp-resolver": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz", + "integrity": "sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==", + "dev": true, + "requires": {} + }, + "jest-regex-util": { + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.4.3.tgz", + "integrity": "sha512-O4FglZaMmWXbGHSQInfXewIsd1LMn9p3ZXB/6r4FOkyhX2/iP/soMG98jGvk/A3HAN78+5VWcBGO0BJAPRh4kg==", + "dev": true + }, + "jest-resolve": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.5.0.tgz", + "integrity": "sha512-1TzxJ37FQq7J10jPtQjcc+MkCkE3GBpBecsSUWJ0qZNJpmg6m0D9/7II03yJulm3H/fvVjgqLh/k2eYg+ui52w==", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.5.0", + "jest-pnp-resolver": "^1.2.2", + "jest-util": "^29.5.0", + "jest-validate": "^29.5.0", + "resolve": "^1.20.0", + "resolve.exports": "^2.0.0", + "slash": "^3.0.0" + } + }, + "jest-resolve-dependencies": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.5.0.tgz", + "integrity": "sha512-sjV3GFr0hDJMBpYeUuGduP+YeCRbd7S/ck6IvL3kQ9cpySYKqcqhdLLC2rFwrcL7tz5vYibomBrsFYWkIGGjOg==", + "dev": true, + "requires": { + "jest-regex-util": "^29.4.3", + "jest-snapshot": "^29.5.0" + } + }, + "jest-runner": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.5.0.tgz", + "integrity": "sha512-m7b6ypERhFghJsslMLhydaXBiLf7+jXy8FwGRHO3BGV1mcQpPbwiqiKUR2zU2NJuNeMenJmlFZCsIqzJCTeGLQ==", + "dev": true, + "requires": { + "@jest/console": "^29.5.0", + "@jest/environment": "^29.5.0", + "@jest/test-result": "^29.5.0", + "@jest/transform": "^29.5.0", + "@jest/types": "^29.5.0", + "@types/node": "*", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "graceful-fs": "^4.2.9", + "jest-docblock": "^29.4.3", + "jest-environment-node": "^29.5.0", + "jest-haste-map": "^29.5.0", + "jest-leak-detector": "^29.5.0", + "jest-message-util": "^29.5.0", + "jest-resolve": "^29.5.0", + "jest-runtime": "^29.5.0", + "jest-util": "^29.5.0", + "jest-watcher": "^29.5.0", + "jest-worker": "^29.5.0", + "p-limit": "^3.1.0", + "source-map-support": "0.5.13" + } + }, + "jest-runtime": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.5.0.tgz", + "integrity": "sha512-1Hr6Hh7bAgXQP+pln3homOiEZtCDZFqwmle7Ew2j8OlbkIu6uE3Y/etJQG8MLQs3Zy90xrp2C0BRrtPHG4zryw==", + "dev": true, + "requires": { + "@jest/environment": "^29.5.0", + "@jest/fake-timers": "^29.5.0", + "@jest/globals": "^29.5.0", + "@jest/source-map": "^29.4.3", + "@jest/test-result": "^29.5.0", + "@jest/transform": "^29.5.0", + "@jest/types": "^29.5.0", + "@types/node": "*", + "chalk": "^4.0.0", + "cjs-module-lexer": "^1.0.0", + "collect-v8-coverage": "^1.0.0", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.5.0", + "jest-message-util": "^29.5.0", + "jest-mock": "^29.5.0", + "jest-regex-util": "^29.4.3", + "jest-resolve": "^29.5.0", + "jest-snapshot": "^29.5.0", + "jest-util": "^29.5.0", + "slash": "^3.0.0", + "strip-bom": "^4.0.0" + } + }, + "jest-snapshot": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.5.0.tgz", + "integrity": "sha512-x7Wolra5V0tt3wRs3/ts3S6ciSQVypgGQlJpz2rsdQYoUKxMxPNaoHMGJN6qAuPJqS+2iQ1ZUn5kl7HCyls84g==", + "dev": true, + "requires": { + "@babel/core": "^7.11.6", + "@babel/generator": "^7.7.2", + "@babel/plugin-syntax-jsx": "^7.7.2", + "@babel/plugin-syntax-typescript": "^7.7.2", + "@babel/traverse": "^7.7.2", + "@babel/types": "^7.3.3", + "@jest/expect-utils": "^29.5.0", + "@jest/transform": "^29.5.0", + "@jest/types": "^29.5.0", + "@types/babel__traverse": "^7.0.6", + "@types/prettier": "^2.1.5", + "babel-preset-current-node-syntax": "^1.0.0", + "chalk": "^4.0.0", + "expect": "^29.5.0", + "graceful-fs": "^4.2.9", + "jest-diff": "^29.5.0", + "jest-get-type": "^29.4.3", + "jest-matcher-utils": "^29.5.0", + "jest-message-util": "^29.5.0", + "jest-util": "^29.5.0", + "natural-compare": "^1.4.0", + "pretty-format": "^29.5.0", + "semver": "^7.3.5" + }, + "dependencies": { + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "semver": { + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz", + "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + } + } + }, + "jest-util": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.5.0.tgz", + "integrity": "sha512-RYMgG/MTadOr5t8KdhejfvUU82MxsCu5MF6KuDUHl+NuwzUt+Sm6jJWxTJVrDR1j5M/gJVCPKQEpWXY+yIQ6lQ==", + "dev": true, + "requires": { + "@jest/types": "^29.5.0", + "@types/node": "*", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "graceful-fs": "^4.2.9", + "picomatch": "^2.2.3" + } + }, + "jest-validate": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.5.0.tgz", + "integrity": "sha512-pC26etNIi+y3HV8A+tUGr/lph9B18GnzSRAkPaaZJIE1eFdiYm6/CewuiJQ8/RlfHd1u/8Ioi8/sJ+CmbA+zAQ==", + "dev": true, + "requires": { + "@jest/types": "^29.5.0", + "camelcase": "^6.2.0", + "chalk": "^4.0.0", + "jest-get-type": "^29.4.3", + "leven": "^3.1.0", + "pretty-format": "^29.5.0" + }, + "dependencies": { + "camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true + } + } + }, + "jest-watcher": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.5.0.tgz", + "integrity": "sha512-KmTojKcapuqYrKDpRwfqcQ3zjMlwu27SYext9pt4GlF5FUgB+7XE1mcCnSm6a4uUpFyQIkb6ZhzZvHl+jiBCiA==", + "dev": true, + "requires": { + "@jest/test-result": "^29.5.0", + "@jest/types": "^29.5.0", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "jest-util": "^29.5.0", + "string-length": "^4.0.1" + } + }, + "jest-worker": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.5.0.tgz", + "integrity": "sha512-NcrQnevGoSp4b5kg+akIpthoAFHxPBcb5P6mYPY0fUNT+sSvmtu6jlkEle3anczUKIKEbMxFimk9oTP/tpIPgA==", + "dev": true, + "requires": { + "@types/node": "*", + "jest-util": "^29.5.0", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "dependencies": { + "supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "dev": true + }, + "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==", + "dev": true + }, + "json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true + }, + "jsonwebtoken": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.0.tgz", + "integrity": "sha512-tuGfYXxkQGDPnLJ7SibiQgVgeDgfbPq2k2ICcbgqW8WxWLBAxKQM/ZCu/IT8SOSwmaYl4dpTFCW5xZv7YbbWUw==", + "requires": { + "jws": "^3.2.2", + "lodash": "^4.17.21", + "ms": "^2.1.1", + "semver": "^7.3.8" + }, + "dependencies": { + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "requires": { + "yallist": "^4.0.0" + } + }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "semver": { + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz", + "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==", + "requires": { + "lru-cache": "^6.0.0" + } + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + } + } + }, + "jwa": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", + "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", + "requires": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "jws": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", + "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", + "requires": { + "jwa": "^1.4.1", + "safe-buffer": "^5.0.1" + } + }, + "kleur": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", + "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", + "dev": true + }, + "le-coffre-resources": { + "version": "git+ssh://git@github.com/smart-chain-fr/leCoffre-resources.git#22f4851fa87489634ea0a629ec040a44e7aa5fb9", + "from": "le-coffre-resources@git@github.com:smart-chain-fr/leCoffre-resources.git#v2.19", + "requires": { + "class-transformer": "^0.5.1", + "class-validator": "^0.14.0" + } + }, + "leven": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", + "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", + "dev": true + }, + "libphonenumber-js": { + "version": "1.10.26", + "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.10.26.tgz", + "integrity": "sha512-oB3l4J5gEhMV+ymmlIjWedsbCpsNRqbEZ/E/MpN2QVyinKNra6DcuXywxSk/72M3DZDoH/6kzurOq1erznBMwQ==" + }, + "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==", + "dev": true + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "lodash.memoize": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", + "integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==", + "dev": true + }, + "long-timeout": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/long-timeout/-/long-timeout-0.1.1.tgz", + "integrity": "sha512-BFRuQUqc7x2NWxfJBCyUrN8iYUYznzL9JROmRz1gZ6KlOIgmoD+njPVbb+VNn2nGMKggMsK79iUNErillsrx7w==" + }, + "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==", + "peer": true, + "requires": { + "js-tokens": "^3.0.0 || ^4.0.0" + } + }, + "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, + "requires": { + "yallist": "^3.0.2" + } + }, + "luxon": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/luxon/-/luxon-3.3.0.tgz", + "integrity": "sha512-An0UCfG/rSiqtAIiBPO0Y9/zAnHUZxAMiCpTd5h2smgsj7GGmcenvrvww2cqNA8/4A5ZrD1gJpHN2mIHZQF+Mg==" + }, + "make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "requires": { + "semver": "^6.0.0" + } + }, + "make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" + }, + "makeerror": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", + "integrity": "sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==", + "dev": true, + "requires": { + "tmpl": "1.0.5" + } + }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==" + }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" + }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==" + }, + "micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "requires": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + } + }, + "mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" + }, + "mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" + }, + "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==", + "requires": { + "mime-db": "1.52.0" + } + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "module-alias": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/module-alias/-/module-alias-2.2.2.tgz", + "integrity": "sha512-A/78XjoX2EmNvppVWEhM2oGk3x4lLxnkEA4jTbaK97QKSDjkIoOsKQlfylt/d3kKKi596Qy3NP5XrXJ6fZIC9Q==" + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, + "nanoid": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", + "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==" + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true + }, + "negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==" + }, + "next": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/next/-/next-13.3.0.tgz", + "integrity": "sha512-OVTw8MpIPa12+DCUkPqRGPS3thlJPcwae2ZL4xti3iBff27goH024xy4q2lhlsdoYiKOi8Kz6uJoLW/GXwgfOA==", + "requires": { + "@next/env": "13.3.0", + "@next/swc-darwin-arm64": "13.3.0", + "@next/swc-darwin-x64": "13.3.0", + "@next/swc-linux-arm64-gnu": "13.3.0", + "@next/swc-linux-arm64-musl": "13.3.0", + "@next/swc-linux-x64-gnu": "13.3.0", + "@next/swc-linux-x64-musl": "13.3.0", + "@next/swc-win32-arm64-msvc": "13.3.0", + "@next/swc-win32-ia32-msvc": "13.3.0", + "@next/swc-win32-x64-msvc": "13.3.0", + "@swc/helpers": "0.4.14", + "busboy": "1.6.0", + "caniuse-lite": "^1.0.30001406", + "postcss": "8.4.14", + "styled-jsx": "5.1.1" + } + }, + "node-cache": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/node-cache/-/node-cache-5.1.2.tgz", + "integrity": "sha512-t1QzWwnk4sjLWaQAS8CHgOJ+RAfmHpxFWmc36IWTiWHQfs0w5JDMBS1b1ZxQteo0vVVuWJvIUKHDkkeK7vIGCg==", + "requires": { + "clone": "2.x" + } + }, + "node-int64": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", + "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==", + "dev": true + }, + "node-releases": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.10.tgz", + "integrity": "sha512-5GFldHPXVG/YZmFzJvKK2zDSzPKhEp0+ZR5SVaoSag9fsL5YgHbUHDfnG5494ISANDcK4KwPXAx2xqVEydmd7w==", + "dev": true + }, + "node-schedule": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/node-schedule/-/node-schedule-2.1.1.tgz", + "integrity": "sha512-OXdegQq03OmXEjt2hZP33W2YPs/E5BcFQks46+G2gAxs4gHOIVD1u7EqlYLYSKsaIpyKCK9Gbk0ta1/gjRSMRQ==", + "requires": { + "cron-parser": "^4.2.0", + "long-timeout": "0.1.1", + "sorted-array-functions": "^1.3.0" + } + }, + "nodemon": { + "version": "2.0.22", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.22.tgz", + "integrity": "sha512-B8YqaKMmyuCO7BowF1Z1/mkPqLk6cs/l63Ojtd6otKjMx47Dq1utxfRxcavH1I7VSaL8n5BUaoutadnsX3AAVQ==", + "dev": true, + "requires": { + "chokidar": "^3.5.2", + "debug": "^3.2.7", + "ignore-by-default": "^1.0.1", + "minimatch": "^3.1.2", + "pstree.remy": "^1.1.8", + "semver": "^5.7.1", + "simple-update-notifier": "^1.0.7", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true + }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "nopt": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", + "integrity": "sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==", + "dev": true, + "requires": { + "abbrev": "1" + } + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true + }, + "npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "requires": { + "path-key": "^3.0.0" + } + }, + "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==" + }, + "object-inspect": { + "version": "1.12.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", + "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==" + }, + "on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "requires": { + "ee-first": "1.1.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "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, + "requires": { + "yocto-queue": "^0.1.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + }, + "dependencies": { + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + } + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "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==", + "dev": true, + "requires": { + "@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" + } + }, + "parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" + }, + "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 + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true + }, + "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 + }, + "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==", + "dev": true + }, + "path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" + }, + "picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" + }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true + }, + "pirates": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.5.tgz", + "integrity": "sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ==", + "dev": true + }, + "pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "requires": { + "find-up": "^4.0.0" + } + }, + "postcss": { + "version": "8.4.14", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.14.tgz", + "integrity": "sha512-E398TUmfAYFPBSdzgeieK2Y1+1cpdxJx8yXbK/m57nRhKSmk1GB2tO4lbLBtlkfPQTDKfe4Xqv1ASWPpayPEig==", + "requires": { + "nanoid": "^3.3.4", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + } + }, + "prettier": { + "version": "2.8.4", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.4.tgz", + "integrity": "sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw==", + "dev": true + }, + "pretty-format": { + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.5.0.tgz", + "integrity": "sha512-V2mGkI31qdttvTFX7Mt4efOqHXqJWMu4/r66Xh3Z3BwZaPfPJgp6/gbwoujRpPUtfEF6AUUWx3Jim3GCw5g/Qw==", + "dev": true, + "requires": { + "@jest/schemas": "^29.4.3", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true + } + } + }, + "prisma": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/prisma/-/prisma-4.12.0.tgz", + "integrity": "sha512-xqVper4mbwl32BWzLpdznHAYvYDWQQWK2tBfXjdUD397XaveRyAP7SkBZ6kFlIg8kKayF4hvuaVtYwXd9BodAg==", + "devOptional": true, + "requires": { + "@prisma/engines": "4.12.0" + } + }, + "prisma-query": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/prisma-query/-/prisma-query-2.0.0.tgz", + "integrity": "sha512-+5eneJrgTFxW48j4JaWJ8iBwFSH+YQRtA1N+QEzqsREnTEAbs1Bq85xoZP7ZNEXDsoLOoIo4rYfCYRozuVOB9Q==" + }, + "prompts": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", + "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", + "dev": true, + "requires": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.5" + } + }, + "proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "requires": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + } + }, + "pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true + }, + "pure-rand": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.0.1.tgz", + "integrity": "sha512-t+x1zEHDjBwkDGY5v5ApnZ/utcd4XYDiJsaQQoptTXgUXX95sDg1elCdJghzicm7n2mbCBJ3uYWr6M22SO19rg==", + "dev": true + }, + "qs": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", + "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "requires": { + "side-channel": "^1.0.4" + } + }, + "range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" + }, + "raw-body": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", + "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", + "requires": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + } + }, + "react": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", + "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", + "peer": true, + "requires": { + "loose-envify": "^1.1.0" + } + }, + "react-dom": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", + "integrity": "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==", + "peer": true, + "requires": { + "loose-envify": "^1.1.0", + "scheduler": "^0.23.0" + } + }, + "react-is": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", + "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", + "dev": true + }, + "readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "requires": { + "picomatch": "^2.2.1" + } + }, + "reflect-metadata": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", + "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==" + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true + }, + "resolve": { + "version": "1.22.3", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.3.tgz", + "integrity": "sha512-P8ur/gp/AmbEzjr729bZnLjXK5Z+4P0zhIJgBgzqRih7hL7BOukHGtSTA3ACMY467GRFz3duQsi0bDZdR7DKdw==", + "dev": true, + "requires": { + "is-core-module": "^2.12.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, + "resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "dev": true, + "requires": { + "resolve-from": "^5.0.0" + } + }, + "resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true + }, + "resolve.exports": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz", + "integrity": "sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==", + "dev": true + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "scheduler": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", + "integrity": "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==", + "peer": true, + "requires": { + "loose-envify": "^1.1.0" + } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + }, + "send": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", + "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "requires": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "dependencies": { + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + } + } + }, + "serve-static": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", + "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.18.0" + } + }, + "setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + }, + "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, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "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 + }, + "side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "requires": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + } + }, + "signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "simple-update-notifier": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-1.1.0.tgz", + "integrity": "sha512-VpsrsJSUcJEseSbMHkrsrAVSdvVS5I96Qo1QAQ4FxQ9wXFcB+pjj7FB7/us9+GcgfW4ziHtYMc1J0PLczb55mg==", + "dev": true, + "requires": { + "semver": "~7.0.0" + }, + "dependencies": { + "semver": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz", + "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==", + "dev": true + } + } + }, + "sisteransi": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", + "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", + "dev": true + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true + }, + "sorted-array-functions": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/sorted-array-functions/-/sorted-array-functions-1.3.0.tgz", + "integrity": "sha512-2sqgzeFlid6N4Z2fUQ1cvFmTOLRi/sEDzSQ0OKYchqgoPmQBVyM3959qYx3fpS6Esef80KjmpgPeEr028dP3OA==" + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "source-map-js": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==" + }, + "source-map-support": { + "version": "0.5.13", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", + "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "dev": true + }, + "stack-utils": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", + "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", + "dev": true, + "requires": { + "escape-string-regexp": "^2.0.0" + } + }, + "statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==" + }, + "streamsearch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", + "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==" + }, + "string-length": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", + "integrity": "sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==", + "dev": true, + "requires": { + "char-regex": "^1.0.2", + "strip-ansi": "^6.0.0" + } + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "strip-bom": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", + "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", + "dev": true + }, + "strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true + }, + "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 + }, + "styled-jsx": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.1.tgz", + "integrity": "sha512-pW7uC1l4mBZ8ugbiZrcIsiIvVx1UmTfw7UkC3Um2tmfUq9Bhk8IiyEIPl6F8agHgjzku6j0xQEZbfA5uSgSaCw==", + "requires": { + "client-only": "0.0.1" + } + }, + "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, + "requires": { + "has-flag": "^4.0.0" + } + }, + "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==", + "dev": true + }, + "test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "dev": true, + "requires": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + } + }, + "tmpl": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", + "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", + "dev": true + }, + "to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", + "dev": true + }, + "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, + "requires": { + "is-number": "^7.0.0" + } + }, + "toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==" + }, + "touch": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", + "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", + "dev": true, + "requires": { + "nopt": "~1.0.10" + } + }, + "ts-jest": { + "version": "29.1.0", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.0.tgz", + "integrity": "sha512-ZhNr7Z4PcYa+JjMl62ir+zPiNJfXJN6E8hSLnaUKhOgqcn8vb3e537cpkd0FuAfRK3sR1LSqM1MOhliXNgOFPA==", + "dev": true, + "requires": { + "bs-logger": "0.x", + "fast-json-stable-stringify": "2.x", + "jest-util": "^29.0.0", + "json5": "^2.2.3", + "lodash.memoize": "4.x", + "make-error": "1.x", + "semver": "7.x", + "yargs-parser": "^21.0.1" + }, + "dependencies": { + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "semver": { + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz", + "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + } + } + }, + "ts-node": { + "version": "10.9.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", + "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", + "requires": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + } + }, + "tslib": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", + "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==" + }, + "type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true + }, + "type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "dev": true + }, + "type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + } + }, + "typedi": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/typedi/-/typedi-0.10.0.tgz", + "integrity": "sha512-v3UJF8xm68BBj6AF4oQML3ikrfK2c9EmZUyLOfShpJuItAqVBHWP/KtpGinkSsIiP6EZyyb6Z3NXyW9dgS9X1w==" + }, + "typescript": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==" + }, + "undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==" + }, + "update-browserslist-db": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz", + "integrity": "sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==", + "dev": true, + "requires": { + "escalade": "^3.1.1", + "picocolors": "^1.0.0" + } + }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==" + }, + "uuid": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", + "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==" + }, + "v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==" + }, + "v8-to-istanbul": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.1.0.tgz", + "integrity": "sha512-6z3GW9x8G1gd+JIIgQQQxXuiJtCXeAjp6RaPEPLv62mH3iPHPxV6W3robxtCzNErRo6ZwTmzWhsbNvjyEBKzKA==", + "dev": true, + "requires": { + "@jridgewell/trace-mapping": "^0.3.12", + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^1.6.0" + }, + "dependencies": { + "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==", + "dev": true + } + } + }, + "validator": { + "version": "13.9.0", + "resolved": "https://registry.npmjs.org/validator/-/validator-13.9.0.tgz", + "integrity": "sha512-B+dGG8U3fdtM0/aNK4/X8CXq/EcxU2WPrPEkJGslb47qyHsxmbggTWK0yEA4qnYVNF+nxNlN88o14hIcPmSIEA==" + }, + "vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==" + }, + "walker": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", + "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==", + "dev": true, + "requires": { + "makeerror": "1.0.12" + } + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + }, + "write-file-atomic": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", + "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", + "dev": true, + "requires": { + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.7" + } + }, + "y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true + }, + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + }, + "yargs": { + "version": "17.7.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.1.tgz", + "integrity": "sha512-cwiTb08Xuv5fqF4AovYacTFNxk62th7LKJ6BL9IGUpTJrWoU7/7WdQGTP2SjKf1dUNBGzDd28p/Yfs/GI6JrLw==", + "dev": true, + "requires": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + } + }, + "yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true + }, + "yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==" + }, + "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 + } + } +} From f178a2116b6ead7b25faf152e8f13351f6c2f554 Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Wed, 19 Apr 2023 11:09:37 +0200 Subject: [PATCH 14/72] :sparkles: Nodemon working --- nodemon.json | 2 +- package.json | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/nodemon.json b/nodemon.json index e1d21322..5a4308f5 100644 --- a/nodemon.json +++ b/nodemon.json @@ -1,5 +1,5 @@ { "watch": ["./src/", "./.env", "./package.json", "./tsconfig.json"], - "exec": "npm run build && npm run start", + "exec": "npm run start", "ext": "ts" } \ No newline at end of file diff --git a/package.json b/package.json index d046166f..2b46a614 100644 --- a/package.json +++ b/package.json @@ -17,11 +17,12 @@ "@Test": "./dist/test" }, "scripts": { + "api:startonly": "node ./dist/entries/App.js", "build": "tsc", "api:start": "npm run migrate && npx prisma db seed && node ./dist/entries/App.js", - "start": "tsc && npm run api:start", + "start": "tsc && npm run api:startonly", "dev": "nodemon -V", - "api:dev": "nodemon -V --exec 'tsc && npm run api:start'", + "api:dev": "nodemon", "build:test": "tsc && mocha ./dist/entries/Test.js", "format": "prettier --write src", "migrate": "npx prisma migrate deploy", From 00a88180e2a310abf59722f2b47c6987d14bc008 Mon Sep 17 00:00:00 2001 From: Vincent Alamelle Date: Thu, 20 Apr 2023 09:52:26 +0200 Subject: [PATCH 15/72] Fixed processFindManyQueries to json queries --- src/app/api/super-admin/CustomersController.ts | 3 +-- src/app/api/super-admin/DeedTypesController.ts | 4 +--- src/app/api/super-admin/DeedsController.ts | 4 +--- src/app/api/super-admin/DocumentTypesController.ts | 3 +-- src/app/api/super-admin/DocumentsController.ts | 2 +- src/app/api/super-admin/OfficeFoldersController.ts | 2 +- src/app/api/super-admin/OfficesController.ts | 3 +-- src/app/api/super-admin/UsersController.ts | 3 +-- src/common/repositories/ContactRepository.ts | 3 +-- src/common/repositories/DocumentsRepository.ts | 3 +-- src/common/repositories/OfficeFoldersRepository.ts | 3 +-- src/common/repositories/OfficesRepository.ts | 3 +-- src/common/repositories/UsersRepository.ts | 3 +-- .../private-services/AddressesService/AddressesService.ts | 3 +-- src/services/super-admin/DocumentsService/DocumentsService.ts | 4 +--- .../super-admin/OfficeFoldersService/OfficeFoldersService.ts | 4 +--- src/services/super-admin/OfficesService/OfficesService.ts | 3 +-- src/test/services/super-admin/CustomersService.test.ts | 3 +-- src/test/services/super-admin/UsersService.test.ts | 3 +-- 19 files changed, 19 insertions(+), 40 deletions(-) diff --git a/src/app/api/super-admin/CustomersController.ts b/src/app/api/super-admin/CustomersController.ts index cd24238d..1efc958c 100644 --- a/src/app/api/super-admin/CustomersController.ts +++ b/src/app/api/super-admin/CustomersController.ts @@ -3,7 +3,6 @@ import { Controller, Get, Post, Put } from "@ControllerPattern/index"; import ApiController from "@Common/system/controller-pattern/ApiController"; import CustomersService from "@Services/super-admin/CustomersService/CustomersService"; import { Service } from "typedi"; -import { processFindManyQuery } from "prisma-query"; import ObjectHydrate from "@Common/helpers/ObjectHydrate"; import { Customer } from "le-coffre-resources/dist/SuperAdmin"; import { Customers } from "@prisma/client"; @@ -24,7 +23,7 @@ export default class CustomersController extends ApiController { protected async get(req: Request, response: Response) { try { //get query - const query = processFindManyQuery(req.query); + const query = JSON.parse(req.query["q"] as string); //call service to get prisma entity const customersEntity: Customers[] = await this.customersService.get(query); diff --git a/src/app/api/super-admin/DeedTypesController.ts b/src/app/api/super-admin/DeedTypesController.ts index 9bbfd160..0a9afb4d 100644 --- a/src/app/api/super-admin/DeedTypesController.ts +++ b/src/app/api/super-admin/DeedTypesController.ts @@ -3,7 +3,6 @@ import { Controller, Get, Post, Put } from "@ControllerPattern/index"; import ApiController from "@Common/system/controller-pattern/ApiController"; import { Service } from "typedi"; import DeedTypesService from "@Services/super-admin/DeedTypesService/DeedTypesService"; -import { processFindManyQuery } from "prisma-query"; import { DeedTypes } from "@prisma/client"; import ObjectHydrate from "@Common/helpers/ObjectHydrate"; import { DeedType } from "le-coffre-resources/dist/SuperAdmin"; @@ -24,8 +23,7 @@ export default class DeedTypesController extends ApiController { protected async get(req: Request, response: Response) { try { //get query - const query = processFindManyQuery(req.query); - + const query = JSON.parse(req.query["q"] as string); //call service to get prisma entity const prismaEntity: DeedTypes[] = await this.deedTypesService.get(query); diff --git a/src/app/api/super-admin/DeedsController.ts b/src/app/api/super-admin/DeedsController.ts index 4a82bb3a..8d070a7d 100644 --- a/src/app/api/super-admin/DeedsController.ts +++ b/src/app/api/super-admin/DeedsController.ts @@ -3,7 +3,6 @@ import { Controller, Get } from "@ControllerPattern/index"; import ApiController from "@Common/system/controller-pattern/ApiController"; import DeedsService from "@Services/super-admin/DeedsService/DeedsService"; import { Service } from "typedi"; -import { processFindManyQuery } from "prisma-query"; import { Deeds } from "@prisma/client"; import Deed from "le-coffre-resources/dist/SuperAdmin"; import ObjectHydrate from "@Common/helpers/ObjectHydrate"; @@ -23,8 +22,7 @@ export default class DeedsController extends ApiController { protected async get(req: Request, response: Response) { try { //get query - const query = processFindManyQuery(req.query); - + const query = JSON.parse(req.query["q"] as string); //call service to get prisma entity const prismaEntity: Deeds[] = await this.deedsService.get(query); diff --git a/src/app/api/super-admin/DocumentTypesController.ts b/src/app/api/super-admin/DocumentTypesController.ts index 7567d216..dcb75806 100644 --- a/src/app/api/super-admin/DocumentTypesController.ts +++ b/src/app/api/super-admin/DocumentTypesController.ts @@ -3,7 +3,6 @@ import { Controller, Get, Post, Put } from "@ControllerPattern/index"; import ApiController from "@Common/system/controller-pattern/ApiController"; import { Service } from "typedi"; import DocumentTypesService from "@Services/super-admin/DocumentTypesService/DocumentTypesService"; -import { processFindManyQuery } from "prisma-query"; import { DocumentTypes } from "@prisma/client"; import ObjectHydrate from "@Common/helpers/ObjectHydrate"; import { DocumentType } from "le-coffre-resources/dist/SuperAdmin"; @@ -25,7 +24,7 @@ export default class DocumentTypesController extends ApiController { protected async get(req: Request, response: Response) { try { //get query - const query = processFindManyQuery(req.query); + const query = JSON.parse(req.query["q"] as string); //call service to get prisma entity const prismaEntity: DocumentTypes[] = await this.documentTypesService.get(query); diff --git a/src/app/api/super-admin/DocumentsController.ts b/src/app/api/super-admin/DocumentsController.ts index a7ef7de0..46e2ffce 100644 --- a/src/app/api/super-admin/DocumentsController.ts +++ b/src/app/api/super-admin/DocumentsController.ts @@ -23,7 +23,7 @@ export default class DocumentsController extends ApiController { // protected async get(req: Request, response: Response) { // try { // //get query - // const query = processFindManyQuery(req.query); + // const query = JSON.parse(req.query["q"] as string); // //call service to get prisma entity // const prismaEntity: Documents[] = await this.documentsService.get(query); diff --git a/src/app/api/super-admin/OfficeFoldersController.ts b/src/app/api/super-admin/OfficeFoldersController.ts index ea27229f..7345f1b7 100644 --- a/src/app/api/super-admin/OfficeFoldersController.ts +++ b/src/app/api/super-admin/OfficeFoldersController.ts @@ -24,7 +24,7 @@ export default class OfficeFoldersController extends ApiController { protected async get(req: Request, response: Response) { try { //get query - // const query = processFindManyQuery(req.query); + // const query = JSON.parse(req.query["q"] as string); // //call service to get prisma entity // const prismaEntity: OfficeFolders[] = await this.officeFoldersService.get(query); // //Hydrate ressource with prisma entity diff --git a/src/app/api/super-admin/OfficesController.ts b/src/app/api/super-admin/OfficesController.ts index 8604706f..f0e93c83 100644 --- a/src/app/api/super-admin/OfficesController.ts +++ b/src/app/api/super-admin/OfficesController.ts @@ -3,7 +3,6 @@ import { Controller, Get, Post, Put } from "@ControllerPattern/index"; import ApiController from "@Common/system/controller-pattern/ApiController"; import OfficesService from "@Services/super-admin/OfficesService/OfficesService"; import { Service } from "typedi"; -import { processFindManyQuery } from "prisma-query"; import { Offices } from "@prisma/client"; import ObjectHydrate from "@Common/helpers/ObjectHydrate"; import { Office as OfficeRessource } from "le-coffre-resources/dist/SuperAdmin"; @@ -23,7 +22,7 @@ export default class OfficesController extends ApiController { protected async get(req: Request, response: Response) { try { //get query - const query = processFindManyQuery(req.query); + const query = JSON.parse(req.query["q"] as string); //call service to get prisma entity const officesEntity: Offices[] = await this.officesService.get(query); //Hydrate ressource with prisma entity diff --git a/src/app/api/super-admin/UsersController.ts b/src/app/api/super-admin/UsersController.ts index fdf2f2db..076c790c 100644 --- a/src/app/api/super-admin/UsersController.ts +++ b/src/app/api/super-admin/UsersController.ts @@ -6,7 +6,6 @@ import { Service } from "typedi"; import ObjectHydrate from "@Common/helpers/ObjectHydrate"; import { validateOrReject } from "class-validator"; import User from "le-coffre-resources/dist/SuperAdmin"; -import { processFindManyQuery } from "prisma-query"; import { Users } from "@prisma/client"; @Controller() @@ -24,7 +23,7 @@ export default class UsersController extends ApiController { protected async get(req: Request, response: Response) { try { //get query - const query = processFindManyQuery(req.query); + const query = JSON.parse(req.query["q"] as string); //call service to get prisma entity const usersEntity: Users[] = await this.usersService.get(query); diff --git a/src/common/repositories/ContactRepository.ts b/src/common/repositories/ContactRepository.ts index bb0496eb..2823a3f5 100644 --- a/src/common/repositories/ContactRepository.ts +++ b/src/common/repositories/ContactRepository.ts @@ -1,7 +1,6 @@ import Database from "@Common/databases/database"; import BaseRepository from "@Repositories/BaseRepository"; import { Service } from "typedi"; -import { processFindManyQuery } from "prisma-query"; import { Addresses } from "@prisma/client"; @Service() @@ -19,7 +18,7 @@ export default class AddressesRepository extends BaseRepository { /** * @description : Find many users */ - public async findMany(query: ReturnType): Promise { + public async findMany(query: any): Promise { query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); return this.model.findMany(query); } diff --git a/src/common/repositories/DocumentsRepository.ts b/src/common/repositories/DocumentsRepository.ts index 1f6b09e5..8b5a8ef0 100644 --- a/src/common/repositories/DocumentsRepository.ts +++ b/src/common/repositories/DocumentsRepository.ts @@ -1,7 +1,6 @@ import Database from "@Common/databases/database"; import BaseRepository from "@Repositories/BaseRepository"; import { Service } from "typedi"; -import { processFindManyQuery } from "prisma-query"; import { Documents } from "@prisma/client"; @Service() @@ -19,7 +18,7 @@ export default class DocumentsRepository extends BaseRepository { /** * @description : Find many users */ - public async findMany(query: ReturnType): Promise { + public async findMany(query: any): Promise { query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); return this.model.findMany(query); } diff --git a/src/common/repositories/OfficeFoldersRepository.ts b/src/common/repositories/OfficeFoldersRepository.ts index efb8f5d5..2f527c29 100644 --- a/src/common/repositories/OfficeFoldersRepository.ts +++ b/src/common/repositories/OfficeFoldersRepository.ts @@ -2,7 +2,6 @@ import Database from "@Common/databases/database"; import { ORMBadQueryError } from "@Common/system/database/exceptions/ORMBadQueryError"; import BaseRepository from "@Repositories/BaseRepository"; import { Service } from "typedi"; -import { processFindManyQuery } from "prisma-query"; import { EFolderStatus, OfficeFolders } from "@prisma/client"; import { OfficeFolder } from "le-coffre-resources/dist/SuperAdmin"; @@ -21,7 +20,7 @@ export default class OfficeFoldersRepository extends BaseRepository { /** * @description : Find many office folders */ - public async findMany(query: ReturnType): Promise { + public async findMany(query: any): Promise { try { const limit = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); diff --git a/src/common/repositories/OfficesRepository.ts b/src/common/repositories/OfficesRepository.ts index 5a9302e6..0f440850 100644 --- a/src/common/repositories/OfficesRepository.ts +++ b/src/common/repositories/OfficesRepository.ts @@ -2,7 +2,6 @@ import Database from "@Common/databases/database"; import { ORMBadQueryError } from "@Common/system/database/exceptions/ORMBadQueryError"; import BaseRepository from "@Repositories/BaseRepository"; import { Service } from "typedi"; -import { processFindManyQuery } from "prisma-query"; import { EOfficeStatus, Offices } from "@prisma/client"; import { Office as OfficeRessource } from "le-coffre-resources/dist/SuperAdmin"; @@ -21,7 +20,7 @@ export default class OfficesRepository extends BaseRepository { /** * @description : Find many users */ - public async findMany(query: ReturnType): Promise { + public async findMany(query: any): Promise { try { const limit = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); diff --git a/src/common/repositories/UsersRepository.ts b/src/common/repositories/UsersRepository.ts index 2c7ef00e..7f0e2b29 100644 --- a/src/common/repositories/UsersRepository.ts +++ b/src/common/repositories/UsersRepository.ts @@ -3,7 +3,6 @@ import BaseRepository from "@Repositories/BaseRepository"; import { Service } from "typedi"; import { ECivility, Users } from "@prisma/client"; import User from "le-coffre-resources/dist/SuperAdmin"; -import { processFindManyQuery } from "prisma-query"; @Service() export default class UsersRepository extends BaseRepository { @@ -20,7 +19,7 @@ export default class UsersRepository extends BaseRepository { /** * @description : Find many users */ - public async findMany(query: ReturnType): Promise { + public async findMany(query: any): Promise { query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); return await this.model.findMany(query); } diff --git a/src/services/private-services/AddressesService/AddressesService.ts b/src/services/private-services/AddressesService/AddressesService.ts index a9c04087..5ed24488 100644 --- a/src/services/private-services/AddressesService/AddressesService.ts +++ b/src/services/private-services/AddressesService/AddressesService.ts @@ -2,7 +2,6 @@ import { Addresses } from "@prisma/client"; import AddressesRepository from "@Repositories/AddressesRepository"; import BaseService from "@Services/BaseService"; -import { processFindManyQuery } from "prisma-query"; import Container, { Service } from "typedi"; @Service() @@ -17,7 +16,7 @@ export default class AddressesService extends BaseService { * @throws {Error} If addresses cannot be get * @param : projectEntity: Partial */ - public async get(query: ReturnType) { + public async get(query: any) { //init repo const repo = Container.get(AddressesRepository); diff --git a/src/services/super-admin/DocumentsService/DocumentsService.ts b/src/services/super-admin/DocumentsService/DocumentsService.ts index cf19570f..6147cc15 100644 --- a/src/services/super-admin/DocumentsService/DocumentsService.ts +++ b/src/services/super-admin/DocumentsService/DocumentsService.ts @@ -1,7 +1,6 @@ import DocumentTypesRepository from "@Repositories/DocumentTypesRepository"; //import { DocumentTypes } from "prisma/prisma-client"; import BaseService from "@Services/BaseService"; -import { processFindManyQuery } from "prisma-query"; import Container, { Service } from "typedi"; @Service() @@ -14,9 +13,8 @@ export default class DocumentsService extends BaseService { * @description : Get all documents * @returns : Document[] * @throws {Error} If documents cannot be get - * @param : ReturnType */ - public async get(query: ReturnType) { + public async get(query: any) { //init repo const repo = Container.get(DocumentTypesRepository); diff --git a/src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts b/src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts index c630756a..da96453d 100644 --- a/src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts +++ b/src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts @@ -2,7 +2,6 @@ import { OfficeFolders } from ".prisma/client"; import OfficeFoldersRepository from "@Repositories/OfficeFoldersRepository"; import BaseService from "@Services/BaseService"; import { OfficeFolder } from "le-coffre-resources/dist/SuperAdmin"; -import { processFindManyQuery } from "prisma-query"; import Container, { Service } from "typedi"; @Service() @@ -15,9 +14,8 @@ export default class OfficeFoldersService extends BaseService { * @description : Get all folders * @returns : OfficeFolders[] * @throws {Error} If folders cannot be get - * @param : query: ReturnType */ - public async get(query: ReturnType) { + public async get(query: any) { //init repo const repo = Container.get(OfficeFoldersRepository); diff --git a/src/services/super-admin/OfficesService/OfficesService.ts b/src/services/super-admin/OfficesService/OfficesService.ts index c9512c84..18610407 100644 --- a/src/services/super-admin/OfficesService/OfficesService.ts +++ b/src/services/super-admin/OfficesService/OfficesService.ts @@ -3,7 +3,6 @@ import { Offices } from "@prisma/client"; import OfficesRepository from "@Repositories/OfficesRepository"; import BaseService from "@Services/BaseService"; import { Office as OfficeRessource } from "le-coffre-resources/dist/SuperAdmin"; -import { processFindManyQuery } from "prisma-query"; import { Service } from "typedi"; @Service() @@ -16,7 +15,7 @@ export default class OfficesService extends BaseService { * @description : Get all offices * @throws {Error} If offices cannot be get */ - public async get(query: ReturnType): Promise { + public async get(query: any): Promise { return this.officeRepository.findMany(query); } diff --git a/src/test/services/super-admin/CustomersService.test.ts b/src/test/services/super-admin/CustomersService.test.ts index d2b5b74b..3eb57464 100644 --- a/src/test/services/super-admin/CustomersService.test.ts +++ b/src/test/services/super-admin/CustomersService.test.ts @@ -2,7 +2,6 @@ import "module-alias/register"; import "reflect-metadata"; import { Customer } from "le-coffre-resources/dist/SuperAdmin"; import CustomersService from "@Services/super-admin/CustomersService/CustomersService"; -import { processFindManyQuery } from "prisma-query"; import { PrismaClient } from "@prisma/client"; import { customer, customer_, userContact, userContact_ } from "./MockedData"; import Container from "typedi"; @@ -152,7 +151,7 @@ describe("test update function", () => { describe("test get function", () => { it("should return an array of Customers", async () => { - const req = processFindManyQuery({}); + const req = {} const customers = await CustomersServiceTest.get(req); // verify result typing diff --git a/src/test/services/super-admin/UsersService.test.ts b/src/test/services/super-admin/UsersService.test.ts index f58b4c8c..fd7dd437 100644 --- a/src/test/services/super-admin/UsersService.test.ts +++ b/src/test/services/super-admin/UsersService.test.ts @@ -2,7 +2,6 @@ import "module-alias/register"; import "reflect-metadata"; import User from "le-coffre-resources/dist/SuperAdmin"; import UsersService from "@Services/super-admin/UsersService/UsersService"; -import { processFindManyQuery } from "prisma-query"; import { PrismaClient } from "@prisma/client"; import { user, userContact, userContact_, user_ } from "./MockedData"; import UsersRepository from "@Repositories/UsersRepository"; @@ -192,7 +191,7 @@ describe("test update function", () => { describe("test get function", () => { it("should return an array of Users", async () => { - const req = processFindManyQuery({}); + const req = {}; const users = await UsersServiceTest.get(req); // verify result typing From c30b9e3f9b2fe0821708aae0a32e88f34ad23bb6 Mon Sep 17 00:00:00 2001 From: OxSaitama Date: Mon, 17 Apr 2023 18:35:19 +0200 Subject: [PATCH 16/72] feature: add office folders services --- .env.test | 2 +- package.json | 4 +- .../api/super-admin/CustomersController.ts | 4 - .../api/super-admin/DeedTypesController.ts | 12 +- src/app/api/super-admin/DeedsController.ts | 18 +- .../super-admin/DocumentTypesController.ts | 4 - .../api/super-admin/DocumentsController.ts | 129 +++++++-- .../super-admin/OfficeFoldersController.ts | 100 ++++--- src/app/api/super-admin/OfficesController.ts | 4 - src/app/api/super-admin/UsersController.ts | 8 +- .../20230417100704_v9/migration.sql | 20 ++ .../20230421130524_v10/migration.sql | 2 + src/common/databases/schema.prisma | 9 +- src/common/databases/seeders/seeder.ts | 8 +- .../repositories/AddressesRepository.ts | 21 +- src/common/repositories/ContactRepository.ts | 25 -- src/common/repositories/ContactsRepository.ts | 42 +++ .../repositories/CustomersRepository.ts | 13 +- .../DeedTypesHasDocumentTypesRepository.ts | 76 +---- .../repositories/DeedTypesRepository.ts | 72 ++--- .../DeedsHasDocumentTypesRepository.ts | 82 +----- src/common/repositories/DeedsRepository.ts | 81 +++--- .../repositories/DocumentTypesRepository.ts | 10 +- .../repositories/DocumentsRepository.ts | 109 ++++++- src/common/repositories/FilesRepository.ts | 84 ++++++ .../OfficeFoldersHasCustomerRepository.ts | 43 +++ .../OfficeFoldersHasStakeholderRepository.ts | 42 +++ .../repositories/OfficeFoldersRepository.ts | 172 ++++++----- src/common/repositories/OfficesRepository.ts | 107 +++---- src/common/repositories/UsersRepository.ts | 8 +- .../AddressesService/AddressesService.ts | 48 +-- .../AuthService/AuthService.ts | 29 +- .../ContactsService/ContactsService.ts | 43 +-- .../FilesService/FilesService.ts | 36 +-- .../DeedTypesService/DeedTypesService.ts | 32 -- .../super-admin/DeedsService/DeedsService.ts | 69 +---- .../DocumentTypesService.ts | 1 - .../DocumentsService/DocumentsService.ts | 56 ++-- .../OfficeFoldersService.ts | 40 +-- .../OfficesService/OfficesService.ts | 1 - .../services/super-admin/DeedService.test.ts | 239 ++++++++------- .../super-admin/DeedTypesService.test.ts | 241 ++++++++-------- src/test/services/super-admin/MockedData.ts | 42 ++- .../super-admin/OfficeFolderService.test.ts | 273 ++++++++++++++++++ 44 files changed, 1444 insertions(+), 1017 deletions(-) create mode 100644 src/common/databases/migrations/20230417100704_v9/migration.sql create mode 100644 src/common/databases/migrations/20230421130524_v10/migration.sql delete mode 100644 src/common/repositories/ContactRepository.ts create mode 100644 src/common/repositories/ContactsRepository.ts create mode 100644 src/common/repositories/FilesRepository.ts create mode 100644 src/common/repositories/OfficeFoldersHasCustomerRepository.ts create mode 100644 src/common/repositories/OfficeFoldersHasStakeholderRepository.ts create mode 100644 src/test/services/super-admin/OfficeFolderService.test.ts diff --git a/.env.test b/.env.test index 0e84c552..149826ef 100644 --- a/.env.test +++ b/.env.test @@ -1,4 +1,4 @@ DATABASE_URL="postgresql://prisma:prisma@localhost:5433/tests" POSTGRES_USER=prisma POSTGRES_PASSWORD=prisma -POSTGRES_DB: tests \ No newline at end of file +POSTGRES_DB=tests \ No newline at end of file diff --git a/package.json b/package.json index 2b46a614..5928f007 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "docker:up": "docker-compose up -d", "docker:up:test": "docker-compose -f docker-compose-test.yml up -d", "docker:down": "docker-compose -f docker-compose-test.yml down", - "test": "tsc && npm run docker:up:test && jest -i --verbose ./dist/test/* && npm run docker:down" + "test": "tsc && npm run docker:up:test && npm run migrate && jest -i --verbose ./dist/test/* && npm run docker:down" }, "repository": { "type": "git", @@ -50,7 +50,7 @@ "dotenv": "^16.0.3", "express": "^4.18.2", "jsonwebtoken": "^9.0.0", - "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.19", + "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.21", "module-alias": "^2.2.2", "next": "^13.1.5", "node-cache": "^5.1.2", diff --git a/src/app/api/super-admin/CustomersController.ts b/src/app/api/super-admin/CustomersController.ts index 1efc958c..5f990ebc 100644 --- a/src/app/api/super-admin/CustomersController.ts +++ b/src/app/api/super-admin/CustomersController.ts @@ -17,7 +17,6 @@ export default class CustomersController extends ApiController { /** * @description Get all customers - * @returns ICustomer[] list of customers */ @Get("/api/v1/super-admin/customers") protected async get(req: Request, response: Response) { @@ -41,7 +40,6 @@ export default class CustomersController extends ApiController { /** * @description Create a new customer - * @returns ICustomer created */ @Post("/api/v1/super-admin/customers") protected async post(req: Request, response: Response) { @@ -71,7 +69,6 @@ export default class CustomersController extends ApiController { /** * @description Modify a specific customer by uid - * @returns ICustomer modified */ @Put("/api/v1/super-admin/customers/:uid") protected async put(req: Request, response: Response) { @@ -104,7 +101,6 @@ export default class CustomersController extends ApiController { /** * @description Get a specific customer by uid - * @returns ICustomer */ @Get("/api/v1/super-admin/customers/:uid") protected async getOneByUid(req: Request, response: Response) { diff --git a/src/app/api/super-admin/DeedTypesController.ts b/src/app/api/super-admin/DeedTypesController.ts index 0a9afb4d..d0071bf1 100644 --- a/src/app/api/super-admin/DeedTypesController.ts +++ b/src/app/api/super-admin/DeedTypesController.ts @@ -17,7 +17,7 @@ export default class DeedTypesController extends ApiController { /** * @description Get all deedtypes - * @returns IDeedtype[] list of deedtypes + * @returns Deedtype[] list of deedtypes */ @Get("/api/v1/super-admin/deed-types") protected async get(req: Request, response: Response) { @@ -40,7 +40,7 @@ export default class DeedTypesController extends ApiController { /** * @description Create a new deedtype - * @returns IDeedtype created + * @returns Deedtype created */ @Post("/api/v1/super-admin/deed-types") protected async post(req: Request, response: Response) { @@ -70,7 +70,7 @@ export default class DeedTypesController extends ApiController { /** * @description Modify a specific deedtype by uid - * @returns IDeedtype modified + * @returns Deedtype modified */ @Put("/api/v1/super-admin/deed-types/:uid") protected async put(req: Request, response: Response) { @@ -115,13 +115,13 @@ export default class DeedTypesController extends ApiController { } //call service to get prisma entity - const userEntity: DeedTypes = await this.deedTypesService.getByUid(uid); + const deedTypeEntity: DeedTypes = await this.deedTypesService.getByUid(uid); //Hydrate ressource with prisma entity - const user = ObjectHydrate.hydrate(new DeedType(), userEntity, { strategy: "exposeAll" }); + const deedType = ObjectHydrate.hydrate(new DeedType(), deedTypeEntity, { strategy: "exposeAll" }); //success - this.httpSuccess(response, user); + this.httpSuccess(response, deedType); } catch (error) { this.httpBadRequest(response, error); return; diff --git a/src/app/api/super-admin/DeedsController.ts b/src/app/api/super-admin/DeedsController.ts index 8d070a7d..2993bcdf 100644 --- a/src/app/api/super-admin/DeedsController.ts +++ b/src/app/api/super-admin/DeedsController.ts @@ -16,7 +16,7 @@ export default class DeedsController extends ApiController { /** * @description Get all deeds - * @returns IDeed[] list of deeds + * @returns Deed[] list of deeds */ @Get("/api/v1/super-admin/deeds") protected async get(req: Request, response: Response) { @@ -39,12 +39,24 @@ export default class DeedsController extends ApiController { /** * @description Get a specific deed by uid - * @returns IDeed + * @returns Deed */ @Get("/api/v1/super-admin/deeds/:uid") protected async getOneByUid(req: Request, response: Response) { try { - // TODO + const uid = req.params["uid"]; + if (!uid) { + throw new Error("No uuid provided"); + } + + //call service to get prisma entity + const deedEntity: Deeds = await this.deedsService.getByUid(uid); + + //Hydrate ressource with prisma entity + const deed = ObjectHydrate.hydrate(new Deed(), deedEntity, { strategy: "exposeAll" }); + + //success + this.httpSuccess(response, deed); } catch (error) { this.httpBadRequest(response, error); return; diff --git a/src/app/api/super-admin/DocumentTypesController.ts b/src/app/api/super-admin/DocumentTypesController.ts index dcb75806..8556210e 100644 --- a/src/app/api/super-admin/DocumentTypesController.ts +++ b/src/app/api/super-admin/DocumentTypesController.ts @@ -18,7 +18,6 @@ export default class DocumentTypesController extends ApiController { /** * @description Get all document-types - * @returns DocumentType[] list of document-types */ @Get("/api/v1/super-admin/document-types") protected async get(req: Request, response: Response) { @@ -44,7 +43,6 @@ export default class DocumentTypesController extends ApiController { /** * @description Create a new documentType - * @returns DocumentType created */ @Post("/api/v1/super-admin/document-types") protected async post(req: Request, response: Response) { @@ -70,7 +68,6 @@ export default class DocumentTypesController extends ApiController { /** * @description Modify a specific documentType by uid - * @returns DocumentType modified */ @Put("/api/v1/super-admin/document-types/:uid") protected async put(req: Request, response: Response) { @@ -104,7 +101,6 @@ export default class DocumentTypesController extends ApiController { /** * @description Get a specific documentType by uid - * @returns DocumentType */ @Get("/api/v1/super-admin/document-types/:uid") protected async getOneByUid(req: Request, response: Response) { diff --git a/src/app/api/super-admin/DocumentsController.ts b/src/app/api/super-admin/DocumentsController.ts index 46e2ffce..7c1c51f2 100644 --- a/src/app/api/super-admin/DocumentsController.ts +++ b/src/app/api/super-admin/DocumentsController.ts @@ -1,12 +1,12 @@ import { Response, Request } from "express"; -import { Controller, Get, Post, Put } from "@ControllerPattern/index"; +import { Controller, Delete, Get, Post, Put } from "@ControllerPattern/index"; import ApiController from "@Common/system/controller-pattern/ApiController"; import { Service } from "typedi"; import DocumentsService from "@Services/super-admin/DocumentsService/DocumentsService"; -// import { processFindManyQuery } from "prisma-query"; -// import { Documents } from "@prisma/client"; -// import ObjectHydrate from "@Common/helpers/ObjectHydrate"; -// import Document from "le-coffre-resources/dist/SuperAdmin"; +import { Documents } from "@prisma/client"; +import ObjectHydrate from "@Common/helpers/ObjectHydrate"; +import { Document } from "le-coffre-resources/dist/SuperAdmin"; +import { validateOrReject } from "class-validator"; @Controller() @Service() @@ -19,25 +19,25 @@ export default class DocumentsController extends ApiController { * @description Get all documents * @returns IDocument[] list of documents */ - // @Get("/api/super-admin/documents") - // protected async get(req: Request, response: Response) { - // try { - // //get query - // const query = JSON.parse(req.query["q"] as string); + @Get("/api/v1/super-admin/documents") + protected async get(req: Request, response: Response) { + try { + //get query + const query = JSON.parse(req.query["q"] as string); - // //call service to get prisma entity - // const prismaEntity: Documents[] = await this.documentsService.get(query); + //call service to get prisma entity + const prismaEntity: Documents[] = await this.documentsService.get(query); - // //Hydrate ressource with prisma entity - // const documents = ObjectHydrate.map(Document, prismaEntity, { strategy: "exposeAll" }); + //Hydrate ressource with prisma entity + const documents = ObjectHydrate.map(Document, prismaEntity, { strategy: "exposeAll" }); - // //success - // this.httpSuccess(response, documents); - // } catch (error) { - // this.httpBadRequest(response, error); - // return; - // } - // } + //success + this.httpSuccess(response, documents); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } /** * @description Create a new document @@ -46,41 +46,108 @@ export default class DocumentsController extends ApiController { @Post("/api/v1/super-admin/documents") protected async post(req: Request, response: Response) { try { - // TODO + //init Document resource with request body values + const documentEntity = new Document(); + ObjectHydrate.hydrate(documentEntity, req.body); + + //validate document + await validateOrReject(documentEntity, { groups: ["create"] }); + + //call service to get prisma entity + const prismaEntityCreated = await this.documentsService.create(documentEntity); + + //Hydrate ressource with prisma entity + const documentEntityCreated = ObjectHydrate.hydrate(new Document(), prismaEntityCreated, { + strategy: "exposeAll", + }); + + //success + this.httpSuccess(response, documentEntityCreated); } catch (error) { this.httpBadRequest(response, error); return; } - // this.httpSuccess(response, await this.documentsService.create()); } /** - * @description Modify a specific document by uid - * @returns IDocument modified + * @description Update a specific document */ @Put("/api/v1/super-admin/documents/:uid") - protected async put(req: Request, response: Response) { + protected async update(req: Request, response: Response) { try { - // TODO + const uid = req.params["uid"]; + if (!uid) { + throw new Error("No uuid provided"); + } + + //init Document resource with request body values + const documentEntity = new Document(); + ObjectHydrate.hydrate(documentEntity, req.body); + + //validate document + await validateOrReject(documentEntity, { groups: ["create"] }); + + //call service to get prisma entity + const prismaEntityUpdated: Documents = await this.documentsService.update(uid, documentEntity); + + //Hydrate ressource with prisma entity + const document = ObjectHydrate.hydrate(new Document(), prismaEntityUpdated, { strategy: "exposeAll" }); + + //success + this.httpSuccess(response, document); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } + + /** + * @description Delete a specific document + */ + @Delete("/api/v1/super-admin/documents/:uid") + protected async delete(req: Request, response: Response) { + try { + const uid = req.params["uid"]; + if (!uid) { + throw new Error("No uuid provided"); + } + + //call service to get prisma entity + const documentEntity: Documents = await this.documentsService.delete(uid); + + //Hydrate ressource with prisma entity + const document = ObjectHydrate.hydrate(new Document(), documentEntity, { strategy: "exposeAll" }); + + //success + this.httpSuccess(response, document); } catch (error) { this.httpBadRequest(response, error); return; } - this.httpSuccess(response, await this.documentsService.put()); } /** * @description Get a specific document by uid - * @returns IDocument */ @Get("/api/v1/super-admin/documents/:uid") protected async getOneByUid(req: Request, response: Response) { try { - // TODO + const uid = req.params["uid"]; + if (!uid) { + throw new Error("No uuid provided"); + } + + //call service to get prisma entity + const documentEntity: Documents = await this.documentsService.getByUid(uid); + + //Hydrate ressource with prisma entity + const document = ObjectHydrate.hydrate(new Document(), documentEntity, { strategy: "exposeAll" }); + + //success + this.httpSuccess(response, document); } catch (error) { this.httpBadRequest(response, error); return; } - this.httpSuccess(response, await this.documentsService.getByUid("uid")); } } diff --git a/src/app/api/super-admin/OfficeFoldersController.ts b/src/app/api/super-admin/OfficeFoldersController.ts index 7345f1b7..308a4168 100644 --- a/src/app/api/super-admin/OfficeFoldersController.ts +++ b/src/app/api/super-admin/OfficeFoldersController.ts @@ -3,11 +3,10 @@ import { Controller, Get, Post, Put } from "@ControllerPattern/index"; import ApiController from "@Common/system/controller-pattern/ApiController"; import OfficeFoldersService from "@Services/super-admin/OfficeFoldersService/OfficeFoldersService"; import { Service } from "typedi"; -// import { processFindManyQuery } from "prisma-query"; -// import { OfficeFolders } from "@prisma/client"; -// import ObjectHydrate from "@Common/helpers/ObjectHydrate"; -// import { OfficeFolder } from "le-coffre-resources/dist/SuperAdmin"; -// import { validateOrReject } from "class-validator"; +import { OfficeFolders } from "@prisma/client"; +import ObjectHydrate from "@Common/helpers/ObjectHydrate"; +import { OfficeFolder } from "le-coffre-resources/dist/SuperAdmin"; +import { validateOrReject } from "class-validator"; @Controller() @Service() @@ -18,21 +17,20 @@ export default class OfficeFoldersController extends ApiController { /** * @description Get all folders - * @returns IFolder[] list of folders */ - @Get("/api/super-admin/folders") + @Get("/api/v1/super-admin/folders") protected async get(req: Request, response: Response) { try { //get query - // const query = JSON.parse(req.query["q"] as string); - // //call service to get prisma entity - // const prismaEntity: OfficeFolders[] = await this.officeFoldersService.get(query); - // //Hydrate ressource with prisma entity - // const officeFolders = ObjectHydrate.map(OfficeFolder, prismaEntity, { - // strategy: "exposeAll", - // }); - // //success - // this.httpSuccess(response, officeFolders); + const query = JSON.parse(req.query["q"] as string); + //call service to get prisma entity + const prismaEntity: OfficeFolders[] = await this.officeFoldersService.get(query); + //Hydrate ressource with prisma entity + const officeFolders = ObjectHydrate.map(OfficeFolder, prismaEntity, { + strategy: "exposeAll", + }); + //success + this.httpSuccess(response, officeFolders); } catch (error) { this.httpBadRequest(response, error); return; @@ -41,24 +39,24 @@ export default class OfficeFoldersController extends ApiController { /** * @description Create a new folder - * @returns IFolder created */ - @Post("/api/super-admin/folders") + @Post("/api/v1/super-admin/folders") protected async post(req: Request, response: Response) { try { - //init IOfficeFolder resource with request body values - // const officeFolderEntity = new OfficeFolder(); - // ObjectHydrate.hydrate(officeFolderEntity, req.body); - // //validate folder - // await validateOrReject(officeFolderEntity, { groups: ["create"] }); - // //call service to get prisma entity - // const prismaEntityCreated = await this.officeFoldersService.create(officeFolderEntity); - // //Hydrate ressource with prisma entity - // const officeFolderEntityCreated = ObjectHydrate.hydrate(new OfficeFolder(), prismaEntityCreated, { - // strategy: "exposeAll", - // }); + //init OfficeFolder resource with request body values + const officeFolderEntity = new OfficeFolder(); + ObjectHydrate.hydrate(officeFolderEntity, req.body); + + //validate folder + await validateOrReject(officeFolderEntity, { groups: ["create"] }); + //call service to get prisma entity + const prismaEntityCreated = await this.officeFoldersService.create(officeFolderEntity); + //Hydrate ressource with prisma entity + const officeFolderEntityCreated = ObjectHydrate.hydrate(new OfficeFolder(), prismaEntityCreated, { + strategy: "exposeAll", + }); //success - //this.httpSuccess(response, officeFolderEntityCreated); + this.httpSuccess(response, officeFolderEntityCreated); } catch (error) { this.httpBadRequest(response, error); return; @@ -67,27 +65,57 @@ export default class OfficeFoldersController extends ApiController { /** * @description Modify a specific folder by uid - * @returns IFolder modified */ - @Put("/api/super-admin/folders/:uid") + @Put("/api/v1/super-admin/folders/:uid") protected async put(req: Request, response: Response) { try { - // TODO + const uid = req.params["uid"]; + if (!uid) { + throw new Error("No uuid provided"); + } + //init IUser resource with request body values + const officeFolderEntity = new OfficeFolder(); + ObjectHydrate.hydrate(officeFolderEntity, req.body); + + //validate user + await validateOrReject(officeFolderEntity, { groups: ["update"] }); + + //call service to get prisma entity + const prismaEntityUpdated = await this.officeFoldersService.update(uid, officeFolderEntity); + + //Hydrate ressource with prisma entity + const officeFolderEntityUpdated = ObjectHydrate.hydrate(new OfficeFolder(), prismaEntityUpdated, { + strategy: "exposeAll", + }); + + //success + this.httpSuccess(response, officeFolderEntityUpdated); } catch (error) { this.httpBadRequest(response, error); return; } - //this.httpSuccess(response, await this.officeFoldersService.update()); } /** * @description Get a specific folder by uid * @returns IFolder */ - @Get("/api/super-admin/folders/:uid") + @Get("/api/v1/super-admin/folders/:uid") protected async getOneByUid(req: Request, response: Response) { try { - // TODO + const uid = req.params["uid"]; + if (!uid) { + throw new Error("No uuid provided"); + } + + //call service to get prisma entity + const officeFolderEntity: OfficeFolders = await this.officeFoldersService.getByUid(uid); + + //Hydrate ressource with prisma entity + const officeFolder = ObjectHydrate.hydrate(new OfficeFolder(), officeFolderEntity, { strategy: "exposeAll" }); + + //success + this.httpSuccess(response, officeFolder); } catch (error) { this.httpBadRequest(response, error); return; diff --git a/src/app/api/super-admin/OfficesController.ts b/src/app/api/super-admin/OfficesController.ts index f0e93c83..cd822332 100644 --- a/src/app/api/super-admin/OfficesController.ts +++ b/src/app/api/super-admin/OfficesController.ts @@ -16,7 +16,6 @@ export default class OfficesController extends ApiController { } /** * @description Get all offices - * @returns IOffice[] list of offices */ @Get("/api/v1/super-admin/offices") protected async get(req: Request, response: Response) { @@ -36,7 +35,6 @@ export default class OfficesController extends ApiController { } /** * @description Create a new office - * @returns IOffice created */ @Post("/api/v1/super-admin/offices") protected async post(req: Request, response: Response) { @@ -61,7 +59,6 @@ export default class OfficesController extends ApiController { } /** * @description Modify a specific office by uid - * @returns IOffice modified */ @Put("/api/v1/super-admin/offices/:uid") protected async put(req: Request, response: Response) { @@ -90,7 +87,6 @@ export default class OfficesController extends ApiController { } /** * @description Get a specific office by uid - * @returns IOffice */ @Get("/api/v1/super-admin/offices/:uid") protected async getOneByUid(req: Request, response: Response) { diff --git a/src/app/api/super-admin/UsersController.ts b/src/app/api/super-admin/UsersController.ts index 076c790c..909bab94 100644 --- a/src/app/api/super-admin/UsersController.ts +++ b/src/app/api/super-admin/UsersController.ts @@ -17,7 +17,6 @@ export default class UsersController extends ApiController { /** * @description Get all users - * @returns IUser[] list of users */ @Get("/api/v1/super-admin/users") protected async get(req: Request, response: Response) { @@ -40,8 +39,7 @@ export default class UsersController extends ApiController { } /** - * @description Get all users - * @returns IUser[] list of users + * @description Create a new user */ @Post("/api/v1/super-admin/users") protected async getAddresses(req: Request, response: Response) { @@ -71,7 +69,6 @@ export default class UsersController extends ApiController { /** * @description Modify a specific user by uid - * @returns IUser modified */ @Put("/api/v1/super-admin/users/:uid") protected async put(req: Request, response: Response) { @@ -104,8 +101,7 @@ export default class UsersController extends ApiController { } /** - * @description Modify a specific user by uid - * @returns IUser modified + * @description Get a specific user by uid */ @Get("/api/v1/super-admin/users/:uid") protected async getOneByUid(req: Request, response: Response) { diff --git a/src/common/databases/migrations/20230417100704_v9/migration.sql b/src/common/databases/migrations/20230417100704_v9/migration.sql new file mode 100644 index 00000000..6a1b9b40 --- /dev/null +++ b/src/common/databases/migrations/20230417100704_v9/migration.sql @@ -0,0 +1,20 @@ +/* + Warnings: + + - You are about to drop the column `type_uuid` on the `documents` table. All the data in the column will be lost. + - Added the required column `document_type_uuid` to the `documents` table without a default value. This is not possible if the table is not empty. + - Made the column `file_path` on table `files` required. This step will fail if there are existing NULL values in that column. + +*/ +-- DropForeignKey +ALTER TABLE "documents" DROP CONSTRAINT "documents_type_uuid_fkey"; + +-- AlterTable +ALTER TABLE "documents" DROP COLUMN "type_uuid", +ADD COLUMN "document_type_uuid" VARCHAR(255) NOT NULL; + +-- AlterTable +ALTER TABLE "files" ALTER COLUMN "file_path" SET NOT NULL; + +-- AddForeignKey +ALTER TABLE "documents" ADD CONSTRAINT "documents_document_type_uuid_fkey" FOREIGN KEY ("document_type_uuid") REFERENCES "document_types"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/src/common/databases/migrations/20230421130524_v10/migration.sql b/src/common/databases/migrations/20230421130524_v10/migration.sql new file mode 100644 index 00000000..43926a8f --- /dev/null +++ b/src/common/databases/migrations/20230421130524_v10/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "contacts" ADD COLUMN "birthdate" TIMESTAMP(3); diff --git a/src/common/databases/schema.prisma b/src/common/databases/schema.prisma index d6e1f3f7..8e4c2d86 100644 --- a/src/common/databases/schema.prisma +++ b/src/common/databases/schema.prisma @@ -38,8 +38,9 @@ model Contacts { phone_number String? @db.VarChar(50) cell_phone_number String? @unique @db.VarChar(50) civility ECivility @default(MALE) - address Addresses @relation(fields: [address_uuid], references: [uuid], onDelete: Cascade) + address Addresses? @relation(fields: [address_uuid], references: [uuid], onDelete: Cascade) address_uuid String @unique @db.VarChar(255) + birthdate DateTime? created_at DateTime? @default(now()) updated_at DateTime? @updatedAt users Users? @@ -168,8 +169,8 @@ model OfficeFolderHasStakeholders { model Documents { uuid String @id @unique @default(uuid()) document_status EDocumentStatus @default(ASKED) - document_type DocumentTypes @relation(fields: [type_uuid], references: [uuid]) - type_uuid String @db.VarChar(255) + document_type DocumentTypes @relation(fields: [document_type_uuid], references: [uuid]) + document_type_uuid String @db.VarChar(255) blockchain_anchor BlockchainAnchors? @relation(fields: [blockchain_anchor_uuid], references: [uuid]) blockchain_anchor_uuid String? @db.VarChar(255) folder OfficeFolders @relation(fields: [folder_uuid], references: [uuid]) @@ -200,7 +201,7 @@ model Files { uuid String @id @unique @default(uuid()) document Documents @relation(fields: [document_uuid], references: [uuid], onDelete: Cascade) document_uuid String @db.VarChar(255) - file_path String? @unique @db.VarChar(255) + file_path String @unique @db.VarChar(255) created_at DateTime? @default(now()) updated_at DateTime? @updatedAt diff --git a/src/common/databases/seeders/seeder.ts b/src/common/databases/seeders/seeder.ts index 8455479a..7bff7d73 100644 --- a/src/common/databases/seeders/seeder.ts +++ b/src/common/databases/seeders/seeder.ts @@ -128,6 +128,7 @@ import { email: "john.doe@example.com", phone_number: randomString(), cell_phone_number: randomString(), + birthdate: null, created_at: new Date(), updated_at: new Date(), civility: ECivility.MALE, @@ -139,9 +140,10 @@ import { last_name: "Doe", email: "jane.doe@example.com", phone_number: randomString(), + cell_phone_number: randomString(), + birthdate: null, created_at: new Date(), updated_at: new Date(), - cell_phone_number: randomString(), civility: ECivility.FEMALE, }, ]; @@ -258,7 +260,7 @@ import { depositor_uuid: uuidCustomer1, document_status: EDocumentStatus.ASKED, folder_uuid: uuidOfficeFolder1, - type_uuid: uuidDocumentType1, + document_type_uuid: uuidDocumentType1, created_at: new Date(), updated_at: new Date(), }, @@ -268,7 +270,7 @@ import { depositor_uuid: uuidCustomer2, document_status: EDocumentStatus.ASKED, folder_uuid: uuidOfficeFolder2, - type_uuid: uuidDocumentType2, + document_type_uuid: uuidDocumentType2, created_at: new Date(), updated_at: new Date(), }, diff --git a/src/common/repositories/AddressesRepository.ts b/src/common/repositories/AddressesRepository.ts index 6b2cf46d..6a5cdba3 100644 --- a/src/common/repositories/AddressesRepository.ts +++ b/src/common/repositories/AddressesRepository.ts @@ -16,20 +16,27 @@ export default class AddressesRepository extends BaseRepository { } /** - * @description : Find many users + * @description : Find many addresses */ public async findMany(query: any): Promise { query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); return this.model.findMany(query); } - public async create(address: Addresses): Promise { - return this.model.create({ - data: { - address: address.address, - city: address.city, - zip_code: address.zip_code, + /** + * @description : Find one address + */ + public async findOneByUid(uid: string): Promise { + const addressEntity = await this.model.findUnique({ + where: { + uuid: uid, }, }); + + if (!addressEntity) { + throw new Error("Address not found"); + } + + return addressEntity; } } diff --git a/src/common/repositories/ContactRepository.ts b/src/common/repositories/ContactRepository.ts deleted file mode 100644 index 2823a3f5..00000000 --- a/src/common/repositories/ContactRepository.ts +++ /dev/null @@ -1,25 +0,0 @@ -import Database from "@Common/databases/database"; -import BaseRepository from "@Repositories/BaseRepository"; -import { Service } from "typedi"; -import { Addresses } from "@prisma/client"; - -@Service() -export default class AddressesRepository extends BaseRepository { - constructor(private database: Database) { - super(); - } - protected get model() { - return this.database.getClient().addresses; - } - protected get instanceDb() { - return this.database.getClient(); - } - - /** - * @description : Find many users - */ - public async findMany(query: any): Promise { - query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); - return this.model.findMany(query); - } -} diff --git a/src/common/repositories/ContactsRepository.ts b/src/common/repositories/ContactsRepository.ts new file mode 100644 index 00000000..836b17d5 --- /dev/null +++ b/src/common/repositories/ContactsRepository.ts @@ -0,0 +1,42 @@ +import Database from "@Common/databases/database"; +import BaseRepository from "@Repositories/BaseRepository"; +import { Service } from "typedi"; +import { Contacts } from "@prisma/client"; + +@Service() +export default class ContactsRepository extends BaseRepository { + constructor(private database: Database) { + super(); + } + protected get model() { + return this.database.getClient().contacts; + } + protected get instanceDb() { + return this.database.getClient(); + } + + /** + * @description : Find many contacts + */ + public async findMany(query: any): Promise { + query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); + return this.model.findMany(query); + } + + /** + * @description : Find unique contact + */ + public async findOneByUid(uid: string): Promise { + const contactEntity = await this.model.findUnique({ + where: { + uuid: uid, + }, + }); + + if (!contactEntity) { + throw new Error("contact not found"); + } + + return contactEntity; + } +} diff --git a/src/common/repositories/CustomersRepository.ts b/src/common/repositories/CustomersRepository.ts index af434c55..97dd50d5 100644 --- a/src/common/repositories/CustomersRepository.ts +++ b/src/common/repositories/CustomersRepository.ts @@ -24,6 +24,9 @@ export default class CustomersRepository extends BaseRepository { return this.model.findMany(query); } + /** + * @description : Create a customer + */ public async create(customer: Customer): Promise { return this.model.create({ data: { @@ -34,11 +37,11 @@ export default class CustomersRepository extends BaseRepository { last_name: customer.contact.last_name, email: customer.contact.email, phone_number: customer.contact.phone_number, - cell_phone_number: customer.contact.cell_phone_number, + cell_phone_number: customer.contact?.cell_phone_number, civility: ECivility[customer.contact.civility as keyof typeof ECivility], address: { create: { - address: customer.contact.address.address, + address: customer.contact.address?.address, zip_code: customer.contact.address.zip_code, city: customer.contact.address.city, }, @@ -49,6 +52,9 @@ export default class CustomersRepository extends BaseRepository { }); } + /** + * @description : Update data from a customer + */ public async update(uid: string, customer: Customer): Promise { return this.model.update({ where: { @@ -77,6 +83,9 @@ export default class CustomersRepository extends BaseRepository { }); } + /** + * @description : Find unique customer + */ public async findOneByUid(uid: string): Promise { const customerEntity = await this.model.findUnique({ where: { diff --git a/src/common/repositories/DeedTypesHasDocumentTypesRepository.ts b/src/common/repositories/DeedTypesHasDocumentTypesRepository.ts index 21141db7..975842c0 100644 --- a/src/common/repositories/DeedTypesHasDocumentTypesRepository.ts +++ b/src/common/repositories/DeedTypesHasDocumentTypesRepository.ts @@ -1,5 +1,5 @@ import Database from "@Common/databases/database"; -import { DeedTypeHasDocumentTypes, Prisma } from "@prisma/client"; +import { DeedTypeHasDocumentTypes } from "@prisma/client"; import BaseRepository from "@Repositories/BaseRepository"; import { Service } from "typedi"; @@ -16,7 +16,7 @@ export default class DeedTypeHasDocumentTypesRepository extends BaseRepository { } /** - * @description : Find many users + * @description : Find many relations between deed type and a document type */ public async findMany(query: any): Promise { query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); @@ -24,78 +24,8 @@ export default class DeedTypeHasDocumentTypesRepository extends BaseRepository { } /** - * @description : Create new relation between deed type and a document type + * @description : Find unique relation between deed type and a document type */ - public async create(deedTypeUuid: string, documentTypesUuid: string): Promise { - return this.model.create({ - data: { - deed_type: { - connect: { - uuid: deedTypeUuid, - }, - }, - document_type: { - connect: { - uuid: documentTypesUuid, - }, - }, - }, - }); - } - - /** - * @description : Create new relation between deed type and a document type - */ - public async createMany(deedTypeUuid: string, documentTypesUuid: string[]): Promise { - let relationsToAdd: Prisma.DeedTypeHasDocumentTypesCreateManyInput[] = []; - documentTypesUuid.forEach((item) => { - relationsToAdd.push({ deed_type_uuid: deedTypeUuid, document_type_uuid: item }); - }); - - const numberOfRelationsAdded = ( - await this.model.createMany({ - data: relationsToAdd, - skipDuplicates: true, - }) - ).count; - - return this.findMany({ where: { deed_type_uuid: deedTypeUuid }, take: numberOfRelationsAdded }); - } - - /** - * @description : Create new relation between deed type and a document type - */ - public async delete(deedTypeUuid: string, documentTypesUuid: string): Promise { - return this.model.delete({ - where: { - deed_type_uuid_document_type_uuid: { - deed_type_uuid: deedTypeUuid, - document_type_uuid: documentTypesUuid, - }, - }, - }); - } - - /** - * @description : Create new relation between deed type and a document type - */ - public async deleteMany(deedTypeUuid: string, documentTypesUuids: string[]): Promise { - let relationsToRemove: any[] = []; - documentTypesUuids.forEach((relationUuid) => { - relationsToRemove.push( - this.model.delete({ - where: { - deed_type_uuid_document_type_uuid: { - deed_type_uuid: deedTypeUuid, - document_type_uuid: relationUuid, - }, - }, - }), - ); - }); - return this.instanceDb.$transaction(relationsToRemove); - } - public async findOneByUid(uid: string): Promise { const deedTypeHasDoculmentTypesEntity = await this.model.findUnique({ where: { diff --git a/src/common/repositories/DeedTypesRepository.ts b/src/common/repositories/DeedTypesRepository.ts index eb60b8ed..5138288b 100644 --- a/src/common/repositories/DeedTypesRepository.ts +++ b/src/common/repositories/DeedTypesRepository.ts @@ -1,7 +1,7 @@ import Database from "@Common/databases/database"; import BaseRepository from "@Repositories/BaseRepository"; import { Service } from "typedi"; -import { DeedTypes } from "@prisma/client"; +import { DeedTypes, Prisma } from "@prisma/client"; import { DeedType } from "le-coffre-resources/dist/SuperAdmin"; @Service() @@ -17,7 +17,7 @@ export default class DeedTypesRepository extends BaseRepository { } /** - * @description : Find many users + * @description : Find many deed types */ public async findMany(query: any): Promise { query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); @@ -25,7 +25,7 @@ export default class DeedTypesRepository extends BaseRepository { } /** - * @description : Create new office folder wihtout customers nor stakeholders + * @description : Create new deed type */ public async create(deedType: DeedType): Promise { return this.model.create({ @@ -42,11 +42,13 @@ export default class DeedTypesRepository extends BaseRepository { } /** - * @description : Create new office folder wihtout customers nor stakeholders + * @description : Update data of a deed type */ public async update(uid: string, deedType: DeedType): Promise { - return this.model.update({ - where: { uuid: uid }, + const updateArgs: Prisma.DeedTypesUpdateArgs = { + where: { + uuid: uid, + }, data: { name: deedType.name, description: deedType.description, @@ -57,9 +59,27 @@ export default class DeedTypesRepository extends BaseRepository { }, }, }, - }); + include: { + deed_type_has_document_types: true, + }, + }; + if (deedType.deed_type_has_document_types) { + updateArgs.data.deed_type_has_document_types = { + deleteMany: { deed_type_uuid: uid }, + createMany: { + data: deedType.deed_type_has_document_types.map((relation) => ({ + document_type_uuid: relation.document_type.uid, + })), + skipDuplicates: true, + }, + }; + } + return this.model.update(updateArgs); } + /** + * @description : Find unique deed type + */ public async findOneByUid(uid: string): Promise { const deedTypeEntity = await this.model.findUnique({ where: { @@ -76,42 +96,4 @@ export default class DeedTypesRepository extends BaseRepository { return deedTypeEntity; } - - /** - * @description : update relations between document types and given deed type - */ - public async addDocumentType(uid: string, deedTypeHasDocumentTypeUuid: string): Promise { - return this.model.update({ - where: { uuid: uid }, - data: { - deed_type_has_document_types: { - connect: { - uuid: deedTypeHasDocumentTypeUuid, - }, - }, - }, - }); - } - - /** - * @description : update relations between document types and given deed type - */ - public async addDocumentTypes(uid: string, deedTypeHasDocumentTypeUuid: string[]): Promise { - let relationsToAdd: any[] = []; - deedTypeHasDocumentTypeUuid.forEach((relationUuid) => { - relationsToAdd.push( - this.model.update({ - where: { uuid: uid }, - data: { - deed_type_has_document_types: { - connect: { - uuid: relationUuid, - }, - }, - }, - }), - ); - }); - return this.instanceDb.$transaction(relationsToAdd); - } } diff --git a/src/common/repositories/DeedsHasDocumentTypesRepository.ts b/src/common/repositories/DeedsHasDocumentTypesRepository.ts index f9b6aa7b..8f3c1712 100644 --- a/src/common/repositories/DeedsHasDocumentTypesRepository.ts +++ b/src/common/repositories/DeedsHasDocumentTypesRepository.ts @@ -1,5 +1,5 @@ import Database from "@Common/databases/database"; -import { DeedHasDocumentTypes, Prisma } from "@prisma/client"; +import { DeedHasDocumentTypes } from "@prisma/client"; import BaseRepository from "@Repositories/BaseRepository"; import { Service } from "typedi"; @@ -16,7 +16,7 @@ export default class DeedHasDocumentTypesRepository extends BaseRepository { } /** - * @description : Find many users + * @description : Find many deeds */ public async findMany(query: any): Promise { query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); @@ -24,89 +24,19 @@ export default class DeedHasDocumentTypesRepository extends BaseRepository { } /** - * @description : Create new relation between deed type and a document type + * @description : Find unique relation between deed and a document type */ - public async create(deedUuid: string, documentTypesUuid: string): Promise { - return this.model.create({ - data: { - deed: { - connect: { - uuid: deedUuid, - }, - }, - document_type: { - connect: { - uuid: documentTypesUuid, - }, - }, - }, - }); - } - - /** - * @description : Create new relation between deed type and a document type - */ - public async createMany(deedUuid: string, documentTypesUuid: string[]): Promise { - let relationsToAdd: Prisma.DeedHasDocumentTypesCreateManyInput[] = []; - documentTypesUuid.forEach((item) => { - relationsToAdd.push({ deed_uuid: deedUuid, document_type_uuid: item }); - }); - - const numberOfRelationsAdded = ( - await this.model.createMany({ - data: relationsToAdd, - skipDuplicates: true, - }) - ).count; - - return this.findMany({ where: { deed_uuid: deedUuid }, take: numberOfRelationsAdded }); - } - - /** - * @description : Create new relation between deed type and a document type - */ - public async delete(deedUuid: string, documentTypesUuid: string): Promise { - return this.model.delete({ - where: { - deed_uuid_document_type_uuid: { - deed_uuid: deedUuid, - document_type_uuid: documentTypesUuid, - }, - }, - }); - } - - /** - * @description : Create new relation between deed type and a document type - */ - public async deleteMany(deedUuid: string, documentTypesUuids: string[]): Promise { - let relationsToRemove: any[] = []; - documentTypesUuids.forEach((relationUuid) => { - relationsToRemove.push( - this.model.delete({ - where: { - deed_uuid_document_type_uuid: { - deed_uuid: deedUuid, - document_type_uuid: relationUuid, - }, - }, - }), - ); - }); - return this.instanceDb.$transaction(relationsToRemove); - } - public async findOneByUid(uid: string): Promise { - const deedHasDoculmentTypesEntity = await this.model.findUnique({ + const deedHasDocumentTypesEntity = await this.model.findUnique({ where: { uuid: uid, }, }); - if (!deedHasDoculmentTypesEntity) { + if (!deedHasDocumentTypesEntity) { throw new Error("relation between deed and document type not found"); } - return deedHasDoculmentTypesEntity; + return deedHasDocumentTypesEntity; } } diff --git a/src/common/repositories/DeedsRepository.ts b/src/common/repositories/DeedsRepository.ts index 494dc60c..098656e7 100644 --- a/src/common/repositories/DeedsRepository.ts +++ b/src/common/repositories/DeedsRepository.ts @@ -1,8 +1,8 @@ import Database from "@Common/databases/database"; import BaseRepository from "@Repositories/BaseRepository"; import { Service } from "typedi"; -import { Deeds } from "@prisma/client"; -import { DeedType } from "le-coffre-resources/dist/Customer"; +import { Deeds, Prisma } from "@prisma/client"; +import { Deed } from "le-coffre-resources/dist/Notary"; @Service() export default class DeedsRepository extends BaseRepository { @@ -24,18 +24,51 @@ export default class DeedsRepository extends BaseRepository { return this.model.findMany(query); } - public async create(deedType: DeedType): Promise { + /** + * @description : Create a deed based on a deed type + */ + public async create(deed: Deed): Promise { return this.model.create({ data: { deed_type: { connect: { - uuid: deedType.uid, + uuid: deed.deed_type.uid, }, }, }, }); } + /** + * @description : Update data of a deed type + */ + public async update(uid: string, deed: Deed): Promise { + const updateArgs: Prisma.DeedsUpdateArgs = { + where: { + uuid: uid, + }, + data: {}, + include: { + deed_has_document_types: true, + }, + }; + if (deed.deed_has_document_types) { + updateArgs.data.deed_has_document_types = { + deleteMany: { deed_uuid: uid }, + createMany: { + data: deed.deed_has_document_types.map((relation) => ({ + document_type_uuid: relation.document_type.uid, + })), + skipDuplicates: true, + }, + }; + } + return this.model.update(updateArgs); + } + + /** + * @description : Find unique deed + */ public async findOneByUid(uid: string): Promise { const deedTypeEntity = await this.model.findUnique({ where: { @@ -44,47 +77,9 @@ export default class DeedsRepository extends BaseRepository { }); if (!deedTypeEntity) { - throw new Error("deed type not found"); + throw new Error("deed not found"); } return deedTypeEntity; } - - /** - * @description : update relations between document types and given deed type - */ - public async addDocumentType(uid: string, deedHasDocumentTypeUuid: string): Promise { - return this.model.update({ - where: { uuid: uid }, - data: { - deed_has_document_types: { - connect: { - uuid: deedHasDocumentTypeUuid, - }, - }, - }, - }); - } - - /** - * @description : update relations between document types and given deed type - */ - public async addDocumentTypes(uid: string, deedHasDocumentTypeUuid: string[]): Promise { - let relationsToAdd: any[] = []; - deedHasDocumentTypeUuid.forEach((relationUuid) => { - relationsToAdd.push( - this.model.update({ - where: { uuid: uid }, - data: { - deed_has_document_types: { - connect: { - uuid: relationUuid, - }, - }, - }, - }), - ); - }); - return this.instanceDb.$transaction(relationsToAdd); - } } diff --git a/src/common/repositories/DocumentTypesRepository.ts b/src/common/repositories/DocumentTypesRepository.ts index ca65f0ad..a502b47a 100644 --- a/src/common/repositories/DocumentTypesRepository.ts +++ b/src/common/repositories/DocumentTypesRepository.ts @@ -17,13 +17,16 @@ export default class DocumentTypesRepository extends BaseRepository { } /** - * @description : Find many users + * @description : Find many document types */ public async findMany(query: any): Promise { query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); return this.model.findMany(query); } + /** + * @description : Create a document type + */ public async create(documentType: DocumentType): Promise { return this.model.create({ data: { @@ -40,7 +43,7 @@ export default class DocumentTypesRepository extends BaseRepository { } /** - * @description : update given deed + * @description : update given document type */ public async update(uuid: string, documentType: DocumentType): Promise { return this.model.update({ @@ -61,6 +64,9 @@ export default class DocumentTypesRepository extends BaseRepository { }); } + /** + * @description : find unique document type + */ public async findOneByUid(uid: string): Promise { const documentTypeEntity = await this.model.findUnique({ where: { diff --git a/src/common/repositories/DocumentsRepository.ts b/src/common/repositories/DocumentsRepository.ts index 8b5a8ef0..2b37321f 100644 --- a/src/common/repositories/DocumentsRepository.ts +++ b/src/common/repositories/DocumentsRepository.ts @@ -1,7 +1,8 @@ import Database from "@Common/databases/database"; import BaseRepository from "@Repositories/BaseRepository"; import { Service } from "typedi"; -import { Documents } from "@prisma/client"; +import { Documents, EDocumentStatus, Prisma } from "@prisma/client"; +import { Document } from "le-coffre-resources/dist/SuperAdmin"; @Service() export default class DocumentsRepository extends BaseRepository { @@ -16,10 +17,114 @@ export default class DocumentsRepository extends BaseRepository { } /** - * @description : Find many users + * @description : Find many documents */ public async findMany(query: any): Promise { query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); return this.model.findMany(query); } + + /** + * @description : Create a document + */ + public async create(document: Document): Promise { + const documentCreated = await this.model.create({ + data: { + folder: { + connect: { + uuid: document.folder.uid, + }, + }, + depositor: { + connect: { + uuid: document.depositor.uid, + }, + }, + document_type: { + connect: { + uuid: document.document_type.uid, + }, + }, + }, + }); + + await this.instanceDb.documentHistory.create({ + data: { + document: { + connect: { + uuid: documentCreated.uuid, + }, + }, + }, + }); + + return documentCreated; + } + + /** + * @description : Create many documents linked to an office folder + */ + public async createMany(documents: Document[]): Promise { + return this.model.createMany({ + data: documents.map((document) => ({ + folder_uuid: document.folder.uid, + depositor_uuid: document.depositor.uid, + document_type_uuid: document.document_type.uid, + })), + skipDuplicates: true, + }); + } + + /** + * @description : Update data of a document + */ + public async update(uid: string, document: Document, refusedReason?: string): Promise { + return this.model.update({ + where: { + uuid: uid, + }, + data: { + document_status: EDocumentStatus[document.document_status as keyof typeof EDocumentStatus], + document_history: { + create: { + document_status: EDocumentStatus[document.document_status as keyof typeof EDocumentStatus], + refused_reason: refusedReason, + }, + }, + depositor: { + connect: { + uuid: document.depositor.uid, + }, + }, + }, + }); + } + + /** + * @description : Delete a document + */ + public async delete(uid: string): Promise { + return this.model.delete({ + where: { + uuid: uid, + }, + }); + } + + /** + * @description : Find unique document + */ + public async findOneByUid(uid: string): Promise { + const documentEntity = await this.model.findUnique({ + where: { + uuid: uid, + }, + }); + + if (!documentEntity) { + throw new Error("Document not found"); + } + + return documentEntity; + } } diff --git a/src/common/repositories/FilesRepository.ts b/src/common/repositories/FilesRepository.ts new file mode 100644 index 00000000..b6431dff --- /dev/null +++ b/src/common/repositories/FilesRepository.ts @@ -0,0 +1,84 @@ +import Database from "@Common/databases/database"; +import BaseRepository from "@Repositories/BaseRepository"; +import { Service } from "typedi"; +import { Files } from "@prisma/client"; +import { File } from "le-coffre-resources/dist/SuperAdmin" + +@Service() +export default class FilesRepository extends BaseRepository { + constructor(private database: Database) { + super(); + } + protected get model() { + return this.database.getClient().files; + } + protected get instanceDb() { + return this.database.getClient(); + } + + /** + * @description : Find many files + */ + public async findMany(query: any): Promise { + query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); + return this.model.findMany(query); + } + + /** + * @description : Create a file linked to a document + */ + public async create(file: File): Promise { + return this.model.create({ + data: { + document: { + connect: { + uuid: file.document.uid + } + }, + file_path: file.file_path + }, + }); + } + + /** + * @description : Update data of a file + */ + public async update(uid: string, file: File): Promise { + return this.model.update({ + where: { + uuid: uid, + }, + data: { + file_path: file.file_path + }, + }); + } + + /** + * @description : Delete a file + */ + public async delete(uid: string): Promise { + return this.model.delete({ + where: { + uuid: uid, + } + }); + } + + /** + * @description : Find unique file + */ + public async findOneByUid(uid: string): Promise { + const fileEntity = await this.model.findUnique({ + where: { + uuid: uid, + }, + }); + + if (!fileEntity) { + throw new Error("File not found"); + } + + return fileEntity; + } +} diff --git a/src/common/repositories/OfficeFoldersHasCustomerRepository.ts b/src/common/repositories/OfficeFoldersHasCustomerRepository.ts new file mode 100644 index 00000000..cb879b32 --- /dev/null +++ b/src/common/repositories/OfficeFoldersHasCustomerRepository.ts @@ -0,0 +1,43 @@ +import Database from "@Common/databases/database"; +import { OfficeFolderHasCustomers } from "@prisma/client"; +import BaseRepository from "@Repositories/BaseRepository"; +import { Service } from "typedi"; + +@Service() +export default class OfficeFoldersHasCustomerRepository extends BaseRepository { + constructor(private database: Database) { + super(); + } + protected get model() { + return this.database.getClient().officeFolderHasCustomers; + } + protected get instanceDb() { + return this.database.getClient(); + } + + /** + * @description : Find many relations + */ + public async findMany(query: any): Promise { + query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); + return this.model.findMany(query); + } + + + /** + * @description : Find a unique relation between an office folder and customers + */ + public async findOneByUid(uid: string): Promise { + const officeFolderHasCustomersEntity = await this.model.findUnique({ + where: { + uuid: uid, + }, + }); + + if (!officeFolderHasCustomersEntity) { + throw new Error("relation between office folder and customer not found"); + } + + return officeFolderHasCustomersEntity; + } +} diff --git a/src/common/repositories/OfficeFoldersHasStakeholderRepository.ts b/src/common/repositories/OfficeFoldersHasStakeholderRepository.ts new file mode 100644 index 00000000..576e9cd0 --- /dev/null +++ b/src/common/repositories/OfficeFoldersHasStakeholderRepository.ts @@ -0,0 +1,42 @@ +import Database from "@Common/databases/database"; +import { OfficeFolderHasStakeholders } from "@prisma/client"; +import BaseRepository from "@Repositories/BaseRepository"; +import { Service } from "typedi"; + +@Service() +export default class OfficeFoldersHasStakeholderRepository extends BaseRepository { + constructor(private database: Database) { + super(); + } + protected get model() { + return this.database.getClient().officeFolderHasStakeholders; + } + protected get instanceDb() { + return this.database.getClient(); + } + + /** + * @description : Find many relations + */ + public async findMany(query: any): Promise { + query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); + return this.model.findMany(query); + } + + /** + * @description : Find a unique relation between an office folder and stakeholders + */ + public async findOneByUid(uid: string): Promise { + const officeFolderHasStakeholdersEntity = await this.model.findUnique({ + where: { + uuid: uid, + }, + }); + + if (!officeFolderHasStakeholdersEntity) { + throw new Error("relation between office folder and stakeholder not found"); + } + + return officeFolderHasStakeholdersEntity; + } +} diff --git a/src/common/repositories/OfficeFoldersRepository.ts b/src/common/repositories/OfficeFoldersRepository.ts index 2f527c29..81274040 100644 --- a/src/common/repositories/OfficeFoldersRepository.ts +++ b/src/common/repositories/OfficeFoldersRepository.ts @@ -1,8 +1,7 @@ import Database from "@Common/databases/database"; -import { ORMBadQueryError } from "@Common/system/database/exceptions/ORMBadQueryError"; import BaseRepository from "@Repositories/BaseRepository"; import { Service } from "typedi"; -import { EFolderStatus, OfficeFolders } from "@prisma/client"; +import { EFolderStatus, OfficeFolders, Prisma } from "@prisma/client"; import { OfficeFolder } from "le-coffre-resources/dist/SuperAdmin"; @Service() @@ -21,86 +20,123 @@ export default class OfficeFoldersRepository extends BaseRepository { * @description : Find many office folders */ public async findMany(query: any): Promise { - try { - const limit = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); - - return await this.model.findMany({ ...query, take: limit }); - } catch (error) { - throw new ORMBadQueryError((error as Error).message, error as Error); - } + query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); + return this.model.findMany(query); } /** - * @description : Create new office folder wihtout customers nor stakeholders + * @description : Create new office folder without customers nor stakeholders */ public async create(officeFolder: OfficeFolder): Promise { - try { - const officeFolderEntityCreated = (await this.model.create({ - data: { - folder_number: officeFolder.folder_number, - name: officeFolder.name, - description: officeFolder.description, - status: EFolderStatus.LIVE, - deed: { - create: { - deed_type: { - connect: { - uuid: officeFolder.deed.deed_type.uid, - }, + const createArgs: Prisma.OfficeFoldersCreateArgs = { + data: { + folder_number: officeFolder.folder_number, + name: officeFolder.name, + description: officeFolder.description, + status: EFolderStatus.LIVE, + deed: { + create: { + deed_type: { + connect: { + uuid: officeFolder.deed.deed_type.uid, }, }, }, - office: { - connect: { - idNot: officeFolder.office.idNot, - }, + }, + office: { + connect: { + idNot: officeFolder.office.idNot, }, }, - })) as OfficeFolders; - - return officeFolderEntityCreated; - } catch (error) { - throw new ORMBadQueryError((error as Error).message, error as Error); + }, + include: { + office_folder_has_stakeholder: true, + } + }; + if (officeFolder.office_folder_has_stakeholder) { + createArgs.data.office_folder_has_stakeholder = { + createMany: { + data: officeFolder.office_folder_has_stakeholder.map((relation) => ({ + user_stakeholder_uuid: relation.user_stakeholder.uid, + })), + skipDuplicates: true + }, + }; } + return this.model.create(createArgs); } - public async update( - officeFolder: OfficeFolder, - officeFolderHasStakeholders_uuid?: string, - officeFolderHasCustomers_uuid?: string, - document_uuid?: string, - ): Promise { - try { - const officeFolderEntityUpdated = (await this.model.update({ - where: { - uuid: officeFolder.uid, + /** + * @description : Update data of an office folder + */ + public async update(officeFolderUuid: string, officeFolder: OfficeFolder): Promise { + const updateArgs: Prisma.OfficeFoldersUpdateArgs = { + where: { + uuid: officeFolderUuid, + }, + data: { + folder_number: officeFolder.folder_number, + name: officeFolder.name, + description: officeFolder.description, + status: EFolderStatus[officeFolder.status as keyof typeof EFolderStatus], + archived_description: officeFolder.archived_description, + }, + include: { + office_folder_has_stakeholder: true, + office_folder_has_customers: true, + documents: true, + } + }; + if (officeFolder.office_folder_has_stakeholder) { + updateArgs.data.office_folder_has_stakeholder = { + deleteMany: { office_folder_uuid: officeFolderUuid }, + createMany: { + data: officeFolder.office_folder_has_stakeholder.map((relation) => ({ + user_stakeholder_uuid: relation.user_stakeholder.uid, + })), + skipDuplicates: true }, - data: { - folder_number: officeFolder.folder_number, - name: officeFolder.name, - description: officeFolder.description, - status: EFolderStatus.LIVE, - office_folder_has_stakeholder: { - connect: { - uuid: officeFolderHasStakeholders_uuid, - }, - }, - office_folder_has_customers: { - connect: { - uuid: officeFolderHasCustomers_uuid, - }, - }, - documents: { - connect: { - uuid: document_uuid, - }, - }, - }, - })) as OfficeFolders; - - return officeFolderEntityUpdated; - } catch (error) { - throw new ORMBadQueryError((error as Error).message, error as Error); + } } + if (officeFolder.office_folder_has_customers) { + updateArgs.data.office_folder_has_customers = { + deleteMany: { office_folder_uuid: officeFolderUuid }, + createMany: { + data: officeFolder.office_folder_has_customers.map((relation) => ({ + customer_uuid: relation.customer.uid, + })), + skipDuplicates: true + }, + } + } + if (officeFolder.documents) { + updateArgs.data.documents = { + createMany: { + data: officeFolder.documents.map((relation) => ({ + document_type_uuid: relation.document_type.uid, + depositor_uuid: relation.depositor.uid + })), + skipDuplicates: true + }, + } + } + return this.model.update(updateArgs); + } + + /** + * @description : Find one office folder + */ + public async findOneByUid(uid: string): Promise { + const officeFolderEntity = await this.model.findUnique({ + where: { + uuid: uid, + }, + }); + + if (!officeFolderEntity) { + throw new Error("office folder not found"); + } + + return officeFolderEntity; } } diff --git a/src/common/repositories/OfficesRepository.ts b/src/common/repositories/OfficesRepository.ts index 0f440850..741bdd10 100644 --- a/src/common/repositories/OfficesRepository.ts +++ b/src/common/repositories/OfficesRepository.ts @@ -1,5 +1,4 @@ import Database from "@Common/databases/database"; -import { ORMBadQueryError } from "@Common/system/database/exceptions/ORMBadQueryError"; import BaseRepository from "@Repositories/BaseRepository"; import { Service } from "typedi"; import { EOfficeStatus, Offices } from "@prisma/client"; @@ -21,80 +20,68 @@ export default class OfficesRepository extends BaseRepository { * @description : Find many users */ public async findMany(query: any): Promise { - try { - const limit = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); + query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); - return await this.model.findMany({ ...query, take: limit }); - } catch (error) { - throw new ORMBadQueryError((error as Error).message, error as Error); - } + return this.model.findMany(query); } + /** + * @description : Create an office + */ public async create(office: OfficeRessource): Promise { - try { - const officeEntityCreated = (await this.model.create({ - data: { - idNot: office.idNot, - name: office.name, - crpcen: office.crpcen, - address: { - create: { - address: office.address.address, - zip_code: office.address.zip_code, - city: office.address.city, - }, + return this.model.create({ + data: { + idNot: office.idNot, + name: office.name, + crpcen: office.crpcen, + address: { + create: { + address: office.address.address, + zip_code: office.address.zip_code, + city: office.address.city, }, - office_status: EOfficeStatus.DESACTIVATED, }, - })) as Offices; - - return officeEntityCreated; - } catch (error) { - throw new ORMBadQueryError((error as Error).message, error as Error); - } + office_status: EOfficeStatus.DESACTIVATED, + }, + }); } + /** + * @description : Update data from an office + */ public async update(uid: string, office: OfficeRessource): Promise { - try { - const officeEntityUpdated = (await this.model.update({ - where: { - uuid: uid, - }, - data: { - name: office.name, - address: { - create: { - address: office.address.address, - zip_code: office.address.zip_code, - city: office.address.city, - }, + return this.model.update({ + where: { + uuid: uid, + }, + data: { + name: office.name, + address: { + create: { + address: office.address.address, + zip_code: office.address.zip_code, + city: office.address.city, }, - office_status: EOfficeStatus[office.office_status as keyof typeof EOfficeStatus], }, - })) as Offices; - return officeEntityUpdated; - } catch (error) { - throw new ORMBadQueryError((error as Error).message, error as Error); - } + office_status: EOfficeStatus[office.office_status as keyof typeof EOfficeStatus], + }, + }); } + /** + * @description : Find one office + */ public async findOneByUid(uid: string): Promise { - try { - const officeEntity = await this.model.findUnique({ - where: { - uuid: uid, - }, - }); + const officeEntity = await this.model.findUnique({ + where: { + uuid: uid, + }, + }); - if (!officeEntity) { - throw new Error("User not found"); - } - - return officeEntity; - - //return await this.model.find({ ...query, take: limit }); - } catch (error) { - throw new ORMBadQueryError((error as Error).message, error as Error); + if (!officeEntity) { + throw new Error("User not found"); } + + return officeEntity; } } diff --git a/src/common/repositories/UsersRepository.ts b/src/common/repositories/UsersRepository.ts index 7f0e2b29..f41eeeb3 100644 --- a/src/common/repositories/UsersRepository.ts +++ b/src/common/repositories/UsersRepository.ts @@ -21,9 +21,12 @@ export default class UsersRepository extends BaseRepository { */ public async findMany(query: any): Promise { query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); - return await this.model.findMany(query); + return this.model.findMany(query); } + /** + * @description : Create a user + */ public async create(user: User): Promise { return this.model.create({ data: { @@ -68,6 +71,9 @@ export default class UsersRepository extends BaseRepository { }); } + /** + * @description : Update data from a user + */ public async update(uid: string, user: User): Promise { return this.model.update({ where: { diff --git a/src/services/private-services/AddressesService/AddressesService.ts b/src/services/private-services/AddressesService/AddressesService.ts index 5ed24488..8d3886c3 100644 --- a/src/services/private-services/AddressesService/AddressesService.ts +++ b/src/services/private-services/AddressesService/AddressesService.ts @@ -1,64 +1,26 @@ -// import { Addresses } from "@prisma/client"; -import { Addresses } from "@prisma/client"; import AddressesRepository from "@Repositories/AddressesRepository"; import BaseService from "@Services/BaseService"; -import Container, { Service } from "typedi"; +import { Service } from "typedi"; @Service() export default class AddressesService extends BaseService { - constructor() { + constructor(private addressRepository: AddressesRepository) { super(); } /** * @description : Get all addresses - * @returns : T * @throws {Error} If addresses cannot be get - * @param : projectEntity: Partial */ public async get(query: any) { - //init repo - const repo = Container.get(AddressesRepository); - - //call service to return prisma entity - return await repo.findMany(query); - } - - /** - * @description : Create a new address - * @returns : T - * @throws {Error} If address cannot be created - * @param : projectEntity: Partial - */ - public async create(address: Addresses): Promise { - //init repo - const repo = Container.get(AddressesRepository); - - // call service to return prisma entity - return await repo.create(address); - } - - /** - * @description : Modify a new address - * @returns : T - * @throws {Error} If address cannot be modified - * @param : projectEntity: Partial - */ - public async put() { - // const address = await this.projectRepository.create(projectEntity); - // if (!address) Promise.reject(new Error("Cannot create project")); - return { response: "/api/addresses > PUT : Modified address > Not implemented yet" }; + return this.addressRepository.findMany(query); } /** * @description : Get a address by uid - * @returns : T - * @throws {Error} If address cannot be created - * @param : projectEntity: Partial + * @throws {Error} If address cannot be get */ public async getByUid(uuid: string) { - // const address = await this.usersRepository.findOne(uuid); - // if (!address) Promise.reject(new Error("Cannot get address by uuid")); - return { response: "/api/addresses/:uuid > GET : address by uid > Not implemented yet" }; + return this.addressRepository.findOneByUid(uuid); } } diff --git a/src/services/private-services/AuthService/AuthService.ts b/src/services/private-services/AuthService/AuthService.ts index c9ab60e9..5470dba2 100644 --- a/src/services/private-services/AuthService/AuthService.ts +++ b/src/services/private-services/AuthService/AuthService.ts @@ -5,9 +5,9 @@ import { BackendVariables } from "@Common/config/variables/Variables"; import Container, { Service } from "typedi"; type IdNotTokens = { - access_token: string, - id_token: string -} + access_token: string; + id_token: string; +}; @Service() export default class AuthService extends BaseService { @@ -20,19 +20,22 @@ export default class AuthService extends BaseService { * @description : Get IdNot id_token and access_token * @throws {Error} If jwt pair cannot be get */ - public async getUserFromIdNotTokens(code: string) { + public async getUserFromIdNotTokens(code: string) { const tokens = await this.getIdNotTokens(code); return jwt.decode(tokens.id_token); } private async getIdNotTokens(code: string): Promise { - const url = new URL(this.variables.IDNOT_CONNEXION_URL.concat("?") + new URLSearchParams({ - client_id: this.variables.IDNOT_CLIENT_ID, - client_secret: this.variables.IDNOT_CLIENT_SECRET, - redirect_uri: this.variables.IDNOT_REDIRECT_URL, - code: code, - grant_type: "authorization_code", - })); + const url = new URL( + this.variables.IDNOT_CONNEXION_URL.concat("?") + + new URLSearchParams({ + client_id: this.variables.IDNOT_CLIENT_ID, + client_secret: this.variables.IDNOT_CLIENT_SECRET, + redirect_uri: this.variables.IDNOT_REDIRECT_URL, + code: code, + grant_type: "authorization_code", + }), + ); try { const headers = new Headers({ "Content-Type": "application/x-www-form-urlencoded", @@ -41,10 +44,10 @@ export default class AuthService extends BaseService { method: "POST", headers: headers, }); - const data = await res.json() + const data = await res.json(); return data as IdNotTokens; } catch (error) { - console.log(error) + console.log(error); throw new Error(); } } diff --git a/src/services/private-services/ContactsService/ContactsService.ts b/src/services/private-services/ContactsService/ContactsService.ts index 7976931c..4c1df6d1 100644 --- a/src/services/private-services/ContactsService/ContactsService.ts +++ b/src/services/private-services/ContactsService/ContactsService.ts @@ -1,57 +1,26 @@ +import ContactsRepository from "@Repositories/ContactsRepository"; import BaseService from "@Services/BaseService"; import { Service } from "typedi"; @Service() export default class ContactsService extends BaseService { - constructor() { + constructor(private contactRepository: ContactsRepository) { super(); } /** * @description : Get all contacts - * @returns : T * @throws {Error} If contacts cannot be get - * @param : projectEntity: Partial */ - public async get() { - // const contact = await this.usersRepository.findOne(uuid); - // if (!contact) Promise.reject(new Error("Cannot get contact by uuid")); - return { response: "/api/contacts > GET : All contacts > Not implemented yet" }; - } - - /** - * @description : Create a new contact - * @returns : T - * @throws {Error} If contact cannot be created - * @param : projectEntity: Partial - */ - public async create() { - // const contact = await this.projectRepository.create(projectEntity); - // if (!contact) Promise.reject(new Error("Cannot create project")); - return { response: "/api/contacts > POST : Create contact > Not implemented yet" }; - } - - /** - * @description : Modify a new contact - * @returns : T - * @throws {Error} If contact cannot be modified - * @param : projectEntity: Partial - */ - public async put() { - // const contact = await this.projectRepository.create(projectEntity); - // if (!contact) Promise.reject(new Error("Cannot create project")); - return { response: "/api/contacts > PUT : Modified contact > Not implemented yet" }; + public async get(query: any) { + return this.contactRepository.findMany(query); } /** * @description : Get a contact by uid - * @returns : T - * @throws {Error} If project cannot be created - * @param : projectEntity: Partial + * @throws {Error} If contact cannot be get */ public async getByUid(uuid: string) { - // const contact = await this.usersRepository.findOne(uuid); - // if (!contact) Promise.reject(new Error("Cannot get contact by uuid")); - return { response: "/api/contacts/:uuid > GET : contact by uid > Not implemented yet" }; + return this.contactRepository.findOneByUid(uuid); } } diff --git a/src/services/private-services/FilesService/FilesService.ts b/src/services/private-services/FilesService/FilesService.ts index 3245f019..67656f16 100644 --- a/src/services/private-services/FilesService/FilesService.ts +++ b/src/services/private-services/FilesService/FilesService.ts @@ -1,57 +1,43 @@ +import FilesRepository from "@Repositories/FilesRepository"; import BaseService from "@Services/BaseService"; import { Service } from "typedi"; +import { File } from "le-coffre-resources/dist/SuperAdmin" @Service() export default class FilesService extends BaseService { - constructor() { + constructor(private filesRepository: FilesRepository) { super(); } /** * @description : Get all files - * @returns : T - * @throws {Error} If files cannot be get - * @param : projectEntity: Partial + * @throws {Error} If files cannot be ge */ - public async get() { - // const files = await this.usersRepository.findOne(uuid); - // if (!files) Promise.reject(new Error("Cannot get files")); - return { response: "/api/files > GET : All files > Not implemented yet" }; + public async get(query: any) { + return this.filesRepository.findMany(query); } /** * @description : Create a new file - * @returns : T * @throws {Error} If file cannot be created - * @param : projectEntity: Partial */ - public async create() { - // const file = await this.projectRepository.create(projectEntity); - // if (!file) Promise.reject(new Error("Cannot create project")); - return { response: "/api/files > POST : Create file > Not implemented yet" }; + public async create(file: File) { + return this.filesRepository.create(file); } /** * @description : Modify a new file - * @returns : T * @throws {Error} If file cannot be modified - * @param : projectEntity: Partial */ - public async put() { - // const file = await this.projectRepository.create(projectEntity); - // if (!file) Promise.reject(new Error("Cannot create project")); - return { response: "/api/files > PUT : Modified file > Not implemented yet" }; + public async put(uid: string, file: File) { + return this.filesRepository.update(uid, file); } /** * @description : Get a file by uid - * @returns : T * @throws {Error} If project cannot be created - * @param : projectEntity: Partial */ public async getByUid(uid: string) { - // const file = await this.usersRepository.findOne(uid); - // if (!file) Promise.reject(new Error("Cannot get file by uid")); - return { response: "/api/files/:uid > GET : file by uid > Not implemented yet" }; + return this.filesRepository.findOneByUid(uid); } } diff --git a/src/services/super-admin/DeedTypesService/DeedTypesService.ts b/src/services/super-admin/DeedTypesService/DeedTypesService.ts index 1a92eb9b..c52f3278 100644 --- a/src/services/super-admin/DeedTypesService/DeedTypesService.ts +++ b/src/services/super-admin/DeedTypesService/DeedTypesService.ts @@ -1,5 +1,4 @@ import { DeedTypes } from "@prisma/client"; -import DeedTypeHasDocumentTypesRepository from "@Repositories/DeedTypesHasDocumentTypesRepository"; import DeedTypesRepository from "@Repositories/DeedTypesRepository"; import BaseService from "@Services/BaseService"; import { DeedType } from "le-coffre-resources/dist/SuperAdmin"; @@ -9,7 +8,6 @@ import { Service } from "typedi"; export default class DeedTypesService extends BaseService { constructor( private deedTypeRepository: DeedTypesRepository, - private deedTypeHasDocumentTypesRepository: DeedTypeHasDocumentTypesRepository, ) { super(); } @@ -25,7 +23,6 @@ export default class DeedTypesService extends BaseService { /** * @description : Create a new deed-type * @throws {Error} If deed-type cannot be created - * @param : deedTypesEntity: Partial */ public async create(deedTypeEntity: DeedType): Promise { return this.deedTypeRepository.create(deedTypeEntity); @@ -46,33 +43,4 @@ export default class DeedTypesService extends BaseService { public async getByUid(uid: string) { return this.deedTypeRepository.findOneByUid(uid); } - - public async addDocumentTypes(deedTypeUuid: string, documentTypesUuidToAdd: string[]): Promise { - const relationsToDocumentTypes = await this.deedTypeHasDocumentTypesRepository.createMany(deedTypeUuid, documentTypesUuidToAdd); - - let deedTypeHasDocumentUuids: string[] = []; - relationsToDocumentTypes.forEach((item) => { - deedTypeHasDocumentUuids.push(item.uuid); - }); - - return this.deedTypeRepository.addDocumentTypes(deedTypeUuid, deedTypeHasDocumentUuids); - } - - public async addDocumentType(deedTypeUuid: string, documentTypesUuidToAdd: string): Promise { - const deedTypeHasDocumentType = await this.deedTypeHasDocumentTypesRepository.create(deedTypeUuid, documentTypesUuidToAdd); - - return this.deedTypeRepository.addDocumentType(deedTypeUuid, deedTypeHasDocumentType.uuid); - } - - public async removeDocumentType(deedTypeUuid: string, documentTypesUuidToRemove: string): Promise { - await this.deedTypeHasDocumentTypesRepository.delete(deedTypeUuid, documentTypesUuidToRemove); - - return this.get({ where: { uuid: deedTypeUuid }, include: { deed_type_has_document_types: true } }); - } - - public async removeDocumentTypes(deedTypeUuid: string, documentTypesUuidToRemove: string[]): Promise { - await this.deedTypeHasDocumentTypesRepository.deleteMany(deedTypeUuid, documentTypesUuidToRemove); - - return this.get({ where: { uuid: deedTypeUuid }, include: { deed_type_has_document_types: true } }); - } } diff --git a/src/services/super-admin/DeedsService/DeedsService.ts b/src/services/super-admin/DeedsService/DeedsService.ts index dbbdb171..5d144b14 100644 --- a/src/services/super-admin/DeedsService/DeedsService.ts +++ b/src/services/super-admin/DeedsService/DeedsService.ts @@ -1,15 +1,12 @@ import { Deeds } from "@prisma/client"; -import DeedHasDocumentTypesRepository from "@Repositories/DeedsHasDocumentTypesRepository"; import DeedsRepository from "@Repositories/DeedsRepository"; -import DeedTypesHasDocumentTypesRepository from "@Repositories/DeedTypesHasDocumentTypesRepository"; -import DeedTypesRepository from "@Repositories/DeedTypesRepository"; import BaseService from "@Services/BaseService"; -import { DeedType } from "le-coffre-resources/dist/Customer"; -import Container, { Service } from "typedi"; +import { Deed } from "le-coffre-resources/dist/SuperAdmin"; +import { Service } from "typedi"; @Service() export default class DeedsService extends BaseService { - constructor(private deedRepository: DeedsRepository, private deedHasDocumentTypesRepository: DeedHasDocumentTypesRepository) { + constructor(private deedRepository: DeedsRepository) { super(); } @@ -25,29 +22,16 @@ export default class DeedsService extends BaseService { * @description : Create a new deed with document types * @throws {Error} If deeds cannot be created */ - public async create(deedType: DeedType): Promise { - let documentTypesToAdd: string[] = []; - const deedTypeHasDocumentTypesRepository = Container.get(DeedTypesHasDocumentTypesRepository); - const deedTypesRepository = Container.get(DeedTypesRepository); + public async create(deed: Deed): Promise { + return this.deedRepository.create(deed); + } - if ((await deedTypesRepository.findOneByUid(deedType.uid)).archived_at != null) throw new Error("deed type is archived"); - - const deedTypeHasDocumentTypes = await deedTypeHasDocumentTypesRepository.findMany({ where: { deed_type_uuid: deedType.uid } }); - deedTypeHasDocumentTypes.forEach((relation) => { - documentTypesToAdd.push(relation.document_type_uuid); - }); - - const deed = await this.deedRepository.create(deedType); - const relations = await this.deedHasDocumentTypesRepository.createMany(deed.uuid, documentTypesToAdd); - - let relationsToAdd: string[] = []; - relations.forEach((relation) => { - documentTypesToAdd.push(relation.uuid); - }); - - await this.deedRepository.addDocumentTypes(deed.uuid, relationsToAdd); - - return this.getByUid(deed.uuid); + /** + * @description : Update data of a deed with document types + * @throws {Error} If deeds cannot be updated with document types or one of them + */ + public async update(deedUuid: string, deed: Deed): Promise { + return this.deedRepository.update(deedUuid, deed); } /** @@ -57,33 +41,4 @@ export default class DeedsService extends BaseService { public async getByUid(uid: string) { return this.deedRepository.findOneByUid(uid); } - - public async addDocumentTypes(deedTypeUuid: string, documentTypesUuidToAdd: string[]): Promise { - const relationsToDocumentTypes = await this.deedHasDocumentTypesRepository.createMany(deedTypeUuid, documentTypesUuidToAdd); - - let deedTypeHasDocumentUuids: string[] = []; - relationsToDocumentTypes.forEach((item) => { - deedTypeHasDocumentUuids.push(item.uuid); - }); - - return this.deedRepository.addDocumentTypes(deedTypeUuid, deedTypeHasDocumentUuids); - } - - public async addDocumentType(deedTypeUuid: string, documentTypesUuidToAdd: string): Promise { - const deedTypeHasDocumentType = await this.deedHasDocumentTypesRepository.create(deedTypeUuid, documentTypesUuidToAdd); - - return this.deedRepository.addDocumentType(deedTypeUuid, deedTypeHasDocumentType.uuid); - } - - public async removeDocumentType(deedTypeUuid: string, documentTypesUuidToRemove: string): Promise { - await this.deedHasDocumentTypesRepository.delete(deedTypeUuid, documentTypesUuidToRemove); - - return await this.get({ where: { uuid: deedTypeUuid }, include: { deed_has_document_types: true } }); - } - - public async removeDocumentTypes(deedTypeUuid: string, documentTypesUuidToRemove: string[]): Promise { - await this.deedHasDocumentTypesRepository.deleteMany(deedTypeUuid, documentTypesUuidToRemove); - - return await this.get({ where: { uuid: deedTypeUuid }, include: { deed_has_document_types: true } }); - } } diff --git a/src/services/super-admin/DocumentTypesService/DocumentTypesService.ts b/src/services/super-admin/DocumentTypesService/DocumentTypesService.ts index a3308ab5..ccf13a05 100644 --- a/src/services/super-admin/DocumentTypesService/DocumentTypesService.ts +++ b/src/services/super-admin/DocumentTypesService/DocumentTypesService.ts @@ -36,7 +36,6 @@ export default class DocumentTypesService extends BaseService { /** * @description : Get a document-type by uid - * @returns : T * @throws {Error} If document-type is not found */ public async getByUid(uid: string) { diff --git a/src/services/super-admin/DocumentsService/DocumentsService.ts b/src/services/super-admin/DocumentsService/DocumentsService.ts index 6147cc15..38bed1f8 100644 --- a/src/services/super-admin/DocumentsService/DocumentsService.ts +++ b/src/services/super-admin/DocumentsService/DocumentsService.ts @@ -1,62 +1,60 @@ -import DocumentTypesRepository from "@Repositories/DocumentTypesRepository"; -//import { DocumentTypes } from "prisma/prisma-client"; +import { Documents, Prisma } from "@prisma/client"; +import { Document } from "le-coffre-resources/dist/SuperAdmin"; +import DocumentsRepository from "@Repositories/DocumentsRepository"; import BaseService from "@Services/BaseService"; -import Container, { Service } from "typedi"; +import { Service } from "typedi"; @Service() export default class DocumentsService extends BaseService { - constructor() { + constructor(private documentsRepository: DocumentsRepository) { super(); } /** * @description : Get all documents - * @returns : Document[] * @throws {Error} If documents cannot be get */ public async get(query: any) { - //init repo - const repo = Container.get(DocumentTypesRepository); - - //call service to return prisma entity - return await repo.findMany(query); + return this.documentsRepository.findMany(query); } /** * @description : Create a new document - * @returns : T * @throws {Error} If document cannot be created - * @param : projectEntity: Partial */ - // public async create(documentTypeEntity: DocumentTypes): Promise { - // //init repo - // const repo = Container.get(DocumentTypesRepository); + public async create(document: Document): Promise { + return this.documentsRepository.create(document); + } - // // call service to return prisma entity - // return await repo.create(documentTypeEntity); - // } + /** + * @description : Create new documents + * @throws {Error} If documents or one of them cannot be created + */ + public async createMany(documents: Document[]): Promise { + return this.documentsRepository.createMany(documents); + } /** * @description : Modify a document - * @returns : T * @throws {Error} If document cannot be modified - * @param : projectEntity: Partial */ - public async put() { - // const document = await this.projectRepository.create(projectEntity); - // if (!document) Promise.reject(new Error("Cannot create document")); - return { response: "/api/documents > PUT : Modified document > Not implemented yet" }; + public async update(uid: string, document: Document): Promise { + return this.documentsRepository.update(uid, document); + } + + /** + * @description : Delete a document + * @throws {Error} If document cannot be deleted + */ + public async delete(uid: string): Promise { + return this.documentsRepository.delete(uid); } /** * @description : Get a document by uid - * @returns : T * @throws {Error} If document cannot be get by uid - * @param : projectEntity: Partial */ public async getByUid(uid: string) { - // const document = await this.customersRepository.findOne(uid); - // if (!document) Promise.reject(new Error("Cannot get document by uid")); - return { response: "/api/documents/:uid > GET : document by uid > Not implemented yet" }; + return this.documentsRepository.findOneByUid(uid); } } diff --git a/src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts b/src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts index da96453d..3102e8bc 100644 --- a/src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts +++ b/src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts @@ -1,65 +1,47 @@ -import { OfficeFolders } from ".prisma/client"; +import { OfficeFolders } from ".prisma/client"; import OfficeFoldersRepository from "@Repositories/OfficeFoldersRepository"; import BaseService from "@Services/BaseService"; import { OfficeFolder } from "le-coffre-resources/dist/SuperAdmin"; -import Container, { Service } from "typedi"; +import { Service } from "typedi"; + @Service() export default class OfficeFoldersService extends BaseService { - constructor() { + constructor( + private officeFoldersRepository: OfficeFoldersRepository + ) { super(); } /** * @description : Get all folders - * @returns : OfficeFolders[] * @throws {Error} If folders cannot be get */ public async get(query: any) { - //init repo - const repo = Container.get(OfficeFoldersRepository); - - //call service to return prisma entity - return await repo.findMany(query); + return this.officeFoldersRepository.findMany(query); } /** * @description : Create a new folder - * @returns : T * @throws {Error} If folder cannot be created - * @param : projectEntity: Partial */ public async create(officeFolderEntity: OfficeFolder): Promise { - //init repo - const repo = Container.get(OfficeFoldersRepository); - - // call service to return prisma entity - return await repo.create(officeFolderEntity); + return this.officeFoldersRepository.create(officeFolderEntity); } /** * @description : Modify a folder - * @returns : T * @throws {Error} If folder cannot be modified - * @param : projectEntity: Partial */ - public async update(officeFolderEntity: OfficeFolder): Promise { - //init repo - const repo = Container.get(OfficeFoldersRepository); - - // call service to return prisma entity - return await repo.update(officeFolderEntity); + public async update(officeFolderUuid: string, officeFolderEntity: OfficeFolder): Promise { + return this.officeFoldersRepository.update(officeFolderUuid, officeFolderEntity); } /** * @description : Get a folder by uid - * @returns : T * @throws {Error} If folder cannot be get by uid - * @param : projectEntity: Partial */ public async getByUid(uid: string) { - // const folder = await this.foldersRepository.findOne(uid); - // if (!folder) Promise.reject(new Error("Cannot get folder by uid")); - return { response: "/api/folders/:uid > GET : folder by uid > Not implemented yet" }; + return this.officeFoldersRepository.findOneByUid(uid); } } diff --git a/src/services/super-admin/OfficesService/OfficesService.ts b/src/services/super-admin/OfficesService/OfficesService.ts index 18610407..6bb49a15 100644 --- a/src/services/super-admin/OfficesService/OfficesService.ts +++ b/src/services/super-admin/OfficesService/OfficesService.ts @@ -1,4 +1,3 @@ -// import ProjectsRepository from "@Common/repositories/projects/ProjectsRepository"; import { Offices } from "@prisma/client"; import OfficesRepository from "@Repositories/OfficesRepository"; import BaseService from "@Services/BaseService"; diff --git a/src/test/services/super-admin/DeedService.test.ts b/src/test/services/super-admin/DeedService.test.ts index be5b0775..35354072 100644 --- a/src/test/services/super-admin/DeedService.test.ts +++ b/src/test/services/super-admin/DeedService.test.ts @@ -1,21 +1,20 @@ import "module-alias/register"; import "reflect-metadata"; -import { Deed, DeedType } from "le-coffre-resources/dist/SuperAdmin"; +import { Deed } from "le-coffre-resources/dist/SuperAdmin"; import DeedService from "@Services/super-admin/DeedsService/DeedsService"; import { PrismaClient, Offices, DocumentTypes, DeedTypes, DeedTypeHasDocumentTypes } from "prisma/prisma-client"; -import { deedType, documentType, documentType_, office } from "./MockedData"; +import { deed, deedType, documentType, office } from "./MockedData"; import DeedsRepository from "@Repositories/DeedsRepository"; import Container from "typedi"; -import DeedHasDocumentTypesRepository from "@Repositories/DeedsHasDocumentTypesRepository"; const prisma = new PrismaClient(); -const DeedServiceTest = new DeedService(Container.get(DeedsRepository), Container.get(DeedHasDocumentTypesRepository)); +const DeedServiceTest = new DeedService(Container.get(DeedsRepository)); let office1: Offices; let documentType1: DocumentTypes; -let documentType2: DocumentTypes; +//let documentType2: DocumentTypes; let deedType1: DeedTypes; @@ -47,15 +46,15 @@ beforeAll(async () => { }, }); - documentType2 = await prisma.documentTypes.create({ - data: { - name: documentType_.name, - public_description: documentType_.public_description, - private_description: documentType_.private_description, - archived_at: null, - office_uuid: office1.uuid, - }, - }); + // documentType2 = await prisma.documentTypes.create({ + // data: { + // name: documentType_.name, + // public_description: documentType_.public_description, + // private_description: documentType_.private_description, + // archived_at: null, + // office_uuid: office1.uuid, + // }, + // }); deedType1 = await prisma.deedTypes.create({ data: { @@ -96,15 +95,15 @@ describe("test create function", () => { it("should not create a new deed if deed type is unknown", async () => { // try to create a new deed with unknown deed type async function createDeedWithUnknownDeedType() { - await DeedServiceTest.create(deedType); + await DeedServiceTest.create(deed); } await expect(createDeedWithUnknownDeedType).rejects.toThrow(); }); it("should create a new deed based on existing deed type", async () => { - let deedTypeWithUid: DeedType = JSON.parse(JSON.stringify(deedType)); - deedTypeWithUid.uid = deedType1.uuid; - const deedCreated = await DeedServiceTest.create(deedTypeWithUid); + let deedWithUid: Deed = JSON.parse(JSON.stringify(deed)); + deedWithUid.uid = deedType1.uuid; + const deedCreated = await DeedServiceTest.create(deedWithUid); expect(deedCreated.deed_type_uuid).toEqual(deedType1.uuid); }); @@ -116,16 +115,16 @@ describe("test create function", () => { }); it("should create a the same deed based on existing deed type", async () => { - let deedTypeWithUid: DeedType = JSON.parse(JSON.stringify(deedType)); - deedTypeWithUid.uid = deedType1.uuid; - const deedCreated = await DeedServiceTest.create(deedTypeWithUid); + let deedWithUid: Deed = JSON.parse(JSON.stringify(deed)); + deedWithUid.uid = deedType1.uuid; + const deedCreated = await DeedServiceTest.create(deedWithUid); expect(deedCreated.deed_type_uuid).toEqual(deedType1.uuid); }); it("should not create a new deed based on archivated deed type", async () => { - let deedTypeArchivated: DeedType = JSON.parse(JSON.stringify(deedType)); - deedTypeArchivated.uid = deedType1.uuid; + let deedArchivated: Deed = JSON.parse(JSON.stringify(deed)); + deedArchivated.uid = deedType1.uuid; await prisma.deedTypes.update({ where: { uuid: deedType1.uuid }, @@ -136,118 +135,118 @@ describe("test create function", () => { // try to create a new deed with archivated deed type async function createDeedWithArchivatedDeedType() { - await DeedServiceTest.create(deedTypeArchivated); + await DeedServiceTest.create(deedArchivated); } await expect(createDeedWithArchivatedDeedType).rejects.toThrow("deed type is archived"); }); }); -describe("test addDocumentTypes function", () => { - it("should add document types to a deed", async () => { - const deedUid = (await prisma.deeds.findFirstOrThrow({ where: { deed_type_uuid: deedType1.uuid } })).uuid; - const documentsToAdd = [documentType1.uuid, documentType2.uuid]; - await DeedServiceTest.addDocumentTypes(deedUid, documentsToAdd); +// describe("test addDocumentTypes function", () => { +// it("should add document types to a deed", async () => { +// const deedUid = (await prisma.deeds.findFirstOrThrow({ where: { deed_type_uuid: deedType1.uuid } })).uuid; +// const documentsToAdd = [documentType1.uuid, documentType2.uuid]; +// await DeedServiceTest.addDocumentTypes(deedUid, documentsToAdd); - const deed = await prisma.deeds.findFirstOrThrow({ - where: { - uuid: deedUid, - }, - include: { - deed_has_document_types: true, - }, - }); - expect(deed.deed_has_document_types.length).toEqual(2); - }); +// const deed = await prisma.deeds.findFirstOrThrow({ +// where: { +// uuid: deedUid, +// }, +// include: { +// deed_has_document_types: true, +// }, +// }); +// expect(deed.deed_has_document_types.length).toEqual(2); +// }); - it("should not add document types to a deed type that already has those document types ", async () => { - const deedUid = (await prisma.deeds.findFirstOrThrow({ where: { deed_type_uuid: deedType1.uuid } })).uuid; - let deedHasDocumentTypes = await prisma.deedHasDocumentTypes.findMany({ where: { deed_uuid: deedUid } }); - expect(deedHasDocumentTypes.length).toEqual(2); +// it("should not add document types to a deed type that already has those document types ", async () => { +// const deedUid = (await prisma.deeds.findFirstOrThrow({ where: { deed_type_uuid: deedType1.uuid } })).uuid; +// let deedHasDocumentTypes = await prisma.deedHasDocumentTypes.findMany({ where: { deed_uuid: deedUid } }); +// expect(deedHasDocumentTypes.length).toEqual(2); - const documentsToAdd = [documentType1.uuid, documentType2.uuid]; - //we expect deedTypeHasDocumentTypes service to skip duplicates without throwing error - await DeedServiceTest.addDocumentTypes(deedUid, documentsToAdd); +// const documentsToAdd = [documentType1.uuid, documentType2.uuid]; +// //we expect deedTypeHasDocumentTypes service to skip duplicates without throwing error +// await DeedServiceTest.addDocumentTypes(deedUid, documentsToAdd); - deedHasDocumentTypes = await prisma.deedHasDocumentTypes.findMany({ where: { deed_uuid: deedUid } }); - expect(deedHasDocumentTypes.length).toEqual(2); - }); -}); -describe("test removeDocumentTypes function", () => { - it("should remove document types from a deed type", async () => { - const deedUid = (await prisma.deeds.findFirstOrThrow({ where: { deed_type_uuid: deedType1.uuid } })).uuid; - const documentsToRemove = [documentType1.uuid]; - await DeedServiceTest.removeDocumentTypes(deedUid, documentsToRemove); +// deedHasDocumentTypes = await prisma.deedHasDocumentTypes.findMany({ where: { deed_uuid: deedUid } }); +// expect(deedHasDocumentTypes.length).toEqual(2); +// }); +// }); +// describe("test removeDocumentTypes function", () => { +// it("should remove document types from a deed type", async () => { +// const deedUid = (await prisma.deeds.findFirstOrThrow({ where: { deed_type_uuid: deedType1.uuid } })).uuid; +// const documentsToRemove = [documentType1.uuid]; +// await DeedServiceTest.removeDocumentTypes(deedUid, documentsToRemove); - const deedWithDocumentTypeRelations = await prisma.deeds.findFirstOrThrow({ - where: { - uuid: deedUid, - }, - include: { - deed_has_document_types: true, - }, - }); - expect(deedWithDocumentTypeRelations.deed_has_document_types.length).toEqual(1); - expect(deedWithDocumentTypeRelations.deed_has_document_types[0]?.document_type_uuid).toEqual(documentType2.uuid); - }); - it("should not remove document types from a deed type is they were not linked", async () => { - let deedWithOneDocumentType = await prisma.deeds.findFirstOrThrow({ - where: { deed_type_uuid: deedType1.uuid }, - include: { - deed_has_document_types: true, - }, - }); - expect(deedWithOneDocumentType.deed_has_document_types.length).toEqual(1); +// const deedWithDocumentTypeRelations = await prisma.deeds.findFirstOrThrow({ +// where: { +// uuid: deedUid, +// }, +// include: { +// deed_has_document_types: true, +// }, +// }); +// expect(deedWithDocumentTypeRelations.deed_has_document_types.length).toEqual(1); +// expect(deedWithDocumentTypeRelations.deed_has_document_types[0]?.document_type_uuid).toEqual(documentType2.uuid); +// }); +// it("should not remove document types from a deed type is they were not linked", async () => { +// let deedWithOneDocumentType = await prisma.deeds.findFirstOrThrow({ +// where: { deed_type_uuid: deedType1.uuid }, +// include: { +// deed_has_document_types: true, +// }, +// }); +// expect(deedWithOneDocumentType.deed_has_document_types.length).toEqual(1); - const documentsToRemove = [documentType1.uuid]; +// const documentsToRemove = [documentType1.uuid]; - async function removeDocumentTypeNotLinkedToDeedType() { - await DeedServiceTest.removeDocumentTypes(deedWithOneDocumentType.uuid, documentsToRemove); - } - await expect(removeDocumentTypeNotLinkedToDeedType).rejects.toThrow(); - }); -}); -describe("test removeDocumentType function", () => { - it("should remove only one document type from a deed type", async () => { - let deedWithOneDocumentType = await prisma.deeds.findFirstOrThrow({ - where: { deed_type_uuid: deedType1.uuid }, - include: { - deed_has_document_types: true, - }, - }); - expect(deedWithOneDocumentType.deed_has_document_types.length).toEqual(1); +// async function removeDocumentTypeNotLinkedToDeedType() { +// await DeedServiceTest.removeDocumentTypes(deedWithOneDocumentType.uuid, documentsToRemove); +// } +// await expect(removeDocumentTypeNotLinkedToDeedType).rejects.toThrow(); +// }); +// }); +// describe("test removeDocumentType function", () => { +// it("should remove only one document type from a deed type", async () => { +// let deedWithOneDocumentType = await prisma.deeds.findFirstOrThrow({ +// where: { deed_type_uuid: deedType1.uuid }, +// include: { +// deed_has_document_types: true, +// }, +// }); +// expect(deedWithOneDocumentType.deed_has_document_types.length).toEqual(1); - const documentToRemove = documentType2.uuid; - await DeedServiceTest.removeDocumentType(deedWithOneDocumentType.uuid, documentToRemove); +// const documentToRemove = documentType2.uuid; +// await DeedServiceTest.removeDocumentType(deedWithOneDocumentType.uuid, documentToRemove); - deedWithOneDocumentType = await prisma.deeds.findFirstOrThrow({ - where: { - uuid: deedWithOneDocumentType.uuid, - }, - include: { - deed_has_document_types: true, - }, - }); - expect(deedWithOneDocumentType.deed_has_document_types.length).toEqual(0); - }); -}); -describe("test addDocumentType function", () => { - it("should add only one document type to a deed type", async () => { - const deedUid = (await prisma.deeds.findFirstOrThrow({ where: { deed_type_uuid: deedType1.uuid } })).uuid; - const documentToAdd = documentType1.uuid; - await DeedServiceTest.addDocumentType(deedUid, documentToAdd); +// deedWithOneDocumentType = await prisma.deeds.findFirstOrThrow({ +// where: { +// uuid: deedWithOneDocumentType.uuid, +// }, +// include: { +// deed_has_document_types: true, +// }, +// }); +// expect(deedWithOneDocumentType.deed_has_document_types.length).toEqual(0); +// }); +// }); +// describe("test addDocumentType function", () => { +// it("should add only one document type to a deed type", async () => { +// const deedUid = (await prisma.deeds.findFirstOrThrow({ where: { deed_type_uuid: deedType1.uuid } })).uuid; +// const documentToAdd = documentType1.uuid; +// await DeedServiceTest.addDocumentType(deedUid, documentToAdd); - const deed = await prisma.deeds.findFirstOrThrow({ - where: { - uuid: deedUid, - }, - include: { - deed_has_document_types: true, - }, - }); - expect(deed.deed_has_document_types.length).toEqual(1); - expect(deed.deed_has_document_types[0]?.document_type_uuid).toEqual(documentType1.uuid); - }); -}); +// const deed = await prisma.deeds.findFirstOrThrow({ +// where: { +// uuid: deedUid, +// }, +// include: { +// deed_has_document_types: true, +// }, +// }); +// expect(deed.deed_has_document_types.length).toEqual(1); +// expect(deed.deed_has_document_types[0]?.document_type_uuid).toEqual(documentType1.uuid); +// }); +// }); describe("test get function", () => { it("should return an array of Deeds", async () => { diff --git a/src/test/services/super-admin/DeedTypesService.test.ts b/src/test/services/super-admin/DeedTypesService.test.ts index 54d30f2f..796225a3 100644 --- a/src/test/services/super-admin/DeedTypesService.test.ts +++ b/src/test/services/super-admin/DeedTypesService.test.ts @@ -2,21 +2,20 @@ import "module-alias/register"; import "reflect-metadata"; import { DeedType } from "le-coffre-resources/dist/SuperAdmin"; import DeedTypeService from "@Services/super-admin/DeedTypesService/DeedTypesService"; -import { PrismaClient, Offices, DocumentTypes } from "prisma/prisma-client"; -import { deedType, deedType_, documentType, documentType_, office, office_ } from "./MockedData"; +import { PrismaClient, Offices } from "prisma/prisma-client"; +import { deedType, deedType_, office, office_ } from "./MockedData"; import DeedTypesRepository from "@Repositories/DeedTypesRepository"; import Container from "typedi"; -import DeedTypeHasDocumentTypesRepository from "@Repositories/DeedTypesHasDocumentTypesRepository"; const prisma = new PrismaClient(); -const DeedTypeServiceTest = new DeedTypeService(Container.get(DeedTypesRepository), Container.get(DeedTypeHasDocumentTypesRepository)); +const DeedTypeServiceTest = new DeedTypeService(Container.get(DeedTypesRepository)); let office1: Offices; let office2: Offices; -let documentType1: DocumentTypes; -let documentType2: DocumentTypes; +// let documentType1: DocumentTypes; +// let documentType2: DocumentTypes; beforeAll(async () => { office1 = await prisma.offices.create({ @@ -49,25 +48,25 @@ beforeAll(async () => { }, }); - documentType1 = await prisma.documentTypes.create({ - data: { - name: documentType.name, - public_description: documentType.public_description, - private_description: documentType.private_description, - archived_at: null, - office_uuid: office1.uuid, - }, - }); + // documentType1 = await prisma.documentTypes.create({ + // data: { + // name: documentType.name, + // public_description: documentType.public_description, + // private_description: documentType.private_description, + // archived_at: null, + // office_uuid: office1.uuid, + // }, + // }); - documentType2 = await prisma.documentTypes.create({ - data: { - name: documentType_.name, - public_description: documentType_.public_description, - private_description: documentType_.private_description, - archived_at: null, - office_uuid: office1.uuid, - }, - }); + // documentType2 = await prisma.documentTypes.create({ + // data: { + // name: documentType_.name, + // public_description: documentType_.public_description, + // private_description: documentType_.private_description, + // archived_at: null, + // office_uuid: office1.uuid, + // }, + // }); }); afterAll(async () => { @@ -244,113 +243,113 @@ describe("test update function", () => { }); }); -describe("test addDocumentTypes function", () => { - it("should add document types to a deed type", async () => { - const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType.name, office_uuid: office1.uuid } })).uuid; - const documentsToAdd = [documentType1.uuid, documentType2.uuid]; - await DeedTypeServiceTest.addDocumentTypes(deedTypeUid, documentsToAdd); +// describe("test addDocumentTypes function", () => { +// it("should add document types to a deed type", async () => { +// const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType.name, office_uuid: office1.uuid } })).uuid; +// const documentsToAdd = [documentType1.uuid, documentType2.uuid]; +// await DeedTypeServiceTest.addDocumentTypes(deedTypeUid, documentsToAdd); - const deedTypes = await prisma.deedTypes.findFirstOrThrow({ - where: { - uuid: deedTypeUid, - }, - include: { - deed_type_has_document_types: true, - }, - }); - expect(deedTypes.deed_type_has_document_types.length).toEqual(2); - }); +// const deedTypes = await prisma.deedTypes.findFirstOrThrow({ +// where: { +// uuid: deedTypeUid, +// }, +// include: { +// deed_type_has_document_types: true, +// }, +// }); +// expect(deedTypes.deed_type_has_document_types.length).toEqual(2); +// }); - it("should not add document types to a deed type that already has those document types ", async () => { - const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType.name, office_uuid: office1.uuid } })).uuid; - let deedTypeHasDocumentTypes = await prisma.deedTypeHasDocumentTypes.findMany({ where: { deed_type_uuid: deedTypeUid } }); - expect(deedTypeHasDocumentTypes.length).toEqual(2); +// it("should not add document types to a deed type that already has those document types ", async () => { +// const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType.name, office_uuid: office1.uuid } })).uuid; +// let deedTypeHasDocumentTypes = await prisma.deedTypeHasDocumentTypes.findMany({ where: { deed_type_uuid: deedTypeUid } }); +// expect(deedTypeHasDocumentTypes.length).toEqual(2); - const documentsToAdd = [documentType1.uuid, documentType2.uuid]; - //we expect deedTypeHasDocumentTypes service to skip duplicates without throwing error - await DeedTypeServiceTest.addDocumentTypes(deedTypeUid, documentsToAdd); +// const documentsToAdd = [documentType1.uuid, documentType2.uuid]; +// //we expect deedTypeHasDocumentTypes service to skip duplicates without throwing error +// await DeedTypeServiceTest.addDocumentTypes(deedTypeUid, documentsToAdd); - deedTypeHasDocumentTypes = await prisma.deedTypeHasDocumentTypes.findMany({ where: { deed_type_uuid: deedTypeUid } }); - expect(deedTypeHasDocumentTypes.length).toEqual(2); - }); -}); -describe("test removeDocumentTypes function", () => { - it("should remove document types from a deed type", async () => { - const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType.name, office_uuid: office1.uuid } })).uuid; - const documentsToRemove = [documentType1.uuid]; - await DeedTypeServiceTest.removeDocumentTypes(deedTypeUid, documentsToRemove); +// deedTypeHasDocumentTypes = await prisma.deedTypeHasDocumentTypes.findMany({ where: { deed_type_uuid: deedTypeUid } }); +// expect(deedTypeHasDocumentTypes.length).toEqual(2); +// }); +// }); +// describe("test removeDocumentTypes function", () => { +// it("should remove document types from a deed type", async () => { +// const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType.name, office_uuid: office1.uuid } })).uuid; +// const documentsToRemove = [documentType1.uuid]; +// await DeedTypeServiceTest.removeDocumentTypes(deedTypeUid, documentsToRemove); - const deedTypeWithDocumentTypeRelations = await prisma.deedTypes.findFirstOrThrow({ - where: { - uuid: deedTypeUid, - }, - include: { - deed_type_has_document_types: true, - }, - }); - expect(deedTypeWithDocumentTypeRelations.deed_type_has_document_types.length).toEqual(1); - expect(deedTypeWithDocumentTypeRelations.deed_type_has_document_types[0]?.document_type_uuid).toEqual(documentType2.uuid); - }); - it("should not remove document types from a deed type is they were not linked", async () => { - let deedTypeWithOneDocumentType = await prisma.deedTypes.findFirstOrThrow({ - where: { name: deedType.name, office_uuid: office1.uuid }, - include: { - deed_type_has_document_types: true, - }, - }); - expect(deedTypeWithOneDocumentType.deed_type_has_document_types.length).toEqual(1); +// const deedTypeWithDocumentTypeRelations = await prisma.deedTypes.findFirstOrThrow({ +// where: { +// uuid: deedTypeUid, +// }, +// include: { +// deed_type_has_document_types: true, +// }, +// }); +// expect(deedTypeWithDocumentTypeRelations.deed_type_has_document_types.length).toEqual(1); +// expect(deedTypeWithDocumentTypeRelations.deed_type_has_document_types[0]?.document_type_uuid).toEqual(documentType2.uuid); +// }); +// it("should not remove document types from a deed type is they were not linked", async () => { +// let deedTypeWithOneDocumentType = await prisma.deedTypes.findFirstOrThrow({ +// where: { name: deedType.name, office_uuid: office1.uuid }, +// include: { +// deed_type_has_document_types: true, +// }, +// }); +// expect(deedTypeWithOneDocumentType.deed_type_has_document_types.length).toEqual(1); - const documentsToRemove = [documentType1.uuid]; +// const documentsToRemove = [documentType1.uuid]; - // try to duplicate deed type in a given office - async function removeDocumentTypeNotLinkedToDeedType() { - await DeedTypeServiceTest.removeDocumentTypes(deedTypeWithOneDocumentType.uuid, documentsToRemove); - } - await expect(removeDocumentTypeNotLinkedToDeedType).rejects.toThrow(); - }); -}); -describe("test removeDocumentType function", () => { - it("should remove only one document type from a deed type", async () => { - let deedTypeWithOneDocumentType = await prisma.deedTypes.findFirstOrThrow({ - where: { name: deedType.name, office_uuid: office1.uuid }, - include: { - deed_type_has_document_types: true, - }, - }); - expect(deedTypeWithOneDocumentType.deed_type_has_document_types.length).toEqual(1); +// // try to duplicate deed type in a given office +// async function removeDocumentTypeNotLinkedToDeedType() { +// await DeedTypeServiceTest.removeDocumentTypes(deedTypeWithOneDocumentType.uuid, documentsToRemove); +// } +// await expect(removeDocumentTypeNotLinkedToDeedType).rejects.toThrow(); +// }); +// }); +// describe("test removeDocumentType function", () => { +// it("should remove only one document type from a deed type", async () => { +// let deedTypeWithOneDocumentType = await prisma.deedTypes.findFirstOrThrow({ +// where: { name: deedType.name, office_uuid: office1.uuid }, +// include: { +// deed_type_has_document_types: true, +// }, +// }); +// expect(deedTypeWithOneDocumentType.deed_type_has_document_types.length).toEqual(1); - const documentToRemove = documentType2.uuid; - await DeedTypeServiceTest.removeDocumentType(deedTypeWithOneDocumentType.uuid, documentToRemove); +// const documentToRemove = documentType2.uuid; +// await DeedTypeServiceTest.removeDocumentType(deedTypeWithOneDocumentType.uuid, documentToRemove); - deedTypeWithOneDocumentType = await prisma.deedTypes.findFirstOrThrow({ - where: { - uuid: deedTypeWithOneDocumentType.uuid, - }, - include: { - deed_type_has_document_types: true, - }, - }); - expect(deedTypeWithOneDocumentType.deed_type_has_document_types.length).toEqual(0); - }); -}); -describe("test addDocumentType function", () => { - it("should add only one document type to a deed type", async () => { - const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType.name, office_uuid: office1.uuid } })).uuid; - const documentToAdd = documentType1.uuid; - await DeedTypeServiceTest.addDocumentType(deedTypeUid, documentToAdd); +// deedTypeWithOneDocumentType = await prisma.deedTypes.findFirstOrThrow({ +// where: { +// uuid: deedTypeWithOneDocumentType.uuid, +// }, +// include: { +// deed_type_has_document_types: true, +// }, +// }); +// expect(deedTypeWithOneDocumentType.deed_type_has_document_types.length).toEqual(0); +// }); +// }); +// describe("test addDocumentType function", () => { +// it("should add only one document type to a deed type", async () => { +// const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType.name, office_uuid: office1.uuid } })).uuid; +// const documentToAdd = documentType1.uuid; +// await DeedTypeServiceTest.addDocumentType(deedTypeUid, documentToAdd); - const deedTypes = await prisma.deedTypes.findFirstOrThrow({ - where: { - uuid: deedTypeUid, - }, - include: { - deed_type_has_document_types: true, - }, - }); - expect(deedTypes.deed_type_has_document_types.length).toEqual(1); - expect(deedTypes.deed_type_has_document_types[0]?.document_type_uuid).toEqual(documentType1.uuid); - }); -}); +// const deedTypes = await prisma.deedTypes.findFirstOrThrow({ +// where: { +// uuid: deedTypeUid, +// }, +// include: { +// deed_type_has_document_types: true, +// }, +// }); +// expect(deedTypes.deed_type_has_document_types.length).toEqual(1); +// expect(deedTypes.deed_type_has_document_types[0]?.document_type_uuid).toEqual(documentType1.uuid); +// }); +// }); describe("test get function", () => { it("should return an array of DeedTypes", async () => { diff --git a/src/test/services/super-admin/MockedData.ts b/src/test/services/super-admin/MockedData.ts index df44244d..f3b03e6f 100644 --- a/src/test/services/super-admin/MockedData.ts +++ b/src/test/services/super-admin/MockedData.ts @@ -1,5 +1,5 @@ import { EOfficeStatus } from "le-coffre-resources/dist/Customer/Office"; -import User, { Address, Contact, Office, DeedType, DocumentType, Customer } from "le-coffre-resources/dist/SuperAdmin"; +import User, { Address, Contact, Office, DeedType, DocumentType, Customer, OfficeFolder, Deed } from "le-coffre-resources/dist/SuperAdmin"; export const userAddress: Address = { uid: "", @@ -123,6 +123,20 @@ export const deedType_: DeedType = { updated_at: null, }; +export const deed: Deed = { + uid: "", + deed_type: deedType, + created_at: null, + updated_at: null, +}; + +export const deed_: Deed = { + uid: "", + deed_type: deedType_, + created_at: null, + updated_at: null, +}; + export const documentType: DocumentType = { uid: "", name: "Identity card", @@ -160,3 +174,29 @@ export const customer_: Customer = { created_at: null, updated_at: null, }; + +export const officeFolder: OfficeFolder = { + uid: "", + name: "Dossier 1234567", + folder_number: "1234567", + description: "Dossier de mr Dupont", + archived_description: null, + status: "ARCHIVED", + deed: deed, + office: office, + created_at: null, + updated_at: null, +}; + +export const officeFolder_: OfficeFolder = { + uid: "", + name: "Dossier 89101112", + folder_number: "89101112", + description: "Dossier de mme Dutunnel", + archived_description: null, + status: "LIVE", + deed: deed_, + office: office_, + created_at: null, + updated_at: null, +}; \ No newline at end of file diff --git a/src/test/services/super-admin/OfficeFolderService.test.ts b/src/test/services/super-admin/OfficeFolderService.test.ts new file mode 100644 index 00000000..1e15b059 --- /dev/null +++ b/src/test/services/super-admin/OfficeFolderService.test.ts @@ -0,0 +1,273 @@ +import "module-alias/register"; +import "reflect-metadata"; +import { PrismaClient, Offices, DocumentTypes, DeedTypes, DeedTypeHasDocumentTypes } from "prisma/prisma-client"; +import { deedType, documentType, office } from "./MockedData"; +// import Container from "typedi"; +// import OfficeFoldersRepository from "@Repositories/OfficeFoldersRepository"; +// import OfficeFoldersHasStakeholderRepository from "@Repositories/OfficeFoldersHasStakeholderRepository"; +// import OfficeFoldersHasCustomerRepository from "@Repositories/OfficeFoldersHasCustomerRepository"; +// import CustomersService from "@Services/super-admin/CustomersService/CustomersService"; +// import OfficeFolderService from "@Services/super-admin/OfficeFoldersService/OfficeFoldersService"; +// import DocumentsRepository from "@Repositories/DocumentsRepository"; + +const prisma = new PrismaClient(); + +// const OfficeFolderServiceTest = new OfficeFolderService( +// Container.get(OfficeFoldersRepository), +// Container.get(OfficeFoldersHasStakeholderRepository), +// Container.get(OfficeFoldersHasCustomerRepository), +// Container.get(CustomersService), +// Container.get(DocumentsRepository), +// ); + +let office1: Offices; + +let documentType1: DocumentTypes; +//let documentType2: DocumentTypes; + +let deedType1: DeedTypes; + +let deedType1HasDocumentType1: DeedTypeHasDocumentTypes; + +beforeAll(async () => { + office1 = await prisma.offices.create({ + data: { + idNot: office.idNot, + name: office.name, + crpcen: office.crpcen, + address: { + create: { + address: office.address.address, + zip_code: office.address.zip_code, + city: office.address.city, + }, + }, + }, + }); + + documentType1 = await prisma.documentTypes.create({ + data: { + name: documentType.name, + public_description: documentType.public_description, + private_description: documentType.private_description, + archived_at: null, + office_uuid: office1.uuid, + }, + }); + + // documentType2 = await prisma.documentTypes.create({ + // data: { + // name: documentType_.name, + // public_description: documentType_.public_description, + // private_description: documentType_.private_description, + // archived_at: null, + // office_uuid: office1.uuid, + // }, + // }); + + deedType1 = await prisma.deedTypes.create({ + data: { + name: deedType.name, + description: deedType.description, + archived_at: null, + office_uuid: office1.uuid, + }, + }); + + deedType1HasDocumentType1 = await prisma.deedTypeHasDocumentTypes.create({ + data: { + deed_type_uuid: deedType1.uuid, + document_type_uuid: documentType1.uuid, + }, + }); + + await prisma.deedTypes.update({ + where: { uuid: deedType1.uuid }, + data: { + deed_type_has_document_types: { + connect: { + uuid: deedType1HasDocumentType1.uuid, + }, + }, + }, + }); +}); + +afterAll(async () => { + const deleteDeedTypes = prisma.deedTypes.deleteMany(); + const deleteOffices = prisma.offices.deleteMany(); + await prisma.$transaction([deleteDeedTypes, deleteOffices]); + await prisma.$disconnect(); +}); + +describe("test create function", () => { + it("should not create a new office folder if deed type is unknown", async () => { + // try to create a new deed with unknown deed type + // async function createDeedWithUnknownDeedType() { + // await OfficeFolderServiceTest.create(officeFolder, deedType); + // } + // await expect(createDeedWithUnknownDeedType).rejects.toThrow("deed type not found"); + }); + + // it("should create a new office folder based on existing deed type", async () => { + // let deedTypeWithUid: DeedType = JSON.parse(JSON.stringify(deedType)); + // deedTypeWithUid.uid = deedType1.uuid; + // const officeFolderCreated = await OfficeFolderServiceTest.create(officeFolder, deedTypeWithUid); + + // expect(officeFolderCreated.office_uuid).toEqual(office1.uuid); + // expect(officeFolderCreated.deed_uuid.).toEqual(office1.uuid); + // }); + + // it("should have by default the same document types as its deed type ", async () => { + // const deedWithDocumentTypes = await prisma.deeds.findFirstOrThrow({ include: { deed_has_document_types: true } }); + // expect(deedWithDocumentTypes.deed_has_document_types.length).toEqual(1); + // expect(deedWithDocumentTypes.deed_has_document_types[0]?.document_type_uuid).toEqual(documentType1.uuid); + // }); + + // it("should create a the same deed based on existing deed type", async () => { + // let deedTypeWithUid: DeedType = JSON.parse(JSON.stringify(deedType)); + // deedTypeWithUid.uid = deedType1.uuid; + // const deedCreated = await OfficeFolderServiceTest.create(deedTypeWithUid); + + // expect(deedCreated.deed_type_uuid).toEqual(deedType1.uuid); + // }); + + // it("should not create a new deed based on archivated deed type", async () => { + // let deedTypeArchivated: DeedType = JSON.parse(JSON.stringify(deedType)); + // deedTypeArchivated.uid = deedType1.uuid; + + // await prisma.deedTypes.update({ + // where: { uuid: deedType1.uuid }, + // data: { + // archived_at: new Date(Date.now()), + // }, + // }); + + // // try to create a new deed with archivated deed type + // async function createDeedWithArchivatedDeedType() { + // await OfficeFolderServiceTest.create(deedTypeArchivated); + // } + // await expect(createDeedWithArchivatedDeedType).rejects.toThrow("deed type is archived"); + // }); +}); + +// describe("test addDocumentTypes function", () => { +// it("should add document types to a deed", async () => { +// const deedUid = (await prisma.deeds.findFirstOrThrow({ where: { deed_type_uuid: deedType1.uuid } })).uuid; +// const documentsToAdd = [documentType1.uuid, documentType2.uuid]; +// await OfficeFolderServiceTest.addDocumentTypes(deedUid, documentsToAdd); + +// const deed = await prisma.deeds.findFirstOrThrow({ +// where: { +// uuid: deedUid, +// }, +// include: { +// deed_has_document_types: true, +// }, +// }); +// expect(deed.deed_has_document_types.length).toEqual(2); +// }); + +// it("should not add document types to a deed type that already has those document types ", async () => { +// const deedUid = (await prisma.deeds.findFirstOrThrow({ where: { deed_type_uuid: deedType1.uuid } })).uuid; +// let deedHasDocumentTypes = await prisma.deedHasDocumentTypes.findMany({ where: { deed_uuid: deedUid } }); +// expect(deedHasDocumentTypes.length).toEqual(2); + +// const documentsToAdd = [documentType1.uuid, documentType2.uuid]; +// //we expect deedTypeHasDocumentTypes service to skip duplicates without throwing error +// await OfficeFolderServiceTest.addDocumentTypes(deedUid, documentsToAdd); + +// deedHasDocumentTypes = await prisma.deedHasDocumentTypes.findMany({ where: { deed_uuid: deedUid } }); +// expect(deedHasDocumentTypes.length).toEqual(2); +// }); +// }); +// describe("test removeDocumentTypes function", () => { +// it("should remove document types from a deed type", async () => { +// const deedUid = (await prisma.deeds.findFirstOrThrow({ where: { deed_type_uuid: deedType1.uuid } })).uuid; +// const documentsToRemove = [documentType1.uuid]; +// await OfficeFolderServiceTest.removeDocumentTypes(deedUid, documentsToRemove); + +// const deedWithDocumentTypeRelations = await prisma.deeds.findFirstOrThrow({ +// where: { +// uuid: deedUid, +// }, +// include: { +// deed_has_document_types: true, +// }, +// }); +// expect(deedWithDocumentTypeRelations.deed_has_document_types.length).toEqual(1); +// expect(deedWithDocumentTypeRelations.deed_has_document_types[0]?.document_type_uuid).toEqual(documentType2.uuid); +// }); +// it("should not remove document types from a deed type is they were not linked", async () => { +// let deedWithOneDocumentType = await prisma.deeds.findFirstOrThrow({ +// where: { deed_type_uuid: deedType1.uuid }, +// include: { +// deed_has_document_types: true, +// }, +// }); +// expect(deedWithOneDocumentType.deed_has_document_types.length).toEqual(1); + +// const documentsToRemove = [documentType1.uuid]; + +// async function removeDocumentTypeNotLinkedToDeedType() { +// await OfficeFolderServiceTest.removeDocumentTypes(deedWithOneDocumentType.uuid, documentsToRemove); +// } +// await expect(removeDocumentTypeNotLinkedToDeedType).rejects.toThrow(); +// }); +// }); +// describe("test removeDocumentType function", () => { +// it("should remove only one document type from a deed type", async () => { +// let deedWithOneDocumentType = await prisma.deeds.findFirstOrThrow({ +// where: { deed_type_uuid: deedType1.uuid }, +// include: { +// deed_has_document_types: true, +// }, +// }); +// expect(deedWithOneDocumentType.deed_has_document_types.length).toEqual(1); + +// const documentToRemove = documentType2.uuid; +// await OfficeFolderServiceTest.removeDocumentType(deedWithOneDocumentType.uuid, documentToRemove); + +// deedWithOneDocumentType = await prisma.deeds.findFirstOrThrow({ +// where: { +// uuid: deedWithOneDocumentType.uuid, +// }, +// include: { +// deed_has_document_types: true, +// }, +// }); +// expect(deedWithOneDocumentType.deed_has_document_types.length).toEqual(0); +// }); +// }); +// describe("test addDocumentType function", () => { +// it("should add only one document type to a deed type", async () => { +// const deedUid = (await prisma.deeds.findFirstOrThrow({ where: { deed_type_uuid: deedType1.uuid } })).uuid; +// const documentToAdd = documentType1.uuid; +// await OfficeFolderServiceTest.addDocumentType(deedUid, documentToAdd); + +// const deed = await prisma.deeds.findFirstOrThrow({ +// where: { +// uuid: deedUid, +// }, +// include: { +// deed_has_document_types: true, +// }, +// }); +// expect(deed.deed_has_document_types.length).toEqual(1); +// expect(deed.deed_has_document_types[0]?.document_type_uuid).toEqual(documentType1.uuid); +// }); +// }); + +// describe("test get function", () => { +// it("should return an array of Deeds", async () => { +// const deeds = await OfficeFolderServiceTest.get({}); + +// // verify result typing +// expect(deeds).toBeInstanceOf(Array); +// expect(deeds.length).toEqual(2); + +// // verify result content +// expect(deeds[0]?.deed_type_uuid).toEqual(deedType1.uuid); +// expect(deeds[1]?.deed_type_uuid).toEqual(deedType1.uuid); +// }); +// }); From 61fee74e4d4186f59e402462a017fe2f741da0b2 Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Tue, 25 Apr 2023 17:08:26 +0200 Subject: [PATCH 17/72] :sparkles: Fixing back launch --- docker-compose.yml | 24 +- init-data.sh | 17 + package-lock.json | 378 +++++++++++------------ package.json | 2 +- src/common/config/variables/Variables.ts | 12 +- src/common/system/database/DbProvider.ts | 10 +- 6 files changed, 233 insertions(+), 210 deletions(-) create mode 100644 init-data.sh diff --git a/docker-compose.yml b/docker-compose.yml index 5de7b1cd..800e53af 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -25,9 +25,9 @@ services: ports: - ${APP_PORT}:${APP_PORT} environment: - - DATABASE_HOSTNAME + - DATABASE_HOST - DATABASE_PORT - - DATABASE_USER + - DATABASE_USERNAME - DATABASE_PASSWORD - DATABASE_NAME - APP_LABEL @@ -41,23 +41,27 @@ services: - IDNOT_REDIRECT_URL postgres: - image: postgres + image: postgres:11 restart: always environment: - - DATABASE_HOSTNAME - - DATABASE_PORT - - DATABASE_USER - - DATABASE_PASSWORD - - DATABASE_NAME + - POSTGRES_USER - POSTGRES_PASSWORD + - POSTGRES_DB + - DATABASE_USERNAME + - DATABASE_PASSWORD + - DATABASE_NAME=${DATABASE_NAME} ports: - - ${DATABASE_PORT}:${DATABASE_PORT} + - ${DATABASE_PORT}:5432 volumes: - db_storage:/var/lib/postgresql/data - ./init-data.sh:/docker-entrypoint-initdb.d/init-data.sh healthcheck: - test: ["CMD-SHELL", "pg_isready -h localhost -U ${DATABASE_USER} -d ${DATABASE_NAME}"] + test: + [ + "CMD-SHELL", + "pg_isready -h localhost -U ${POSTGRES_USER} -d ${POSTGRES_DB}", + ] interval: 5s timeout: 5s retries: 10 \ No newline at end of file diff --git a/init-data.sh b/init-data.sh new file mode 100644 index 00000000..337cb03f --- /dev/null +++ b/init-data.sh @@ -0,0 +1,17 @@ +#!/bin/bash +set -e; + +# Make sure this script doesn't encounter any errors while building the docker container for the first time +# Carriage returns might be a problem (the first line #!/bin/bash will create an error) +# On Windows Docker Desktop i had to use the following command (in linux env): +# $ sed -i -e 's/\r$//' init-data.sh + +if [ -n "${DATABASE_USERNAME:-}" ] && [ -n "${DATABASE_PASSWORD:-}" ]; then + psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL + CREATE DATABASE ${DATABASE_NAME}; + CREATE USER ${DATABASE_USERNAME} WITH PASSWORD '${DATABASE_PASSWORD}'; + GRANT ALL PRIVILEGES ON DATABASE ${DATABASE_NAME} TO ${DATABASE_USERNAME}; + EOSQL +else + echo "SETUP INFO: No Environment variables given!" +fi \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 91a8b846..936d360e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "dotenv": "^16.0.3", "express": "^4.18.2", "jsonwebtoken": "^9.0.0", - "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.19", + "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.21", "module-alias": "^2.2.2", "next": "^13.1.5", "node-cache": "^5.1.2", @@ -1039,14 +1039,14 @@ "dev": true }, "node_modules/@next/env": { - "version": "13.3.0", - "resolved": "https://registry.npmjs.org/@next/env/-/env-13.3.0.tgz", - "integrity": "sha512-AjppRV4uG3No7L1plinoTQETH+j2F10TEnrMfzbTUYwze5sBUPveeeBAPZPm8OkJZ1epq9OyYKhZrvbD6/9HCQ==" + "version": "13.3.1", + "resolved": "https://registry.npmjs.org/@next/env/-/env-13.3.1.tgz", + "integrity": "sha512-EDtCoedIZC7JlUQ3uaQpSc4aVmyhbLHmQVALg7pFfQgOTjgSnn7mKtA0DiCMkYvvsx6aFb5octGMtWrOtGXW9A==" }, "node_modules/@next/swc-darwin-arm64": { - "version": "13.3.0", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.3.0.tgz", - "integrity": "sha512-DmIQCNq6JtccLPPBzf0dgh2vzMWt5wjxbP71pCi5EWpWYE3MsP6FcRXi4MlAmFNDQOfcFXR2r7kBeG1LpZUh1w==", + "version": "13.3.1", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.3.1.tgz", + "integrity": "sha512-UXPtriEc/pBP8luSLSCZBcbzPeVv+SSjs9cH/KygTbhmACye8/OOXRZO13Z2Wq1G0gLmEAIHQAOuF+vafPd2lw==", "cpu": [ "arm64" ], @@ -1059,9 +1059,9 @@ } }, "node_modules/@next/swc-darwin-x64": { - "version": "13.3.0", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.3.0.tgz", - "integrity": "sha512-oQoqFa88OGgwnYlnAGHVct618FRI/749se0N3S8t9Bzdv5CRbscnO0RcX901+YnNK4Q6yeiizfgO3b7kogtsZg==", + "version": "13.3.1", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.3.1.tgz", + "integrity": "sha512-lT36yYxosCfLtplFzJWgo0hrPu6/do8+msgM7oQkPeohDNdhjtjFUgOOwdSnPublLR6Mo2Ym4P/wl5OANuD2bw==", "cpu": [ "x64" ], @@ -1074,9 +1074,9 @@ } }, "node_modules/@next/swc-linux-arm64-gnu": { - "version": "13.3.0", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.3.0.tgz", - "integrity": "sha512-Wzz2p/WqAJUqTVoLo6H18WMeAXo3i+9DkPDae4oQG8LMloJ3if4NEZTnOnTUlro6cq+S/W4pTGa97nWTrOjbGw==", + "version": "13.3.1", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.3.1.tgz", + "integrity": "sha512-wRb76nLWJhonH8s3kxC/1tFguEkeOPayIwe9mkaz1G/yeS3OrjeyKMJsb4+Kdg0zbTo53bNCOl59NNtDM7yyyw==", "cpu": [ "arm64" ], @@ -1089,9 +1089,9 @@ } }, "node_modules/@next/swc-linux-arm64-musl": { - "version": "13.3.0", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.3.0.tgz", - "integrity": "sha512-xPVrIQOQo9WXJYgmoTlMnAD/HlR/1e1ZIWGbwIzEirXBVBqMARUulBEIKdC19zuvoJ477qZJgBDCKtKEykCpyQ==", + "version": "13.3.1", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.3.1.tgz", + "integrity": "sha512-qz3BzjJRZ16Iq/jrp+pjiYOc0jTjHlfmxQmZk9x/+5uhRP6/eWQSTAPVJ33BMo6oK5O5N4644OgTAbzXzorecg==", "cpu": [ "arm64" ], @@ -1104,9 +1104,9 @@ } }, "node_modules/@next/swc-linux-x64-gnu": { - "version": "13.3.0", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.3.0.tgz", - "integrity": "sha512-jOFlpGuPD7W2tuXVJP4wt9a3cpNxWAPcloq5EfMJRiXsBBOjLVFZA7boXYxEBzSVgUiVVr1V9T0HFM7pULJ1qA==", + "version": "13.3.1", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.3.1.tgz", + "integrity": "sha512-6mgkLmwlyWlomQmpl21I3hxgqE5INoW4owTlcLpNsd1V4wP+J46BlI/5zV5KWWbzjfncIqzXoeGs5Eg+1GHODA==", "cpu": [ "x64" ], @@ -1119,9 +1119,9 @@ } }, "node_modules/@next/swc-linux-x64-musl": { - "version": "13.3.0", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.3.0.tgz", - "integrity": "sha512-2OwKlzaBgmuet9XYHc3KwsEilzb04F540rlRXkAcjMHL7eCxB7uZIGtsVvKOnQLvC/elrUegwSw1+5f7WmfyOw==", + "version": "13.3.1", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.3.1.tgz", + "integrity": "sha512-uqm5sielhQmKJM+qayIhgZv1KlS5pqTdQ99b+Z7hMWryXS96qE0DftTmMZowBcUL6x7s2vSXyH5wPtO1ON7LBg==", "cpu": [ "x64" ], @@ -1134,9 +1134,9 @@ } }, "node_modules/@next/swc-win32-arm64-msvc": { - "version": "13.3.0", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.3.0.tgz", - "integrity": "sha512-OeHiA6YEvndxT46g+rzFK/MQTfftKxJmzslERMu9LDdC6Kez0bdrgEYed5eXFK2Z1viKZJCGRlhd06rBusyztA==", + "version": "13.3.1", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.3.1.tgz", + "integrity": "sha512-WomIiTj/v3LevltlibNQKmvrOymNRYL+a0dp5R73IwPWN5FvXWwSELN/kiNALig/+T3luc4qHNTyvMCp9L6U5Q==", "cpu": [ "arm64" ], @@ -1149,9 +1149,9 @@ } }, "node_modules/@next/swc-win32-ia32-msvc": { - "version": "13.3.0", - "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.3.0.tgz", - "integrity": "sha512-4aB7K9mcVK1lYEzpOpqWrXHEZympU3oK65fnNcY1Qc4HLJFLJj8AViuqQd4jjjPNuV4sl8jAwTz3gN5VNGWB7w==", + "version": "13.3.1", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.3.1.tgz", + "integrity": "sha512-M+PoH+0+q658wRUbs285RIaSTYnGBSTdweH/0CdzDgA6Q4rBM0sQs4DHmO3BPP0ltCO/vViIoyG7ks66XmCA5g==", "cpu": [ "ia32" ], @@ -1164,9 +1164,9 @@ } }, "node_modules/@next/swc-win32-x64-msvc": { - "version": "13.3.0", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.3.0.tgz", - "integrity": "sha512-Reer6rkLLcoOvB0dd66+Y7WrWVFH7sEEkF/4bJCIfsSKnTStTYaHtwIJAwbqnt9I392Tqvku0KkoqZOryWV9LQ==", + "version": "13.3.1", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.3.1.tgz", + "integrity": "sha512-Sl1F4Vp5Z1rNXWZYqJwMuWRRol4bqOB6+/d7KqkgQ4AcafKPN1PZmpkCoxv4UFHtFNIB7EotnuIhtXu3zScicQ==", "cpu": [ "x64" ], @@ -1179,12 +1179,12 @@ } }, "node_modules/@prisma/client": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/@prisma/client/-/client-4.12.0.tgz", - "integrity": "sha512-j9/ighfWwux97J2dS15nqhl60tYoH8V0IuSsgZDb6bCFcQD3fXbXmxjYC8GHhIgOk3lB7Pq+8CwElz2MiDpsSg==", + "version": "4.13.0", + "resolved": "https://registry.npmjs.org/@prisma/client/-/client-4.13.0.tgz", + "integrity": "sha512-YaiiICcRB2hatxsbnfB66uWXjcRw3jsZdlAVxmx0cFcTc/Ad/sKdHCcWSnqyDX47vAewkjRFwiLwrOUjswVvmA==", "hasInstallScript": true, "dependencies": { - "@prisma/engines-version": "4.12.0-67.659ef412370fa3b41cd7bf6e94587c1dfb7f67e7" + "@prisma/engines-version": "4.13.0-50.1e7af066ee9cb95cf3a403c78d9aab3e6b04f37a" }, "engines": { "node": ">=14.17" @@ -1199,16 +1199,16 @@ } }, "node_modules/@prisma/engines": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-4.12.0.tgz", - "integrity": "sha512-0alKtnxhNB5hYU+ymESBlGI4b9XrGGSdv7Ud+8TE/fBNOEhIud0XQsAR+TrvUZgS4na5czubiMsODw0TUrgkIA==", + "version": "4.13.0", + "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-4.13.0.tgz", + "integrity": "sha512-HrniowHRZXHuGT9XRgoXEaP2gJLXM5RMoItaY2PkjvuZ+iHc0Zjbm/302MB8YsPdWozAPHHn+jpFEcEn71OgPw==", "devOptional": true, "hasInstallScript": true }, "node_modules/@prisma/engines-version": { - "version": "4.12.0-67.659ef412370fa3b41cd7bf6e94587c1dfb7f67e7", - "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-4.12.0-67.659ef412370fa3b41cd7bf6e94587c1dfb7f67e7.tgz", - "integrity": "sha512-JIHNj5jlXb9mcaJwakM0vpgRYJIAurxTUqM0iX0tfEQA5XLZ9ONkIckkhuAKdAzocZ+80GYg7QSsfpjg7OxbOA==" + "version": "4.13.0-50.1e7af066ee9cb95cf3a403c78d9aab3e6b04f37a", + "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-4.13.0-50.1e7af066ee9cb95cf3a403c78d9aab3e6b04f37a.tgz", + "integrity": "sha512-fsQlbkhPJf08JOzKoyoD9atdUijuGBekwoOPZC3YOygXEml1MTtgXVpnUNchQlRSY82OQ6pSGQ9PxUe4arcSLQ==" }, "node_modules/@sinclair/typebox": { "version": "0.25.24", @@ -1235,9 +1235,9 @@ } }, "node_modules/@swc/helpers": { - "version": "0.4.14", - "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.4.14.tgz", - "integrity": "sha512-4C7nX/dvpzB7za4Ql9K81xK3HPxCpHMgwTZVyf+9JQ6VUbn9jjZVN7/Nkdz/Ugzs2CSjqnL/UPXroiVBVHUWUw==", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.0.tgz", + "integrity": "sha512-SjY/p4MmECVVEWspzSRpQEM3sjR17sP8PbGxELWrT+YZMBfiUyt1MRUNjMV23zohwlG2HYtCQOsCwsTHguXkyg==", "dependencies": { "tslib": "^2.4.0" } @@ -1388,9 +1388,9 @@ } }, "node_modules/@types/jest": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.0.tgz", - "integrity": "sha512-3Emr5VOl/aoBwnWcH/EFQvlSAmjV+XtV9GGu5mwdYew5vhQh0IUZx/60x0TzHDu09Bi7HMx10t/namdJw5QIcg==", + "version": "29.5.1", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.1.tgz", + "integrity": "sha512-tEuVcHrpaixS36w7hpsfLBLpjtMRJUE09/MHXn923LOVojDwyC14cWcfc0rDs0VEfUyYmt/+iX1kxxp+gZMcaQ==", "dev": true, "dependencies": { "expect": "^29.0.0", @@ -1413,9 +1413,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "18.15.11", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.11.tgz", - "integrity": "sha512-E5Kwq2n4SbMzQOn6wnmBjuK9ouqlURrcZDVfbo9ftDDTFt3nk7ZKK4GMOzoYgnpQJKcxwQw+lGaBvvlMo0qN/Q==" + "version": "18.16.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.0.tgz", + "integrity": "sha512-BsAaKhB+7X+H4GnSjGhJG9Qi8Tw+inU9nJDwmD5CgOmBLEI6ArdhikpLX7DjbjDRDTbqZzU2LSQNZg8WGPiSZQ==" }, "node_modules/@types/node-schedule": { "version": "2.1.0", @@ -1855,9 +1855,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001480", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001480.tgz", - "integrity": "sha512-q7cpoPPvZYgtyC4VaBSN0Bt+PJ4c4EYRf0DrduInOz2SkFpHD5p3LnvEpqBp7UnJn+8x1Ogl1s38saUxe+ihQQ==", + "version": "1.0.30001481", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001481.tgz", + "integrity": "sha512-KCqHwRnaa1InZBtqXzP98LPg0ajCVujMKjqKDhZEthIpAsJl/YEIa3YvXjGXPVqzZVguccuu7ga9KOE1J9rKPQ==", "funding": [ { "type": "opencollective", @@ -2201,9 +2201,9 @@ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" }, "node_modules/electron-to-chromium": { - "version": "1.4.365", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.365.tgz", - "integrity": "sha512-FRHZO+1tUNO4TOPXmlxetkoaIY8uwHzd1kKopK/Gx2SKn1L47wJXWD44wxP5CGRyyP98z/c8e1eBzJrgPeiBOg==", + "version": "1.4.371", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.371.tgz", + "integrity": "sha512-jlBzY4tFcJaiUjzhRTCWAqRvTO/fWzjA3Bls0mykzGZ7zvcMP7h05W6UcgzfT9Ca1SW2xyKDOFRyI0pQeRNZGw==", "dev": true }, "node_modules/emittery": { @@ -3361,9 +3361,9 @@ } }, "node_modules/jest-snapshot/node_modules/semver": { - "version": "7.4.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz", - "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==", + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz", + "integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" @@ -3556,9 +3556,9 @@ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, "node_modules/jsonwebtoken/node_modules/semver": { - "version": "7.4.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz", - "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==", + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz", + "integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==", "dependencies": { "lru-cache": "^6.0.0" }, @@ -3603,7 +3603,7 @@ } }, "node_modules/le-coffre-resources": { - "resolved": "git+ssh://git@github.com/smart-chain-fr/leCoffre-resources.git#22f4851fa87489634ea0a629ec040a44e7aa5fb9", + "resolved": "git+ssh://git@github.com/smart-chain-fr/leCoffre-resources.git#7f6d31080e8903998f6e5a687ead5635999d52eb", "license": "MIT", "dependencies": { "class-transformer": "^0.5.1", @@ -3620,9 +3620,9 @@ } }, "node_modules/libphonenumber-js": { - "version": "1.10.26", - "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.10.26.tgz", - "integrity": "sha512-oB3l4J5gEhMV+ymmlIjWedsbCpsNRqbEZ/E/MpN2QVyinKNra6DcuXywxSk/72M3DZDoH/6kzurOq1erznBMwQ==" + "version": "1.10.28", + "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.10.28.tgz", + "integrity": "sha512-1eAgjLrZA0+2Wgw4hs+4Q/kEBycxQo8ZLYnmOvZ3AlM8ImAVAJgDPlZtISLEzD1vunc2q8s2Pn7XwB7I8U3Kzw==" }, "node_modules/lines-and-columns": { "version": "1.2.4", @@ -3849,12 +3849,12 @@ } }, "node_modules/next": { - "version": "13.3.0", - "resolved": "https://registry.npmjs.org/next/-/next-13.3.0.tgz", - "integrity": "sha512-OVTw8MpIPa12+DCUkPqRGPS3thlJPcwae2ZL4xti3iBff27goH024xy4q2lhlsdoYiKOi8Kz6uJoLW/GXwgfOA==", + "version": "13.3.1", + "resolved": "https://registry.npmjs.org/next/-/next-13.3.1.tgz", + "integrity": "sha512-eByWRxPzKHs2oQz1yE41LX35umhz86ZSZ+mYyXBqn2IBi2hyUqxBA88avywdr4uyH+hCJczegGsDGWbzQA5Rqw==", "dependencies": { - "@next/env": "13.3.0", - "@swc/helpers": "0.4.14", + "@next/env": "13.3.1", + "@swc/helpers": "0.5.0", "busboy": "1.6.0", "caniuse-lite": "^1.0.30001406", "postcss": "8.4.14", @@ -3864,18 +3864,18 @@ "next": "dist/bin/next" }, "engines": { - "node": ">=14.6.0" + "node": ">=14.18.0" }, "optionalDependencies": { - "@next/swc-darwin-arm64": "13.3.0", - "@next/swc-darwin-x64": "13.3.0", - "@next/swc-linux-arm64-gnu": "13.3.0", - "@next/swc-linux-arm64-musl": "13.3.0", - "@next/swc-linux-x64-gnu": "13.3.0", - "@next/swc-linux-x64-musl": "13.3.0", - "@next/swc-win32-arm64-msvc": "13.3.0", - "@next/swc-win32-ia32-msvc": "13.3.0", - "@next/swc-win32-x64-msvc": "13.3.0" + "@next/swc-darwin-arm64": "13.3.1", + "@next/swc-darwin-x64": "13.3.1", + "@next/swc-linux-arm64-gnu": "13.3.1", + "@next/swc-linux-arm64-musl": "13.3.1", + "@next/swc-linux-x64-gnu": "13.3.1", + "@next/swc-linux-x64-musl": "13.3.1", + "@next/swc-win32-arm64-msvc": "13.3.1", + "@next/swc-win32-ia32-msvc": "13.3.1", + "@next/swc-win32-x64-msvc": "13.3.1" }, "peerDependencies": { "@opentelemetry/api": "^1.1.0", @@ -4314,13 +4314,13 @@ } }, "node_modules/prisma": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/prisma/-/prisma-4.12.0.tgz", - "integrity": "sha512-xqVper4mbwl32BWzLpdznHAYvYDWQQWK2tBfXjdUD397XaveRyAP7SkBZ6kFlIg8kKayF4hvuaVtYwXd9BodAg==", + "version": "4.13.0", + "resolved": "https://registry.npmjs.org/prisma/-/prisma-4.13.0.tgz", + "integrity": "sha512-L9mqjnSmvWIRCYJ9mQkwCtj4+JDYYTdhoyo8hlsHNDXaZLh/b4hR0IoKIBbTKxZuyHQzLopb/+0Rvb69uGV7uA==", "devOptional": true, "hasInstallScript": true, "dependencies": { - "@prisma/engines": "4.12.0" + "@prisma/engines": "4.13.0" }, "bin": { "prisma": "build/index.js", @@ -4367,9 +4367,9 @@ "dev": true }, "node_modules/pure-rand": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.0.1.tgz", - "integrity": "sha512-t+x1zEHDjBwkDGY5v5ApnZ/utcd4XYDiJsaQQoptTXgUXX95sDg1elCdJghzicm7n2mbCBJ3uYWr6M22SO19rg==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.0.2.tgz", + "integrity": "sha512-6Yg0ekpKICSjPswYOuC5sku/TSWaRYlA0qsXqJgM/d/4pLPHPuTxK7Nbf7jFKzAeedUhR8C7K9Uv63FBsSo8xQ==", "dev": true, "funding": [ { @@ -4476,12 +4476,12 @@ } }, "node_modules/resolve": { - "version": "1.22.3", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.3.tgz", - "integrity": "sha512-P8ur/gp/AmbEzjr729bZnLjXK5Z+4P0zhIJgBgzqRih7hL7BOukHGtSTA3ACMY467GRFz3duQsi0bDZdR7DKdw==", + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", + "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", "dev": true, "dependencies": { - "is-core-module": "^2.12.0", + "is-core-module": "^2.11.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, @@ -4985,9 +4985,9 @@ } }, "node_modules/ts-jest/node_modules/semver": { - "version": "7.4.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz", - "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==", + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz", + "integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" @@ -6094,82 +6094,82 @@ } }, "@next/env": { - "version": "13.3.0", - "resolved": "https://registry.npmjs.org/@next/env/-/env-13.3.0.tgz", - "integrity": "sha512-AjppRV4uG3No7L1plinoTQETH+j2F10TEnrMfzbTUYwze5sBUPveeeBAPZPm8OkJZ1epq9OyYKhZrvbD6/9HCQ==" + "version": "13.3.1", + "resolved": "https://registry.npmjs.org/@next/env/-/env-13.3.1.tgz", + "integrity": "sha512-EDtCoedIZC7JlUQ3uaQpSc4aVmyhbLHmQVALg7pFfQgOTjgSnn7mKtA0DiCMkYvvsx6aFb5octGMtWrOtGXW9A==" }, "@next/swc-darwin-arm64": { - "version": "13.3.0", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.3.0.tgz", - "integrity": "sha512-DmIQCNq6JtccLPPBzf0dgh2vzMWt5wjxbP71pCi5EWpWYE3MsP6FcRXi4MlAmFNDQOfcFXR2r7kBeG1LpZUh1w==", + "version": "13.3.1", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.3.1.tgz", + "integrity": "sha512-UXPtriEc/pBP8luSLSCZBcbzPeVv+SSjs9cH/KygTbhmACye8/OOXRZO13Z2Wq1G0gLmEAIHQAOuF+vafPd2lw==", "optional": true }, "@next/swc-darwin-x64": { - "version": "13.3.0", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.3.0.tgz", - "integrity": "sha512-oQoqFa88OGgwnYlnAGHVct618FRI/749se0N3S8t9Bzdv5CRbscnO0RcX901+YnNK4Q6yeiizfgO3b7kogtsZg==", + "version": "13.3.1", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.3.1.tgz", + "integrity": "sha512-lT36yYxosCfLtplFzJWgo0hrPu6/do8+msgM7oQkPeohDNdhjtjFUgOOwdSnPublLR6Mo2Ym4P/wl5OANuD2bw==", "optional": true }, "@next/swc-linux-arm64-gnu": { - "version": "13.3.0", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.3.0.tgz", - "integrity": "sha512-Wzz2p/WqAJUqTVoLo6H18WMeAXo3i+9DkPDae4oQG8LMloJ3if4NEZTnOnTUlro6cq+S/W4pTGa97nWTrOjbGw==", + "version": "13.3.1", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.3.1.tgz", + "integrity": "sha512-wRb76nLWJhonH8s3kxC/1tFguEkeOPayIwe9mkaz1G/yeS3OrjeyKMJsb4+Kdg0zbTo53bNCOl59NNtDM7yyyw==", "optional": true }, "@next/swc-linux-arm64-musl": { - "version": "13.3.0", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.3.0.tgz", - "integrity": "sha512-xPVrIQOQo9WXJYgmoTlMnAD/HlR/1e1ZIWGbwIzEirXBVBqMARUulBEIKdC19zuvoJ477qZJgBDCKtKEykCpyQ==", + "version": "13.3.1", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.3.1.tgz", + "integrity": "sha512-qz3BzjJRZ16Iq/jrp+pjiYOc0jTjHlfmxQmZk9x/+5uhRP6/eWQSTAPVJ33BMo6oK5O5N4644OgTAbzXzorecg==", "optional": true }, "@next/swc-linux-x64-gnu": { - "version": "13.3.0", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.3.0.tgz", - "integrity": "sha512-jOFlpGuPD7W2tuXVJP4wt9a3cpNxWAPcloq5EfMJRiXsBBOjLVFZA7boXYxEBzSVgUiVVr1V9T0HFM7pULJ1qA==", + "version": "13.3.1", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.3.1.tgz", + "integrity": "sha512-6mgkLmwlyWlomQmpl21I3hxgqE5INoW4owTlcLpNsd1V4wP+J46BlI/5zV5KWWbzjfncIqzXoeGs5Eg+1GHODA==", "optional": true }, "@next/swc-linux-x64-musl": { - "version": "13.3.0", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.3.0.tgz", - "integrity": "sha512-2OwKlzaBgmuet9XYHc3KwsEilzb04F540rlRXkAcjMHL7eCxB7uZIGtsVvKOnQLvC/elrUegwSw1+5f7WmfyOw==", + "version": "13.3.1", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.3.1.tgz", + "integrity": "sha512-uqm5sielhQmKJM+qayIhgZv1KlS5pqTdQ99b+Z7hMWryXS96qE0DftTmMZowBcUL6x7s2vSXyH5wPtO1ON7LBg==", "optional": true }, "@next/swc-win32-arm64-msvc": { - "version": "13.3.0", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.3.0.tgz", - "integrity": "sha512-OeHiA6YEvndxT46g+rzFK/MQTfftKxJmzslERMu9LDdC6Kez0bdrgEYed5eXFK2Z1viKZJCGRlhd06rBusyztA==", + "version": "13.3.1", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.3.1.tgz", + "integrity": "sha512-WomIiTj/v3LevltlibNQKmvrOymNRYL+a0dp5R73IwPWN5FvXWwSELN/kiNALig/+T3luc4qHNTyvMCp9L6U5Q==", "optional": true }, "@next/swc-win32-ia32-msvc": { - "version": "13.3.0", - "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.3.0.tgz", - "integrity": "sha512-4aB7K9mcVK1lYEzpOpqWrXHEZympU3oK65fnNcY1Qc4HLJFLJj8AViuqQd4jjjPNuV4sl8jAwTz3gN5VNGWB7w==", + "version": "13.3.1", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.3.1.tgz", + "integrity": "sha512-M+PoH+0+q658wRUbs285RIaSTYnGBSTdweH/0CdzDgA6Q4rBM0sQs4DHmO3BPP0ltCO/vViIoyG7ks66XmCA5g==", "optional": true }, "@next/swc-win32-x64-msvc": { - "version": "13.3.0", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.3.0.tgz", - "integrity": "sha512-Reer6rkLLcoOvB0dd66+Y7WrWVFH7sEEkF/4bJCIfsSKnTStTYaHtwIJAwbqnt9I392Tqvku0KkoqZOryWV9LQ==", + "version": "13.3.1", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.3.1.tgz", + "integrity": "sha512-Sl1F4Vp5Z1rNXWZYqJwMuWRRol4bqOB6+/d7KqkgQ4AcafKPN1PZmpkCoxv4UFHtFNIB7EotnuIhtXu3zScicQ==", "optional": true }, "@prisma/client": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/@prisma/client/-/client-4.12.0.tgz", - "integrity": "sha512-j9/ighfWwux97J2dS15nqhl60tYoH8V0IuSsgZDb6bCFcQD3fXbXmxjYC8GHhIgOk3lB7Pq+8CwElz2MiDpsSg==", + "version": "4.13.0", + "resolved": "https://registry.npmjs.org/@prisma/client/-/client-4.13.0.tgz", + "integrity": "sha512-YaiiICcRB2hatxsbnfB66uWXjcRw3jsZdlAVxmx0cFcTc/Ad/sKdHCcWSnqyDX47vAewkjRFwiLwrOUjswVvmA==", "requires": { - "@prisma/engines-version": "4.12.0-67.659ef412370fa3b41cd7bf6e94587c1dfb7f67e7" + "@prisma/engines-version": "4.13.0-50.1e7af066ee9cb95cf3a403c78d9aab3e6b04f37a" } }, "@prisma/engines": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-4.12.0.tgz", - "integrity": "sha512-0alKtnxhNB5hYU+ymESBlGI4b9XrGGSdv7Ud+8TE/fBNOEhIud0XQsAR+TrvUZgS4na5czubiMsODw0TUrgkIA==", + "version": "4.13.0", + "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-4.13.0.tgz", + "integrity": "sha512-HrniowHRZXHuGT9XRgoXEaP2gJLXM5RMoItaY2PkjvuZ+iHc0Zjbm/302MB8YsPdWozAPHHn+jpFEcEn71OgPw==", "devOptional": true }, "@prisma/engines-version": { - "version": "4.12.0-67.659ef412370fa3b41cd7bf6e94587c1dfb7f67e7", - "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-4.12.0-67.659ef412370fa3b41cd7bf6e94587c1dfb7f67e7.tgz", - "integrity": "sha512-JIHNj5jlXb9mcaJwakM0vpgRYJIAurxTUqM0iX0tfEQA5XLZ9ONkIckkhuAKdAzocZ+80GYg7QSsfpjg7OxbOA==" + "version": "4.13.0-50.1e7af066ee9cb95cf3a403c78d9aab3e6b04f37a", + "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-4.13.0-50.1e7af066ee9cb95cf3a403c78d9aab3e6b04f37a.tgz", + "integrity": "sha512-fsQlbkhPJf08JOzKoyoD9atdUijuGBekwoOPZC3YOygXEml1MTtgXVpnUNchQlRSY82OQ6pSGQ9PxUe4arcSLQ==" }, "@sinclair/typebox": { "version": "0.25.24", @@ -6196,9 +6196,9 @@ } }, "@swc/helpers": { - "version": "0.4.14", - "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.4.14.tgz", - "integrity": "sha512-4C7nX/dvpzB7za4Ql9K81xK3HPxCpHMgwTZVyf+9JQ6VUbn9jjZVN7/Nkdz/Ugzs2CSjqnL/UPXroiVBVHUWUw==", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.0.tgz", + "integrity": "sha512-SjY/p4MmECVVEWspzSRpQEM3sjR17sP8PbGxELWrT+YZMBfiUyt1MRUNjMV23zohwlG2HYtCQOsCwsTHguXkyg==", "requires": { "tslib": "^2.4.0" } @@ -6349,9 +6349,9 @@ } }, "@types/jest": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.0.tgz", - "integrity": "sha512-3Emr5VOl/aoBwnWcH/EFQvlSAmjV+XtV9GGu5mwdYew5vhQh0IUZx/60x0TzHDu09Bi7HMx10t/namdJw5QIcg==", + "version": "29.5.1", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.1.tgz", + "integrity": "sha512-tEuVcHrpaixS36w7hpsfLBLpjtMRJUE09/MHXn923LOVojDwyC14cWcfc0rDs0VEfUyYmt/+iX1kxxp+gZMcaQ==", "dev": true, "requires": { "expect": "^29.0.0", @@ -6374,9 +6374,9 @@ "dev": true }, "@types/node": { - "version": "18.15.11", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.11.tgz", - "integrity": "sha512-E5Kwq2n4SbMzQOn6wnmBjuK9ouqlURrcZDVfbo9ftDDTFt3nk7ZKK4GMOzoYgnpQJKcxwQw+lGaBvvlMo0qN/Q==" + "version": "18.16.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.0.tgz", + "integrity": "sha512-BsAaKhB+7X+H4GnSjGhJG9Qi8Tw+inU9nJDwmD5CgOmBLEI6ArdhikpLX7DjbjDRDTbqZzU2LSQNZg8WGPiSZQ==" }, "@types/node-schedule": { "version": "2.1.0", @@ -6721,9 +6721,9 @@ "dev": true }, "caniuse-lite": { - "version": "1.0.30001480", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001480.tgz", - "integrity": "sha512-q7cpoPPvZYgtyC4VaBSN0Bt+PJ4c4EYRf0DrduInOz2SkFpHD5p3LnvEpqBp7UnJn+8x1Ogl1s38saUxe+ihQQ==" + "version": "1.0.30001481", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001481.tgz", + "integrity": "sha512-KCqHwRnaa1InZBtqXzP98LPg0ajCVujMKjqKDhZEthIpAsJl/YEIa3YvXjGXPVqzZVguccuu7ga9KOE1J9rKPQ==" }, "chalk": { "version": "4.1.2", @@ -6971,9 +6971,9 @@ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" }, "electron-to-chromium": { - "version": "1.4.365", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.365.tgz", - "integrity": "sha512-FRHZO+1tUNO4TOPXmlxetkoaIY8uwHzd1kKopK/Gx2SKn1L47wJXWD44wxP5CGRyyP98z/c8e1eBzJrgPeiBOg==", + "version": "1.4.371", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.371.tgz", + "integrity": "sha512-jlBzY4tFcJaiUjzhRTCWAqRvTO/fWzjA3Bls0mykzGZ7zvcMP7h05W6UcgzfT9Ca1SW2xyKDOFRyI0pQeRNZGw==", "dev": true }, "emittery": { @@ -7843,9 +7843,9 @@ } }, "semver": { - "version": "7.4.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz", - "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==", + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz", + "integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==", "dev": true, "requires": { "lru-cache": "^6.0.0" @@ -7992,9 +7992,9 @@ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, "semver": { - "version": "7.4.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz", - "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==", + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz", + "integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==", "requires": { "lru-cache": "^6.0.0" } @@ -8032,8 +8032,8 @@ "dev": true }, "le-coffre-resources": { - "version": "git+ssh://git@github.com/smart-chain-fr/leCoffre-resources.git#22f4851fa87489634ea0a629ec040a44e7aa5fb9", - "from": "le-coffre-resources@git@github.com:smart-chain-fr/leCoffre-resources.git#v2.19", + "version": "git+ssh://git@github.com/smart-chain-fr/leCoffre-resources.git#7f6d31080e8903998f6e5a687ead5635999d52eb", + "from": "le-coffre-resources@git@github.com:smart-chain-fr/leCoffre-resources.git#v2.21", "requires": { "class-transformer": "^0.5.1", "class-validator": "^0.14.0" @@ -8046,9 +8046,9 @@ "dev": true }, "libphonenumber-js": { - "version": "1.10.26", - "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.10.26.tgz", - "integrity": "sha512-oB3l4J5gEhMV+ymmlIjWedsbCpsNRqbEZ/E/MpN2QVyinKNra6DcuXywxSk/72M3DZDoH/6kzurOq1erznBMwQ==" + "version": "1.10.28", + "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.10.28.tgz", + "integrity": "sha512-1eAgjLrZA0+2Wgw4hs+4Q/kEBycxQo8ZLYnmOvZ3AlM8ImAVAJgDPlZtISLEzD1vunc2q8s2Pn7XwB7I8U3Kzw==" }, "lines-and-columns": { "version": "1.2.4", @@ -8218,21 +8218,21 @@ "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==" }, "next": { - "version": "13.3.0", - "resolved": "https://registry.npmjs.org/next/-/next-13.3.0.tgz", - "integrity": "sha512-OVTw8MpIPa12+DCUkPqRGPS3thlJPcwae2ZL4xti3iBff27goH024xy4q2lhlsdoYiKOi8Kz6uJoLW/GXwgfOA==", + "version": "13.3.1", + "resolved": "https://registry.npmjs.org/next/-/next-13.3.1.tgz", + "integrity": "sha512-eByWRxPzKHs2oQz1yE41LX35umhz86ZSZ+mYyXBqn2IBi2hyUqxBA88avywdr4uyH+hCJczegGsDGWbzQA5Rqw==", "requires": { - "@next/env": "13.3.0", - "@next/swc-darwin-arm64": "13.3.0", - "@next/swc-darwin-x64": "13.3.0", - "@next/swc-linux-arm64-gnu": "13.3.0", - "@next/swc-linux-arm64-musl": "13.3.0", - "@next/swc-linux-x64-gnu": "13.3.0", - "@next/swc-linux-x64-musl": "13.3.0", - "@next/swc-win32-arm64-msvc": "13.3.0", - "@next/swc-win32-ia32-msvc": "13.3.0", - "@next/swc-win32-x64-msvc": "13.3.0", - "@swc/helpers": "0.4.14", + "@next/env": "13.3.1", + "@next/swc-darwin-arm64": "13.3.1", + "@next/swc-darwin-x64": "13.3.1", + "@next/swc-linux-arm64-gnu": "13.3.1", + "@next/swc-linux-arm64-musl": "13.3.1", + "@next/swc-linux-x64-gnu": "13.3.1", + "@next/swc-linux-x64-musl": "13.3.1", + "@next/swc-win32-arm64-msvc": "13.3.1", + "@next/swc-win32-ia32-msvc": "13.3.1", + "@next/swc-win32-x64-msvc": "13.3.1", + "@swc/helpers": "0.5.0", "busboy": "1.6.0", "caniuse-lite": "^1.0.30001406", "postcss": "8.4.14", @@ -8528,12 +8528,12 @@ } }, "prisma": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/prisma/-/prisma-4.12.0.tgz", - "integrity": "sha512-xqVper4mbwl32BWzLpdznHAYvYDWQQWK2tBfXjdUD397XaveRyAP7SkBZ6kFlIg8kKayF4hvuaVtYwXd9BodAg==", + "version": "4.13.0", + "resolved": "https://registry.npmjs.org/prisma/-/prisma-4.13.0.tgz", + "integrity": "sha512-L9mqjnSmvWIRCYJ9mQkwCtj4+JDYYTdhoyo8hlsHNDXaZLh/b4hR0IoKIBbTKxZuyHQzLopb/+0Rvb69uGV7uA==", "devOptional": true, "requires": { - "@prisma/engines": "4.12.0" + "@prisma/engines": "4.13.0" } }, "prisma-query": { @@ -8567,9 +8567,9 @@ "dev": true }, "pure-rand": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.0.1.tgz", - "integrity": "sha512-t+x1zEHDjBwkDGY5v5ApnZ/utcd4XYDiJsaQQoptTXgUXX95sDg1elCdJghzicm7n2mbCBJ3uYWr6M22SO19rg==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.0.2.tgz", + "integrity": "sha512-6Yg0ekpKICSjPswYOuC5sku/TSWaRYlA0qsXqJgM/d/4pLPHPuTxK7Nbf7jFKzAeedUhR8C7K9Uv63FBsSo8xQ==", "dev": true }, "qs": { @@ -8642,12 +8642,12 @@ "dev": true }, "resolve": { - "version": "1.22.3", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.3.tgz", - "integrity": "sha512-P8ur/gp/AmbEzjr729bZnLjXK5Z+4P0zhIJgBgzqRih7hL7BOukHGtSTA3ACMY467GRFz3duQsi0bDZdR7DKdw==", + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", + "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", "dev": true, "requires": { - "is-core-module": "^2.12.0", + "is-core-module": "^2.11.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" } @@ -8995,9 +8995,9 @@ } }, "semver": { - "version": "7.4.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz", - "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==", + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz", + "integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==", "dev": true, "requires": { "lru-cache": "^6.0.0" diff --git a/package.json b/package.json index 5928f007..806322f7 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "scripts": { "api:startonly": "node ./dist/entries/App.js", "build": "tsc", - "api:start": "npm run migrate && npx prisma db seed && node ./dist/entries/App.js", + "api:start": "tsc && npm run migrate && npx prisma db seed && node ./dist/entries/App.js", "start": "tsc && npm run api:startonly", "dev": "nodemon -V", "api:dev": "nodemon", diff --git a/src/common/config/variables/Variables.ts b/src/common/config/variables/Variables.ts index b6432b98..8624a386 100644 --- a/src/common/config/variables/Variables.ts +++ b/src/common/config/variables/Variables.ts @@ -1,6 +1,6 @@ -import { Service } from "typedi"; -import { validateOrReject, IsNotEmpty, IsOptional } from "class-validator"; +import { IsNotEmpty, IsOptional, validateOrReject } from "class-validator"; import dotenv from "dotenv"; +import { Service } from "typedi"; @Service() export class BackendVariables { @@ -8,10 +8,10 @@ export class BackendVariables { public readonly DATABASE_PORT!: string; @IsNotEmpty() - public readonly DATABASE_HOSTNAME!: string; + public readonly DATABASE_HOST!: string; @IsNotEmpty() - public readonly DATABASE_USER!: string; + public readonly DATABASE_USERNAME!: string; @IsNotEmpty() public readonly DATABASE_PASSWORD!: string; @@ -48,8 +48,8 @@ export class BackendVariables { public constructor() { dotenv.config(); this.DATABASE_PORT = process.env["DATABASE_PORT"]!; - this.DATABASE_HOSTNAME = process.env["DATABASE_HOSTNAME"]!; - this.DATABASE_USER = process.env["DATABASE_USER"]!; + this.DATABASE_HOST = process.env["DATABASE_HOST"]!; + this.DATABASE_USERNAME = process.env["DATABASE_USERNAME"]!; this.DATABASE_PASSWORD = process.env["DATABASE_PASSWORD"]!; this.DATABASE_NAME = process.env["DATABASE_NAME"]!; this.API_ROOT_URL = process.env["API_ROOT_URL"]!; diff --git a/src/common/system/database/DbProvider.ts b/src/common/system/database/DbProvider.ts index 1c5f9d69..fa640f45 100644 --- a/src/common/system/database/DbProvider.ts +++ b/src/common/system/database/DbProvider.ts @@ -1,17 +1,19 @@ -import dotenv from "dotenv"; -import { PrismaClient } from "@prisma/client"; -import IDatabaseConfig from "../../config/database/IDatabaseConfig"; import { BackendVariables } from "@Common/config/variables/Variables"; +import { PrismaClient } from "@prisma/client"; +import dotenv from "dotenv"; import Container from "typedi"; +import IDatabaseConfig from "../../config/database/IDatabaseConfig"; + dotenv.config(); export default class DbProvider { protected readonly variables = Container.get(BackendVariables); + protected url = `postgres://${this.variables.DATABASE_USERNAME}:${this.variables.DATABASE_PASSWORD}@${this.variables.DATABASE_HOST}:${this.variables.DATABASE_PORT}/${this.variables.DATABASE_NAME}`; protected client = new PrismaClient({ datasources: { db: { - url: `postgres://${this.variables.DATABASE_USER}:${this.variables.DATABASE_PASSWORD}@${this.variables.DATABASE_HOSTNAME}:${this.variables.DATABASE_PORT}/${this.variables.DATABASE_NAME}`, + url: this.url, }, }, }); From 1e641cf3c4b19bb2cbd806ae43c940cf304e8405 Mon Sep 17 00:00:00 2001 From: OxSaitama Date: Mon, 17 Apr 2023 18:35:19 +0200 Subject: [PATCH 18/72] feature: add office folders services --- .env.test | 9 +- package.json | 7 +- src/common/databases/schema.prisma | 3 +- .../repositories/CustomersRepository.ts | 43 +- .../repositories/DeedTypesRepository.ts | 19 +- src/common/repositories/DeedsRepository.ts | 24 +- .../repositories/DocumentsRepository.ts | 6 +- .../repositories/OfficeFoldersRepository.ts | 12 +- src/common/repositories/UsersRepository.ts | 42 +- .../OfficeFoldersService.ts | 6 +- src/test/config/Init.ts | 121 +++++ .../super-admin => config}/MockedData.ts | 146 ++++-- .../super-admin/CustomersService.test.ts | 32 +- .../services/super-admin/DeedService.test.ts | 280 ++++------ .../super-admin/DeedTypesService.test.ts | 338 +++++------- .../super-admin/DocumentTypesService.test.ts | 113 ++-- .../super-admin/OfficeFolderService.test.ts | 483 +++++++++--------- .../services/super-admin/UsersService.test.ts | 20 +- 18 files changed, 868 insertions(+), 836 deletions(-) create mode 100644 src/test/config/Init.ts rename src/test/{services/super-admin => config}/MockedData.ts (75%) diff --git a/.env.test b/.env.test index 149826ef..01e23bcd 100644 --- a/.env.test +++ b/.env.test @@ -1,4 +1,7 @@ DATABASE_URL="postgresql://prisma:prisma@localhost:5433/tests" -POSTGRES_USER=prisma -POSTGRES_PASSWORD=prisma -POSTGRES_DB=tests \ No newline at end of file +DATABASE_PORT="5433" +DATABASE_USER="prisma" +DATABASE_PASSWORD="prisma" +DATABASE_NAME="tests" +DATABASE_HOSTNAME="localhost" +DEV_PRISMA_STUDIO_DB_URL="postgresql://prisma:prisma@localhost:5433/tests" \ No newline at end of file diff --git a/package.json b/package.json index 806322f7..94b842d1 100644 --- a/package.json +++ b/package.json @@ -25,11 +25,12 @@ "api:dev": "nodemon", "build:test": "tsc && mocha ./dist/entries/Test.js", "format": "prettier --write src", + "migrate:test": "dotenv -e .env.test -- npx prisma migrate deploy", "migrate": "npx prisma migrate deploy", "docker:up": "docker-compose up -d", "docker:up:test": "docker-compose -f docker-compose-test.yml up -d", "docker:down": "docker-compose -f docker-compose-test.yml down", - "test": "tsc && npm run docker:up:test && npm run migrate && jest -i --verbose ./dist/test/* && npm run docker:down" + "test": "tsc && npm run docker:up:test && npm run migrate:test && dotenv -e .env.test -- jest -i --verbose ./dist/test/* && npm run docker:down" }, "repository": { "type": "git", @@ -47,10 +48,9 @@ "class-validator": "^0.14.0", "classnames": "^2.3.2", "cors": "^2.8.5", - "dotenv": "^16.0.3", "express": "^4.18.2", "jsonwebtoken": "^9.0.0", - "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.21", + "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.24", "module-alias": "^2.2.2", "next": "^13.1.5", "node-cache": "^5.1.2", @@ -71,6 +71,7 @@ "@types/node": "^18.11.18", "@types/node-schedule": "^2.1.0", "@types/uuid": "^9.0.0", + "dotenv": "^16.0.3", "jest": "^29.5.0", "nodemon": "^2.0.20", "prettier": "2.8.4", diff --git a/src/common/databases/schema.prisma b/src/common/databases/schema.prisma index 8e4c2d86..113b282f 100644 --- a/src/common/databases/schema.prisma +++ b/src/common/databases/schema.prisma @@ -137,6 +137,7 @@ model OfficeFolders { office_folder_has_stakeholder OfficeFolderHasStakeholders[] documents Documents[] + @@unique([folder_number, office_uuid]) @@map("office_folders") } @@ -149,7 +150,7 @@ model OfficeFolderHasCustomers { created_at DateTime? @default(now()) updated_at DateTime? @updatedAt - @@unique([customer_uuid, office_folder_uuid]) + @@unique([office_folder_uuid, customer_uuid]) @@map("office_folder_has_customers") } diff --git a/src/common/repositories/CustomersRepository.ts b/src/common/repositories/CustomersRepository.ts index 97dd50d5..7dc3e1ee 100644 --- a/src/common/repositories/CustomersRepository.ts +++ b/src/common/repositories/CustomersRepository.ts @@ -1,7 +1,7 @@ import Database from "@Common/databases/database"; import BaseRepository from "@Repositories/BaseRepository"; import { Service } from "typedi"; -import { Customers, ECivility, ECustomerStatus } from "@prisma/client"; +import { Customers, ECivility, ECustomerStatus, Prisma } from "@prisma/client"; import { Customer } from "le-coffre-resources/dist/SuperAdmin"; @Service() @@ -28,7 +28,7 @@ export default class CustomersRepository extends BaseRepository { * @description : Create a customer */ public async create(customer: Customer): Promise { - return this.model.create({ + const createArgs: Prisma.CustomersCreateArgs = { data: { status: ECustomerStatus.PENDING, contact: { @@ -39,24 +39,27 @@ export default class CustomersRepository extends BaseRepository { phone_number: customer.contact.phone_number, cell_phone_number: customer.contact?.cell_phone_number, civility: ECivility[customer.contact.civility as keyof typeof ECivility], - address: { - create: { - address: customer.contact.address?.address, - zip_code: customer.contact.address.zip_code, - city: customer.contact.address.city, - }, - }, + address: {} }, }, }, - }); + }; + + if (customer.contact.address) { + createArgs.data.contact!.create!.address!.create = { + address: customer.contact.address!.address, + zip_code: customer.contact.address!.zip_code, + city: customer.contact.address!.city, + }; + } + return this.model.create(createArgs); } /** * @description : Update data from a customer */ public async update(uid: string, customer: Customer): Promise { - return this.model.update({ + const updateArgs: Prisma.CustomersUpdateArgs = { where: { uuid: uid, }, @@ -70,17 +73,19 @@ export default class CustomersRepository extends BaseRepository { phone_number: customer.contact.phone_number, cell_phone_number: customer.contact.cell_phone_number, civility: ECivility[customer.contact.civility as keyof typeof ECivility], - address: { - update: { - address: customer.contact.address.address, - zip_code: customer.contact.address.zip_code, - city: customer.contact.address.city, - }, - }, + address: {} }, }, }, - }); + } + if (customer.contact.address) { + updateArgs.data.contact!.update!.address!.update = { + address: customer.contact.address!.address, + zip_code: customer.contact.address!.zip_code, + city: customer.contact.address!.city, + }; + } + return this.model.update(updateArgs); } /** diff --git a/src/common/repositories/DeedTypesRepository.ts b/src/common/repositories/DeedTypesRepository.ts index 5138288b..28bc1e7a 100644 --- a/src/common/repositories/DeedTypesRepository.ts +++ b/src/common/repositories/DeedTypesRepository.ts @@ -28,7 +28,7 @@ export default class DeedTypesRepository extends BaseRepository { * @description : Create new deed type */ public async create(deedType: DeedType): Promise { - return this.model.create({ + const createArgs: Prisma.DeedTypesCreateArgs = { data: { name: deedType.name, description: deedType.description, @@ -37,8 +37,19 @@ export default class DeedTypesRepository extends BaseRepository { uuid: deedType.office.uid, }, }, - }, - }); + } + }; + if (deedType.deed_type_has_document_types) { + createArgs.data.deed_type_has_document_types = { + createMany: { + data: deedType.deed_type_has_document_types.map((relation) => ({ + document_type_uuid: relation.document_type.uid!, + })), + skipDuplicates: true, + }, + }; + } + return this.model.create(createArgs); } /** @@ -68,7 +79,7 @@ export default class DeedTypesRepository extends BaseRepository { deleteMany: { deed_type_uuid: uid }, createMany: { data: deedType.deed_type_has_document_types.map((relation) => ({ - document_type_uuid: relation.document_type.uid, + document_type_uuid: relation.document_type.uid!, })), skipDuplicates: true, }, diff --git a/src/common/repositories/DeedsRepository.ts b/src/common/repositories/DeedsRepository.ts index 098656e7..b430000f 100644 --- a/src/common/repositories/DeedsRepository.ts +++ b/src/common/repositories/DeedsRepository.ts @@ -28,7 +28,7 @@ export default class DeedsRepository extends BaseRepository { * @description : Create a deed based on a deed type */ public async create(deed: Deed): Promise { - return this.model.create({ + const createArgs: Prisma.DeedsCreateArgs = { data: { deed_type: { connect: { @@ -36,7 +36,27 @@ export default class DeedsRepository extends BaseRepository { }, }, }, + }; + const deedTypeWithDocumentTypes = await this.instanceDb.deedTypes.findUniqueOrThrow({ + where: { + uuid: deed.deed_type.uid, + }, + include: { deed_type_has_document_types: true }, }); + + if (deedTypeWithDocumentTypes.archived_at) throw new Error("deed type is archived"); + + if (deedTypeWithDocumentTypes.deed_type_has_document_types) { + createArgs.data.deed_has_document_types = { + createMany: { + data: deedTypeWithDocumentTypes.deed_type_has_document_types.map((relation) => ({ + document_type_uuid: relation.document_type_uuid, + })), + skipDuplicates: true, + }, + }; + } + return this.model.create(createArgs); } /** @@ -57,7 +77,7 @@ export default class DeedsRepository extends BaseRepository { deleteMany: { deed_uuid: uid }, createMany: { data: deed.deed_has_document_types.map((relation) => ({ - document_type_uuid: relation.document_type.uid, + document_type_uuid: relation.document_type.uid!, })), skipDuplicates: true, }, diff --git a/src/common/repositories/DocumentsRepository.ts b/src/common/repositories/DocumentsRepository.ts index 2b37321f..310ab78a 100644 --- a/src/common/repositories/DocumentsRepository.ts +++ b/src/common/repositories/DocumentsRepository.ts @@ -67,9 +67,9 @@ export default class DocumentsRepository extends BaseRepository { public async createMany(documents: Document[]): Promise { return this.model.createMany({ data: documents.map((document) => ({ - folder_uuid: document.folder.uid, - depositor_uuid: document.depositor.uid, - document_type_uuid: document.document_type.uid, + folder_uuid: document.folder.uid!, + depositor_uuid: document.depositor.uid!, + document_type_uuid: document.document_type.uid!, })), skipDuplicates: true, }); diff --git a/src/common/repositories/OfficeFoldersRepository.ts b/src/common/repositories/OfficeFoldersRepository.ts index 81274040..5f7032ab 100644 --- a/src/common/repositories/OfficeFoldersRepository.ts +++ b/src/common/repositories/OfficeFoldersRepository.ts @@ -25,7 +25,7 @@ export default class OfficeFoldersRepository extends BaseRepository { } /** - * @description : Create new office folder without customers nor stakeholders + * @description : Create new office folder with stakeholders */ public async create(officeFolder: OfficeFolder): Promise { const createArgs: Prisma.OfficeFoldersCreateArgs = { @@ -57,7 +57,7 @@ export default class OfficeFoldersRepository extends BaseRepository { createArgs.data.office_folder_has_stakeholder = { createMany: { data: officeFolder.office_folder_has_stakeholder.map((relation) => ({ - user_stakeholder_uuid: relation.user_stakeholder.uid, + user_stakeholder_uuid: relation.user_stakeholder.uid!, })), skipDuplicates: true }, @@ -92,7 +92,7 @@ export default class OfficeFoldersRepository extends BaseRepository { deleteMany: { office_folder_uuid: officeFolderUuid }, createMany: { data: officeFolder.office_folder_has_stakeholder.map((relation) => ({ - user_stakeholder_uuid: relation.user_stakeholder.uid, + user_stakeholder_uuid: relation.user_stakeholder.uid!, })), skipDuplicates: true }, @@ -103,7 +103,7 @@ export default class OfficeFoldersRepository extends BaseRepository { deleteMany: { office_folder_uuid: officeFolderUuid }, createMany: { data: officeFolder.office_folder_has_customers.map((relation) => ({ - customer_uuid: relation.customer.uid, + customer_uuid: relation.customer.uid!, })), skipDuplicates: true }, @@ -113,8 +113,8 @@ export default class OfficeFoldersRepository extends BaseRepository { updateArgs.data.documents = { createMany: { data: officeFolder.documents.map((relation) => ({ - document_type_uuid: relation.document_type.uid, - depositor_uuid: relation.depositor.uid + document_type_uuid: relation.document_type.uid!, + depositor_uuid: relation.depositor.uid! })), skipDuplicates: true }, diff --git a/src/common/repositories/UsersRepository.ts b/src/common/repositories/UsersRepository.ts index f41eeeb3..8d1dedb7 100644 --- a/src/common/repositories/UsersRepository.ts +++ b/src/common/repositories/UsersRepository.ts @@ -1,7 +1,7 @@ import Database from "@Common/databases/database"; import BaseRepository from "@Repositories/BaseRepository"; import { Service } from "typedi"; -import { ECivility, Users } from "@prisma/client"; +import { ECivility, Prisma, Users } from "@prisma/client"; import User from "le-coffre-resources/dist/SuperAdmin"; @Service() @@ -28,7 +28,7 @@ export default class UsersRepository extends BaseRepository { * @description : Create a user */ public async create(user: User): Promise { - return this.model.create({ + const createArgs: Prisma.UsersCreateArgs = { data: { idNot: user.idNot, office_membership: { @@ -58,24 +58,26 @@ export default class UsersRepository extends BaseRepository { phone_number: user.contact.phone_number, cell_phone_number: user.contact.cell_phone_number, civility: ECivility[user.contact.civility as keyof typeof ECivility], - address: { - create: { - address: user.contact.address.address, - zip_code: user.contact.address.zip_code, - city: user.contact.address.city, - }, - }, + address: {}, }, }, }, - }); + } + if (user.contact.address) { + createArgs.data.contact!.create!.address!.create = { + address: user.contact.address!.address, + zip_code: user.contact.address!.zip_code, + city: user.contact.address!.city, + }; + } + return this.model.create(createArgs); } /** * @description : Update data from a user */ public async update(uid: string, user: User): Promise { - return this.model.update({ + const updateArgs: Prisma.UsersUpdateArgs = { where: { uuid: uid, }, @@ -108,17 +110,19 @@ export default class UsersRepository extends BaseRepository { phone_number: user.contact.phone_number, cell_phone_number: user.contact.cell_phone_number, civility: ECivility[user.contact.civility as keyof typeof ECivility], - address: { - update: { - address: user.contact.address.address, - zip_code: user.contact.address.zip_code, - city: user.contact.address.city, - }, - }, + address: {} }, }, }, - }); + }; + if (user.contact.address) { + updateArgs.data.contact!.update!.address!.update = { + address: user.contact.address!.address, + zip_code: user.contact.address!.zip_code, + city: user.contact.address!.city, + }; + } + return this.model.update(updateArgs); } /** diff --git a/src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts b/src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts index 3102e8bc..bcc7147d 100644 --- a/src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts +++ b/src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts @@ -3,12 +3,14 @@ import OfficeFoldersRepository from "@Repositories/OfficeFoldersRepository"; import BaseService from "@Services/BaseService"; import { OfficeFolder } from "le-coffre-resources/dist/SuperAdmin"; import { Service } from "typedi"; +import DeedTypesService from "../DeedTypesService/DeedTypesService"; @Service() export default class OfficeFoldersService extends BaseService { constructor( - private officeFoldersRepository: OfficeFoldersRepository + private officeFoldersRepository: OfficeFoldersRepository, + private deedTypeService: DeedTypesService ) { super(); } @@ -26,6 +28,8 @@ export default class OfficeFoldersService extends BaseService { * @throws {Error} If folder cannot be created */ public async create(officeFolderEntity: OfficeFolder): Promise { + const deedType = await this.deedTypeService.getByUid(officeFolderEntity.deed.deed_type.uid!); + if(deedType.archived_at) throw new Error('deed type is archived'); return this.officeFoldersRepository.create(officeFolderEntity); } diff --git a/src/test/config/Init.ts b/src/test/config/Init.ts new file mode 100644 index 00000000..0d6d0380 --- /dev/null +++ b/src/test/config/Init.ts @@ -0,0 +1,121 @@ +import { Customers, DeedTypes, DocumentTypes, ECivility, ECustomerStatus, Offices, PrismaClient, Users } from "@prisma/client"; +import User, { Customer, DeedType, DocumentType, Office } from "le-coffre-resources/dist/SuperAdmin"; + +const prisma = new PrismaClient(); + +export const initOffice = (office: Office): Promise => { + return prisma.offices.create({ + data: { + idNot: office.idNot, + name: office.name, + crpcen: office.crpcen, + address: { + create: { + address: office.address.address, + zip_code: office.address.zip_code, + city: office.address.city, + }, + }, + }, + }); +}; + +export const initDocumentType = (documentType: DocumentType, office: Office): Promise => { + return prisma.documentTypes.create({ + data: { + name: documentType.name, + public_description: documentType.public_description, + private_description: documentType.private_description, + archived_at: null, + office_uuid: office.uid!, + }, + }); +}; + +export const initDeedType = (deedType: DeedType, office: Office, documentTypes?: string[]): Promise => { + return prisma.deedTypes.create({ + data: { + name: deedType.name, + description: deedType.description, + archived_at: null, + office_uuid: office.uid!, + deed_type_has_document_types: { + createMany: { + data: documentTypes!.map((documentType) => ({ + document_type_uuid: documentType, + })), + skipDuplicates: true, + }, + }, + }, + }); +}; + +export const initCustomers = (customer: Customer): Promise => { + return prisma.customers.create({ + data: { + status: ECustomerStatus.PENDING, + contact: { + create: { + first_name: customer.contact.first_name, + last_name: customer.contact.last_name, + email: customer.contact.email, + phone_number: customer.contact.phone_number, + cell_phone_number: customer.contact?.cell_phone_number, + civility: ECivility[customer.contact.civility as keyof typeof ECivility], + address: { + create: { + address: customer.contact.address!.address, + zip_code: customer.contact.address!.zip_code, + city: customer.contact.address!.city, + }, + }, + }, + }, + }, + }); +}; + +export const initUsers = (user: User): Promise => { + return prisma.users.create({ + data: { + idNot: user.idNot, + office_membership: { + connectOrCreate: { + where: { + idNot: user.office_membership.idNot, + }, + create: { + idNot: user.office_membership.idNot, + name: user.office_membership.name, + crpcen: user.office_membership.crpcen, + address: { + create: { + address: user.office_membership.address.address, + zip_code: user.office_membership.address.zip_code, + city: user.office_membership.address.city, + }, + }, + }, + }, + }, + contact: { + create: { + first_name: user.contact.first_name, + last_name: user.contact.last_name, + email: user.contact.email, + phone_number: user.contact.phone_number, + cell_phone_number: user.contact.cell_phone_number, + civility: ECivility[user.contact.civility as keyof typeof ECivility], + address: { + create: { + address: user.contact.address!.address, + zip_code: user.contact.address!.zip_code, + city: user.contact.address!.city, + }, + }, + }, + }, + }, + }); +}; diff --git a/src/test/services/super-admin/MockedData.ts b/src/test/config/MockedData.ts similarity index 75% rename from src/test/services/super-admin/MockedData.ts rename to src/test/config/MockedData.ts index f3b03e6f..051fe912 100644 --- a/src/test/services/super-admin/MockedData.ts +++ b/src/test/config/MockedData.ts @@ -2,7 +2,6 @@ import { EOfficeStatus } from "le-coffre-resources/dist/Customer/Office"; import User, { Address, Contact, Office, DeedType, DocumentType, Customer, OfficeFolder, Deed } from "le-coffre-resources/dist/SuperAdmin"; export const userAddress: Address = { - uid: "", address: "1 avenue des champs élysées", zip_code: 75008, city: "paris", @@ -11,7 +10,6 @@ export const userAddress: Address = { }; export const userAddress_: Address = { - uid: "", address: "1 rue Victor Hugo", zip_code: 75001, city: "paris", @@ -20,7 +18,6 @@ export const userAddress_: Address = { }; export const userContact: Contact = { - uid: "", first_name: "Philippe", last_name: "le Bel", address: userAddress, @@ -33,7 +30,6 @@ export const userContact: Contact = { }; export const userContact_: Contact = { - uid: "", first_name: "Saint", last_name: "Louise", address: userAddress_, @@ -45,8 +41,31 @@ export const userContact_: Contact = { updated_at: null, }; +export const customerContact: Contact = { + first_name: "John", + last_name: "Doe", + address: userAddress, + email: "john.doe@customer.fr", + phone_number: "+3313847505", + cell_phone_number: "+3313847505", + civility: "MALE", + created_at: null, + updated_at: null, +}; + +export const customerContact_: Contact = { + first_name: "Jocelyne", + last_name: "Doe", + address: userAddress, + email: "jocelyne.doe@customer.fr", + phone_number: "+331384894505", + cell_phone_number: "+331384894505", + civility: "FEMALE", + created_at: null, + updated_at: null, +}; + export const officeAddress: Address = { - uid: "", address: "1 rue Rivoli", zip_code: 75001, city: "paris", @@ -55,7 +74,6 @@ export const officeAddress: Address = { }; export const officeAddress_: Address = { - uid: "", address: "1 rue de la paix", zip_code: 75008, city: "paris", @@ -64,7 +82,6 @@ export const officeAddress_: Address = { }; export const office: Office = { - uid: "", idNot: "123456789", name: "first office", crpcen: "0123456789CRPCEN", @@ -75,7 +92,6 @@ export const office: Office = { }; export const office_: Office = { - uid: "", idNot: "789101112", name: "second office", crpcen: "987654321CRPCEN", @@ -86,7 +102,6 @@ export const office_: Office = { }; export const user: User = { - uid: "", idNot: "123456_123456789", contact: userContact, office_membership: office, @@ -95,7 +110,6 @@ export const user: User = { }; export const user_: User = { - uid: "", idNot: "654321_789101112", contact: userContact_, office_membership: office_, @@ -103,42 +117,7 @@ export const user_: User = { updated_at: null, }; -export const deedType: DeedType = { - uid: "", - name: "Wedding", - description: "we assume wedding involve two people", - archived_at: null, - office: office, - created_at: null, - updated_at: null, -}; - -export const deedType_: DeedType = { - uid: "", - name: "Inheritance", - description: "we assume inheritance involve two people", - archived_at: null, - office: office, - created_at: null, - updated_at: null, -}; - -export const deed: Deed = { - uid: "", - deed_type: deedType, - created_at: null, - updated_at: null, -}; - -export const deed_: Deed = { - uid: "", - deed_type: deedType_, - created_at: null, - updated_at: null, -}; - export const documentType: DocumentType = { - uid: "", name: "Identity card", public_description: "your ID card delivered by your country of residence", private_description: "verify if this ID card is legit", @@ -149,7 +128,6 @@ export const documentType: DocumentType = { }; export const documentType_: DocumentType = { - uid: "", name: "Electricity bill", public_description: "an electricity bill payed within the last 3 months", private_description: "verify if this electricity company is legit", @@ -159,24 +137,59 @@ export const documentType_: DocumentType = { updated_at: null, }; +export const deedType: DeedType = { + name: "Wedding", + description: "we assume wedding involve two people", + archived_at: null, + office: office, + created_at: null, + updated_at: null, + deed_type_has_document_types: [ + { + document_type: documentType, + deed_type: new DeedType(), + created_at: null, + updated_at: null, + }, + ], +}; + +export const deedType_: DeedType = { + name: "Inheritance", + description: "we assume inheritance involve two people", + archived_at: null, + office: office_, + created_at: null, + updated_at: null, +}; + +export const deed: Deed = { + deed_type: deedType, + created_at: null, + updated_at: null, +}; + +export const deed_: Deed = { + deed_type: deedType_, + created_at: null, + updated_at: null, +}; + export const customer: Customer = { - uid: "", - contact: userContact, + contact: customerContact, status: "PENDING", created_at: null, updated_at: null, }; export const customer_: Customer = { - uid: "", - contact: userContact_, + contact: customerContact_, status: "ERRONED", created_at: null, updated_at: null, }; export const officeFolder: OfficeFolder = { - uid: "", name: "Dossier 1234567", folder_number: "1234567", description: "Dossier de mr Dupont", @@ -184,12 +197,39 @@ export const officeFolder: OfficeFolder = { status: "ARCHIVED", deed: deed, office: office, + office_folder_has_customers: [ + { + customer: customer, + office_folder: new OfficeFolder(), + created_at: null, + updated_at: null, + }, + { + customer: customer_, + office_folder: new OfficeFolder(), + created_at: null, + updated_at: null, + }, + ], + office_folder_has_stakeholder: [ + { + user_stakeholder: user, + office_folder: new OfficeFolder(), + created_at: null, + updated_at: null, + }, + { + user_stakeholder: user_, + office_folder: new OfficeFolder(), + created_at: null, + updated_at: null, + }, + ], created_at: null, updated_at: null, }; export const officeFolder_: OfficeFolder = { - uid: "", name: "Dossier 89101112", folder_number: "89101112", description: "Dossier de mme Dutunnel", @@ -199,4 +239,4 @@ export const officeFolder_: OfficeFolder = { office: office_, created_at: null, updated_at: null, -}; \ No newline at end of file +}; diff --git a/src/test/services/super-admin/CustomersService.test.ts b/src/test/services/super-admin/CustomersService.test.ts index 3eb57464..6d7282bc 100644 --- a/src/test/services/super-admin/CustomersService.test.ts +++ b/src/test/services/super-admin/CustomersService.test.ts @@ -3,7 +3,7 @@ import "reflect-metadata"; import { Customer } from "le-coffre-resources/dist/SuperAdmin"; import CustomersService from "@Services/super-admin/CustomersService/CustomersService"; import { PrismaClient } from "@prisma/client"; -import { customer, customer_, userContact, userContact_ } from "./MockedData"; +import { customer, customerContact, customerContact_, customer_ } from "@Test/config/MockedData"; import Container from "typedi"; import CustomersRepository from "@Repositories/CustomersRepository"; @@ -38,9 +38,9 @@ describe("test create function", () => { // verify if customer address is created in db const addressForContactCreated = await prisma.addresses.findUnique({ where: { uuid: contactCreated?.address_uuid } }); - expect(addressForContactCreated?.address).toEqual(customer.contact.address.address); - expect(addressForContactCreated?.zip_code).toEqual(customer.contact.address.zip_code); - expect(addressForContactCreated?.city).toEqual(customer.contact.address.city); + expect(addressForContactCreated?.address).toEqual(customer.contact.address?.address); + expect(addressForContactCreated?.zip_code).toEqual(customer.contact.address?.zip_code); + expect(addressForContactCreated?.city).toEqual(customer.contact.address?.city); }); it("should not create an customer already created", async () => { @@ -53,7 +53,7 @@ describe("test create function", () => { it("should not create an new customer with an email already created", async () => { let newCustomer: Customer = JSON.parse(JSON.stringify(customer_)); - newCustomer.contact.email = userContact.email; + newCustomer.contact.email = customerContact.email; // try to create a new customer with already used email async function createCustomerWithDuplicateEmail() { @@ -64,7 +64,7 @@ describe("test create function", () => { it("should not create an customer with an phone number already created", async () => { let newCustomer: Customer = JSON.parse(JSON.stringify(customer_)); - newCustomer.contact.cell_phone_number = userContact.cell_phone_number; + newCustomer.contact.cell_phone_number = customerContact.cell_phone_number; // try to create a new customer with already used cellphone number async function duplicateCustomer() { @@ -75,8 +75,8 @@ describe("test create function", () => { it("should create an new customer if unique attributes differ from existing customers", async () => { let newCustomer: Customer = JSON.parse(JSON.stringify(customer)); - newCustomer.contact.email = userContact_.email; - newCustomer.contact.cell_phone_number = userContact_.cell_phone_number; + newCustomer.contact.email = customerContact_.email; + newCustomer.contact.cell_phone_number = customerContact_.cell_phone_number; const customerCreated = await CustomersServiceTest.create(newCustomer); @@ -93,9 +93,9 @@ describe("test create function", () => { // verify if customer_ address is created in db const addressForContactCreated = await prisma.addresses.findUnique({ where: { uuid: contactCreated?.address_uuid } }); - expect(addressForContactCreated?.address).toEqual(customer.contact.address.address); - expect(addressForContactCreated?.zip_code).toEqual(customer.contact.address.zip_code); - expect(addressForContactCreated?.city).toEqual(customer.contact.address.city); + expect(addressForContactCreated?.address).toEqual(customer.contact.address?.address); + expect(addressForContactCreated?.zip_code).toEqual(customer.contact.address?.zip_code); + expect(addressForContactCreated?.city).toEqual(customer.contact.address?.city); }); }); @@ -119,15 +119,15 @@ describe("test update function", () => { // verify if customer_ address is created in db const addressForExistingContact = await prisma.addresses.findUnique({ where: { uuid: existingContact?.address_uuid } }); - expect(addressForExistingContact?.address).toEqual(customer_.contact.address.address); - expect(addressForExistingContact?.zip_code).toEqual(customer_.contact.address.zip_code); - expect(addressForExistingContact?.city).toEqual(customer_.contact.address.city); + expect(addressForExistingContact?.address).toEqual(customer_.contact.address?.address); + expect(addressForExistingContact?.zip_code).toEqual(customer_.contact.address?.zip_code); + expect(addressForExistingContact?.city).toEqual(customer_.contact.address?.city); }); it("should not update an customer with an email already used", async () => { const customerUid = (await prisma.customers.findFirstOrThrow({ where: { contact: { email: customer_.contact.email } } })).uuid; let updatedCustomer: Customer = JSON.parse(JSON.stringify(customer_)); - updatedCustomer.contact.email = userContact.email; + updatedCustomer.contact.email = customerContact.email; // try to create a new customer with already used email async function updateCustomerWithDuplicateEmail() { @@ -139,7 +139,7 @@ describe("test update function", () => { it("should not update an customer with an phone number already used", async () => { const customerUid = (await prisma.customers.findFirstOrThrow({ where: { contact: { email: customer_.contact.email } } })).uuid; let updatedCustomer: Customer = JSON.parse(JSON.stringify(customer_)); - updatedCustomer.contact.cell_phone_number = userContact.cell_phone_number; + updatedCustomer.contact.cell_phone_number = customerContact.cell_phone_number; // try to create a new customer with already used email async function updateCustomerWithDuplicateEmail() { diff --git a/src/test/services/super-admin/DeedService.test.ts b/src/test/services/super-admin/DeedService.test.ts index 35354072..f208958f 100644 --- a/src/test/services/super-admin/DeedService.test.ts +++ b/src/test/services/super-admin/DeedService.test.ts @@ -2,86 +2,21 @@ import "module-alias/register"; import "reflect-metadata"; import { Deed } from "le-coffre-resources/dist/SuperAdmin"; import DeedService from "@Services/super-admin/DeedsService/DeedsService"; -import { PrismaClient, Offices, DocumentTypes, DeedTypes, DeedTypeHasDocumentTypes } from "prisma/prisma-client"; -import { deed, deedType, documentType, office } from "./MockedData"; +import { PrismaClient } from "prisma/prisma-client"; +import { deed, deedType, documentType, documentType_, office } from "@Test/config/MockedData"; import DeedsRepository from "@Repositories/DeedsRepository"; import Container from "typedi"; +import { initDeedType, initDocumentType, initOffice } from "@Test/config/Init"; const prisma = new PrismaClient(); const DeedServiceTest = new DeedService(Container.get(DeedsRepository)); -let office1: Offices; - -let documentType1: DocumentTypes; -//let documentType2: DocumentTypes; - -let deedType1: DeedTypes; - -let deedType1HasDocumentType1: DeedTypeHasDocumentTypes; - beforeAll(async () => { - office1 = await prisma.offices.create({ - data: { - idNot: office.idNot, - name: office.name, - crpcen: office.crpcen, - address: { - create: { - address: office.address.address, - zip_code: office.address.zip_code, - city: office.address.city, - }, - }, - }, - }); - - documentType1 = await prisma.documentTypes.create({ - data: { - name: documentType.name, - public_description: documentType.public_description, - private_description: documentType.private_description, - archived_at: null, - office_uuid: office1.uuid, - }, - }); - - // documentType2 = await prisma.documentTypes.create({ - // data: { - // name: documentType_.name, - // public_description: documentType_.public_description, - // private_description: documentType_.private_description, - // archived_at: null, - // office_uuid: office1.uuid, - // }, - // }); - - deedType1 = await prisma.deedTypes.create({ - data: { - name: deedType.name, - description: deedType.description, - archived_at: null, - office_uuid: office1.uuid, - }, - }); - - deedType1HasDocumentType1 = await prisma.deedTypeHasDocumentTypes.create({ - data: { - deed_type_uuid: deedType1.uuid, - document_type_uuid: documentType1.uuid, - }, - }); - - await prisma.deedTypes.update({ - where: { uuid: deedType1.uuid }, - data: { - deed_type_has_document_types: { - connect: { - uuid: deedType1HasDocumentType1.uuid, - }, - }, - }, - }); + office.uid = (await initOffice(office)).uuid; + documentType.uid = (await initDocumentType(documentType, office)).uuid; + documentType_.uid = (await initDocumentType(documentType_, office)).uuid; + deedType.uid = (await initDeedType(deedType, office, [documentType.uid])).uuid; }); afterAll(async () => { @@ -93,41 +28,43 @@ afterAll(async () => { describe("test create function", () => { it("should not create a new deed if deed type is unknown", async () => { + let deedWithoutDeedTypeUid: Deed = JSON.parse(JSON.stringify(deed)); + deedWithoutDeedTypeUid.deed_type.uid = "random uuid"; // try to create a new deed with unknown deed type async function createDeedWithUnknownDeedType() { - await DeedServiceTest.create(deed); + await DeedServiceTest.create(deedWithoutDeedTypeUid); } await expect(createDeedWithUnknownDeedType).rejects.toThrow(); }); it("should create a new deed based on existing deed type", async () => { - let deedWithUid: Deed = JSON.parse(JSON.stringify(deed)); - deedWithUid.uid = deedType1.uuid; - const deedCreated = await DeedServiceTest.create(deedWithUid); + let deedWithDeedTypeUid: Deed = JSON.parse(JSON.stringify(deed)); + deedWithDeedTypeUid.deed_type.uid = deedType.uid; + const deedCreated = await DeedServiceTest.create(deedWithDeedTypeUid); - expect(deedCreated.deed_type_uuid).toEqual(deedType1.uuid); + expect(deedCreated.deed_type_uuid).toEqual(deedType.uid); }); it("should have by default the same document types as its deed type ", async () => { const deedWithDocumentTypes = await prisma.deeds.findFirstOrThrow({ include: { deed_has_document_types: true } }); expect(deedWithDocumentTypes.deed_has_document_types.length).toEqual(1); - expect(deedWithDocumentTypes.deed_has_document_types[0]?.document_type_uuid).toEqual(documentType1.uuid); + expect(deedWithDocumentTypes.deed_has_document_types[0]?.document_type_uuid).toEqual(documentType.uid); }); it("should create a the same deed based on existing deed type", async () => { - let deedWithUid: Deed = JSON.parse(JSON.stringify(deed)); - deedWithUid.uid = deedType1.uuid; - const deedCreated = await DeedServiceTest.create(deedWithUid); + let deedWithDeedTypeUid: Deed = JSON.parse(JSON.stringify(deed)); + deedWithDeedTypeUid.deed_type.uid = deedType.uid; + const deedCreated = await DeedServiceTest.create(deedWithDeedTypeUid); - expect(deedCreated.deed_type_uuid).toEqual(deedType1.uuid); + expect(deedCreated.deed_type_uuid).toEqual(deedType.uid); }); it("should not create a new deed based on archivated deed type", async () => { let deedArchivated: Deed = JSON.parse(JSON.stringify(deed)); - deedArchivated.uid = deedType1.uuid; + deedArchivated.deed_type.uid = deedType.uid; await prisma.deedTypes.update({ - where: { uuid: deedType1.uuid }, + where: { uuid: deedType.uid }, data: { archived_at: new Date(Date.now()), }, @@ -141,112 +78,91 @@ describe("test create function", () => { }); }); -// describe("test addDocumentTypes function", () => { -// it("should add document types to a deed", async () => { -// const deedUid = (await prisma.deeds.findFirstOrThrow({ where: { deed_type_uuid: deedType1.uuid } })).uuid; -// const documentsToAdd = [documentType1.uuid, documentType2.uuid]; -// await DeedServiceTest.addDocumentTypes(deedUid, documentsToAdd); +describe("test update function", () => { + it("should add document types to a deed", async () => { + const deedUid = (await prisma.deeds.findFirstOrThrow({ where: { deed_type_uuid: deedType.uid } })).uuid; + let deedToUpdate: Deed = JSON.parse(JSON.stringify(deed)); -// const deed = await prisma.deeds.findFirstOrThrow({ -// where: { -// uuid: deedUid, -// }, -// include: { -// deed_has_document_types: true, -// }, -// }); -// expect(deed.deed_has_document_types.length).toEqual(2); -// }); + deedToUpdate.deed_has_document_types = [ + { + document_type: documentType, + deed: new Deed(), + created_at: null, + updated_at: null, + }, + { + document_type: documentType_, + deed: new Deed(), + created_at: null, + updated_at: null, + }, + ]; -// it("should not add document types to a deed type that already has those document types ", async () => { -// const deedUid = (await prisma.deeds.findFirstOrThrow({ where: { deed_type_uuid: deedType1.uuid } })).uuid; -// let deedHasDocumentTypes = await prisma.deedHasDocumentTypes.findMany({ where: { deed_uuid: deedUid } }); -// expect(deedHasDocumentTypes.length).toEqual(2); + await DeedServiceTest.update(deedUid, deedToUpdate); -// const documentsToAdd = [documentType1.uuid, documentType2.uuid]; -// //we expect deedTypeHasDocumentTypes service to skip duplicates without throwing error -// await DeedServiceTest.addDocumentTypes(deedUid, documentsToAdd); + const deedUpdated = await prisma.deeds.findFirstOrThrow({ + where: { + uuid: deedUid, + }, + include: { + deed_has_document_types: true, + }, + }); + expect(deedUpdated.deed_has_document_types.length).toEqual(2); + }); -// deedHasDocumentTypes = await prisma.deedHasDocumentTypes.findMany({ where: { deed_uuid: deedUid } }); -// expect(deedHasDocumentTypes.length).toEqual(2); -// }); -// }); -// describe("test removeDocumentTypes function", () => { -// it("should remove document types from a deed type", async () => { -// const deedUid = (await prisma.deeds.findFirstOrThrow({ where: { deed_type_uuid: deedType1.uuid } })).uuid; -// const documentsToRemove = [documentType1.uuid]; -// await DeedServiceTest.removeDocumentTypes(deedUid, documentsToRemove); + it("should not add document types to a deed type that already has those document types ", async () => { + const deedUid = (await prisma.deeds.findFirstOrThrow({ where: { deed_type_uuid: deedType.uid } })).uuid; + let deedToUpdate: Deed = JSON.parse(JSON.stringify(deed)); -// const deedWithDocumentTypeRelations = await prisma.deeds.findFirstOrThrow({ -// where: { -// uuid: deedUid, -// }, -// include: { -// deed_has_document_types: true, -// }, -// }); -// expect(deedWithDocumentTypeRelations.deed_has_document_types.length).toEqual(1); -// expect(deedWithDocumentTypeRelations.deed_has_document_types[0]?.document_type_uuid).toEqual(documentType2.uuid); -// }); -// it("should not remove document types from a deed type is they were not linked", async () => { -// let deedWithOneDocumentType = await prisma.deeds.findFirstOrThrow({ -// where: { deed_type_uuid: deedType1.uuid }, -// include: { -// deed_has_document_types: true, -// }, -// }); -// expect(deedWithOneDocumentType.deed_has_document_types.length).toEqual(1); + deedToUpdate.deed_has_document_types = [ + { + document_type: documentType, + deed: new Deed(), + created_at: null, + updated_at: null, + }, + { + document_type: documentType_, + deed: new Deed(), + created_at: null, + updated_at: null, + }, + ]; -// const documentsToRemove = [documentType1.uuid]; + await DeedServiceTest.update(deedUid, deedToUpdate); -// async function removeDocumentTypeNotLinkedToDeedType() { -// await DeedServiceTest.removeDocumentTypes(deedWithOneDocumentType.uuid, documentsToRemove); -// } -// await expect(removeDocumentTypeNotLinkedToDeedType).rejects.toThrow(); -// }); -// }); -// describe("test removeDocumentType function", () => { -// it("should remove only one document type from a deed type", async () => { -// let deedWithOneDocumentType = await prisma.deeds.findFirstOrThrow({ -// where: { deed_type_uuid: deedType1.uuid }, -// include: { -// deed_has_document_types: true, -// }, -// }); -// expect(deedWithOneDocumentType.deed_has_document_types.length).toEqual(1); + const deedUpdated = await prisma.deeds.findFirstOrThrow({ + where: { + uuid: deedUid, + }, + include: { + deed_has_document_types: true, + }, + }); + expect(deedUpdated.deed_has_document_types.length).toEqual(2); + }); -// const documentToRemove = documentType2.uuid; -// await DeedServiceTest.removeDocumentType(deedWithOneDocumentType.uuid, documentToRemove); + it("should delete document types from a deed", async () => { + const deedUid = (await prisma.deeds.findFirstOrThrow({ where: { deed_type_uuid: deedType.uid } })).uuid; + let deedToUpdate: Deed = JSON.parse(JSON.stringify(deed)); -// deedWithOneDocumentType = await prisma.deeds.findFirstOrThrow({ -// where: { -// uuid: deedWithOneDocumentType.uuid, -// }, -// include: { -// deed_has_document_types: true, -// }, -// }); -// expect(deedWithOneDocumentType.deed_has_document_types.length).toEqual(0); -// }); -// }); -// describe("test addDocumentType function", () => { -// it("should add only one document type to a deed type", async () => { -// const deedUid = (await prisma.deeds.findFirstOrThrow({ where: { deed_type_uuid: deedType1.uuid } })).uuid; -// const documentToAdd = documentType1.uuid; -// await DeedServiceTest.addDocumentType(deedUid, documentToAdd); + // set relation between deed and document types empty + deedToUpdate.deed_has_document_types = []; -// const deed = await prisma.deeds.findFirstOrThrow({ -// where: { -// uuid: deedUid, -// }, -// include: { -// deed_has_document_types: true, -// }, -// }); -// expect(deed.deed_has_document_types.length).toEqual(1); -// expect(deed.deed_has_document_types[0]?.document_type_uuid).toEqual(documentType1.uuid); -// }); -// }); + await DeedServiceTest.update(deedUid, deedToUpdate); + + const deedUpdated = await prisma.deeds.findFirstOrThrow({ + where: { + uuid: deedUid, + }, + include: { + deed_has_document_types: true, + }, + }); + expect(deedUpdated.deed_has_document_types.length).toEqual(0); + }); +}); describe("test get function", () => { it("should return an array of Deeds", async () => { @@ -257,7 +173,7 @@ describe("test get function", () => { expect(deeds.length).toEqual(2); // verify result content - expect(deeds[0]?.deed_type_uuid).toEqual(deedType1.uuid); - expect(deeds[1]?.deed_type_uuid).toEqual(deedType1.uuid); + expect(deeds[0]?.deed_type_uuid).toEqual(deedType.uid); + expect(deeds[1]?.deed_type_uuid).toEqual(deedType.uid); }); }); diff --git a/src/test/services/super-admin/DeedTypesService.test.ts b/src/test/services/super-admin/DeedTypesService.test.ts index 796225a3..28b99eb6 100644 --- a/src/test/services/super-admin/DeedTypesService.test.ts +++ b/src/test/services/super-admin/DeedTypesService.test.ts @@ -2,71 +2,21 @@ import "module-alias/register"; import "reflect-metadata"; import { DeedType } from "le-coffre-resources/dist/SuperAdmin"; import DeedTypeService from "@Services/super-admin/DeedTypesService/DeedTypesService"; -import { PrismaClient, Offices } from "prisma/prisma-client"; -import { deedType, deedType_, office, office_ } from "./MockedData"; +import { PrismaClient } from "prisma/prisma-client"; +import { deedType, deedType_, documentType, documentType_, office, office_ } from "@Test/config/MockedData"; import DeedTypesRepository from "@Repositories/DeedTypesRepository"; import Container from "typedi"; +import { initDocumentType, initOffice } from "@Test/config/Init"; const prisma = new PrismaClient(); const DeedTypeServiceTest = new DeedTypeService(Container.get(DeedTypesRepository)); -let office1: Offices; -let office2: Offices; - -// let documentType1: DocumentTypes; -// let documentType2: DocumentTypes; - beforeAll(async () => { - office1 = await prisma.offices.create({ - data: { - idNot: office.idNot, - name: office.name, - crpcen: office.crpcen, - address: { - create: { - address: office.address.address, - zip_code: office.address.zip_code, - city: office.address.city, - }, - }, - }, - }); - - office2 = await prisma.offices.create({ - data: { - idNot: office_.idNot, - name: office_.name, - crpcen: office_.crpcen, - address: { - create: { - address: office_.address.address, - zip_code: office_.address.zip_code, - city: office_.address.city, - }, - }, - }, - }); - - // documentType1 = await prisma.documentTypes.create({ - // data: { - // name: documentType.name, - // public_description: documentType.public_description, - // private_description: documentType.private_description, - // archived_at: null, - // office_uuid: office1.uuid, - // }, - // }); - - // documentType2 = await prisma.documentTypes.create({ - // data: { - // name: documentType_.name, - // public_description: documentType_.public_description, - // private_description: documentType_.private_description, - // archived_at: null, - // office_uuid: office1.uuid, - // }, - // }); + office.uid = (await initOffice(office)).uuid; + office_.uid = (await initOffice(office_)).uuid; + documentType.uid = (await initDocumentType(documentType, office)).uuid; + documentType_.uid = (await initDocumentType(documentType_, office)).uuid; }); afterAll(async () => { @@ -78,27 +28,27 @@ afterAll(async () => { describe("test create function", () => { it("should not create a new deed type if office is unknown", async () => { + let deedTypeWithoutOfficeUid: DeedType = JSON.parse(JSON.stringify(deedType)); + deedTypeWithoutOfficeUid.office.uid = "random uuid"; // try to create a new deed type with unknown office async function createDeedTypeWithUnknownOffice() { - await DeedTypeServiceTest.create(deedType); + await DeedTypeServiceTest.create(deedTypeWithoutOfficeUid); } await expect(createDeedTypeWithUnknownOffice).rejects.toThrow(); }); it("should create a new deed type", async () => { - let deedTypeWithOfficeUid: DeedType = JSON.parse(JSON.stringify(deedType)); - deedTypeWithOfficeUid.office.uid = office1.uuid; - const deedTypeCreated = await DeedTypeServiceTest.create(deedTypeWithOfficeUid); + const deedTypeCreated = await DeedTypeServiceTest.create(deedType); expect(deedTypeCreated.name).toEqual(deedType.name); expect(deedTypeCreated.description).toEqual(deedType.description); expect(deedTypeCreated.archived_at).toBeNull(); - expect(deedTypeCreated.office_uuid).toEqual(office1.uuid); + expect(deedTypeCreated.office_uuid).toEqual(office.uid); }); it("should not create a new deed type with a name already used for a given office", async () => { let deedTypeWithSameNameAndOffice: DeedType = JSON.parse(JSON.stringify(deedType_)); - deedTypeWithSameNameAndOffice.office.uid = office1.uuid; + deedTypeWithSameNameAndOffice.office = office; deedTypeWithSameNameAndOffice.name = deedType.name; async function createDeedTypeWithSameNameAndOffice() { @@ -109,19 +59,18 @@ describe("test create function", () => { it("should create the same deed type for a different office", async () => { let deedTypeDuplicatedForNewOffice: DeedType = JSON.parse(JSON.stringify(deedType)); - deedTypeDuplicatedForNewOffice.office.uid = office2.uuid; + deedTypeDuplicatedForNewOffice.office = office_; const deedTypeCreated = await DeedTypeServiceTest.create(deedTypeDuplicatedForNewOffice); expect(deedTypeCreated.name).toEqual(deedType.name); expect(deedTypeCreated.description).toEqual(deedType.description); expect(deedTypeCreated.archived_at).toBeNull(); - expect(deedTypeCreated.office_uuid).toEqual(office2.uuid); + expect(deedTypeCreated.office_uuid).toEqual(office_.uid); }); it("should create the a new deed type version with a different name for a given office", async () => { let deedTypeWithSameDescription: DeedType = JSON.parse(JSON.stringify(deedType)); - deedTypeWithSameDescription.office.uid = office1.uuid; deedTypeWithSameDescription.name = deedType_.name; const deedTypeCreated = await DeedTypeServiceTest.create(deedTypeWithSameDescription); @@ -129,21 +78,21 @@ describe("test create function", () => { expect(deedTypeCreated.name).toEqual(deedType_.name); expect(deedTypeCreated.description).toEqual(deedType.description); expect(deedTypeCreated.archived_at).toBeNull(); - expect(deedTypeCreated.office_uuid).toEqual(office1.uuid); + expect(deedTypeCreated.office_uuid).toEqual(office.uid); }); }); describe("test update function", () => { it("should update a deed type data", async () => { - const deedTypeCreated = await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType_.name, office_uuid: office1.uuid } }); + const deedTypeCreated = await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType_.name, office_uuid: office.uid } }); expect(deedTypeCreated.name).toEqual(deedType_.name); expect(deedTypeCreated.description).toEqual(deedType.description); expect(deedTypeCreated.archived_at).toBeNull(); - expect(deedTypeCreated.office_uuid).toEqual(office1.uuid); + expect(deedTypeCreated.office_uuid).toEqual(deedType.office.uid); let deedTypeWithNewDescription: DeedType = JSON.parse(JSON.stringify(deedType_)); - deedTypeWithNewDescription.office.uid = office1.uuid; + deedTypeWithNewDescription.office = office; // update the last deed type created with his the right description const deedTypeUpdated = await DeedTypeServiceTest.update(deedTypeCreated.uuid, deedTypeWithNewDescription); @@ -151,13 +100,13 @@ describe("test update function", () => { expect(deedTypeUpdated.name).toEqual(deedType_.name); expect(deedTypeUpdated.description).toEqual(deedType_.description); expect(deedTypeUpdated.archived_at).toBeNull(); - expect(deedTypeUpdated.office_uuid).toEqual(office1.uuid); + expect(deedTypeUpdated.office_uuid).toEqual(deedType.office.uid); }); it("should not update a deed type name with an already used name for given office", async () => { - const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType_.name, office_uuid: office1.uuid } })).uuid; + const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType_.name, office_uuid: office.uid } })).uuid; let deedTypeWithSameNameAndOffice: DeedType = JSON.parse(JSON.stringify(deedType_)); - deedTypeWithSameNameAndOffice.office.uid = office1.uuid; + deedTypeWithSameNameAndOffice.office.uid = office.uid; deedTypeWithSameNameAndOffice.name = deedType.name; // update the last deed type created with his the right description @@ -168,9 +117,9 @@ describe("test update function", () => { }); it("should not update a deed type office membership if the office already have this document type", async () => { - const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType_.name, office_uuid: office1.uuid } })).uuid; + const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType_.name, office_uuid: office.uid } })).uuid; let deedTypeWithSameNameAndOffice: DeedType = JSON.parse(JSON.stringify(deedType_)); - deedTypeWithSameNameAndOffice.office.uid = office1.uuid; + deedTypeWithSameNameAndOffice.office.uid = office.uid; deedTypeWithSameNameAndOffice.name = deedType.name; // try to duplicate deed type in a given office @@ -181,37 +130,33 @@ describe("test update function", () => { }); it("should update a deed type office membership", async () => { - const deedTypeCreated = await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType_.name, office_uuid: office1.uuid } }); + const deedTypeCreated = await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType_.name, office_uuid: office.uid } }); expect(deedTypeCreated.name).toEqual(deedType_.name); expect(deedTypeCreated.description).toEqual(deedType_.description); expect(deedTypeCreated.archived_at).toBeNull(); - expect(deedTypeCreated.office_uuid).toEqual(office1.uuid); - - let deedTypeTransferedToNewOffice: DeedType = JSON.parse(JSON.stringify(deedType_)); - deedTypeTransferedToNewOffice.office.uid = office2.uuid; + expect(deedTypeCreated.office_uuid).toEqual(office.uid); // update the last deed type updated with a new office membership - const deedTypeUpdated = await DeedTypeServiceTest.update(deedTypeCreated.uuid, deedTypeTransferedToNewOffice); + const deedTypeUpdated = await DeedTypeServiceTest.update(deedTypeCreated.uuid, deedType_); expect(deedTypeUpdated.name).toEqual(deedType_.name); expect(deedTypeUpdated.description).toEqual(deedType_.description); expect(deedTypeUpdated.archived_at).toBeNull(); - expect(deedTypeUpdated.office_uuid).toEqual(office2.uuid); + expect(deedTypeUpdated.office_uuid).toEqual(deedType_.office.uid); }); it("should archivate a deed type", async () => { - const deedTypeCreated = await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType_.name, office_uuid: office2.uuid } }); + const deedTypeCreated = await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType_.name, office_uuid: office_.uid } }); expect(deedTypeCreated.name).toEqual(deedType_.name); expect(deedTypeCreated.description).toEqual(deedType_.description); expect(deedTypeCreated.archived_at).toBeNull(); - expect(deedTypeCreated.office_uuid).toEqual(office2.uuid); + expect(deedTypeCreated.office_uuid).toEqual(deedType_.office.uid); let deedTypeArchivated: DeedType = JSON.parse(JSON.stringify(deedType_)); - deedTypeArchivated.office.uid = office2.uuid; const currentDate = new Date(Date.now()); - deedTypeArchivated.archived_at = currentDate; + deedTypeArchivated.archived_at = new Date(Date.now()); // archivate a deed type by giving a non null date for archivated_at attribute const deedTypeUpdated = await DeedTypeServiceTest.update(deedTypeCreated.uuid, deedTypeArchivated); @@ -219,138 +164,111 @@ describe("test update function", () => { expect(deedTypeUpdated.name).toEqual(deedType_.name); expect(deedTypeUpdated.description).toEqual(deedType_.description); expect(deedTypeUpdated.archived_at).toEqual(currentDate); - expect(deedTypeUpdated.office_uuid).toEqual(office2.uuid); + expect(deedTypeUpdated.office_uuid).toEqual(office_.uid); }); it("should unarchivate a deed type", async () => { - const deedTypeCreated = await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType_.name, office_uuid: office2.uuid } }); + const deedTypeCreated = await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType_.name, office_uuid: office_.uid } }); expect(deedTypeCreated.name).toEqual(deedType_.name); expect(deedTypeCreated.description).toEqual(deedType_.description); expect(deedTypeCreated.archived_at).not.toBeNull(); - expect(deedTypeCreated.office_uuid).toEqual(office2.uuid); - - let deedTypeUnarchivated: DeedType = JSON.parse(JSON.stringify(deedType_)); - deedTypeUnarchivated.office.uid = office2.uuid; + expect(deedTypeCreated.office_uuid).toEqual(deedType_.office.uid); // unarchivate a deed type by giving a null date for archivated_at attribute - const deedTypeUpdated = await DeedTypeServiceTest.update(deedTypeCreated.uuid, deedTypeUnarchivated); + const deedTypeUpdated = await DeedTypeServiceTest.update(deedTypeCreated.uuid, deedType_); expect(deedTypeUpdated.name).toEqual(deedType_.name); expect(deedTypeUpdated.description).toEqual(deedType_.description); expect(deedTypeUpdated.archived_at).toBeNull(); - expect(deedTypeUpdated.office_uuid).toEqual(office2.uuid); + expect(deedTypeUpdated.office_uuid).toEqual(office_.uid); + }); + + it("should add document types to a deed type", async () => { + const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType.name, office_uuid: office.uid } })).uuid; + let deedTypeToUpdate: DeedType = JSON.parse(JSON.stringify(deedType)); + + deedTypeToUpdate.deed_type_has_document_types = [ + { + document_type: documentType, + deed_type: new DeedType(), + created_at: null, + updated_at: null, + }, + { + document_type: documentType_, + deed_type: new DeedType(), + created_at: null, + updated_at: null, + }, + ]; + + await DeedTypeServiceTest.update(deedTypeUid, deedTypeToUpdate); + + const deedTypeUpdated = await prisma.deedTypes.findFirstOrThrow({ + where: { + uuid: deedTypeUid, + }, + include: { + deed_type_has_document_types: true, + }, + }); + expect(deedTypeUpdated.deed_type_has_document_types.length).toEqual(2); + }); + + it("should not add document types to a deed type that already has those document types ", async () => { + const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType.name, office_uuid: office.uid } })).uuid; + let deedTypeToUpdate: DeedType = JSON.parse(JSON.stringify(deedType)); + + deedTypeToUpdate.deed_type_has_document_types = [ + { + document_type: documentType, + deed_type: new DeedType(), + created_at: null, + updated_at: null, + }, + { + document_type: documentType_, + deed_type: new DeedType(), + created_at: null, + updated_at: null, + }, + ]; + + await DeedTypeServiceTest.update(deedTypeUid, deedTypeToUpdate); + + const deedTypeUpdated = await prisma.deedTypes.findFirstOrThrow({ + where: { + uuid: deedTypeUid, + }, + include: { + deed_type_has_document_types: true, + }, + }); + expect(deedTypeUpdated.deed_type_has_document_types.length).toEqual(2); + }); + + it("should delete document types from a deed", async () => { + const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType.name, office_uuid: office.uid } })).uuid; + let deedTypeToUpdate: DeedType = JSON.parse(JSON.stringify(deedType)); + + // set relation between deed and document types empty + deedTypeToUpdate.deed_type_has_document_types = []; + + await DeedTypeServiceTest.update(deedTypeUid, deedTypeToUpdate); + + const deedTypeUpdated = await prisma.deedTypes.findFirstOrThrow({ + where: { + uuid: deedTypeUid, + }, + include: { + deed_type_has_document_types: true, + }, + }); + expect(deedTypeUpdated.deed_type_has_document_types.length).toEqual(0); }); }); -// describe("test addDocumentTypes function", () => { -// it("should add document types to a deed type", async () => { -// const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType.name, office_uuid: office1.uuid } })).uuid; -// const documentsToAdd = [documentType1.uuid, documentType2.uuid]; -// await DeedTypeServiceTest.addDocumentTypes(deedTypeUid, documentsToAdd); - -// const deedTypes = await prisma.deedTypes.findFirstOrThrow({ -// where: { -// uuid: deedTypeUid, -// }, -// include: { -// deed_type_has_document_types: true, -// }, -// }); -// expect(deedTypes.deed_type_has_document_types.length).toEqual(2); -// }); - -// it("should not add document types to a deed type that already has those document types ", async () => { -// const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType.name, office_uuid: office1.uuid } })).uuid; -// let deedTypeHasDocumentTypes = await prisma.deedTypeHasDocumentTypes.findMany({ where: { deed_type_uuid: deedTypeUid } }); -// expect(deedTypeHasDocumentTypes.length).toEqual(2); - -// const documentsToAdd = [documentType1.uuid, documentType2.uuid]; -// //we expect deedTypeHasDocumentTypes service to skip duplicates without throwing error -// await DeedTypeServiceTest.addDocumentTypes(deedTypeUid, documentsToAdd); - -// deedTypeHasDocumentTypes = await prisma.deedTypeHasDocumentTypes.findMany({ where: { deed_type_uuid: deedTypeUid } }); -// expect(deedTypeHasDocumentTypes.length).toEqual(2); -// }); -// }); -// describe("test removeDocumentTypes function", () => { -// it("should remove document types from a deed type", async () => { -// const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType.name, office_uuid: office1.uuid } })).uuid; -// const documentsToRemove = [documentType1.uuid]; -// await DeedTypeServiceTest.removeDocumentTypes(deedTypeUid, documentsToRemove); - -// const deedTypeWithDocumentTypeRelations = await prisma.deedTypes.findFirstOrThrow({ -// where: { -// uuid: deedTypeUid, -// }, -// include: { -// deed_type_has_document_types: true, -// }, -// }); -// expect(deedTypeWithDocumentTypeRelations.deed_type_has_document_types.length).toEqual(1); -// expect(deedTypeWithDocumentTypeRelations.deed_type_has_document_types[0]?.document_type_uuid).toEqual(documentType2.uuid); -// }); -// it("should not remove document types from a deed type is they were not linked", async () => { -// let deedTypeWithOneDocumentType = await prisma.deedTypes.findFirstOrThrow({ -// where: { name: deedType.name, office_uuid: office1.uuid }, -// include: { -// deed_type_has_document_types: true, -// }, -// }); -// expect(deedTypeWithOneDocumentType.deed_type_has_document_types.length).toEqual(1); - -// const documentsToRemove = [documentType1.uuid]; - -// // try to duplicate deed type in a given office -// async function removeDocumentTypeNotLinkedToDeedType() { -// await DeedTypeServiceTest.removeDocumentTypes(deedTypeWithOneDocumentType.uuid, documentsToRemove); -// } -// await expect(removeDocumentTypeNotLinkedToDeedType).rejects.toThrow(); -// }); -// }); -// describe("test removeDocumentType function", () => { -// it("should remove only one document type from a deed type", async () => { -// let deedTypeWithOneDocumentType = await prisma.deedTypes.findFirstOrThrow({ -// where: { name: deedType.name, office_uuid: office1.uuid }, -// include: { -// deed_type_has_document_types: true, -// }, -// }); -// expect(deedTypeWithOneDocumentType.deed_type_has_document_types.length).toEqual(1); - -// const documentToRemove = documentType2.uuid; -// await DeedTypeServiceTest.removeDocumentType(deedTypeWithOneDocumentType.uuid, documentToRemove); - -// deedTypeWithOneDocumentType = await prisma.deedTypes.findFirstOrThrow({ -// where: { -// uuid: deedTypeWithOneDocumentType.uuid, -// }, -// include: { -// deed_type_has_document_types: true, -// }, -// }); -// expect(deedTypeWithOneDocumentType.deed_type_has_document_types.length).toEqual(0); -// }); -// }); -// describe("test addDocumentType function", () => { -// it("should add only one document type to a deed type", async () => { -// const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType.name, office_uuid: office1.uuid } })).uuid; -// const documentToAdd = documentType1.uuid; -// await DeedTypeServiceTest.addDocumentType(deedTypeUid, documentToAdd); - -// const deedTypes = await prisma.deedTypes.findFirstOrThrow({ -// where: { -// uuid: deedTypeUid, -// }, -// include: { -// deed_type_has_document_types: true, -// }, -// }); -// expect(deedTypes.deed_type_has_document_types.length).toEqual(1); -// expect(deedTypes.deed_type_has_document_types[0]?.document_type_uuid).toEqual(documentType1.uuid); -// }); -// }); - describe("test get function", () => { it("should return an array of DeedTypes", async () => { const deedTypes = await DeedTypeServiceTest.get({ orderBy: [{ name: "asc" }, { created_at: "asc" }] }); @@ -363,21 +281,21 @@ describe("test get function", () => { expect(deedTypes[0]?.name).toEqual(deedType_.name); expect(deedTypes[0]?.description).toEqual(deedType_.description); expect(deedTypes[0]?.archived_at).toBeNull(); - expect(deedTypes[0]?.office_uuid).toEqual(office2.uuid); + expect(deedTypes[0]?.office_uuid).toEqual(office_.uid); expect(deedTypes[1]?.name).toEqual(deedType.name); expect(deedTypes[1]?.description).toEqual(deedType.description); expect(deedTypes[1]?.archived_at).toBeNull(); - expect(deedTypes[1]?.office_uuid).toEqual(office1.uuid); + expect(deedTypes[1]?.office_uuid).toEqual(office.uid); expect(deedTypes[2]?.name).toEqual(deedType.name); expect(deedTypes[2]?.description).toEqual(deedType.description); expect(deedTypes[2]?.archived_at).toBeNull(); - expect(deedTypes[2]?.office_uuid).toEqual(office2.uuid); + expect(deedTypes[2]?.office_uuid).toEqual(office_.uid); }); it("should return an array of DeedTypes per offices", async () => { - const deedTypesForFirstOffice = await DeedTypeServiceTest.get({ where: { office: office1 }, orderBy: { name: "asc" } }); + const deedTypesForFirstOffice = await DeedTypeServiceTest.get({ where: { office: {uuid: office.uid} }, orderBy: { name: "asc" } }); expect(deedTypesForFirstOffice.length).toEqual(1); @@ -385,9 +303,9 @@ describe("test get function", () => { expect(deedTypesForFirstOffice[0]?.name).toEqual(deedType.name); expect(deedTypesForFirstOffice[0]?.description).toEqual(deedType.description); expect(deedTypesForFirstOffice[0]?.archived_at).toBeNull(); - expect(deedTypesForFirstOffice[0]?.office_uuid).toEqual(office1.uuid); + expect(deedTypesForFirstOffice[0]?.office_uuid).toEqual(office.uid); - const deedTypesForSecondOffice = await DeedTypeServiceTest.get({ where: { office: office2 }, orderBy: { name: "asc" } }); + const deedTypesForSecondOffice = await DeedTypeServiceTest.get({ where: { office: {uuid: office_.uid} }, orderBy: { name: "asc" } }); expect(deedTypesForSecondOffice.length).toEqual(2); @@ -395,11 +313,11 @@ describe("test get function", () => { expect(deedTypesForSecondOffice[0]?.name).toEqual(deedType_.name); expect(deedTypesForSecondOffice[0]?.description).toEqual(deedType_.description); expect(deedTypesForSecondOffice[0]?.archived_at).toBeNull(); - expect(deedTypesForSecondOffice[0]?.office_uuid).toEqual(office2.uuid); + expect(deedTypesForSecondOffice[0]?.office_uuid).toEqual(office_.uid); expect(deedTypesForSecondOffice[1]?.name).toEqual(deedType.name); expect(deedTypesForSecondOffice[1]?.description).toEqual(deedType.description); expect(deedTypesForSecondOffice[1]?.archived_at).toBeNull(); - expect(deedTypesForSecondOffice[1]?.office_uuid).toEqual(office2.uuid); + expect(deedTypesForSecondOffice[1]?.office_uuid).toEqual(office_.uid); }); }); diff --git a/src/test/services/super-admin/DocumentTypesService.test.ts b/src/test/services/super-admin/DocumentTypesService.test.ts index 51460c70..bc7c40e8 100644 --- a/src/test/services/super-admin/DocumentTypesService.test.ts +++ b/src/test/services/super-admin/DocumentTypesService.test.ts @@ -2,48 +2,19 @@ import "module-alias/register"; import "reflect-metadata"; import { DocumentType } from "le-coffre-resources/dist/SuperAdmin"; import DocumentTypesService from "@Services/super-admin/DocumentTypesService/DocumentTypesService"; -import { PrismaClient, Offices } from "prisma/prisma-client"; -import { documentType, documentType_, office, office_ } from "./MockedData"; +import { PrismaClient } from "prisma/prisma-client"; +import { documentType, documentType_, office, office_ } from "@Test/config/MockedData"; import DocumentTypesRepository from "@Repositories/DocumentTypesRepository"; import Container from "typedi"; +import { initOffice } from "@Test/config/Init"; const prisma = new PrismaClient(); const DocumentTypesServiceTest = new DocumentTypesService(Container.get(DocumentTypesRepository)); -let office1: Offices; -let office2: Offices; - beforeAll(async () => { - office1 = await prisma.offices.create({ - data: { - idNot: office.idNot, - name: office.name, - crpcen: office.crpcen, - address: { - create: { - address: office.address.address, - zip_code: office.address.zip_code, - city: office.address.city, - }, - }, - }, - }); - - office2 = await prisma.offices.create({ - data: { - idNot: office_.idNot, - name: office_.name, - crpcen: office_.crpcen, - address: { - create: { - address: office_.address.address, - zip_code: office_.address.zip_code, - city: office_.address.city, - }, - }, - }, - }); + office.uid = (await initOffice(office)).uuid; + office_.uid = (await initOffice(office_)).uuid; }); afterAll(async () => { @@ -55,28 +26,30 @@ afterAll(async () => { describe("test create function", () => { it("should not create a new document type if office is unknown", async () => { + let documentTypeWithoutOfficeUid: DocumentType = JSON.parse(JSON.stringify(documentType)); + documentTypeWithoutOfficeUid.office.uid = "random uuid"; // try to create a new document type with unknown office async function createDocumentTypeWithUnknownOffice() { - await DocumentTypesServiceTest.create(documentType); + await DocumentTypesServiceTest.create(documentTypeWithoutOfficeUid); } await expect(createDocumentTypeWithUnknownOffice).rejects.toThrow(); }); it("should create a new document type", async () => { let documentTypeWithOfficeUid: DocumentType = JSON.parse(JSON.stringify(documentType)); - documentTypeWithOfficeUid.office.uid = office1.uuid; + documentTypeWithOfficeUid.office.uid = office.uid; const documentTypeCreated = await DocumentTypesServiceTest.create(documentTypeWithOfficeUid); expect(documentTypeCreated.name).toEqual(documentType.name); expect(documentTypeCreated.public_description).toEqual(documentType.public_description); expect(documentTypeCreated.private_description).toEqual(documentType.private_description); expect(documentTypeCreated.archived_at).toBeNull(); - expect(documentTypeCreated.office_uuid).toEqual(office1.uuid); + expect(documentTypeCreated.office_uuid).toEqual(office.uid); }); it("should not create a new document type with a name already used for a given office", async () => { let documentTypeWithSameNameAndOffice: DocumentType = JSON.parse(JSON.stringify(documentType_)); - documentTypeWithSameNameAndOffice.office.uid = office1.uuid; + documentTypeWithSameNameAndOffice.office.uid = office.uid; documentTypeWithSameNameAndOffice.name = documentType.name; async function createDocumentTypeWithSameNameAndOffice() { @@ -87,7 +60,7 @@ describe("test create function", () => { it("should create the same document type for a different office", async () => { let documentTypeDuplicatedForNewOffice: DocumentType = JSON.parse(JSON.stringify(documentType)); - documentTypeDuplicatedForNewOffice.office.uid = office2.uuid; + documentTypeDuplicatedForNewOffice.office.uid = office_.uid; const documentTypeCreated = await DocumentTypesServiceTest.create(documentTypeDuplicatedForNewOffice); @@ -95,12 +68,12 @@ describe("test create function", () => { expect(documentTypeCreated.public_description).toEqual(documentType.public_description); expect(documentTypeCreated.private_description).toEqual(documentType.private_description); expect(documentTypeCreated.archived_at).toBeNull(); - expect(documentTypeCreated.office_uuid).toEqual(office2.uuid); + expect(documentTypeCreated.office_uuid).toEqual(office_.uid); }); it("should create a new document type version with a different name for a given office", async () => { let documentTypeWithSameDescription: DocumentType = JSON.parse(JSON.stringify(documentType)); - documentTypeWithSameDescription.office.uid = office1.uuid; + documentTypeWithSameDescription.office.uid = office.uid; documentTypeWithSameDescription.name = documentType_.name; const documentTypeCreated = await DocumentTypesServiceTest.create(documentTypeWithSameDescription); @@ -109,23 +82,23 @@ describe("test create function", () => { expect(documentTypeCreated.public_description).toEqual(documentType.public_description); expect(documentTypeCreated.private_description).toEqual(documentType.private_description); expect(documentTypeCreated.archived_at).toBeNull(); - expect(documentTypeCreated.office_uuid).toEqual(office1.uuid); + expect(documentTypeCreated.office_uuid).toEqual(office.uid); }); }); describe("test update function", () => { it("should update a document type", async () => { const documentTypeCreated = await prisma.documentTypes.findFirstOrThrow({ - where: { name: documentType_.name, office_uuid: office1.uuid }, + where: { name: documentType_.name, office_uuid: office.uid }, }); expect(documentTypeCreated.name).toEqual(documentType_.name); expect(documentTypeCreated.public_description).toEqual(documentType.public_description); expect(documentTypeCreated.private_description).toEqual(documentType.private_description); expect(documentTypeCreated.archived_at).toBeNull(); - expect(documentTypeCreated.office_uuid).toEqual(office1.uuid); + expect(documentTypeCreated.office_uuid).toEqual(office.uid); let documentTypeWithNewDescription: DocumentType = JSON.parse(JSON.stringify(documentType_)); - documentTypeWithNewDescription.office.uid = office1.uuid; + documentTypeWithNewDescription.office.uid = office.uid; // update the last document type created with his the right descriptions const documentTypeUpdated = await DocumentTypesServiceTest.update(documentTypeCreated.uuid, documentTypeWithNewDescription); @@ -133,15 +106,15 @@ describe("test update function", () => { expect(documentTypeUpdated.public_description).toEqual(documentType_.public_description); expect(documentTypeUpdated.private_description).toEqual(documentType_.private_description); expect(documentTypeUpdated.archived_at).toBeNull(); - expect(documentTypeUpdated.office_uuid).toEqual(office1.uuid); + expect(documentTypeUpdated.office_uuid).toEqual(office.uid); }); it("should not update a document type name with an already used name for given office", async () => { const documentTypeUid = ( - await prisma.documentTypes.findFirstOrThrow({ where: { name: documentType_.name, office_uuid: office1.uuid } }) + await prisma.documentTypes.findFirstOrThrow({ where: { name: documentType_.name, office_uuid: office.uid } }) ).uuid; let documentTypeWithSameNameAndOffice: DocumentType = JSON.parse(JSON.stringify(documentType_)); - documentTypeWithSameNameAndOffice.office.uid = office1.uuid; + documentTypeWithSameNameAndOffice.office.uid = office.uid; documentTypeWithSameNameAndOffice.name = documentType.name; // update the last document type created with his the right description @@ -153,10 +126,10 @@ describe("test update function", () => { it("should not update a document type office membership if the office already has this document type", async () => { const documentTypeUid = ( - await prisma.documentTypes.findFirstOrThrow({ where: { name: documentType_.name, office_uuid: office1.uuid } }) + await prisma.documentTypes.findFirstOrThrow({ where: { name: documentType_.name, office_uuid: office.uid } }) ).uuid; let documentTypeWithSameNameAndOffice: DocumentType = JSON.parse(JSON.stringify(documentType_)); - documentTypeWithSameNameAndOffice.office.uid = office1.uuid; + documentTypeWithSameNameAndOffice.office.uid = office.uid; documentTypeWithSameNameAndOffice.name = documentType.name; // try to duplicate document type in a given office @@ -168,17 +141,17 @@ describe("test update function", () => { it("should update a document type office membership", async () => { const documentTypeCreated = await prisma.documentTypes.findFirstOrThrow({ - where: { name: documentType_.name, office_uuid: office1.uuid }, + where: { name: documentType_.name, office_uuid: office.uid }, }); expect(documentTypeCreated.name).toEqual(documentType_.name); expect(documentTypeCreated.public_description).toEqual(documentType_.public_description); expect(documentTypeCreated.private_description).toEqual(documentType_.private_description); expect(documentTypeCreated.archived_at).toBeNull(); - expect(documentTypeCreated.office_uuid).toEqual(office1.uuid); + expect(documentTypeCreated.office_uuid).toEqual(office.uid); let documentTypeTransferedToNewOffice: DocumentType = JSON.parse(JSON.stringify(documentType_)); - documentTypeTransferedToNewOffice.office.uid = office2.uuid; + documentTypeTransferedToNewOffice.office.uid = office_.uid; // update the last document type updated with a new office membership const documentTypeUpdated = await DocumentTypesServiceTest.update(documentTypeCreated.uuid, documentTypeTransferedToNewOffice); @@ -187,22 +160,22 @@ describe("test update function", () => { expect(documentTypeUpdated.public_description).toEqual(documentType_.public_description); expect(documentTypeUpdated.private_description).toEqual(documentType_.private_description); expect(documentTypeUpdated.archived_at).toBeNull(); - expect(documentTypeUpdated.office_uuid).toEqual(office2.uuid); + expect(documentTypeUpdated.office_uuid).toEqual(office_.uid); }); it("should archivate a document type", async () => { const documentTypeCreated = await prisma.documentTypes.findFirstOrThrow({ - where: { name: documentType_.name, office_uuid: office2.uuid }, + where: { name: documentType_.name, office_uuid: office_.uid }, }); expect(documentTypeCreated.name).toEqual(documentType_.name); expect(documentTypeCreated.public_description).toEqual(documentType_.public_description); expect(documentTypeCreated.private_description).toEqual(documentType_.private_description); expect(documentTypeCreated.archived_at).toBeNull(); - expect(documentTypeCreated.office_uuid).toEqual(office2.uuid); + expect(documentTypeCreated.office_uuid).toEqual(office_.uid); let documentTypeArchivated: DocumentType = JSON.parse(JSON.stringify(documentType_)); - documentTypeArchivated.office.uid = office2.uuid; + documentTypeArchivated.office.uid = office_.uid; const currentDate = new Date(Date.now()); documentTypeArchivated.archived_at = currentDate; // archivate a document type by giving a non null date for archivated_at attribute @@ -211,22 +184,22 @@ describe("test update function", () => { expect(documentTypeUpdated.public_description).toEqual(documentType_.public_description); expect(documentTypeUpdated.private_description).toEqual(documentType_.private_description); expect(documentTypeUpdated.archived_at).toEqual(currentDate); - expect(documentTypeUpdated.office_uuid).toEqual(office2.uuid); + expect(documentTypeUpdated.office_uuid).toEqual(office_.uid); }); it("should unarchivate a document type", async () => { const documentTypeCreated = await prisma.documentTypes.findFirstOrThrow({ - where: { name: documentType_.name, office_uuid: office2.uuid }, + where: { name: documentType_.name, office_uuid: office_.uid }, }); expect(documentTypeCreated.name).toEqual(documentType_.name); expect(documentTypeCreated.public_description).toEqual(documentType_.public_description); expect(documentTypeCreated.private_description).toEqual(documentType_.private_description); expect(documentTypeCreated.archived_at).not.toBeNull(); - expect(documentTypeCreated.office_uuid).toEqual(office2.uuid); + expect(documentTypeCreated.office_uuid).toEqual(office_.uid); let documentTypeUnarchivated: DocumentType = JSON.parse(JSON.stringify(documentType_)); - documentTypeUnarchivated.office.uid = office2.uuid; + documentTypeUnarchivated.office.uid = office_.uid; // unarchivate a document type by giving a null date for archivated_at attribute const documentTypeUpdated = await DocumentTypesServiceTest.update(documentTypeCreated.uuid, documentTypeUnarchivated); @@ -235,7 +208,7 @@ describe("test update function", () => { expect(documentTypeUpdated.public_description).toEqual(documentType_.public_description); expect(documentTypeUpdated.private_description).toEqual(documentType_.private_description); expect(documentTypeUpdated.archived_at).toBeNull(); - expect(documentTypeUpdated.office_uuid).toEqual(office2.uuid); + expect(documentTypeUpdated.office_uuid).toEqual(office_.uid); }); }); @@ -252,23 +225,23 @@ describe("test get function", () => { expect(documentTypes[0]?.public_description).toEqual(documentType_.public_description); expect(documentTypes[0]?.private_description).toEqual(documentType_.private_description); expect(documentTypes[0]?.archived_at).toBeNull(); - expect(documentTypes[0]?.office_uuid).toEqual(office2.uuid); + expect(documentTypes[0]?.office_uuid).toEqual(office_.uid); expect(documentTypes[1]?.name).toEqual(documentType.name); expect(documentTypes[1]?.public_description).toEqual(documentType.public_description); expect(documentTypes[1]?.private_description).toEqual(documentType.private_description); expect(documentTypes[1]?.archived_at).toBeNull(); - expect(documentTypes[1]?.office_uuid).toEqual(office1.uuid); + expect(documentTypes[1]?.office_uuid).toEqual(office.uid); expect(documentTypes[2]?.name).toEqual(documentType.name); expect(documentTypes[2]?.public_description).toEqual(documentType.public_description); expect(documentTypes[2]?.private_description).toEqual(documentType.private_description); expect(documentTypes[2]?.archived_at).toBeNull(); - expect(documentTypes[2]?.office_uuid).toEqual(office2.uuid); + expect(documentTypes[2]?.office_uuid).toEqual(office_.uid); }); it("should return an array of DocumentTypes per offices", async () => { - const documentTypesForFirstOffice = await DocumentTypesServiceTest.get({ where: { office: office1 }, orderBy: { name: "asc" } }); + const documentTypesForFirstOffice = await DocumentTypesServiceTest.get({ where: { office: {uuid : office.uid }}, orderBy: { name: "asc" } }); expect(documentTypesForFirstOffice.length).toEqual(1); @@ -277,9 +250,9 @@ describe("test get function", () => { expect(documentTypesForFirstOffice[0]?.public_description).toEqual(documentType.public_description); expect(documentTypesForFirstOffice[0]?.private_description).toEqual(documentType.private_description); expect(documentTypesForFirstOffice[0]?.archived_at).toBeNull(); - expect(documentTypesForFirstOffice[0]?.office_uuid).toEqual(office1.uuid); + expect(documentTypesForFirstOffice[0]?.office_uuid).toEqual(office.uid); - const documentTypesForSecondOffice = await DocumentTypesServiceTest.get({ where: { office: office2 }, orderBy: { name: "asc" } }); + const documentTypesForSecondOffice = await DocumentTypesServiceTest.get({ where: { office: {uuid : office_.uid }}, orderBy: { name: "asc" } }); expect(documentTypesForSecondOffice.length).toEqual(2); @@ -288,12 +261,12 @@ describe("test get function", () => { expect(documentTypesForSecondOffice[0]?.public_description).toEqual(documentType_.public_description); expect(documentTypesForSecondOffice[0]?.private_description).toEqual(documentType_.private_description); expect(documentTypesForSecondOffice[0]?.archived_at).toBeNull(); - expect(documentTypesForSecondOffice[0]?.office_uuid).toEqual(office2.uuid); + expect(documentTypesForSecondOffice[0]?.office_uuid).toEqual(office_.uid); expect(documentTypesForSecondOffice[1]?.name).toEqual(documentType.name); expect(documentTypesForSecondOffice[1]?.public_description).toEqual(documentType.public_description); expect(documentTypesForSecondOffice[1]?.private_description).toEqual(documentType.private_description); expect(documentTypesForSecondOffice[1]?.archived_at).toBeNull(); - expect(documentTypesForSecondOffice[1]?.office_uuid).toEqual(office2.uuid); + expect(documentTypesForSecondOffice[1]?.office_uuid).toEqual(office_.uid); }); }); diff --git a/src/test/services/super-admin/OfficeFolderService.test.ts b/src/test/services/super-admin/OfficeFolderService.test.ts index 1e15b059..6aa7451f 100644 --- a/src/test/services/super-admin/OfficeFolderService.test.ts +++ b/src/test/services/super-admin/OfficeFolderService.test.ts @@ -1,273 +1,288 @@ import "module-alias/register"; import "reflect-metadata"; -import { PrismaClient, Offices, DocumentTypes, DeedTypes, DeedTypeHasDocumentTypes } from "prisma/prisma-client"; -import { deedType, documentType, office } from "./MockedData"; -// import Container from "typedi"; -// import OfficeFoldersRepository from "@Repositories/OfficeFoldersRepository"; -// import OfficeFoldersHasStakeholderRepository from "@Repositories/OfficeFoldersHasStakeholderRepository"; -// import OfficeFoldersHasCustomerRepository from "@Repositories/OfficeFoldersHasCustomerRepository"; -// import CustomersService from "@Services/super-admin/CustomersService/CustomersService"; -// import OfficeFolderService from "@Services/super-admin/OfficeFoldersService/OfficeFoldersService"; -// import DocumentsRepository from "@Repositories/DocumentsRepository"; +import { OfficeFolderHasCustomers, OfficeFolderHasStakeholders, PrismaClient } from "prisma/prisma-client"; +import { + customer, + customer_, + deedType, + documentType, + documentType_, + office, + officeFolder, + officeFolder_, + user, + user_, +} from "@Test/config/MockedData"; +import Container from "typedi"; +import OfficeFoldersRepository from "@Repositories/OfficeFoldersRepository"; +import OfficeFolderService from "@Services/super-admin/OfficeFoldersService/OfficeFoldersService"; +import { initCustomers, initDeedType, initDocumentType, initOffice, initUsers } from "@Test/config/Init"; +import { OfficeFolder } from "le-coffre-resources/dist/SuperAdmin"; +import DeedTypesService from "@Services/super-admin/DeedTypesService/DeedTypesService"; const prisma = new PrismaClient(); -// const OfficeFolderServiceTest = new OfficeFolderService( -// Container.get(OfficeFoldersRepository), -// Container.get(OfficeFoldersHasStakeholderRepository), -// Container.get(OfficeFoldersHasCustomerRepository), -// Container.get(CustomersService), -// Container.get(DocumentsRepository), -// ); - -let office1: Offices; - -let documentType1: DocumentTypes; -//let documentType2: DocumentTypes; - -let deedType1: DeedTypes; - -let deedType1HasDocumentType1: DeedTypeHasDocumentTypes; +const OfficeFolderServiceTest = new OfficeFolderService(Container.get(OfficeFoldersRepository), Container.get(DeedTypesService)); beforeAll(async () => { - office1 = await prisma.offices.create({ - data: { - idNot: office.idNot, - name: office.name, - crpcen: office.crpcen, - address: { - create: { - address: office.address.address, - zip_code: office.address.zip_code, - city: office.address.city, - }, - }, - }, - }); - - documentType1 = await prisma.documentTypes.create({ - data: { - name: documentType.name, - public_description: documentType.public_description, - private_description: documentType.private_description, - archived_at: null, - office_uuid: office1.uuid, - }, - }); - - // documentType2 = await prisma.documentTypes.create({ - // data: { - // name: documentType_.name, - // public_description: documentType_.public_description, - // private_description: documentType_.private_description, - // archived_at: null, - // office_uuid: office1.uuid, - // }, - // }); - - deedType1 = await prisma.deedTypes.create({ - data: { - name: deedType.name, - description: deedType.description, - archived_at: null, - office_uuid: office1.uuid, - }, - }); - - deedType1HasDocumentType1 = await prisma.deedTypeHasDocumentTypes.create({ - data: { - deed_type_uuid: deedType1.uuid, - document_type_uuid: documentType1.uuid, - }, - }); - - await prisma.deedTypes.update({ - where: { uuid: deedType1.uuid }, - data: { - deed_type_has_document_types: { - connect: { - uuid: deedType1HasDocumentType1.uuid, - }, - }, - }, - }); + office.uid = (await initOffice(office)).uuid; + documentType.uid = (await initDocumentType(documentType, office)).uuid; + documentType_.uid = (await initDocumentType(documentType_, office)).uuid; + deedType.uid = (await initDeedType(deedType, office, [documentType.uid])).uuid; + user.uid = (await initUsers(user)).uuid; + user_.uid = (await initUsers(user_)).uuid; + customer.uid = (await initCustomers(customer)).uuid; + customer_.uid = (await initCustomers(customer_)).uuid; }); afterAll(async () => { + /* + * Clean database after all tests execution. + * Due to cascade deletion, if addresses are deleted, all items following tables are dropped: contacts, customers, offices + */ const deleteDeedTypes = prisma.deedTypes.deleteMany(); - const deleteOffices = prisma.offices.deleteMany(); - await prisma.$transaction([deleteDeedTypes, deleteOffices]); + const deleteAddresses = prisma.addresses.deleteMany(); + await prisma.$transaction([deleteDeedTypes, deleteAddresses]); await prisma.$disconnect(); }); describe("test create function", () => { it("should not create a new office folder if deed type is unknown", async () => { + let officeFolderWithoutDeedTypeUid: OfficeFolder = JSON.parse(JSON.stringify(officeFolder)); + officeFolderWithoutDeedTypeUid.deed.deed_type.uid = "random uuid"; // try to create a new deed with unknown deed type - // async function createDeedWithUnknownDeedType() { - // await OfficeFolderServiceTest.create(officeFolder, deedType); - // } - // await expect(createDeedWithUnknownDeedType).rejects.toThrow("deed type not found"); + async function createOfficeFolderWithUnknownDeedType() { + await OfficeFolderServiceTest.create(officeFolderWithoutDeedTypeUid); + } + await expect(createOfficeFolderWithUnknownDeedType).rejects.toThrow(); }); - // it("should create a new office folder based on existing deed type", async () => { - // let deedTypeWithUid: DeedType = JSON.parse(JSON.stringify(deedType)); - // deedTypeWithUid.uid = deedType1.uuid; - // const officeFolderCreated = await OfficeFolderServiceTest.create(officeFolder, deedTypeWithUid); + it("should create a new office folder based on existing deed type", async () => { + const officeFolderCreated = await OfficeFolderServiceTest.create(officeFolder); - // expect(officeFolderCreated.office_uuid).toEqual(office1.uuid); - // expect(officeFolderCreated.deed_uuid.).toEqual(office1.uuid); - // }); + const deedCreated = await prisma.deeds.findUniqueOrThrow({ where: { uuid: officeFolderCreated.deed_uuid } }); - // it("should have by default the same document types as its deed type ", async () => { - // const deedWithDocumentTypes = await prisma.deeds.findFirstOrThrow({ include: { deed_has_document_types: true } }); - // expect(deedWithDocumentTypes.deed_has_document_types.length).toEqual(1); - // expect(deedWithDocumentTypes.deed_has_document_types[0]?.document_type_uuid).toEqual(documentType1.uuid); - // }); + expect(officeFolderCreated.name).toEqual(officeFolder.name); + expect(officeFolderCreated.folder_number).toEqual(officeFolder.folder_number); + expect(officeFolderCreated.description).toEqual(officeFolder.description); + expect(officeFolderCreated.archived_description).toEqual(null); + expect(officeFolderCreated.status).toEqual("LIVE"); + expect(officeFolderCreated.office_uuid).toEqual(officeFolder.office.uid); + expect(deedCreated.deed_type_uuid).toEqual(officeFolder.deed.deed_type.uid); + }); - // it("should create a the same deed based on existing deed type", async () => { - // let deedTypeWithUid: DeedType = JSON.parse(JSON.stringify(deedType)); - // deedTypeWithUid.uid = deedType1.uuid; - // const deedCreated = await OfficeFolderServiceTest.create(deedTypeWithUid); + it("should contains stakeholders", async () => { + const officeFolderCreated = await prisma.officeFolders.findFirstOrThrow({ + include: { office_folder_has_stakeholder: true }, + }); + const stakeholderRelation = await prisma.officeFolderHasStakeholders.findUniqueOrThrow({ + where: { + office_folder_uuid_user_stakeholder_uuid: { + user_stakeholder_uuid: user.uid!, + office_folder_uuid: officeFolderCreated.uuid, + }, + }, + }); + const stakeholderRelation_ = await prisma.officeFolderHasStakeholders.findUniqueOrThrow({ + where: { + office_folder_uuid_user_stakeholder_uuid: { + user_stakeholder_uuid: user_.uid!, + office_folder_uuid: officeFolderCreated.uuid, + }, + }, + }); + expect(officeFolderCreated.office_folder_has_stakeholder.length).toEqual(2); + const stakeholder: OfficeFolderHasStakeholders = { + uuid: stakeholderRelation.uuid, + office_folder_uuid: officeFolderCreated.uuid, + user_stakeholder_uuid: user.uid!, + created_at: officeFolderCreated.created_at, + updated_at: officeFolderCreated.updated_at, + }; + const stakeholder_: OfficeFolderHasStakeholders = { + uuid: stakeholderRelation_.uuid, + office_folder_uuid: officeFolderCreated.uuid, + user_stakeholder_uuid: user_.uid!, + created_at: officeFolderCreated.created_at, + updated_at: officeFolderCreated.updated_at, + }; + expect(officeFolderCreated.office_folder_has_stakeholder).toEqual(expect.arrayContaining([stakeholder, stakeholder_])); + }); - // expect(deedCreated.deed_type_uuid).toEqual(deedType1.uuid); - // }); + it("should not create a new office folder with folder number already created", async () => { + let officeFolderWithSameFolderNumber: OfficeFolder = JSON.parse(JSON.stringify(officeFolder_)); + officeFolderWithSameFolderNumber.folder_number = officeFolder.folder_number; + // try to create a new deed with unknown deed type + async function createOfficeFolderWithSameFolderNumber() { + await OfficeFolderServiceTest.create(officeFolderWithSameFolderNumber); + } + await expect(createOfficeFolderWithSameFolderNumber).rejects.toThrow(); + }); - // it("should not create a new deed based on archivated deed type", async () => { - // let deedTypeArchivated: DeedType = JSON.parse(JSON.stringify(deedType)); - // deedTypeArchivated.uid = deedType1.uuid; - - // await prisma.deedTypes.update({ - // where: { uuid: deedType1.uuid }, - // data: { - // archived_at: new Date(Date.now()), - // }, - // }); - - // // try to create a new deed with archivated deed type - // async function createDeedWithArchivatedDeedType() { - // await OfficeFolderServiceTest.create(deedTypeArchivated); - // } - // await expect(createDeedWithArchivatedDeedType).rejects.toThrow("deed type is archived"); - // }); + it("should not create a new office folder if deed type is archived", async () => { + await prisma.deedTypes.update({ where: { uuid: deedType.uid }, data: { archived_at: new Date(Date.now()) } }); + // try to create a new deed with archivated deed type + async function createDeedWithArchivatedDeedType() { + await OfficeFolderServiceTest.create(officeFolder); + } + await expect(createDeedWithArchivatedDeedType).rejects.toThrow("deed type is archived"); + }); }); -// describe("test addDocumentTypes function", () => { -// it("should add document types to a deed", async () => { -// const deedUid = (await prisma.deeds.findFirstOrThrow({ where: { deed_type_uuid: deedType1.uuid } })).uuid; -// const documentsToAdd = [documentType1.uuid, documentType2.uuid]; -// await OfficeFolderServiceTest.addDocumentTypes(deedUid, documentsToAdd); +describe("test update function", () => { + it("should add customers", async () => { + let officeFolderCreated = await prisma.officeFolders.findFirstOrThrow({ + include: { office_folder_has_customers: true }, + }); -// const deed = await prisma.deeds.findFirstOrThrow({ -// where: { -// uuid: deedUid, -// }, -// include: { -// deed_has_document_types: true, -// }, -// }); -// expect(deed.deed_has_document_types.length).toEqual(2); -// }); + expect(officeFolderCreated.office_folder_has_customers).toEqual([]); + // mocked data contains the customers + await OfficeFolderServiceTest.update(officeFolderCreated.uuid, officeFolder); -// it("should not add document types to a deed type that already has those document types ", async () => { -// const deedUid = (await prisma.deeds.findFirstOrThrow({ where: { deed_type_uuid: deedType1.uuid } })).uuid; -// let deedHasDocumentTypes = await prisma.deedHasDocumentTypes.findMany({ where: { deed_uuid: deedUid } }); -// expect(deedHasDocumentTypes.length).toEqual(2); + const customerRelation = await prisma.officeFolderHasCustomers.findUniqueOrThrow({ + where: { + office_folder_uuid_customer_uuid: { + customer_uuid: customer.uid!, + office_folder_uuid: officeFolderCreated.uuid, + }, + }, + }); + const customerRelation_ = await prisma.officeFolderHasCustomers.findUniqueOrThrow({ + where: { + office_folder_uuid_customer_uuid: { + customer_uuid: customer_.uid!, + office_folder_uuid: officeFolderCreated.uuid, + }, + }, + }); -// const documentsToAdd = [documentType1.uuid, documentType2.uuid]; -// //we expect deedTypeHasDocumentTypes service to skip duplicates without throwing error -// await OfficeFolderServiceTest.addDocumentTypes(deedUid, documentsToAdd); + officeFolderCreated = await prisma.officeFolders.findFirstOrThrow({ + include: { office_folder_has_customers: true }, + }); -// deedHasDocumentTypes = await prisma.deedHasDocumentTypes.findMany({ where: { deed_uuid: deedUid } }); -// expect(deedHasDocumentTypes.length).toEqual(2); -// }); -// }); -// describe("test removeDocumentTypes function", () => { -// it("should remove document types from a deed type", async () => { -// const deedUid = (await prisma.deeds.findFirstOrThrow({ where: { deed_type_uuid: deedType1.uuid } })).uuid; -// const documentsToRemove = [documentType1.uuid]; -// await OfficeFolderServiceTest.removeDocumentTypes(deedUid, documentsToRemove); + expect(officeFolderCreated.office_folder_has_customers.length).toEqual(2); + const officeFolderHasCustomer: OfficeFolderHasCustomers = { + uuid: customerRelation.uuid, + office_folder_uuid: officeFolderCreated.uuid, + customer_uuid: customer.uid!, + created_at: customerRelation.created_at, + updated_at: customerRelation.updated_at, + }; + const officeFolderHasCustomer_: OfficeFolderHasCustomers = { + uuid: customerRelation_.uuid, + office_folder_uuid: officeFolderCreated.uuid, + customer_uuid: customer_.uid!, + created_at: customerRelation_.created_at, + updated_at: customerRelation_.updated_at, + }; + expect(officeFolderCreated.office_folder_has_customers).toEqual( + expect.arrayContaining([officeFolderHasCustomer, officeFolderHasCustomer_]), + ); + }); -// const deedWithDocumentTypeRelations = await prisma.deeds.findFirstOrThrow({ -// where: { -// uuid: deedUid, -// }, -// include: { -// deed_has_document_types: true, -// }, -// }); -// expect(deedWithDocumentTypeRelations.deed_has_document_types.length).toEqual(1); -// expect(deedWithDocumentTypeRelations.deed_has_document_types[0]?.document_type_uuid).toEqual(documentType2.uuid); -// }); -// it("should not remove document types from a deed type is they were not linked", async () => { -// let deedWithOneDocumentType = await prisma.deeds.findFirstOrThrow({ -// where: { deed_type_uuid: deedType1.uuid }, -// include: { -// deed_has_document_types: true, -// }, -// }); -// expect(deedWithOneDocumentType.deed_has_document_types.length).toEqual(1); + it("should remove customers", async () => { + let officeFolderCreated = await prisma.officeFolders.findFirstOrThrow({ + include: { office_folder_has_customers: true }, + }); -// const documentsToRemove = [documentType1.uuid]; + expect(officeFolderCreated.office_folder_has_customers.length).toEqual(2); -// async function removeDocumentTypeNotLinkedToDeedType() { -// await OfficeFolderServiceTest.removeDocumentTypes(deedWithOneDocumentType.uuid, documentsToRemove); -// } -// await expect(removeDocumentTypeNotLinkedToDeedType).rejects.toThrow(); -// }); -// }); -// describe("test removeDocumentType function", () => { -// it("should remove only one document type from a deed type", async () => { -// let deedWithOneDocumentType = await prisma.deeds.findFirstOrThrow({ -// where: { deed_type_uuid: deedType1.uuid }, -// include: { -// deed_has_document_types: true, -// }, -// }); -// expect(deedWithOneDocumentType.deed_has_document_types.length).toEqual(1); + let officeFolderWithLessCustomers: OfficeFolder = JSON.parse(JSON.stringify(officeFolder)); + officeFolderWithLessCustomers.office_folder_has_customers!.pop(); + // mocked data contains the customers + await OfficeFolderServiceTest.update(officeFolderCreated.uuid, officeFolderWithLessCustomers); -// const documentToRemove = documentType2.uuid; -// await OfficeFolderServiceTest.removeDocumentType(deedWithOneDocumentType.uuid, documentToRemove); + const customerRelation = await prisma.officeFolderHasCustomers.findUniqueOrThrow({ + where: { + office_folder_uuid_customer_uuid: { + customer_uuid: customer.uid!, + office_folder_uuid: officeFolderCreated.uuid, + }, + }, + }); -// deedWithOneDocumentType = await prisma.deeds.findFirstOrThrow({ -// where: { -// uuid: deedWithOneDocumentType.uuid, -// }, -// include: { -// deed_has_document_types: true, -// }, -// }); -// expect(deedWithOneDocumentType.deed_has_document_types.length).toEqual(0); -// }); -// }); -// describe("test addDocumentType function", () => { -// it("should add only one document type to a deed type", async () => { -// const deedUid = (await prisma.deeds.findFirstOrThrow({ where: { deed_type_uuid: deedType1.uuid } })).uuid; -// const documentToAdd = documentType1.uuid; -// await OfficeFolderServiceTest.addDocumentType(deedUid, documentToAdd); + officeFolderCreated = await prisma.officeFolders.findFirstOrThrow({ + include: { office_folder_has_customers: true }, + }); -// const deed = await prisma.deeds.findFirstOrThrow({ -// where: { -// uuid: deedUid, -// }, -// include: { -// deed_has_document_types: true, -// }, -// }); -// expect(deed.deed_has_document_types.length).toEqual(1); -// expect(deed.deed_has_document_types[0]?.document_type_uuid).toEqual(documentType1.uuid); -// }); -// }); + expect(officeFolderCreated.office_folder_has_customers.length).toEqual(1); + const officeFolderHasCustomer: OfficeFolderHasCustomers = { + uuid: customerRelation.uuid, + office_folder_uuid: officeFolderCreated.uuid, + customer_uuid: customer.uid!, + created_at: customerRelation.created_at, + updated_at: customerRelation.updated_at, + }; + expect(officeFolderCreated.office_folder_has_customers).toEqual([officeFolderHasCustomer]); + }); + it("should remove stakeholders", async () => { + let officeFolderCreated = await prisma.officeFolders.findFirstOrThrow({ + include: { office_folder_has_stakeholder: true }, + }); -// describe("test get function", () => { -// it("should return an array of Deeds", async () => { -// const deeds = await OfficeFolderServiceTest.get({}); + expect(officeFolderCreated.office_folder_has_stakeholder.length).toEqual(2); -// // verify result typing -// expect(deeds).toBeInstanceOf(Array); -// expect(deeds.length).toEqual(2); + let officeFolderWithLessStakeholders: OfficeFolder = JSON.parse(JSON.stringify(officeFolder)); + officeFolderWithLessStakeholders.office_folder_has_stakeholder!.pop(); + // mocked data contains the customers + await OfficeFolderServiceTest.update(officeFolderCreated.uuid, officeFolderWithLessStakeholders); -// // verify result content -// expect(deeds[0]?.deed_type_uuid).toEqual(deedType1.uuid); -// expect(deeds[1]?.deed_type_uuid).toEqual(deedType1.uuid); -// }); -// }); + const stakeholderRelation = await prisma.officeFolderHasStakeholders.findUniqueOrThrow({ + where: { + office_folder_uuid_user_stakeholder_uuid: { + user_stakeholder_uuid: user.uid!, + office_folder_uuid: officeFolderCreated.uuid, + }, + }, + }); + + officeFolderCreated = await prisma.officeFolders.findFirstOrThrow({ + include: { office_folder_has_stakeholder: true }, + }); + + expect(officeFolderCreated.office_folder_has_stakeholder.length).toEqual(1); + const officeFolderHasStakeholder: OfficeFolderHasStakeholders = { + uuid: stakeholderRelation.uuid, + office_folder_uuid: officeFolderCreated.uuid, + user_stakeholder_uuid: user.uid!, + created_at: stakeholderRelation.created_at, + updated_at: stakeholderRelation.updated_at, + }; + expect(officeFolderCreated.office_folder_has_stakeholder).toEqual([officeFolderHasStakeholder]); + }); + it("should archivate an office folder", async () => { + const officeFolderCreated = await prisma.officeFolders.findFirstOrThrow({}); + let officeFolderArchived: OfficeFolder = JSON.parse(JSON.stringify(officeFolder)); + // mocked data for this office folder is "ARCHIVATED" by default + officeFolderArchived.archived_description = "folder complete"; + + const officeFolderUpdated = await OfficeFolderServiceTest.update(officeFolderCreated.uuid, officeFolderArchived); + + expect(officeFolderUpdated.archived_description).toEqual(officeFolderArchived.archived_description); + expect(officeFolderUpdated.status).toEqual("ARCHIVED"); + }); + it("should unarchivate an office folder", async () => { + const officeFolderCreated = await prisma.officeFolders.findFirstOrThrow({}); + + expect(officeFolderCreated.archived_description).toEqual("folder complete"); + expect(officeFolderCreated.status).toEqual("ARCHIVED"); + + let officeFolderUnarchived: OfficeFolder = JSON.parse(JSON.stringify(officeFolder)); + officeFolderUnarchived.status = "LIVE"; + + const officeFolderUpdated = await OfficeFolderServiceTest.update(officeFolderCreated.uuid, officeFolderUnarchived); + + expect(officeFolderUpdated.archived_description).toBeNull(); + expect(officeFolderUpdated.status).toEqual("LIVE"); + }); +}); + +describe("test get function", () => { + it("should return an array of officeFolders", async () => { + const officeFolders = await OfficeFolderServiceTest.get({}); + + // verify result typing + expect(officeFolders).toBeInstanceOf(Array); + expect(officeFolders.length).toEqual(1); + }); +}); diff --git a/src/test/services/super-admin/UsersService.test.ts b/src/test/services/super-admin/UsersService.test.ts index fd7dd437..ca1bb88f 100644 --- a/src/test/services/super-admin/UsersService.test.ts +++ b/src/test/services/super-admin/UsersService.test.ts @@ -3,7 +3,7 @@ import "reflect-metadata"; import User from "le-coffre-resources/dist/SuperAdmin"; import UsersService from "@Services/super-admin/UsersService/UsersService"; import { PrismaClient } from "@prisma/client"; -import { user, userContact, userContact_, user_ } from "./MockedData"; +import { user, userContact, userContact_, user_ } from "@Test/config/MockedData"; import UsersRepository from "@Repositories/UsersRepository"; import Container from "typedi"; @@ -38,9 +38,9 @@ describe("test create function", () => { // verify if user address is created in db const addressForContactCreated = await prisma.addresses.findUnique({ where: { uuid: contactCreated?.address_uuid } }); - expect(addressForContactCreated?.address).toEqual(user.contact.address.address); - expect(addressForContactCreated?.zip_code).toEqual(user.contact.address.zip_code); - expect(addressForContactCreated?.city).toEqual(user.contact.address.city); + expect(addressForContactCreated?.address).toEqual(user.contact.address?.address); + expect(addressForContactCreated?.zip_code).toEqual(user.contact.address?.zip_code); + expect(addressForContactCreated?.city).toEqual(user.contact.address?.city); // verify if user office is created in db const officeCreated = await prisma.offices.findUnique({ where: { uuid: userCreated.office_uuid } }); @@ -107,9 +107,9 @@ describe("test create function", () => { // verify if user_ address is created in db const addressForContactCreated = await prisma.addresses.findUnique({ where: { uuid: contactCreated?.address_uuid } }); - expect(addressForContactCreated?.address).toEqual(user.contact.address.address); - expect(addressForContactCreated?.zip_code).toEqual(user.contact.address.zip_code); - expect(addressForContactCreated?.city).toEqual(user.contact.address.city); + expect(addressForContactCreated?.address).toEqual(user.contact.address?.address); + expect(addressForContactCreated?.zip_code).toEqual(user.contact.address?.zip_code); + expect(addressForContactCreated?.city).toEqual(user.contact.address?.city); // verify if user joined the existing office const officeJoined = await prisma.offices.findUnique({ where: { uuid: userCreated.office_uuid } }); @@ -146,9 +146,9 @@ describe("test update function", () => { // verify if user_ address is created in db const addressForExistingContact = await prisma.addresses.findUnique({ where: { uuid: existingContact?.address_uuid } }); - expect(addressForExistingContact?.address).toEqual(user_.contact.address.address); - expect(addressForExistingContact?.zip_code).toEqual(user_.contact.address.zip_code); - expect(addressForExistingContact?.city).toEqual(user_.contact.address.city); + expect(addressForExistingContact?.address).toEqual(user_.contact.address?.address); + expect(addressForExistingContact?.zip_code).toEqual(user_.contact.address?.zip_code); + expect(addressForExistingContact?.city).toEqual(user_.contact.address?.city); // verify if user_ joined the new office const officeCreated = await prisma.offices.findUnique({ where: { uuid: updatedUser.office_uuid } }); From edfc585d5259e7601dd50e8931e17463e334e387 Mon Sep 17 00:00:00 2001 From: OxSaitama Date: Mon, 17 Apr 2023 18:35:19 +0200 Subject: [PATCH 19/72] add include query parameter to findOneByUid --- init-data.sh | 3 +- package-lock.json | 3948 +---------------- package.json | 12 +- .../api/super-admin/CustomersController.ts | 13 +- .../api/super-admin/DeedTypesController.ts | 15 +- src/app/api/super-admin/DeedsController.ts | 2 +- .../super-admin/DocumentTypesController.ts | 17 +- .../api/super-admin/DocumentsController.ts | 17 +- .../super-admin/OfficeFoldersController.ts | 19 +- src/app/api/super-admin/OfficesController.ts | 15 +- src/app/api/super-admin/UsersController.ts | 24 +- .../20230321102005_v0/migration.sql | 413 -- .../migration.sql | 92 - .../20230324130335_20230324_v2/migration.sql | 2 - .../20230324171729_v3/migration.sql | 119 - .../20230328095747_v4/migration.sql | 8 - .../20230329084446_v5/migration.sql | 8 - .../20230329145139_v6/migration.sql | 15 - .../20230330150236_v8/migration.sql | 24 - .../20230417100704_v9/migration.sql | 20 - .../20230421130524_v10/migration.sql | 2 - .../20230426144239_init/migration.sql | 445 ++ src/common/databases/schema.prisma | 158 +- src/common/databases/seeders/seeder.ts | 276 +- src/common/helpers/ObjectHydrate.ts | 4 +- .../repositories/AddressesRepository.ts | 2 +- src/common/repositories/ContactsRepository.ts | 2 +- .../repositories/CustomersRepository.ts | 16 +- .../DeedTypesHasDocumentTypesRepository.ts | 2 +- .../repositories/DeedTypesRepository.ts | 29 +- .../DeedsHasDocumentTypesRepository.ts | 2 +- src/common/repositories/DeedsRepository.ts | 14 +- .../repositories/DocumentTypesRepository.ts | 24 +- .../repositories/DocumentsRepository.ts | 35 +- src/common/repositories/FilesRepository.ts | 8 +- .../OfficeFoldersHasCustomerRepository.ts | 2 +- .../OfficeFoldersHasStakeholderRepository.ts | 2 +- .../repositories/OfficeFoldersRepository.ts | 34 +- src/common/repositories/OfficesRepository.ts | 21 +- src/common/repositories/UsersRepository.ts | 16 +- .../AddressesService/AddressesService.ts | 4 +- .../ContactsService/ContactsService.ts | 4 +- .../CustomersService/CustomersService.ts | 4 +- .../DeedTypesService/DeedTypesService.ts | 4 +- .../super-admin/DeedsService/DeedsService.ts | 4 +- .../DocumentTypesService.ts | 4 +- .../DocumentsService/DocumentsService.ts | 4 +- .../OfficeFoldersService.ts | 8 +- .../OfficesService/OfficesService.ts | 4 +- .../super-admin/UsersService/UsersService.ts | 8 +- src/test/config/Init.ts | 6 +- .../super-admin/CustomersService.test.ts | 18 +- .../services/super-admin/DeedService.test.ts | 34 +- .../super-admin/DeedTypesService.test.ts | 80 +- .../super-admin/DocumentTypesService.test.ts | 68 +- .../super-admin/OfficeFolderService.test.ts | 130 +- .../services/super-admin/UsersService.test.ts | 34 +- 57 files changed, 1143 insertions(+), 5155 deletions(-) mode change 100644 => 100755 init-data.sh delete mode 100644 src/common/databases/migrations/20230321102005_v0/migration.sql delete mode 100644 src/common/databases/migrations/20230324125436_20230324102005_v1/migration.sql delete mode 100644 src/common/databases/migrations/20230324130335_20230324_v2/migration.sql delete mode 100644 src/common/databases/migrations/20230324171729_v3/migration.sql delete mode 100644 src/common/databases/migrations/20230328095747_v4/migration.sql delete mode 100644 src/common/databases/migrations/20230329084446_v5/migration.sql delete mode 100644 src/common/databases/migrations/20230329145139_v6/migration.sql delete mode 100644 src/common/databases/migrations/20230330150236_v8/migration.sql delete mode 100644 src/common/databases/migrations/20230417100704_v9/migration.sql delete mode 100644 src/common/databases/migrations/20230421130524_v10/migration.sql create mode 100644 src/common/databases/migrations/20230426144239_init/migration.sql diff --git a/init-data.sh b/init-data.sh old mode 100644 new mode 100755 index 337cb03f..552a9078 --- a/init-data.sh +++ b/init-data.sh @@ -8,9 +8,8 @@ set -e; if [ -n "${DATABASE_USERNAME:-}" ] && [ -n "${DATABASE_PASSWORD:-}" ]; then psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL - CREATE DATABASE ${DATABASE_NAME}; CREATE USER ${DATABASE_USERNAME} WITH PASSWORD '${DATABASE_PASSWORD}'; - GRANT ALL PRIVILEGES ON DATABASE ${DATABASE_NAME} TO ${DATABASE_USERNAME}; + ALTER USER ${DATABASE_USERNAME} CREATEDB; EOSQL else echo "SETUP INFO: No Environment variables given!" diff --git a/package-lock.json b/package-lock.json index 936d360e..f20818b1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,7 +1,7 @@ { "name": "lecoffre-back", "version": "1.0.0", - "lockfileVersion": 2, + "lockfileVersion": 3, "requires": true, "packages": { "": { @@ -14,10 +14,9 @@ "class-validator": "^0.14.0", "classnames": "^2.3.2", "cors": "^2.8.5", - "dotenv": "^16.0.3", "express": "^4.18.2", "jsonwebtoken": "^9.0.0", - "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.21", + "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.24", "module-alias": "^2.2.2", "next": "^13.1.5", "node-cache": "^5.1.2", @@ -38,6 +37,7 @@ "@types/node": "^18.11.18", "@types/node-schedule": "^2.1.0", "@types/uuid": "^9.0.0", + "dotenv": "^16.0.3", "jest": "^29.5.0", "nodemon": "^2.0.20", "prettier": "2.8.4", @@ -1295,9 +1295,9 @@ } }, "node_modules/@types/babel__traverse": { - "version": "7.18.3", - "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.18.3.tgz", - "integrity": "sha512-1kbcJ40lLB7MHsj39U4Sh1uTd2E7rLEa79kmDpI6cy+XiXsteB3POdQomoq4FxszMrO3ZYchkhYJw7A2862b3w==", + "version": "7.18.4", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.18.4.tgz", + "integrity": "sha512-TLG7CsGZZmX9aDF78UuJxnNTfQyRUFU0OYIVyIblr0/wd/HvsIo8wmuB90CszeD2MtLLAE9Tt4cWvk+KVkyGIw==", "dev": true, "dependencies": { "@babel/types": "^7.3.0" @@ -1344,14 +1344,15 @@ } }, "node_modules/@types/express-serve-static-core": { - "version": "4.17.33", - "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.33.tgz", - "integrity": "sha512-TPBqmR/HRYI3eC2E5hmiivIzv+bidAfXofM+sbonAGvyDhySGw9/PQZFt2BLOrjUUR++4eJVpx6KnLQK1Fk9tA==", + "version": "4.17.34", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.34.tgz", + "integrity": "sha512-fvr49XlCGoUj2Pp730AItckfjat4WNb0lb3kfrLWffd+RLeoGAMsq7UOy04PAPtoL01uKwcp6u8nhzpgpDYr3w==", "dev": true, "dependencies": { "@types/node": "*", "@types/qs": "*", - "@types/range-parser": "*" + "@types/range-parser": "*", + "@types/send": "*" } }, "node_modules/@types/graceful-fs": { @@ -1407,15 +1408,15 @@ } }, "node_modules/@types/mime": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@types/mime/-/mime-3.0.1.tgz", - "integrity": "sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.2.tgz", + "integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw==", "dev": true }, "node_modules/@types/node": { - "version": "18.16.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.0.tgz", - "integrity": "sha512-BsAaKhB+7X+H4GnSjGhJG9Qi8Tw+inU9nJDwmD5CgOmBLEI6ArdhikpLX7DjbjDRDTbqZzU2LSQNZg8WGPiSZQ==" + "version": "18.16.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.1.tgz", + "integrity": "sha512-DZxSZWXxFfOlx7k7Rv4LAyiMroaxa3Ly/7OOzZO8cBNho0YzAi4qlbrx8W27JGqG57IgR/6J7r+nOJWw6kcvZA==" }, "node_modules/@types/node-schedule": { "version": "2.1.0", @@ -1444,6 +1445,16 @@ "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==", "dev": true }, + "node_modules/@types/send": { + "version": "0.17.1", + "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.1.tgz", + "integrity": "sha512-Cwo8LE/0rnvX7kIIa3QHCkcuF21c05Ayb0ZfxPiv0W8VRiZiNW/WuRupHKpqqGVGf7SUA44QSOUKaEd9lIrd/Q==", + "dev": true, + "dependencies": { + "@types/mime": "^1", + "@types/node": "*" + } + }, "node_modules/@types/serve-static": { "version": "1.15.1", "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.1.tgz", @@ -2183,6 +2194,7 @@ "version": "16.0.3", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz", "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==", + "dev": true, "engines": { "node": ">=12" } @@ -2201,9 +2213,9 @@ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" }, "node_modules/electron-to-chromium": { - "version": "1.4.371", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.371.tgz", - "integrity": "sha512-jlBzY4tFcJaiUjzhRTCWAqRvTO/fWzjA3Bls0mykzGZ7zvcMP7h05W6UcgzfT9Ca1SW2xyKDOFRyI0pQeRNZGw==", + "version": "1.4.372", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.372.tgz", + "integrity": "sha512-MrlFq/j+TYHOjeWsWGYfzevc25HNeJdsF6qaLFrqBTRWZQtWkb1myq/Q2veLWezVaa5OcSZ99CFwTT4aF4Mung==", "dev": true }, "node_modules/emittery": { @@ -3603,7 +3615,7 @@ } }, "node_modules/le-coffre-resources": { - "resolved": "git+ssh://git@github.com/smart-chain-fr/leCoffre-resources.git#7f6d31080e8903998f6e5a687ead5635999d52eb", + "resolved": "git+ssh://git@github.com/smart-chain-fr/leCoffre-resources.git#0e3dfd0c6e4bfdf2ef78ba13c79ac213c34ab174", "license": "MIT", "dependencies": { "class-transformer": "^0.5.1", @@ -5325,3901 +5337,5 @@ "url": "https://github.com/sponsors/sindresorhus" } } - }, - "dependencies": { - "@ampproject/remapping": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz", - "integrity": "sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==", - "dev": true, - "requires": { - "@jridgewell/gen-mapping": "^0.3.0", - "@jridgewell/trace-mapping": "^0.3.9" - } - }, - "@babel/code-frame": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.21.4.tgz", - "integrity": "sha512-LYvhNKfwWSPpocw8GI7gpK2nq3HSDuEPC/uSYaALSJu9xjsalaaYFOq0Pwt5KmVqwEbZlDu81aLXwBOmD/Fv9g==", - "dev": true, - "requires": { - "@babel/highlight": "^7.18.6" - } - }, - "@babel/compat-data": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.21.4.tgz", - "integrity": "sha512-/DYyDpeCfaVinT40FPGdkkb+lYSKvsVuMjDAG7jPOWWiM1ibOaB9CXJAlc4d1QpP/U2q2P9jbrSlClKSErd55g==", - "dev": true - }, - "@babel/core": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.21.4.tgz", - "integrity": "sha512-qt/YV149Jman/6AfmlxJ04LMIu8bMoyl3RB91yTFrxQmgbrSvQMy7cI8Q62FHx1t8wJ8B5fu0UDoLwHAhUo1QA==", - "dev": true, - "requires": { - "@ampproject/remapping": "^2.2.0", - "@babel/code-frame": "^7.21.4", - "@babel/generator": "^7.21.4", - "@babel/helper-compilation-targets": "^7.21.4", - "@babel/helper-module-transforms": "^7.21.2", - "@babel/helpers": "^7.21.0", - "@babel/parser": "^7.21.4", - "@babel/template": "^7.20.7", - "@babel/traverse": "^7.21.4", - "@babel/types": "^7.21.4", - "convert-source-map": "^1.7.0", - "debug": "^4.1.0", - "gensync": "^1.0.0-beta.2", - "json5": "^2.2.2", - "semver": "^6.3.0" - }, - "dependencies": { - "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==", - "dev": true - }, - "debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - } - } - }, - "@babel/generator": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.21.4.tgz", - "integrity": "sha512-NieM3pVIYW2SwGzKoqfPrQsf4xGs9M9AIG3ThppsSRmO+m7eQhmI6amajKMUeIO37wFfsvnvcxQFx6x6iqxDnA==", - "dev": true, - "requires": { - "@babel/types": "^7.21.4", - "@jridgewell/gen-mapping": "^0.3.2", - "@jridgewell/trace-mapping": "^0.3.17", - "jsesc": "^2.5.1" - } - }, - "@babel/helper-compilation-targets": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.21.4.tgz", - "integrity": "sha512-Fa0tTuOXZ1iL8IeDFUWCzjZcn+sJGd9RZdH9esYVjEejGmzf+FFYQpMi/kZUk2kPy/q1H3/GPw7np8qar/stfg==", - "dev": true, - "requires": { - "@babel/compat-data": "^7.21.4", - "@babel/helper-validator-option": "^7.21.0", - "browserslist": "^4.21.3", - "lru-cache": "^5.1.1", - "semver": "^6.3.0" - } - }, - "@babel/helper-environment-visitor": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz", - "integrity": "sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==", - "dev": true - }, - "@babel/helper-function-name": { - "version": "7.21.0", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.21.0.tgz", - "integrity": "sha512-HfK1aMRanKHpxemaY2gqBmL04iAPOPRj7DxtNbiDOrJK+gdwkiNRVpCpUJYbUT+aZyemKN8brqTOxzCaG6ExRg==", - "dev": true, - "requires": { - "@babel/template": "^7.20.7", - "@babel/types": "^7.21.0" - } - }, - "@babel/helper-hoist-variables": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz", - "integrity": "sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==", - "dev": true, - "requires": { - "@babel/types": "^7.18.6" - } - }, - "@babel/helper-module-imports": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.21.4.tgz", - "integrity": "sha512-orajc5T2PsRYUN3ZryCEFeMDYwyw09c/pZeaQEZPH0MpKzSvn3e0uXsDBu3k03VI+9DBiRo+l22BfKTpKwa/Wg==", - "dev": true, - "requires": { - "@babel/types": "^7.21.4" - } - }, - "@babel/helper-module-transforms": { - "version": "7.21.2", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.21.2.tgz", - "integrity": "sha512-79yj2AR4U/Oqq/WOV7Lx6hUjau1Zfo4cI+JLAVYeMV5XIlbOhmjEk5ulbTc9fMpmlojzZHkUUxAiK+UKn+hNQQ==", - "dev": true, - "requires": { - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-module-imports": "^7.18.6", - "@babel/helper-simple-access": "^7.20.2", - "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/helper-validator-identifier": "^7.19.1", - "@babel/template": "^7.20.7", - "@babel/traverse": "^7.21.2", - "@babel/types": "^7.21.2" - } - }, - "@babel/helper-plugin-utils": { - "version": "7.20.2", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.20.2.tgz", - "integrity": "sha512-8RvlJG2mj4huQ4pZ+rU9lqKi9ZKiRmuvGuM2HlWmkmgOhbs6zEAw6IEiJ5cQqGbDzGZOhwuOQNtZMi/ENLjZoQ==", - "dev": true - }, - "@babel/helper-simple-access": { - "version": "7.20.2", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.20.2.tgz", - "integrity": "sha512-+0woI/WPq59IrqDYbVGfshjT5Dmk/nnbdpcF8SnMhhXObpTq2KNBdLFRFrkVdbDOyUmHBCxzm5FHV1rACIkIbA==", - "dev": true, - "requires": { - "@babel/types": "^7.20.2" - } - }, - "@babel/helper-split-export-declaration": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz", - "integrity": "sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==", - "dev": true, - "requires": { - "@babel/types": "^7.18.6" - } - }, - "@babel/helper-string-parser": { - "version": "7.19.4", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz", - "integrity": "sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==", - "dev": true - }, - "@babel/helper-validator-identifier": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", - "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", - "dev": true - }, - "@babel/helper-validator-option": { - "version": "7.21.0", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.21.0.tgz", - "integrity": "sha512-rmL/B8/f0mKS2baE9ZpyTcTavvEuWhTTW8amjzXNvYG4AwBsqTLikfXsEofsJEfKHf+HQVQbFOHy6o+4cnC/fQ==", - "dev": true - }, - "@babel/helpers": { - "version": "7.21.0", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.21.0.tgz", - "integrity": "sha512-XXve0CBtOW0pd7MRzzmoyuSj0e3SEzj8pgyFxnTT1NJZL38BD1MK7yYrm8yefRPIDvNNe14xR4FdbHwpInD4rA==", - "dev": true, - "requires": { - "@babel/template": "^7.20.7", - "@babel/traverse": "^7.21.0", - "@babel/types": "^7.21.0" - } - }, - "@babel/highlight": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", - "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", - "dev": true, - "requires": { - "@babel/helper-validator-identifier": "^7.18.6", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "@babel/parser": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.21.4.tgz", - "integrity": "sha512-alVJj7k7zIxqBZ7BTRhz0IqJFxW1VJbm6N8JbcYhQ186df9ZBPbZBmWSqAMXwHGsCJdYks7z/voa3ibiS5bCIw==", - "dev": true - }, - "@babel/plugin-syntax-async-generators": { - "version": "7.8.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", - "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-bigint": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", - "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-class-properties": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", - "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.12.13" - } - }, - "@babel/plugin-syntax-import-meta": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", - "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-syntax-json-strings": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", - "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-jsx": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.21.4.tgz", - "integrity": "sha512-5hewiLct5OKyh6PLKEYaFclcqtIgCb6bmELouxjF6up5q3Sov7rOayW4RwhbaBL0dit8rA80GNfY+UuDp2mBbQ==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.20.2" - } - }, - "@babel/plugin-syntax-logical-assignment-operators": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", - "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-syntax-nullish-coalescing-operator": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", - "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-numeric-separator": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", - "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-syntax-object-rest-spread": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", - "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-optional-catch-binding": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", - "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-optional-chaining": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", - "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-top-level-await": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", - "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-syntax-typescript": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.21.4.tgz", - "integrity": "sha512-xz0D39NvhQn4t4RNsHmDnnsaQizIlUkdtYvLs8La1BlfjQ6JEwxkJGeqJMW2tAXx+q6H+WFuUTXNdYVpEya0YA==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.20.2" - } - }, - "@babel/template": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.20.7.tgz", - "integrity": "sha512-8SegXApWe6VoNw0r9JHpSteLKTpTiLZ4rMlGIm9JQ18KiCtyQiAMEazujAHrUS5flrcqYZa75ukev3P6QmUwUw==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.18.6", - "@babel/parser": "^7.20.7", - "@babel/types": "^7.20.7" - } - }, - "@babel/traverse": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.21.4.tgz", - "integrity": "sha512-eyKrRHKdyZxqDm+fV1iqL9UAHMoIg0nDaGqfIOd8rKH17m5snv7Gn4qgjBoFfLz9APvjFU/ICT00NVCv1Epp8Q==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.21.4", - "@babel/generator": "^7.21.4", - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.21.0", - "@babel/helper-hoist-variables": "^7.18.6", - "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.21.4", - "@babel/types": "^7.21.4", - "debug": "^4.1.0", - "globals": "^11.1.0" - }, - "dependencies": { - "debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - } - } - }, - "@babel/types": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.21.4.tgz", - "integrity": "sha512-rU2oY501qDxE8Pyo7i/Orqma4ziCOrby0/9mvbDUGEfvZjb279Nk9k19e2fiCxHbRRpY2ZyrgW1eq22mvmOIzA==", - "dev": true, - "requires": { - "@babel/helper-string-parser": "^7.19.4", - "@babel/helper-validator-identifier": "^7.19.1", - "to-fast-properties": "^2.0.0" - } - }, - "@bcoe/v8-coverage": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", - "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", - "dev": true - }, - "@cspotcode/source-map-support": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", - "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", - "requires": { - "@jridgewell/trace-mapping": "0.3.9" - }, - "dependencies": { - "@jridgewell/trace-mapping": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", - "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", - "requires": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" - } - } - } - }, - "@istanbuljs/load-nyc-config": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", - "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", - "dev": true, - "requires": { - "camelcase": "^5.3.1", - "find-up": "^4.1.0", - "get-package-type": "^0.1.0", - "js-yaml": "^3.13.1", - "resolve-from": "^5.0.0" - } - }, - "@istanbuljs/schema": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", - "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", - "dev": true - }, - "@jest/console": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.5.0.tgz", - "integrity": "sha512-NEpkObxPwyw/XxZVLPmAGKE89IQRp4puc6IQRPru6JKd1M3fW9v1xM1AnzIJE65hbCkzQAdnL8P47e9hzhiYLQ==", - "dev": true, - "requires": { - "@jest/types": "^29.5.0", - "@types/node": "*", - "chalk": "^4.0.0", - "jest-message-util": "^29.5.0", - "jest-util": "^29.5.0", - "slash": "^3.0.0" - } - }, - "@jest/core": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.5.0.tgz", - "integrity": "sha512-28UzQc7ulUrOQw1IsN/kv1QES3q2kkbl/wGslyhAclqZ/8cMdB5M68BffkIdSJgKBUt50d3hbwJ92XESlE7LiQ==", - "dev": true, - "requires": { - "@jest/console": "^29.5.0", - "@jest/reporters": "^29.5.0", - "@jest/test-result": "^29.5.0", - "@jest/transform": "^29.5.0", - "@jest/types": "^29.5.0", - "@types/node": "*", - "ansi-escapes": "^4.2.1", - "chalk": "^4.0.0", - "ci-info": "^3.2.0", - "exit": "^0.1.2", - "graceful-fs": "^4.2.9", - "jest-changed-files": "^29.5.0", - "jest-config": "^29.5.0", - "jest-haste-map": "^29.5.0", - "jest-message-util": "^29.5.0", - "jest-regex-util": "^29.4.3", - "jest-resolve": "^29.5.0", - "jest-resolve-dependencies": "^29.5.0", - "jest-runner": "^29.5.0", - "jest-runtime": "^29.5.0", - "jest-snapshot": "^29.5.0", - "jest-util": "^29.5.0", - "jest-validate": "^29.5.0", - "jest-watcher": "^29.5.0", - "micromatch": "^4.0.4", - "pretty-format": "^29.5.0", - "slash": "^3.0.0", - "strip-ansi": "^6.0.0" - } - }, - "@jest/environment": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.5.0.tgz", - "integrity": "sha512-5FXw2+wD29YU1d4I2htpRX7jYnAyTRjP2CsXQdo9SAM8g3ifxWPSV0HnClSn71xwctr0U3oZIIH+dtbfmnbXVQ==", - "dev": true, - "requires": { - "@jest/fake-timers": "^29.5.0", - "@jest/types": "^29.5.0", - "@types/node": "*", - "jest-mock": "^29.5.0" - } - }, - "@jest/expect": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.5.0.tgz", - "integrity": "sha512-PueDR2HGihN3ciUNGr4uelropW7rqUfTiOn+8u0leg/42UhblPxHkfoh0Ruu3I9Y1962P3u2DY4+h7GVTSVU6g==", - "dev": true, - "requires": { - "expect": "^29.5.0", - "jest-snapshot": "^29.5.0" - } - }, - "@jest/expect-utils": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.5.0.tgz", - "integrity": "sha512-fmKzsidoXQT2KwnrwE0SQq3uj8Z763vzR8LnLBwC2qYWEFpjX8daRsk6rHUM1QvNlEW/UJXNXm59ztmJJWs2Mg==", - "dev": true, - "requires": { - "jest-get-type": "^29.4.3" - } - }, - "@jest/fake-timers": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.5.0.tgz", - "integrity": "sha512-9ARvuAAQcBwDAqOnglWq2zwNIRUDtk/SCkp/ToGEhFv5r86K21l+VEs0qNTaXtyiY0lEePl3kylijSYJQqdbDg==", - "dev": true, - "requires": { - "@jest/types": "^29.5.0", - "@sinonjs/fake-timers": "^10.0.2", - "@types/node": "*", - "jest-message-util": "^29.5.0", - "jest-mock": "^29.5.0", - "jest-util": "^29.5.0" - } - }, - "@jest/globals": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.5.0.tgz", - "integrity": "sha512-S02y0qMWGihdzNbUiqSAiKSpSozSuHX5UYc7QbnHP+D9Lyw8DgGGCinrN9uSuHPeKgSSzvPom2q1nAtBvUsvPQ==", - "dev": true, - "requires": { - "@jest/environment": "^29.5.0", - "@jest/expect": "^29.5.0", - "@jest/types": "^29.5.0", - "jest-mock": "^29.5.0" - } - }, - "@jest/reporters": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.5.0.tgz", - "integrity": "sha512-D05STXqj/M8bP9hQNSICtPqz97u7ffGzZu+9XLucXhkOFBqKcXe04JLZOgIekOxdb73MAoBUFnqvf7MCpKk5OA==", - "dev": true, - "requires": { - "@bcoe/v8-coverage": "^0.2.3", - "@jest/console": "^29.5.0", - "@jest/test-result": "^29.5.0", - "@jest/transform": "^29.5.0", - "@jest/types": "^29.5.0", - "@jridgewell/trace-mapping": "^0.3.15", - "@types/node": "*", - "chalk": "^4.0.0", - "collect-v8-coverage": "^1.0.0", - "exit": "^0.1.2", - "glob": "^7.1.3", - "graceful-fs": "^4.2.9", - "istanbul-lib-coverage": "^3.0.0", - "istanbul-lib-instrument": "^5.1.0", - "istanbul-lib-report": "^3.0.0", - "istanbul-lib-source-maps": "^4.0.0", - "istanbul-reports": "^3.1.3", - "jest-message-util": "^29.5.0", - "jest-util": "^29.5.0", - "jest-worker": "^29.5.0", - "slash": "^3.0.0", - "string-length": "^4.0.1", - "strip-ansi": "^6.0.0", - "v8-to-istanbul": "^9.0.1" - } - }, - "@jest/schemas": { - "version": "29.4.3", - "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.4.3.tgz", - "integrity": "sha512-VLYKXQmtmuEz6IxJsrZwzG9NvtkQsWNnWMsKxqWNu3+CnfzJQhp0WDDKWLVV9hLKr0l3SLLFRqcYHjhtyuDVxg==", - "dev": true, - "requires": { - "@sinclair/typebox": "^0.25.16" - } - }, - "@jest/source-map": { - "version": "29.4.3", - "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.4.3.tgz", - "integrity": "sha512-qyt/mb6rLyd9j1jUts4EQncvS6Yy3PM9HghnNv86QBlV+zdL2inCdK1tuVlL+J+lpiw2BI67qXOrX3UurBqQ1w==", - "dev": true, - "requires": { - "@jridgewell/trace-mapping": "^0.3.15", - "callsites": "^3.0.0", - "graceful-fs": "^4.2.9" - } - }, - "@jest/test-result": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.5.0.tgz", - "integrity": "sha512-fGl4rfitnbfLsrfx1uUpDEESS7zM8JdgZgOCQuxQvL1Sn/I6ijeAVQWGfXI9zb1i9Mzo495cIpVZhA0yr60PkQ==", - "dev": true, - "requires": { - "@jest/console": "^29.5.0", - "@jest/types": "^29.5.0", - "@types/istanbul-lib-coverage": "^2.0.0", - "collect-v8-coverage": "^1.0.0" - } - }, - "@jest/test-sequencer": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.5.0.tgz", - "integrity": "sha512-yPafQEcKjkSfDXyvtgiV4pevSeyuA6MQr6ZIdVkWJly9vkqjnFfcfhRQqpD5whjoU8EORki752xQmjaqoFjzMQ==", - "dev": true, - "requires": { - "@jest/test-result": "^29.5.0", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.5.0", - "slash": "^3.0.0" - } - }, - "@jest/transform": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.5.0.tgz", - "integrity": "sha512-8vbeZWqLJOvHaDfeMuoHITGKSz5qWc9u04lnWrQE3VyuSw604PzQM824ZeX9XSjUCeDiE3GuxZe5UKa8J61NQw==", - "dev": true, - "requires": { - "@babel/core": "^7.11.6", - "@jest/types": "^29.5.0", - "@jridgewell/trace-mapping": "^0.3.15", - "babel-plugin-istanbul": "^6.1.1", - "chalk": "^4.0.0", - "convert-source-map": "^2.0.0", - "fast-json-stable-stringify": "^2.1.0", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.5.0", - "jest-regex-util": "^29.4.3", - "jest-util": "^29.5.0", - "micromatch": "^4.0.4", - "pirates": "^4.0.4", - "slash": "^3.0.0", - "write-file-atomic": "^4.0.2" - } - }, - "@jest/types": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.5.0.tgz", - "integrity": "sha512-qbu7kN6czmVRc3xWFQcAN03RAUamgppVUdXrvl1Wr3jlNF93o9mJbGcDWrwGB6ht44u7efB1qCFgVQmca24Uog==", - "dev": true, - "requires": { - "@jest/schemas": "^29.4.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" - } - }, - "@jridgewell/gen-mapping": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", - "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", - "dev": true, - "requires": { - "@jridgewell/set-array": "^1.0.1", - "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.9" - } - }, - "@jridgewell/resolve-uri": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", - "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==" - }, - "@jridgewell/set-array": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", - "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", - "dev": true - }, - "@jridgewell/sourcemap-codec": { - "version": "1.4.15", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", - "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==" - }, - "@jridgewell/trace-mapping": { - "version": "0.3.18", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz", - "integrity": "sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==", - "dev": true, - "requires": { - "@jridgewell/resolve-uri": "3.1.0", - "@jridgewell/sourcemap-codec": "1.4.14" - }, - "dependencies": { - "@jridgewell/sourcemap-codec": { - "version": "1.4.14", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", - "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", - "dev": true - } - } - }, - "@next/env": { - "version": "13.3.1", - "resolved": "https://registry.npmjs.org/@next/env/-/env-13.3.1.tgz", - "integrity": "sha512-EDtCoedIZC7JlUQ3uaQpSc4aVmyhbLHmQVALg7pFfQgOTjgSnn7mKtA0DiCMkYvvsx6aFb5octGMtWrOtGXW9A==" - }, - "@next/swc-darwin-arm64": { - "version": "13.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.3.1.tgz", - "integrity": "sha512-UXPtriEc/pBP8luSLSCZBcbzPeVv+SSjs9cH/KygTbhmACye8/OOXRZO13Z2Wq1G0gLmEAIHQAOuF+vafPd2lw==", - "optional": true - }, - "@next/swc-darwin-x64": { - "version": "13.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.3.1.tgz", - "integrity": "sha512-lT36yYxosCfLtplFzJWgo0hrPu6/do8+msgM7oQkPeohDNdhjtjFUgOOwdSnPublLR6Mo2Ym4P/wl5OANuD2bw==", - "optional": true - }, - "@next/swc-linux-arm64-gnu": { - "version": "13.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.3.1.tgz", - "integrity": "sha512-wRb76nLWJhonH8s3kxC/1tFguEkeOPayIwe9mkaz1G/yeS3OrjeyKMJsb4+Kdg0zbTo53bNCOl59NNtDM7yyyw==", - "optional": true - }, - "@next/swc-linux-arm64-musl": { - "version": "13.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.3.1.tgz", - "integrity": "sha512-qz3BzjJRZ16Iq/jrp+pjiYOc0jTjHlfmxQmZk9x/+5uhRP6/eWQSTAPVJ33BMo6oK5O5N4644OgTAbzXzorecg==", - "optional": true - }, - "@next/swc-linux-x64-gnu": { - "version": "13.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.3.1.tgz", - "integrity": "sha512-6mgkLmwlyWlomQmpl21I3hxgqE5INoW4owTlcLpNsd1V4wP+J46BlI/5zV5KWWbzjfncIqzXoeGs5Eg+1GHODA==", - "optional": true - }, - "@next/swc-linux-x64-musl": { - "version": "13.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.3.1.tgz", - "integrity": "sha512-uqm5sielhQmKJM+qayIhgZv1KlS5pqTdQ99b+Z7hMWryXS96qE0DftTmMZowBcUL6x7s2vSXyH5wPtO1ON7LBg==", - "optional": true - }, - "@next/swc-win32-arm64-msvc": { - "version": "13.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.3.1.tgz", - "integrity": "sha512-WomIiTj/v3LevltlibNQKmvrOymNRYL+a0dp5R73IwPWN5FvXWwSELN/kiNALig/+T3luc4qHNTyvMCp9L6U5Q==", - "optional": true - }, - "@next/swc-win32-ia32-msvc": { - "version": "13.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.3.1.tgz", - "integrity": "sha512-M+PoH+0+q658wRUbs285RIaSTYnGBSTdweH/0CdzDgA6Q4rBM0sQs4DHmO3BPP0ltCO/vViIoyG7ks66XmCA5g==", - "optional": true - }, - "@next/swc-win32-x64-msvc": { - "version": "13.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.3.1.tgz", - "integrity": "sha512-Sl1F4Vp5Z1rNXWZYqJwMuWRRol4bqOB6+/d7KqkgQ4AcafKPN1PZmpkCoxv4UFHtFNIB7EotnuIhtXu3zScicQ==", - "optional": true - }, - "@prisma/client": { - "version": "4.13.0", - "resolved": "https://registry.npmjs.org/@prisma/client/-/client-4.13.0.tgz", - "integrity": "sha512-YaiiICcRB2hatxsbnfB66uWXjcRw3jsZdlAVxmx0cFcTc/Ad/sKdHCcWSnqyDX47vAewkjRFwiLwrOUjswVvmA==", - "requires": { - "@prisma/engines-version": "4.13.0-50.1e7af066ee9cb95cf3a403c78d9aab3e6b04f37a" - } - }, - "@prisma/engines": { - "version": "4.13.0", - "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-4.13.0.tgz", - "integrity": "sha512-HrniowHRZXHuGT9XRgoXEaP2gJLXM5RMoItaY2PkjvuZ+iHc0Zjbm/302MB8YsPdWozAPHHn+jpFEcEn71OgPw==", - "devOptional": true - }, - "@prisma/engines-version": { - "version": "4.13.0-50.1e7af066ee9cb95cf3a403c78d9aab3e6b04f37a", - "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-4.13.0-50.1e7af066ee9cb95cf3a403c78d9aab3e6b04f37a.tgz", - "integrity": "sha512-fsQlbkhPJf08JOzKoyoD9atdUijuGBekwoOPZC3YOygXEml1MTtgXVpnUNchQlRSY82OQ6pSGQ9PxUe4arcSLQ==" - }, - "@sinclair/typebox": { - "version": "0.25.24", - "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.25.24.tgz", - "integrity": "sha512-XJfwUVUKDHF5ugKwIcxEgc9k8b7HbznCp6eUfWgu710hMPNIO4aw4/zB5RogDQz8nd6gyCDpU9O/m6qYEWY6yQ==", - "dev": true - }, - "@sinonjs/commons": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-2.0.0.tgz", - "integrity": "sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==", - "dev": true, - "requires": { - "type-detect": "4.0.8" - } - }, - "@sinonjs/fake-timers": { - "version": "10.0.2", - "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.0.2.tgz", - "integrity": "sha512-SwUDyjWnah1AaNl7kxsa7cfLhlTYoiyhDAIgyh+El30YvXs/o7OLXpYH88Zdhyx9JExKrmHDJ+10bwIcY80Jmw==", - "dev": true, - "requires": { - "@sinonjs/commons": "^2.0.0" - } - }, - "@swc/helpers": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.0.tgz", - "integrity": "sha512-SjY/p4MmECVVEWspzSRpQEM3sjR17sP8PbGxELWrT+YZMBfiUyt1MRUNjMV23zohwlG2HYtCQOsCwsTHguXkyg==", - "requires": { - "tslib": "^2.4.0" - } - }, - "@tsconfig/node10": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", - "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==" - }, - "@tsconfig/node12": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==" - }, - "@tsconfig/node14": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==" - }, - "@tsconfig/node16": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz", - "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==" - }, - "@types/babel__core": { - "version": "7.20.0", - "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.0.tgz", - "integrity": "sha512-+n8dL/9GWblDO0iU6eZAwEIJVr5DWigtle+Q6HLOrh/pdbXOhOtqzq8VPPE2zvNJzSKY4vH/z3iT3tn0A3ypiQ==", - "dev": true, - "requires": { - "@babel/parser": "^7.20.7", - "@babel/types": "^7.20.7", - "@types/babel__generator": "*", - "@types/babel__template": "*", - "@types/babel__traverse": "*" - } - }, - "@types/babel__generator": { - "version": "7.6.4", - "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.4.tgz", - "integrity": "sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg==", - "dev": true, - "requires": { - "@babel/types": "^7.0.0" - } - }, - "@types/babel__template": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.1.tgz", - "integrity": "sha512-azBFKemX6kMg5Io+/rdGT0dkGreboUVR0Cdm3fz9QJWpaQGJRQXl7C+6hOTCZcMll7KFyEQpgbYI2lHdsS4U7g==", - "dev": true, - "requires": { - "@babel/parser": "^7.1.0", - "@babel/types": "^7.0.0" - } - }, - "@types/babel__traverse": { - "version": "7.18.3", - "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.18.3.tgz", - "integrity": "sha512-1kbcJ40lLB7MHsj39U4Sh1uTd2E7rLEa79kmDpI6cy+XiXsteB3POdQomoq4FxszMrO3ZYchkhYJw7A2862b3w==", - "dev": true, - "requires": { - "@babel/types": "^7.3.0" - } - }, - "@types/body-parser": { - "version": "1.19.2", - "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz", - "integrity": "sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==", - "dev": true, - "requires": { - "@types/connect": "*", - "@types/node": "*" - } - }, - "@types/connect": { - "version": "3.4.35", - "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", - "integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "@types/cors": { - "version": "2.8.13", - "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.13.tgz", - "integrity": "sha512-RG8AStHlUiV5ysZQKq97copd2UmVYw3/pRMLefISZ3S1hK104Cwm7iLQ3fTKx+lsUH2CE8FlLaYeEA2LSeqYUA==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "@types/express": { - "version": "4.17.17", - "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.17.tgz", - "integrity": "sha512-Q4FmmuLGBG58btUnfS1c1r/NQdlp3DMfGDGig8WhfpA2YRUtEkxAjkZb0yvplJGYdF1fsQ81iMDcH24sSCNC/Q==", - "dev": true, - "requires": { - "@types/body-parser": "*", - "@types/express-serve-static-core": "^4.17.33", - "@types/qs": "*", - "@types/serve-static": "*" - } - }, - "@types/express-serve-static-core": { - "version": "4.17.33", - "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.33.tgz", - "integrity": "sha512-TPBqmR/HRYI3eC2E5hmiivIzv+bidAfXofM+sbonAGvyDhySGw9/PQZFt2BLOrjUUR++4eJVpx6KnLQK1Fk9tA==", - "dev": true, - "requires": { - "@types/node": "*", - "@types/qs": "*", - "@types/range-parser": "*" - } - }, - "@types/graceful-fs": { - "version": "4.1.6", - "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.6.tgz", - "integrity": "sha512-Sig0SNORX9fdW+bQuTEovKj3uHcUL6LQKbCrrqb1X7J6/ReAbhCXRAhc+SMejhLELFj2QcyuxmUooZ4bt5ReSw==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "@types/istanbul-lib-coverage": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", - "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", - "dev": true - }, - "@types/istanbul-lib-report": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", - "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "*" - } - }, - "@types/istanbul-reports": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz", - "integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==", - "dev": true, - "requires": { - "@types/istanbul-lib-report": "*" - } - }, - "@types/jest": { - "version": "29.5.1", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.1.tgz", - "integrity": "sha512-tEuVcHrpaixS36w7hpsfLBLpjtMRJUE09/MHXn923LOVojDwyC14cWcfc0rDs0VEfUyYmt/+iX1kxxp+gZMcaQ==", - "dev": true, - "requires": { - "expect": "^29.0.0", - "pretty-format": "^29.0.0" - } - }, - "@types/jsonwebtoken": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-9.0.1.tgz", - "integrity": "sha512-c5ltxazpWabia/4UzhIoaDcIza4KViOQhdbjRlfcIGVnsE3c3brkz9Z+F/EeJIECOQP7W7US2hNE930cWWkPiw==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "@types/mime": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@types/mime/-/mime-3.0.1.tgz", - "integrity": "sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA==", - "dev": true - }, - "@types/node": { - "version": "18.16.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.0.tgz", - "integrity": "sha512-BsAaKhB+7X+H4GnSjGhJG9Qi8Tw+inU9nJDwmD5CgOmBLEI6ArdhikpLX7DjbjDRDTbqZzU2LSQNZg8WGPiSZQ==" - }, - "@types/node-schedule": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@types/node-schedule/-/node-schedule-2.1.0.tgz", - "integrity": "sha512-NiTwl8YN3v/1YCKrDFSmCTkVxFDylueEqsOFdgF+vPsm+AlyJKGAo5yzX1FiOxPsZiN6/r8gJitYx2EaSuBmmg==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "@types/prettier": { - "version": "2.7.2", - "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.2.tgz", - "integrity": "sha512-KufADq8uQqo1pYKVIYzfKbJfBAc0sOeXqGbFaSpv8MRmC/zXgowNZmFcbngndGk922QDmOASEXUZCaY48gs4cg==", - "dev": true - }, - "@types/qs": { - "version": "6.9.7", - "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", - "integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==", - "dev": true - }, - "@types/range-parser": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz", - "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==", - "dev": true - }, - "@types/serve-static": { - "version": "1.15.1", - "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.1.tgz", - "integrity": "sha512-NUo5XNiAdULrJENtJXZZ3fHtfMolzZwczzBbnAeBbqBwG+LaG6YaJtuwzwGSQZ2wsCrxjEhNNjAkKigy3n8teQ==", - "dev": true, - "requires": { - "@types/mime": "*", - "@types/node": "*" - } - }, - "@types/stack-utils": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", - "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==", - "dev": true - }, - "@types/uuid": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.1.tgz", - "integrity": "sha512-rFT3ak0/2trgvp4yYZo5iKFEPsET7vKydKF+VRCxlQ9bpheehyAJH89dAkaLEq/j/RZXJIqcgsmPJKUP1Z28HA==", - "dev": true - }, - "@types/validator": { - "version": "13.7.15", - "resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.7.15.tgz", - "integrity": "sha512-yeinDVQunb03AEP8luErFcyf/7Lf7AzKCD0NXfgVoGCCQDNpZET8Jgq74oBgqKld3hafLbfzt/3inUdQvaFeXQ==" - }, - "@types/yargs": { - "version": "17.0.24", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.24.tgz", - "integrity": "sha512-6i0aC7jV6QzQB8ne1joVZ0eSFIstHsCrobmOtghM11yGlH0j43FKL2UhWdELkyps0zuf7qVTUVCCR+tgSlyLLw==", - "dev": true, - "requires": { - "@types/yargs-parser": "*" - } - }, - "@types/yargs-parser": { - "version": "21.0.0", - "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz", - "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==", - "dev": true - }, - "abbrev": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", - "dev": true - }, - "accepts": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", - "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", - "requires": { - "mime-types": "~2.1.34", - "negotiator": "0.6.3" - } - }, - "acorn": { - "version": "8.8.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", - "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==" - }, - "acorn-walk": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==" - }, - "ansi-escapes": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", - "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", - "dev": true, - "requires": { - "type-fest": "^0.21.3" - } - }, - "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true - }, - "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, - "requires": { - "color-convert": "^2.0.1" - } - }, - "anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dev": true, - "requires": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - } - }, - "arg": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" - }, - "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "requires": { - "sprintf-js": "~1.0.2" - } - }, - "array-flatten": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" - }, - "babel-jest": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.5.0.tgz", - "integrity": "sha512-mA4eCDh5mSo2EcA9xQjVTpmbbNk32Zb3Q3QFQsNhaK56Q+yoXowzFodLux30HRgyOho5rsQ6B0P9QpMkvvnJ0Q==", - "dev": true, - "requires": { - "@jest/transform": "^29.5.0", - "@types/babel__core": "^7.1.14", - "babel-plugin-istanbul": "^6.1.1", - "babel-preset-jest": "^29.5.0", - "chalk": "^4.0.0", - "graceful-fs": "^4.2.9", - "slash": "^3.0.0" - } - }, - "babel-plugin-istanbul": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", - "integrity": "sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.0.0", - "@istanbuljs/load-nyc-config": "^1.0.0", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-instrument": "^5.0.4", - "test-exclude": "^6.0.0" - } - }, - "babel-plugin-jest-hoist": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.5.0.tgz", - "integrity": "sha512-zSuuuAlTMT4mzLj2nPnUm6fsE6270vdOfnpbJ+RmruU75UhLFvL0N2NgI7xpeS7NaB6hGqmd5pVpGTDYvi4Q3w==", - "dev": true, - "requires": { - "@babel/template": "^7.3.3", - "@babel/types": "^7.3.3", - "@types/babel__core": "^7.1.14", - "@types/babel__traverse": "^7.0.6" - } - }, - "babel-preset-current-node-syntax": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz", - "integrity": "sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ==", - "dev": true, - "requires": { - "@babel/plugin-syntax-async-generators": "^7.8.4", - "@babel/plugin-syntax-bigint": "^7.8.3", - "@babel/plugin-syntax-class-properties": "^7.8.3", - "@babel/plugin-syntax-import-meta": "^7.8.3", - "@babel/plugin-syntax-json-strings": "^7.8.3", - "@babel/plugin-syntax-logical-assignment-operators": "^7.8.3", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", - "@babel/plugin-syntax-numeric-separator": "^7.8.3", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", - "@babel/plugin-syntax-optional-chaining": "^7.8.3", - "@babel/plugin-syntax-top-level-await": "^7.8.3" - } - }, - "babel-preset-jest": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.5.0.tgz", - "integrity": "sha512-JOMloxOqdiBSxMAzjRaH023/vvcaSaec49zvg+2LmNsktC7ei39LTJGw02J+9uUtTZUq6xbLyJ4dxe9sSmIuAg==", - "dev": true, - "requires": { - "babel-plugin-jest-hoist": "^29.5.0", - "babel-preset-current-node-syntax": "^1.0.0" - } - }, - "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 - }, - "binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "dev": true - }, - "body-parser": { - "version": "1.20.1", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", - "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", - "requires": { - "bytes": "3.1.2", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "on-finished": "2.4.1", - "qs": "6.11.0", - "raw-body": "2.5.1", - "type-is": "~1.6.18", - "unpipe": "1.0.0" - } - }, - "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, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "requires": { - "fill-range": "^7.0.1" - } - }, - "browserslist": { - "version": "4.21.5", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.5.tgz", - "integrity": "sha512-tUkiguQGW7S3IhB7N+c2MV/HZPSCPAAiYBZXLsBhFB/PCy6ZKKsZrmBayHV9fdGV/ARIfJ14NkxKzRDjvp7L6w==", - "dev": true, - "requires": { - "caniuse-lite": "^1.0.30001449", - "electron-to-chromium": "^1.4.284", - "node-releases": "^2.0.8", - "update-browserslist-db": "^1.0.10" - } - }, - "bs-logger": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz", - "integrity": "sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==", - "dev": true, - "requires": { - "fast-json-stable-stringify": "2.x" - } - }, - "bser": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", - "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", - "dev": true, - "requires": { - "node-int64": "^0.4.0" - } - }, - "buffer-equal-constant-time": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", - "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==" - }, - "buffer-from": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", - "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", - "dev": true - }, - "busboy": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", - "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", - "requires": { - "streamsearch": "^1.1.0" - } - }, - "bytes": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", - "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==" - }, - "call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", - "requires": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" - } - }, - "callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true - }, - "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true - }, - "caniuse-lite": { - "version": "1.0.30001481", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001481.tgz", - "integrity": "sha512-KCqHwRnaa1InZBtqXzP98LPg0ajCVujMKjqKDhZEthIpAsJl/YEIa3YvXjGXPVqzZVguccuu7ga9KOE1J9rKPQ==" - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "char-regex": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz", - "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", - "dev": true - }, - "chokidar": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", - "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", - "dev": true, - "requires": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "fsevents": "~2.3.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - } - }, - "ci-info": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.8.0.tgz", - "integrity": "sha512-eXTggHWSooYhq49F2opQhuHWgzucfF2YgODK4e1566GQs5BIfP30B0oenwBJHfWxAs2fyPB1s7Mg949zLf61Yw==", - "dev": true - }, - "cjs-module-lexer": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.2.tgz", - "integrity": "sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA==", - "dev": true - }, - "class-transformer": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/class-transformer/-/class-transformer-0.5.1.tgz", - "integrity": "sha512-SQa1Ws6hUbfC98vKGxZH3KFY0Y1lm5Zm0SY8XX9zbK7FJCyVEac3ATW0RIpwzW+oOfmHE5PMPufDG9hCfoEOMw==" - }, - "class-validator": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/class-validator/-/class-validator-0.14.0.tgz", - "integrity": "sha512-ct3ltplN8I9fOwUd8GrP8UQixwff129BkEtuWDKL5W45cQuLd19xqmTLu5ge78YDm/fdje6FMt0hGOhl0lii3A==", - "requires": { - "@types/validator": "^13.7.10", - "libphonenumber-js": "^1.10.14", - "validator": "^13.7.0" - } - }, - "classnames": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.3.2.tgz", - "integrity": "sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw==" - }, - "client-only": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", - "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==" - }, - "cliui": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", - "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", - "dev": true, - "requires": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.1", - "wrap-ansi": "^7.0.0" - } - }, - "clone": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", - "integrity": "sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==" - }, - "co": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==", - "dev": true - }, - "collect-v8-coverage": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz", - "integrity": "sha512-iBPtljfCNcTKNAto0KEtDfZ3qzjJvqE3aTGZsbhjSBlorqpXJlaWWtPO35D+ZImoC3KWejX64o+yPGxhWSTzfg==", - "dev": true - }, - "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, - "requires": { - "color-name": "~1.1.4" - } - }, - "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 - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true - }, - "content-disposition": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", - "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", - "requires": { - "safe-buffer": "5.2.1" - } - }, - "content-type": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", - "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==" - }, - "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 - }, - "cookie": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==" - }, - "cookie-signature": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" - }, - "cors": { - "version": "2.8.5", - "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", - "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", - "requires": { - "object-assign": "^4", - "vary": "^1" - } - }, - "create-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==" - }, - "cron-parser": { - "version": "4.8.1", - "resolved": "https://registry.npmjs.org/cron-parser/-/cron-parser-4.8.1.tgz", - "integrity": "sha512-jbokKWGcyU4gl6jAfX97E1gDpY12DJ1cLJZmoDzaAln/shZ+S3KBFBuA2Q6WeUN4gJf/8klnV1EfvhA2lK5IRQ==", - "requires": { - "luxon": "^3.2.1" - } - }, - "cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, - "requires": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - } - }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, - "dedent": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz", - "integrity": "sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA==", - "dev": true - }, - "deepmerge": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", - "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", - "dev": true - }, - "depd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==" - }, - "destroy": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", - "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==" - }, - "detect-newline": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", - "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", - "dev": true - }, - "diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==" - }, - "diff-sequences": { - "version": "29.4.3", - "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.4.3.tgz", - "integrity": "sha512-ofrBgwpPhCD85kMKtE9RYFFq6OC1A89oW2vvgWZNCwxrUpRUILopY7lsYyMDSjc8g6U6aiO0Qubg6r4Wgt5ZnA==", - "dev": true - }, - "dotenv": { - "version": "16.0.3", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz", - "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==" - }, - "ecdsa-sig-formatter": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", - "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" - }, - "electron-to-chromium": { - "version": "1.4.371", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.371.tgz", - "integrity": "sha512-jlBzY4tFcJaiUjzhRTCWAqRvTO/fWzjA3Bls0mykzGZ7zvcMP7h05W6UcgzfT9Ca1SW2xyKDOFRyI0pQeRNZGw==", - "dev": true - }, - "emittery": { - "version": "0.13.1", - "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.13.1.tgz", - "integrity": "sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==", - "dev": true - }, - "emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==" - }, - "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==", - "dev": true, - "requires": { - "is-arrayish": "^0.2.1" - } - }, - "escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true - }, - "escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" - }, - "escape-string-regexp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", - "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", - "dev": true - }, - "esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true - }, - "etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==" - }, - "execa": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", - "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", - "dev": true, - "requires": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.0", - "human-signals": "^2.1.0", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.1", - "onetime": "^5.1.2", - "signal-exit": "^3.0.3", - "strip-final-newline": "^2.0.0" - } - }, - "exit": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", - "integrity": "sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==", - "dev": true - }, - "expect": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/expect/-/expect-29.5.0.tgz", - "integrity": "sha512-yM7xqUrCO2JdpFo4XpM82t+PJBFybdqoQuJLDGeDX2ij8NZzqRHyu3Hp188/JX7SWqud+7t4MUdvcgGBICMHZg==", - "dev": true, - "requires": { - "@jest/expect-utils": "^29.5.0", - "jest-get-type": "^29.4.3", - "jest-matcher-utils": "^29.5.0", - "jest-message-util": "^29.5.0", - "jest-util": "^29.5.0" - } - }, - "express": { - "version": "4.18.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", - "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==", - "requires": { - "accepts": "~1.3.8", - "array-flatten": "1.1.1", - "body-parser": "1.20.1", - "content-disposition": "0.5.4", - "content-type": "~1.0.4", - "cookie": "0.5.0", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "2.0.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "1.2.0", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.7", - "qs": "6.11.0", - "range-parser": "~1.2.1", - "safe-buffer": "5.2.1", - "send": "0.18.0", - "serve-static": "1.15.0", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "type-is": "~1.6.18", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - } - }, - "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 - }, - "fb-watchman": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", - "integrity": "sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==", - "dev": true, - "requires": { - "bser": "2.1.1" - } - }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "finalhandler": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", - "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", - "requires": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "statuses": "2.0.1", - "unpipe": "~1.0.0" - } - }, - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "forwarded": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", - "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==" - }, - "fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==" - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true - }, - "fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "optional": true - }, - "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" - }, - "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 - }, - "get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true - }, - "get-intrinsic": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz", - "integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==", - "requires": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.3" - } - }, - "get-package-type": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", - "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", - "dev": true - }, - "get-stream": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", - "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", - "dev": true - }, - "glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "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, - "requires": { - "is-glob": "^4.0.1" - } - }, - "globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", - "dev": true - }, - "graceful-fs": { - "version": "4.2.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", - "dev": true - }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "requires": { - "function-bind": "^1.1.1" - } - }, - "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 - }, - "has-symbols": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" - }, - "html-escaper": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", - "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", - "dev": true - }, - "http-errors": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", - "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", - "requires": { - "depd": "2.0.0", - "inherits": "2.0.4", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "toidentifier": "1.0.1" - } - }, - "human-signals": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", - "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", - "dev": true - }, - "iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "ignore-by-default": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", - "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", - "dev": true - }, - "import-local": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", - "integrity": "sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==", - "dev": true, - "requires": { - "pkg-dir": "^4.2.0", - "resolve-cwd": "^3.0.0" - } - }, - "imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", - "dev": true - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - }, - "ipaddr.js": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", - "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" - }, - "is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", - "dev": true - }, - "is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "requires": { - "binary-extensions": "^2.0.0" - } - }, - "is-core-module": { - "version": "2.12.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.0.tgz", - "integrity": "sha512-RECHCBCd/viahWmwj6enj19sKbHfJrddi/6cBDsNTKbNq0f7VeaUkBo60BqzvPqo/W54ChS62Z5qyun7cfOMqQ==", - "dev": true, - "requires": { - "has": "^1.0.3" - } - }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true - }, - "is-generator-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", - "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", - "dev": true - }, - "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, - "requires": { - "is-extglob": "^2.1.1" - } - }, - "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 - }, - "is-stream": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", - "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", - "dev": true - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true - }, - "istanbul-lib-coverage": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", - "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==", - "dev": true - }, - "istanbul-lib-instrument": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz", - "integrity": "sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==", - "dev": true, - "requires": { - "@babel/core": "^7.12.3", - "@babel/parser": "^7.14.7", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-coverage": "^3.2.0", - "semver": "^6.3.0" - } - }, - "istanbul-lib-report": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", - "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", - "dev": true, - "requires": { - "istanbul-lib-coverage": "^3.0.0", - "make-dir": "^3.0.0", - "supports-color": "^7.1.0" - } - }, - "istanbul-lib-source-maps": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", - "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", - "dev": true, - "requires": { - "debug": "^4.1.1", - "istanbul-lib-coverage": "^3.0.0", - "source-map": "^0.6.1" - }, - "dependencies": { - "debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - } - } - }, - "istanbul-reports": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.5.tgz", - "integrity": "sha512-nUsEMa9pBt/NOHqbcbeJEgqIlY/K7rVWUX6Lql2orY5e9roQOthbR3vtY4zzf2orPELg80fnxxk9zUyPlgwD1w==", - "dev": true, - "requires": { - "html-escaper": "^2.0.0", - "istanbul-lib-report": "^3.0.0" - } - }, - "jest": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest/-/jest-29.5.0.tgz", - "integrity": "sha512-juMg3he2uru1QoXX078zTa7pO85QyB9xajZc6bU+d9yEGwrKX6+vGmJQ3UdVZsvTEUARIdObzH68QItim6OSSQ==", - "dev": true, - "requires": { - "@jest/core": "^29.5.0", - "@jest/types": "^29.5.0", - "import-local": "^3.0.2", - "jest-cli": "^29.5.0" - } - }, - "jest-changed-files": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.5.0.tgz", - "integrity": "sha512-IFG34IUMUaNBIxjQXF/iu7g6EcdMrGRRxaUSw92I/2g2YC6vCdTltl4nHvt7Ci5nSJwXIkCu8Ka1DKF+X7Z1Ag==", - "dev": true, - "requires": { - "execa": "^5.0.0", - "p-limit": "^3.1.0" - } - }, - "jest-circus": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.5.0.tgz", - "integrity": "sha512-gq/ongqeQKAplVxqJmbeUOJJKkW3dDNPY8PjhJ5G0lBRvu0e3EWGxGy5cI4LAGA7gV2UHCtWBI4EMXK8c9nQKA==", - "dev": true, - "requires": { - "@jest/environment": "^29.5.0", - "@jest/expect": "^29.5.0", - "@jest/test-result": "^29.5.0", - "@jest/types": "^29.5.0", - "@types/node": "*", - "chalk": "^4.0.0", - "co": "^4.6.0", - "dedent": "^0.7.0", - "is-generator-fn": "^2.0.0", - "jest-each": "^29.5.0", - "jest-matcher-utils": "^29.5.0", - "jest-message-util": "^29.5.0", - "jest-runtime": "^29.5.0", - "jest-snapshot": "^29.5.0", - "jest-util": "^29.5.0", - "p-limit": "^3.1.0", - "pretty-format": "^29.5.0", - "pure-rand": "^6.0.0", - "slash": "^3.0.0", - "stack-utils": "^2.0.3" - } - }, - "jest-cli": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.5.0.tgz", - "integrity": "sha512-L1KcP1l4HtfwdxXNFCL5bmUbLQiKrakMUriBEcc1Vfz6gx31ORKdreuWvmQVBit+1ss9NNR3yxjwfwzZNdQXJw==", - "dev": true, - "requires": { - "@jest/core": "^29.5.0", - "@jest/test-result": "^29.5.0", - "@jest/types": "^29.5.0", - "chalk": "^4.0.0", - "exit": "^0.1.2", - "graceful-fs": "^4.2.9", - "import-local": "^3.0.2", - "jest-config": "^29.5.0", - "jest-util": "^29.5.0", - "jest-validate": "^29.5.0", - "prompts": "^2.0.1", - "yargs": "^17.3.1" - } - }, - "jest-config": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.5.0.tgz", - "integrity": "sha512-kvDUKBnNJPNBmFFOhDbm59iu1Fii1Q6SxyhXfvylq3UTHbg6o7j/g8k2dZyXWLvfdKB1vAPxNZnMgtKJcmu3kA==", - "dev": true, - "requires": { - "@babel/core": "^7.11.6", - "@jest/test-sequencer": "^29.5.0", - "@jest/types": "^29.5.0", - "babel-jest": "^29.5.0", - "chalk": "^4.0.0", - "ci-info": "^3.2.0", - "deepmerge": "^4.2.2", - "glob": "^7.1.3", - "graceful-fs": "^4.2.9", - "jest-circus": "^29.5.0", - "jest-environment-node": "^29.5.0", - "jest-get-type": "^29.4.3", - "jest-regex-util": "^29.4.3", - "jest-resolve": "^29.5.0", - "jest-runner": "^29.5.0", - "jest-util": "^29.5.0", - "jest-validate": "^29.5.0", - "micromatch": "^4.0.4", - "parse-json": "^5.2.0", - "pretty-format": "^29.5.0", - "slash": "^3.0.0", - "strip-json-comments": "^3.1.1" - } - }, - "jest-diff": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.5.0.tgz", - "integrity": "sha512-LtxijLLZBduXnHSniy0WMdaHjmQnt3g5sa16W4p0HqukYTTsyTW3GD1q41TyGl5YFXj/5B2U6dlh5FM1LIMgxw==", - "dev": true, - "requires": { - "chalk": "^4.0.0", - "diff-sequences": "^29.4.3", - "jest-get-type": "^29.4.3", - "pretty-format": "^29.5.0" - } - }, - "jest-docblock": { - "version": "29.4.3", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.4.3.tgz", - "integrity": "sha512-fzdTftThczeSD9nZ3fzA/4KkHtnmllawWrXO69vtI+L9WjEIuXWs4AmyME7lN5hU7dB0sHhuPfcKofRsUb/2Fg==", - "dev": true, - "requires": { - "detect-newline": "^3.0.0" - } - }, - "jest-each": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.5.0.tgz", - "integrity": "sha512-HM5kIJ1BTnVt+DQZ2ALp3rzXEl+g726csObrW/jpEGl+CDSSQpOJJX2KE/vEg8cxcMXdyEPu6U4QX5eruQv5hA==", - "dev": true, - "requires": { - "@jest/types": "^29.5.0", - "chalk": "^4.0.0", - "jest-get-type": "^29.4.3", - "jest-util": "^29.5.0", - "pretty-format": "^29.5.0" - } - }, - "jest-environment-node": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.5.0.tgz", - "integrity": "sha512-ExxuIK/+yQ+6PRGaHkKewYtg6hto2uGCgvKdb2nfJfKXgZ17DfXjvbZ+jA1Qt9A8EQSfPnt5FKIfnOO3u1h9qw==", - "dev": true, - "requires": { - "@jest/environment": "^29.5.0", - "@jest/fake-timers": "^29.5.0", - "@jest/types": "^29.5.0", - "@types/node": "*", - "jest-mock": "^29.5.0", - "jest-util": "^29.5.0" - } - }, - "jest-get-type": { - "version": "29.4.3", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.4.3.tgz", - "integrity": "sha512-J5Xez4nRRMjk8emnTpWrlkyb9pfRQQanDrvWHhsR1+VUfbwxi30eVcZFlcdGInRibU4G5LwHXpI7IRHU0CY+gg==", - "dev": true - }, - "jest-haste-map": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.5.0.tgz", - "integrity": "sha512-IspOPnnBro8YfVYSw6yDRKh/TiCdRngjxeacCps1cQ9cgVN6+10JUcuJ1EabrgYLOATsIAigxA0rLR9x/YlrSA==", - "dev": true, - "requires": { - "@jest/types": "^29.5.0", - "@types/graceful-fs": "^4.1.3", - "@types/node": "*", - "anymatch": "^3.0.3", - "fb-watchman": "^2.0.0", - "fsevents": "^2.3.2", - "graceful-fs": "^4.2.9", - "jest-regex-util": "^29.4.3", - "jest-util": "^29.5.0", - "jest-worker": "^29.5.0", - "micromatch": "^4.0.4", - "walker": "^1.0.8" - } - }, - "jest-leak-detector": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.5.0.tgz", - "integrity": "sha512-u9YdeeVnghBUtpN5mVxjID7KbkKE1QU4f6uUwuxiY0vYRi9BUCLKlPEZfDGR67ofdFmDz9oPAy2G92Ujrntmow==", - "dev": true, - "requires": { - "jest-get-type": "^29.4.3", - "pretty-format": "^29.5.0" - } - }, - "jest-matcher-utils": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.5.0.tgz", - "integrity": "sha512-lecRtgm/rjIK0CQ7LPQwzCs2VwW6WAahA55YBuI+xqmhm7LAaxokSB8C97yJeYyT+HvQkH741StzpU41wohhWw==", - "dev": true, - "requires": { - "chalk": "^4.0.0", - "jest-diff": "^29.5.0", - "jest-get-type": "^29.4.3", - "pretty-format": "^29.5.0" - } - }, - "jest-message-util": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.5.0.tgz", - "integrity": "sha512-Kijeg9Dag6CKtIDA7O21zNTACqD5MD/8HfIV8pdD94vFyFuer52SigdC3IQMhab3vACxXMiFk+yMHNdbqtyTGA==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.12.13", - "@jest/types": "^29.5.0", - "@types/stack-utils": "^2.0.0", - "chalk": "^4.0.0", - "graceful-fs": "^4.2.9", - "micromatch": "^4.0.4", - "pretty-format": "^29.5.0", - "slash": "^3.0.0", - "stack-utils": "^2.0.3" - } - }, - "jest-mock": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.5.0.tgz", - "integrity": "sha512-GqOzvdWDE4fAV2bWQLQCkujxYWL7RxjCnj71b5VhDAGOevB3qj3Ovg26A5NI84ZpODxyzaozXLOh2NCgkbvyaw==", - "dev": true, - "requires": { - "@jest/types": "^29.5.0", - "@types/node": "*", - "jest-util": "^29.5.0" - } - }, - "jest-pnp-resolver": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz", - "integrity": "sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==", - "dev": true, - "requires": {} - }, - "jest-regex-util": { - "version": "29.4.3", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.4.3.tgz", - "integrity": "sha512-O4FglZaMmWXbGHSQInfXewIsd1LMn9p3ZXB/6r4FOkyhX2/iP/soMG98jGvk/A3HAN78+5VWcBGO0BJAPRh4kg==", - "dev": true - }, - "jest-resolve": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.5.0.tgz", - "integrity": "sha512-1TzxJ37FQq7J10jPtQjcc+MkCkE3GBpBecsSUWJ0qZNJpmg6m0D9/7II03yJulm3H/fvVjgqLh/k2eYg+ui52w==", - "dev": true, - "requires": { - "chalk": "^4.0.0", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.5.0", - "jest-pnp-resolver": "^1.2.2", - "jest-util": "^29.5.0", - "jest-validate": "^29.5.0", - "resolve": "^1.20.0", - "resolve.exports": "^2.0.0", - "slash": "^3.0.0" - } - }, - "jest-resolve-dependencies": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.5.0.tgz", - "integrity": "sha512-sjV3GFr0hDJMBpYeUuGduP+YeCRbd7S/ck6IvL3kQ9cpySYKqcqhdLLC2rFwrcL7tz5vYibomBrsFYWkIGGjOg==", - "dev": true, - "requires": { - "jest-regex-util": "^29.4.3", - "jest-snapshot": "^29.5.0" - } - }, - "jest-runner": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.5.0.tgz", - "integrity": "sha512-m7b6ypERhFghJsslMLhydaXBiLf7+jXy8FwGRHO3BGV1mcQpPbwiqiKUR2zU2NJuNeMenJmlFZCsIqzJCTeGLQ==", - "dev": true, - "requires": { - "@jest/console": "^29.5.0", - "@jest/environment": "^29.5.0", - "@jest/test-result": "^29.5.0", - "@jest/transform": "^29.5.0", - "@jest/types": "^29.5.0", - "@types/node": "*", - "chalk": "^4.0.0", - "emittery": "^0.13.1", - "graceful-fs": "^4.2.9", - "jest-docblock": "^29.4.3", - "jest-environment-node": "^29.5.0", - "jest-haste-map": "^29.5.0", - "jest-leak-detector": "^29.5.0", - "jest-message-util": "^29.5.0", - "jest-resolve": "^29.5.0", - "jest-runtime": "^29.5.0", - "jest-util": "^29.5.0", - "jest-watcher": "^29.5.0", - "jest-worker": "^29.5.0", - "p-limit": "^3.1.0", - "source-map-support": "0.5.13" - } - }, - "jest-runtime": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.5.0.tgz", - "integrity": "sha512-1Hr6Hh7bAgXQP+pln3homOiEZtCDZFqwmle7Ew2j8OlbkIu6uE3Y/etJQG8MLQs3Zy90xrp2C0BRrtPHG4zryw==", - "dev": true, - "requires": { - "@jest/environment": "^29.5.0", - "@jest/fake-timers": "^29.5.0", - "@jest/globals": "^29.5.0", - "@jest/source-map": "^29.4.3", - "@jest/test-result": "^29.5.0", - "@jest/transform": "^29.5.0", - "@jest/types": "^29.5.0", - "@types/node": "*", - "chalk": "^4.0.0", - "cjs-module-lexer": "^1.0.0", - "collect-v8-coverage": "^1.0.0", - "glob": "^7.1.3", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.5.0", - "jest-message-util": "^29.5.0", - "jest-mock": "^29.5.0", - "jest-regex-util": "^29.4.3", - "jest-resolve": "^29.5.0", - "jest-snapshot": "^29.5.0", - "jest-util": "^29.5.0", - "slash": "^3.0.0", - "strip-bom": "^4.0.0" - } - }, - "jest-snapshot": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.5.0.tgz", - "integrity": "sha512-x7Wolra5V0tt3wRs3/ts3S6ciSQVypgGQlJpz2rsdQYoUKxMxPNaoHMGJN6qAuPJqS+2iQ1ZUn5kl7HCyls84g==", - "dev": true, - "requires": { - "@babel/core": "^7.11.6", - "@babel/generator": "^7.7.2", - "@babel/plugin-syntax-jsx": "^7.7.2", - "@babel/plugin-syntax-typescript": "^7.7.2", - "@babel/traverse": "^7.7.2", - "@babel/types": "^7.3.3", - "@jest/expect-utils": "^29.5.0", - "@jest/transform": "^29.5.0", - "@jest/types": "^29.5.0", - "@types/babel__traverse": "^7.0.6", - "@types/prettier": "^2.1.5", - "babel-preset-current-node-syntax": "^1.0.0", - "chalk": "^4.0.0", - "expect": "^29.5.0", - "graceful-fs": "^4.2.9", - "jest-diff": "^29.5.0", - "jest-get-type": "^29.4.3", - "jest-matcher-utils": "^29.5.0", - "jest-message-util": "^29.5.0", - "jest-util": "^29.5.0", - "natural-compare": "^1.4.0", - "pretty-format": "^29.5.0", - "semver": "^7.3.5" - }, - "dependencies": { - "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "requires": { - "yallist": "^4.0.0" - } - }, - "semver": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz", - "integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==", - "dev": true, - "requires": { - "lru-cache": "^6.0.0" - } - }, - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - } - } - }, - "jest-util": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.5.0.tgz", - "integrity": "sha512-RYMgG/MTadOr5t8KdhejfvUU82MxsCu5MF6KuDUHl+NuwzUt+Sm6jJWxTJVrDR1j5M/gJVCPKQEpWXY+yIQ6lQ==", - "dev": true, - "requires": { - "@jest/types": "^29.5.0", - "@types/node": "*", - "chalk": "^4.0.0", - "ci-info": "^3.2.0", - "graceful-fs": "^4.2.9", - "picomatch": "^2.2.3" - } - }, - "jest-validate": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.5.0.tgz", - "integrity": "sha512-pC26etNIi+y3HV8A+tUGr/lph9B18GnzSRAkPaaZJIE1eFdiYm6/CewuiJQ8/RlfHd1u/8Ioi8/sJ+CmbA+zAQ==", - "dev": true, - "requires": { - "@jest/types": "^29.5.0", - "camelcase": "^6.2.0", - "chalk": "^4.0.0", - "jest-get-type": "^29.4.3", - "leven": "^3.1.0", - "pretty-format": "^29.5.0" - }, - "dependencies": { - "camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", - "dev": true - } - } - }, - "jest-watcher": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.5.0.tgz", - "integrity": "sha512-KmTojKcapuqYrKDpRwfqcQ3zjMlwu27SYext9pt4GlF5FUgB+7XE1mcCnSm6a4uUpFyQIkb6ZhzZvHl+jiBCiA==", - "dev": true, - "requires": { - "@jest/test-result": "^29.5.0", - "@jest/types": "^29.5.0", - "@types/node": "*", - "ansi-escapes": "^4.2.1", - "chalk": "^4.0.0", - "emittery": "^0.13.1", - "jest-util": "^29.5.0", - "string-length": "^4.0.1" - } - }, - "jest-worker": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.5.0.tgz", - "integrity": "sha512-NcrQnevGoSp4b5kg+akIpthoAFHxPBcb5P6mYPY0fUNT+sSvmtu6jlkEle3anczUKIKEbMxFimk9oTP/tpIPgA==", - "dev": true, - "requires": { - "@types/node": "*", - "jest-util": "^29.5.0", - "merge-stream": "^2.0.0", - "supports-color": "^8.0.0" - }, - "dependencies": { - "supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" - }, - "js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, - "jsesc": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", - "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", - "dev": true - }, - "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==", - "dev": true - }, - "json5": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", - "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", - "dev": true - }, - "jsonwebtoken": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.0.tgz", - "integrity": "sha512-tuGfYXxkQGDPnLJ7SibiQgVgeDgfbPq2k2ICcbgqW8WxWLBAxKQM/ZCu/IT8SOSwmaYl4dpTFCW5xZv7YbbWUw==", - "requires": { - "jws": "^3.2.2", - "lodash": "^4.17.21", - "ms": "^2.1.1", - "semver": "^7.3.8" - }, - "dependencies": { - "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "requires": { - "yallist": "^4.0.0" - } - }, - "ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" - }, - "semver": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz", - "integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==", - "requires": { - "lru-cache": "^6.0.0" - } - }, - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" - } - } - }, - "jwa": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", - "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", - "requires": { - "buffer-equal-constant-time": "1.0.1", - "ecdsa-sig-formatter": "1.0.11", - "safe-buffer": "^5.0.1" - } - }, - "jws": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", - "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", - "requires": { - "jwa": "^1.4.1", - "safe-buffer": "^5.0.1" - } - }, - "kleur": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", - "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", - "dev": true - }, - "le-coffre-resources": { - "version": "git+ssh://git@github.com/smart-chain-fr/leCoffre-resources.git#7f6d31080e8903998f6e5a687ead5635999d52eb", - "from": "le-coffre-resources@git@github.com:smart-chain-fr/leCoffre-resources.git#v2.21", - "requires": { - "class-transformer": "^0.5.1", - "class-validator": "^0.14.0" - } - }, - "leven": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", - "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", - "dev": true - }, - "libphonenumber-js": { - "version": "1.10.28", - "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.10.28.tgz", - "integrity": "sha512-1eAgjLrZA0+2Wgw4hs+4Q/kEBycxQo8ZLYnmOvZ3AlM8ImAVAJgDPlZtISLEzD1vunc2q8s2Pn7XwB7I8U3Kzw==" - }, - "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==", - "dev": true - }, - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "requires": { - "p-locate": "^4.1.0" - } - }, - "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, - "lodash.memoize": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", - "integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==", - "dev": true - }, - "long-timeout": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/long-timeout/-/long-timeout-0.1.1.tgz", - "integrity": "sha512-BFRuQUqc7x2NWxfJBCyUrN8iYUYznzL9JROmRz1gZ6KlOIgmoD+njPVbb+VNn2nGMKggMsK79iUNErillsrx7w==" - }, - "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==", - "peer": true, - "requires": { - "js-tokens": "^3.0.0 || ^4.0.0" - } - }, - "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, - "requires": { - "yallist": "^3.0.2" - } - }, - "luxon": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/luxon/-/luxon-3.3.0.tgz", - "integrity": "sha512-An0UCfG/rSiqtAIiBPO0Y9/zAnHUZxAMiCpTd5h2smgsj7GGmcenvrvww2cqNA8/4A5ZrD1gJpHN2mIHZQF+Mg==" - }, - "make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "dev": true, - "requires": { - "semver": "^6.0.0" - } - }, - "make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" - }, - "makeerror": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", - "integrity": "sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==", - "dev": true, - "requires": { - "tmpl": "1.0.5" - } - }, - "media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==" - }, - "merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" - }, - "merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "dev": true - }, - "methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==" - }, - "micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", - "dev": true, - "requires": { - "braces": "^3.0.2", - "picomatch": "^2.3.1" - } - }, - "mime": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" - }, - "mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" - }, - "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==", - "requires": { - "mime-db": "1.52.0" - } - }, - "mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true - }, - "minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "module-alias": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/module-alias/-/module-alias-2.2.2.tgz", - "integrity": "sha512-A/78XjoX2EmNvppVWEhM2oGk3x4lLxnkEA4jTbaK97QKSDjkIoOsKQlfylt/d3kKKi596Qy3NP5XrXJ6fZIC9Q==" - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" - }, - "nanoid": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", - "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==" - }, - "natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", - "dev": true - }, - "negotiator": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", - "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==" - }, - "next": { - "version": "13.3.1", - "resolved": "https://registry.npmjs.org/next/-/next-13.3.1.tgz", - "integrity": "sha512-eByWRxPzKHs2oQz1yE41LX35umhz86ZSZ+mYyXBqn2IBi2hyUqxBA88avywdr4uyH+hCJczegGsDGWbzQA5Rqw==", - "requires": { - "@next/env": "13.3.1", - "@next/swc-darwin-arm64": "13.3.1", - "@next/swc-darwin-x64": "13.3.1", - "@next/swc-linux-arm64-gnu": "13.3.1", - "@next/swc-linux-arm64-musl": "13.3.1", - "@next/swc-linux-x64-gnu": "13.3.1", - "@next/swc-linux-x64-musl": "13.3.1", - "@next/swc-win32-arm64-msvc": "13.3.1", - "@next/swc-win32-ia32-msvc": "13.3.1", - "@next/swc-win32-x64-msvc": "13.3.1", - "@swc/helpers": "0.5.0", - "busboy": "1.6.0", - "caniuse-lite": "^1.0.30001406", - "postcss": "8.4.14", - "styled-jsx": "5.1.1" - } - }, - "node-cache": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/node-cache/-/node-cache-5.1.2.tgz", - "integrity": "sha512-t1QzWwnk4sjLWaQAS8CHgOJ+RAfmHpxFWmc36IWTiWHQfs0w5JDMBS1b1ZxQteo0vVVuWJvIUKHDkkeK7vIGCg==", - "requires": { - "clone": "2.x" - } - }, - "node-int64": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", - "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==", - "dev": true - }, - "node-releases": { - "version": "2.0.10", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.10.tgz", - "integrity": "sha512-5GFldHPXVG/YZmFzJvKK2zDSzPKhEp0+ZR5SVaoSag9fsL5YgHbUHDfnG5494ISANDcK4KwPXAx2xqVEydmd7w==", - "dev": true - }, - "node-schedule": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/node-schedule/-/node-schedule-2.1.1.tgz", - "integrity": "sha512-OXdegQq03OmXEjt2hZP33W2YPs/E5BcFQks46+G2gAxs4gHOIVD1u7EqlYLYSKsaIpyKCK9Gbk0ta1/gjRSMRQ==", - "requires": { - "cron-parser": "^4.2.0", - "long-timeout": "0.1.1", - "sorted-array-functions": "^1.3.0" - } - }, - "nodemon": { - "version": "2.0.22", - "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.22.tgz", - "integrity": "sha512-B8YqaKMmyuCO7BowF1Z1/mkPqLk6cs/l63Ojtd6otKjMx47Dq1utxfRxcavH1I7VSaL8n5BUaoutadnsX3AAVQ==", - "dev": true, - "requires": { - "chokidar": "^3.5.2", - "debug": "^3.2.7", - "ignore-by-default": "^1.0.1", - "minimatch": "^3.1.2", - "pstree.remy": "^1.1.8", - "semver": "^5.7.1", - "simple-update-notifier": "^1.0.7", - "supports-color": "^5.5.0", - "touch": "^3.1.0", - "undefsafe": "^2.0.5" - }, - "dependencies": { - "debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true - }, - "ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true - }, - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "nopt": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", - "integrity": "sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==", - "dev": true, - "requires": { - "abbrev": "1" - } - }, - "normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true - }, - "npm-run-path": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", - "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", - "dev": true, - "requires": { - "path-key": "^3.0.0" - } - }, - "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==" - }, - "object-inspect": { - "version": "1.12.3", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", - "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==" - }, - "on-finished": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", - "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", - "requires": { - "ee-first": "1.1.1" - } - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "onetime": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "dev": true, - "requires": { - "mimic-fn": "^2.1.0" - } - }, - "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, - "requires": { - "yocto-queue": "^0.1.0" - } - }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "requires": { - "p-limit": "^2.2.0" - }, - "dependencies": { - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - } - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true - }, - "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==", - "dev": true, - "requires": { - "@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" - } - }, - "parseurl": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", - "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" - }, - "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 - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "dev": true - }, - "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 - }, - "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==", - "dev": true - }, - "path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" - }, - "picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" - }, - "picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true - }, - "pirates": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.5.tgz", - "integrity": "sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ==", - "dev": true - }, - "pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", - "dev": true, - "requires": { - "find-up": "^4.0.0" - } - }, - "postcss": { - "version": "8.4.14", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.14.tgz", - "integrity": "sha512-E398TUmfAYFPBSdzgeieK2Y1+1cpdxJx8yXbK/m57nRhKSmk1GB2tO4lbLBtlkfPQTDKfe4Xqv1ASWPpayPEig==", - "requires": { - "nanoid": "^3.3.4", - "picocolors": "^1.0.0", - "source-map-js": "^1.0.2" - } - }, - "prettier": { - "version": "2.8.4", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.4.tgz", - "integrity": "sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw==", - "dev": true - }, - "pretty-format": { - "version": "29.5.0", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.5.0.tgz", - "integrity": "sha512-V2mGkI31qdttvTFX7Mt4efOqHXqJWMu4/r66Xh3Z3BwZaPfPJgp6/gbwoujRpPUtfEF6AUUWx3Jim3GCw5g/Qw==", - "dev": true, - "requires": { - "@jest/schemas": "^29.4.3", - "ansi-styles": "^5.0.0", - "react-is": "^18.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", - "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", - "dev": true - } - } - }, - "prisma": { - "version": "4.13.0", - "resolved": "https://registry.npmjs.org/prisma/-/prisma-4.13.0.tgz", - "integrity": "sha512-L9mqjnSmvWIRCYJ9mQkwCtj4+JDYYTdhoyo8hlsHNDXaZLh/b4hR0IoKIBbTKxZuyHQzLopb/+0Rvb69uGV7uA==", - "devOptional": true, - "requires": { - "@prisma/engines": "4.13.0" - } - }, - "prisma-query": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/prisma-query/-/prisma-query-2.0.0.tgz", - "integrity": "sha512-+5eneJrgTFxW48j4JaWJ8iBwFSH+YQRtA1N+QEzqsREnTEAbs1Bq85xoZP7ZNEXDsoLOoIo4rYfCYRozuVOB9Q==" - }, - "prompts": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", - "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", - "dev": true, - "requires": { - "kleur": "^3.0.3", - "sisteransi": "^1.0.5" - } - }, - "proxy-addr": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", - "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", - "requires": { - "forwarded": "0.2.0", - "ipaddr.js": "1.9.1" - } - }, - "pstree.remy": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", - "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", - "dev": true - }, - "pure-rand": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.0.2.tgz", - "integrity": "sha512-6Yg0ekpKICSjPswYOuC5sku/TSWaRYlA0qsXqJgM/d/4pLPHPuTxK7Nbf7jFKzAeedUhR8C7K9Uv63FBsSo8xQ==", - "dev": true - }, - "qs": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", - "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", - "requires": { - "side-channel": "^1.0.4" - } - }, - "range-parser": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", - "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" - }, - "raw-body": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", - "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", - "requires": { - "bytes": "3.1.2", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - } - }, - "react": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", - "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", - "peer": true, - "requires": { - "loose-envify": "^1.1.0" - } - }, - "react-dom": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", - "integrity": "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==", - "peer": true, - "requires": { - "loose-envify": "^1.1.0", - "scheduler": "^0.23.0" - } - }, - "react-is": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", - "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", - "dev": true - }, - "readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, - "requires": { - "picomatch": "^2.2.1" - } - }, - "reflect-metadata": { - "version": "0.1.13", - "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", - "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==" - }, - "require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", - "dev": true - }, - "resolve": { - "version": "1.22.2", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", - "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", - "dev": true, - "requires": { - "is-core-module": "^2.11.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - } - }, - "resolve-cwd": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", - "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", - "dev": true, - "requires": { - "resolve-from": "^5.0.0" - } - }, - "resolve-from": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", - "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", - "dev": true - }, - "resolve.exports": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz", - "integrity": "sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==", - "dev": true - }, - "safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" - }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, - "scheduler": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", - "integrity": "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==", - "peer": true, - "requires": { - "loose-envify": "^1.1.0" - } - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - }, - "send": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", - "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", - "requires": { - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "mime": "1.6.0", - "ms": "2.1.3", - "on-finished": "2.4.1", - "range-parser": "~1.2.1", - "statuses": "2.0.1" - }, - "dependencies": { - "ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" - } - } - }, - "serve-static": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", - "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", - "requires": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.3", - "send": "0.18.0" - } - }, - "setprototypeof": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", - "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" - }, - "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, - "requires": { - "shebang-regex": "^3.0.0" - } - }, - "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 - }, - "side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", - "requires": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" - } - }, - "signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true - }, - "simple-update-notifier": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-1.1.0.tgz", - "integrity": "sha512-VpsrsJSUcJEseSbMHkrsrAVSdvVS5I96Qo1QAQ4FxQ9wXFcB+pjj7FB7/us9+GcgfW4ziHtYMc1J0PLczb55mg==", - "dev": true, - "requires": { - "semver": "~7.0.0" - }, - "dependencies": { - "semver": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz", - "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==", - "dev": true - } - } - }, - "sisteransi": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", - "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", - "dev": true - }, - "slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "dev": true - }, - "sorted-array-functions": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/sorted-array-functions/-/sorted-array-functions-1.3.0.tgz", - "integrity": "sha512-2sqgzeFlid6N4Z2fUQ1cvFmTOLRi/sEDzSQ0OKYchqgoPmQBVyM3959qYx3fpS6Esef80KjmpgPeEr028dP3OA==" - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - }, - "source-map-js": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", - "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==" - }, - "source-map-support": { - "version": "0.5.13", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", - "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==", - "dev": true, - "requires": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - } - }, - "sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", - "dev": true - }, - "stack-utils": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", - "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", - "dev": true, - "requires": { - "escape-string-regexp": "^2.0.0" - } - }, - "statuses": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", - "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==" - }, - "streamsearch": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", - "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==" - }, - "string-length": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", - "integrity": "sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==", - "dev": true, - "requires": { - "char-regex": "^1.0.2", - "strip-ansi": "^6.0.0" - } - }, - "string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - } - }, - "strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.1" - } - }, - "strip-bom": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", - "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", - "dev": true - }, - "strip-final-newline": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", - "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", - "dev": true - }, - "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 - }, - "styled-jsx": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.1.tgz", - "integrity": "sha512-pW7uC1l4mBZ8ugbiZrcIsiIvVx1UmTfw7UkC3Um2tmfUq9Bhk8IiyEIPl6F8agHgjzku6j0xQEZbfA5uSgSaCw==", - "requires": { - "client-only": "0.0.1" - } - }, - "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, - "requires": { - "has-flag": "^4.0.0" - } - }, - "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==", - "dev": true - }, - "test-exclude": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", - "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", - "dev": true, - "requires": { - "@istanbuljs/schema": "^0.1.2", - "glob": "^7.1.4", - "minimatch": "^3.0.4" - } - }, - "tmpl": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", - "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", - "dev": true - }, - "to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", - "dev": true - }, - "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, - "requires": { - "is-number": "^7.0.0" - } - }, - "toidentifier": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", - "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==" - }, - "touch": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", - "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", - "dev": true, - "requires": { - "nopt": "~1.0.10" - } - }, - "ts-jest": { - "version": "29.1.0", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.0.tgz", - "integrity": "sha512-ZhNr7Z4PcYa+JjMl62ir+zPiNJfXJN6E8hSLnaUKhOgqcn8vb3e537cpkd0FuAfRK3sR1LSqM1MOhliXNgOFPA==", - "dev": true, - "requires": { - "bs-logger": "0.x", - "fast-json-stable-stringify": "2.x", - "jest-util": "^29.0.0", - "json5": "^2.2.3", - "lodash.memoize": "4.x", - "make-error": "1.x", - "semver": "7.x", - "yargs-parser": "^21.0.1" - }, - "dependencies": { - "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "requires": { - "yallist": "^4.0.0" - } - }, - "semver": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz", - "integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==", - "dev": true, - "requires": { - "lru-cache": "^6.0.0" - } - }, - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - } - } - }, - "ts-node": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", - "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", - "requires": { - "@cspotcode/source-map-support": "^0.8.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.1", - "yn": "3.1.1" - } - }, - "tslib": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", - "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==" - }, - "type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", - "dev": true - }, - "type-fest": { - "version": "0.21.3", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", - "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", - "dev": true - }, - "type-is": { - "version": "1.6.18", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", - "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", - "requires": { - "media-typer": "0.3.0", - "mime-types": "~2.1.24" - } - }, - "typedi": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/typedi/-/typedi-0.10.0.tgz", - "integrity": "sha512-v3UJF8xm68BBj6AF4oQML3ikrfK2c9EmZUyLOfShpJuItAqVBHWP/KtpGinkSsIiP6EZyyb6Z3NXyW9dgS9X1w==" - }, - "typescript": { - "version": "4.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==" - }, - "undefsafe": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", - "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", - "dev": true - }, - "unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==" - }, - "update-browserslist-db": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz", - "integrity": "sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==", - "dev": true, - "requires": { - "escalade": "^3.1.1", - "picocolors": "^1.0.0" - } - }, - "utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==" - }, - "uuid": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", - "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==" - }, - "v8-compile-cache-lib": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", - "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==" - }, - "v8-to-istanbul": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.1.0.tgz", - "integrity": "sha512-6z3GW9x8G1gd+JIIgQQQxXuiJtCXeAjp6RaPEPLv62mH3iPHPxV6W3robxtCzNErRo6ZwTmzWhsbNvjyEBKzKA==", - "dev": true, - "requires": { - "@jridgewell/trace-mapping": "^0.3.12", - "@types/istanbul-lib-coverage": "^2.0.1", - "convert-source-map": "^1.6.0" - }, - "dependencies": { - "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==", - "dev": true - } - } - }, - "validator": { - "version": "13.9.0", - "resolved": "https://registry.npmjs.org/validator/-/validator-13.9.0.tgz", - "integrity": "sha512-B+dGG8U3fdtM0/aNK4/X8CXq/EcxU2WPrPEkJGslb47qyHsxmbggTWK0yEA4qnYVNF+nxNlN88o14hIcPmSIEA==" - }, - "vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==" - }, - "walker": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", - "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==", - "dev": true, - "requires": { - "makeerror": "1.0.12" - } - }, - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - }, - "wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true - }, - "write-file-atomic": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", - "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", - "dev": true, - "requires": { - "imurmurhash": "^0.1.4", - "signal-exit": "^3.0.7" - } - }, - "y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "dev": true - }, - "yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true - }, - "yargs": { - "version": "17.7.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.1.tgz", - "integrity": "sha512-cwiTb08Xuv5fqF4AovYacTFNxk62th7LKJ6BL9IGUpTJrWoU7/7WdQGTP2SjKf1dUNBGzDd28p/Yfs/GI6JrLw==", - "dev": true, - "requires": { - "cliui": "^8.0.1", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.3", - "y18n": "^5.0.5", - "yargs-parser": "^21.1.1" - } - }, - "yargs-parser": { - "version": "21.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", - "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", - "dev": true - }, - "yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==" - }, - "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 - } } } diff --git a/package.json b/package.json index 94b842d1..58892f98 100644 --- a/package.json +++ b/package.json @@ -17,20 +17,16 @@ "@Test": "./dist/test" }, "scripts": { - "api:startonly": "node ./dist/entries/App.js", + "build-db": "npx prisma migrate dev", "build": "tsc", - "api:start": "tsc && npm run migrate && npx prisma db seed && node ./dist/entries/App.js", - "start": "tsc && npm run api:startonly", + "start": "tsc && node ./dist/entries/App.js", "dev": "nodemon -V", - "api:dev": "nodemon", "build:test": "tsc && mocha ./dist/entries/Test.js", "format": "prettier --write src", "migrate:test": "dotenv -e .env.test -- npx prisma migrate deploy", - "migrate": "npx prisma migrate deploy", - "docker:up": "docker-compose up -d", "docker:up:test": "docker-compose -f docker-compose-test.yml up -d", - "docker:down": "docker-compose -f docker-compose-test.yml down", - "test": "tsc && npm run docker:up:test && npm run migrate:test && dotenv -e .env.test -- jest -i --verbose ./dist/test/* && npm run docker:down" + "docker:down:test": "docker-compose down", + "test": "tsc && npm run docker:up:test && npm run migrate:test && dotenv -e .env.test -- jest -i --verbose ./dist/test/* && npm run docker:down:test" }, "repository": { "type": "git", diff --git a/src/app/api/super-admin/CustomersController.ts b/src/app/api/super-admin/CustomersController.ts index 5f990ebc..b43c76e6 100644 --- a/src/app/api/super-admin/CustomersController.ts +++ b/src/app/api/super-admin/CustomersController.ts @@ -107,11 +107,18 @@ export default class CustomersController extends ApiController { try { const uid = req.params["uid"]; if (!uid) { - throw new Error("No uuid provided"); + throw new Error("No uid provided"); } - //call service to get prisma entity - const customerEntity: Customers = await this.customersService.getByUid(uid); + let customerEntity: Customers; + //get query + if (req.query["q"]) { + const query = JSON.parse(req.query["q"] as string); + customerEntity = await this.customersService.getByUid(uid, query); + } else { + //call service to get prisma entity + customerEntity = await this.customersService.getByUid(uid); + } //Hydrate ressource with prisma entity const customer = ObjectHydrate.hydrate(new Customer(), customerEntity, { strategy: "exposeAll" }); diff --git a/src/app/api/super-admin/DeedTypesController.ts b/src/app/api/super-admin/DeedTypesController.ts index d0071bf1..ac4bf9c6 100644 --- a/src/app/api/super-admin/DeedTypesController.ts +++ b/src/app/api/super-admin/DeedTypesController.ts @@ -77,7 +77,7 @@ export default class DeedTypesController extends ApiController { try { const uid = req.params["uid"]; if (!uid) { - throw new Error("No uuid provided"); + throw new Error("No uid provided"); } //init DeedType resource with request body values const deedTypeEntity = new DeedType(); @@ -111,11 +111,18 @@ export default class DeedTypesController extends ApiController { try { const uid = req.params["uid"]; if (!uid) { - throw new Error("No uuid provided"); + throw new Error("No uid provided"); } - //call service to get prisma entity - const deedTypeEntity: DeedTypes = await this.deedTypesService.getByUid(uid); + let deedTypeEntity: DeedTypes; + //get query + if (req.query["q"]) { + const query = JSON.parse(req.query["q"] as string); + deedTypeEntity = await this.deedTypesService.getByUid(uid, query); + } else { + //call service to get prisma entity + deedTypeEntity = await this.deedTypesService.getByUid(uid); + } //Hydrate ressource with prisma entity const deedType = ObjectHydrate.hydrate(new DeedType(), deedTypeEntity, { strategy: "exposeAll" }); diff --git a/src/app/api/super-admin/DeedsController.ts b/src/app/api/super-admin/DeedsController.ts index 2993bcdf..df6a836d 100644 --- a/src/app/api/super-admin/DeedsController.ts +++ b/src/app/api/super-admin/DeedsController.ts @@ -46,7 +46,7 @@ export default class DeedsController extends ApiController { try { const uid = req.params["uid"]; if (!uid) { - throw new Error("No uuid provided"); + throw new Error("No uid provided"); } //call service to get prisma entity diff --git a/src/app/api/super-admin/DocumentTypesController.ts b/src/app/api/super-admin/DocumentTypesController.ts index 8556210e..e8fe1cc3 100644 --- a/src/app/api/super-admin/DocumentTypesController.ts +++ b/src/app/api/super-admin/DocumentTypesController.ts @@ -74,7 +74,7 @@ export default class DocumentTypesController extends ApiController { try { const uid = req.params["uid"]; if (!uid) { - throw new Error("No uuid provided"); + throw new Error("No uid provided"); } //init DocumentType resource with request body values const documentTypeEntity = new DocumentType(); @@ -107,12 +107,19 @@ export default class DocumentTypesController extends ApiController { try { const uid = req.params["uid"]; if (!uid) { - throw new Error("No uuid provided"); + throw new Error("No uid provided"); } - //call service to get prisma entity - const documentTypeEntity: DocumentTypes = await this.documentTypesService.getByUid(uid); - + let documentTypeEntity: DocumentTypes; + //get query + if (req.query["q"]) { + const query = JSON.parse(req.query["q"] as string); + documentTypeEntity = await this.documentTypesService.getByUid(uid, query); + } else { + //call service to get prisma entity + documentTypeEntity = await this.documentTypesService.getByUid(uid); + } + //Hydrate ressource with prisma entity const user = ObjectHydrate.hydrate(new DocumentType(), documentTypeEntity, { strategy: "exposeAll" }); diff --git a/src/app/api/super-admin/DocumentsController.ts b/src/app/api/super-admin/DocumentsController.ts index 7c1c51f2..f1d2c798 100644 --- a/src/app/api/super-admin/DocumentsController.ts +++ b/src/app/api/super-admin/DocumentsController.ts @@ -77,7 +77,7 @@ export default class DocumentsController extends ApiController { try { const uid = req.params["uid"]; if (!uid) { - throw new Error("No uuid provided"); + throw new Error("No uid provided"); } //init Document resource with request body values @@ -109,7 +109,7 @@ export default class DocumentsController extends ApiController { try { const uid = req.params["uid"]; if (!uid) { - throw new Error("No uuid provided"); + throw new Error("No uid provided"); } //call service to get prisma entity @@ -134,11 +134,18 @@ export default class DocumentsController extends ApiController { try { const uid = req.params["uid"]; if (!uid) { - throw new Error("No uuid provided"); + throw new Error("No uid provided"); } - //call service to get prisma entity - const documentEntity: Documents = await this.documentsService.getByUid(uid); + let documentEntity: Documents; + //get query + if (req.query["q"]) { + const query = JSON.parse(req.query["q"] as string); + documentEntity = await this.documentsService.getByUid(uid, query); + } else { + //call service to get prisma entity + documentEntity = await this.documentsService.getByUid(uid); + } //Hydrate ressource with prisma entity const document = ObjectHydrate.hydrate(new Document(), documentEntity, { strategy: "exposeAll" }); diff --git a/src/app/api/super-admin/OfficeFoldersController.ts b/src/app/api/super-admin/OfficeFoldersController.ts index 308a4168..b123e8cb 100644 --- a/src/app/api/super-admin/OfficeFoldersController.ts +++ b/src/app/api/super-admin/OfficeFoldersController.ts @@ -27,7 +27,7 @@ export default class OfficeFoldersController extends ApiController { const prismaEntity: OfficeFolders[] = await this.officeFoldersService.get(query); //Hydrate ressource with prisma entity const officeFolders = ObjectHydrate.map(OfficeFolder, prismaEntity, { - strategy: "exposeAll", + strategy: "exposeAll", enableImplicitConversion: true }); //success this.httpSuccess(response, officeFolders); @@ -53,7 +53,7 @@ export default class OfficeFoldersController extends ApiController { const prismaEntityCreated = await this.officeFoldersService.create(officeFolderEntity); //Hydrate ressource with prisma entity const officeFolderEntityCreated = ObjectHydrate.hydrate(new OfficeFolder(), prismaEntityCreated, { - strategy: "exposeAll", + strategy: "exposeAll", enableImplicitConversion: true }); //success this.httpSuccess(response, officeFolderEntityCreated); @@ -71,7 +71,7 @@ export default class OfficeFoldersController extends ApiController { try { const uid = req.params["uid"]; if (!uid) { - throw new Error("No uuid provided"); + throw new Error("No uid provided"); } //init IUser resource with request body values const officeFolderEntity = new OfficeFolder(); @@ -105,11 +105,18 @@ export default class OfficeFoldersController extends ApiController { try { const uid = req.params["uid"]; if (!uid) { - throw new Error("No uuid provided"); + throw new Error("No uid provided"); } - //call service to get prisma entity - const officeFolderEntity: OfficeFolders = await this.officeFoldersService.getByUid(uid); + let officeFolderEntity: OfficeFolders; + //get query + if (req.query["q"]) { + const query = JSON.parse(req.query["q"] as string); + officeFolderEntity = await this.officeFoldersService.getByUid(uid, query); + } else { + //call service to get prisma entity + officeFolderEntity = await this.officeFoldersService.getByUid(uid); + } //Hydrate ressource with prisma entity const officeFolder = ObjectHydrate.hydrate(new OfficeFolder(), officeFolderEntity, { strategy: "exposeAll" }); diff --git a/src/app/api/super-admin/OfficesController.ts b/src/app/api/super-admin/OfficesController.ts index cd822332..3d0c835e 100644 --- a/src/app/api/super-admin/OfficesController.ts +++ b/src/app/api/super-admin/OfficesController.ts @@ -65,7 +65,7 @@ export default class OfficesController extends ApiController { try { const uid = req.params["uid"]; if (!uid) { - throw new Error("No uuid provided"); + throw new Error("No uid provided"); } //init IUser resource with request body values const officeEntity = new OfficeRessource(); @@ -93,10 +93,17 @@ export default class OfficesController extends ApiController { try { const uid = req.params["uid"]; if (!uid) { - throw new Error("No uuid provided"); + throw new Error("No uid provided"); + } + let officeEntity: Offices; + //get query + if (req.query["q"]) { + const query = JSON.parse(req.query["q"] as string); + officeEntity = await this.officesService.getByUid(uid, query); + } else { + //call service to get prisma entity + officeEntity = await this.officesService.getByUid(uid); } - //call service to get prisma entity - const officeEntity: Offices = await this.officesService.getByUid(uid); //Hydrate ressource with prisma entity const office = ObjectHydrate.hydrate(new OfficeRessource(), officeEntity, { strategy: "exposeAll" }); //success diff --git a/src/app/api/super-admin/UsersController.ts b/src/app/api/super-admin/UsersController.ts index 909bab94..9726c8e1 100644 --- a/src/app/api/super-admin/UsersController.ts +++ b/src/app/api/super-admin/UsersController.ts @@ -5,8 +5,9 @@ import UsersService from "@Services/super-admin/UsersService/UsersService"; import { Service } from "typedi"; import ObjectHydrate from "@Common/helpers/ObjectHydrate"; import { validateOrReject } from "class-validator"; -import User from "le-coffre-resources/dist/SuperAdmin"; +import User from "le-coffre-resources/dist/Notary"; import { Users } from "@prisma/client"; +import { plainToInstance } from "class-transformer"; @Controller() @Service() @@ -28,7 +29,10 @@ export default class UsersController extends ApiController { const usersEntity: Users[] = await this.usersService.get(query); //Hydrate ressource with prisma entity - const users = ObjectHydrate.map(User, usersEntity, { strategy: "exposeAll" }); + const users = plainToInstance(User, usersEntity, { + enableImplicitConversion: true, + excludeExtraneousValues: false, + }); //success this.httpSuccess(response, users); @@ -75,7 +79,7 @@ export default class UsersController extends ApiController { try { const uid = req.params["uid"]; if (!uid) { - throw new Error("No uuid provided"); + throw new Error("No uid provided"); } //init IUser resource with request body values const userEntity = new User(); @@ -108,11 +112,17 @@ export default class UsersController extends ApiController { try { const uid = req.params["uid"]; if (!uid) { - throw new Error("No uuid provided"); + throw new Error("No uid provided"); + } + let userEntity: Users; + //get query + if (req.query["q"]) { + const query = JSON.parse(req.query["q"] as string); + userEntity = await this.usersService.getByUid(uid, query); + } else { + //call service to get prisma entity + userEntity = await this.usersService.getByUid(uid); } - - //call service to get prisma entity - const userEntity: Users = await this.usersService.getByUid(uid); //Hydrate ressource with prisma entity const user = ObjectHydrate.hydrate(new User(), userEntity, { strategy: "exposeAll" }); diff --git a/src/common/databases/migrations/20230321102005_v0/migration.sql b/src/common/databases/migrations/20230321102005_v0/migration.sql deleted file mode 100644 index 0a36da48..00000000 --- a/src/common/databases/migrations/20230321102005_v0/migration.sql +++ /dev/null @@ -1,413 +0,0 @@ --- CreateEnum -CREATE TYPE "ECivility" AS ENUM ('MALE', 'FEMALE', 'OTHERS'); - --- CreateEnum -CREATE TYPE "EFolderStatus" AS ENUM ('LIVE', 'ARCHIVED'); - --- CreateEnum -CREATE TYPE "EOfficeStatus" AS ENUM ('ACTIVATED', 'DESACTIVATED'); - --- CreateEnum -CREATE TYPE "ENotificationStatus" AS ENUM ('READ', 'UNREAD'); - --- CreateEnum -CREATE TYPE "ECustomerStatus" AS ENUM ('VALIDATED', 'PENDING', 'ERRONED'); - --- CreateEnum -CREATE TYPE "EDocumentStatus" AS ENUM ('ASKED', 'DEPOSITED', 'VALIDATED', 'ANCHORED', 'REFUSED'); - --- CreateTable -CREATE TABLE "addresses" ( - "uuid" TEXT NOT NULL, - "address" VARCHAR(255) NOT NULL, - "city" VARCHAR(255) NOT NULL, - "zip_code" INTEGER NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "addresses_pkey" PRIMARY KEY ("uuid") -); - --- CreateTable -CREATE TABLE "contacts" ( - "uuid" TEXT NOT NULL, - "first_name" VARCHAR(255) NOT NULL, - "last_name" VARCHAR(255) NOT NULL, - "email" VARCHAR(255) NOT NULL, - "phone_number" VARCHAR(50), - "cell_phone_number" VARCHAR(50), - "civility" "ECivility" NOT NULL DEFAULT 'MALE', - "address_uuid" VARCHAR(255) NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "contacts_pkey" PRIMARY KEY ("uuid") -); - --- CreateTable -CREATE TABLE "users" ( - "uuid" TEXT NOT NULL, - "idNot" VARCHAR(255) NOT NULL, - "contact_uuid" VARCHAR(255) NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - "office_uuid" VARCHAR(255) NOT NULL, - - CONSTRAINT "users_pkey" PRIMARY KEY ("uuid") -); - --- CreateTable -CREATE TABLE "offices" ( - "uuid" TEXT NOT NULL, - "idNot" VARCHAR(255) NOT NULL, - "name" VARCHAR(255) NOT NULL, - "crpcen" VARCHAR(255) NOT NULL, - "address_uuid" VARCHAR(255) NOT NULL, - "office_status" "EOfficeStatus" NOT NULL DEFAULT 'DESACTIVATED', - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "offices_pkey" PRIMARY KEY ("uuid") -); - --- CreateTable -CREATE TABLE "customers" ( - "uuid" TEXT NOT NULL, - "status" "ECustomerStatus" NOT NULL DEFAULT 'PENDING', - "contact_uuid" VARCHAR(255) NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "customers_pkey" PRIMARY KEY ("uuid") -); - --- CreateTable -CREATE TABLE "user_has_notifications" ( - "uuid" TEXT NOT NULL, - "user_uuid" VARCHAR(255) NOT NULL, - "notification_uuid" VARCHAR(255) NOT NULL, - "notification_status" "ENotificationStatus" NOT NULL DEFAULT 'UNREAD', - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "user_has_notifications_pkey" PRIMARY KEY ("uuid") -); - --- CreateTable -CREATE TABLE "notifications" ( - "uuid" TEXT NOT NULL, - "message" VARCHAR(255) NOT NULL, - "redirection_url" VARCHAR(255) NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "notifications_pkey" PRIMARY KEY ("uuid") -); - --- CreateTable -CREATE TABLE "office_folders" ( - "uuid" TEXT NOT NULL, - "folder_number" VARCHAR(255) NOT NULL, - "name" VARCHAR(255) NOT NULL, - "description" VARCHAR(255), - "archived_description" VARCHAR(255), - "status" "EFolderStatus" NOT NULL DEFAULT 'LIVE', - "deed_uuid" VARCHAR(255) NOT NULL, - "office_uuid" VARCHAR(255) NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "office_folders_pkey" PRIMARY KEY ("uuid") -); - --- CreateTable -CREATE TABLE "office_folder_has_customers" ( - "uuid" TEXT NOT NULL, - "customer_uuid" VARCHAR(255) NOT NULL, - "office_folder_uuid" VARCHAR(255) NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "office_folder_has_customers_pkey" PRIMARY KEY ("uuid") -); - --- CreateTable -CREATE TABLE "office_folder_has_stakeholder" ( - "uuid" TEXT NOT NULL, - "office_folder_uuid" VARCHAR(255) NOT NULL, - "user_stakeholder_uuid" VARCHAR(255) NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "office_folder_has_stakeholder_pkey" PRIMARY KEY ("uuid") -); - --- CreateTable -CREATE TABLE "documents" ( - "uuid" TEXT NOT NULL, - "document_status" "EDocumentStatus" NOT NULL DEFAULT 'ASKED', - "type_uuid" VARCHAR(255) NOT NULL, - "blockchain_anchor_uuid" VARCHAR(255), - "folder_uuid" VARCHAR(255) NOT NULL, - "depositor_uuid" VARCHAR(255) NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "documents_pkey" PRIMARY KEY ("uuid") -); - --- CreateTable -CREATE TABLE "document_history" ( - "uuid" TEXT NOT NULL, - "document_status" "EDocumentStatus" NOT NULL DEFAULT 'ASKED', - "refused_reason" VARCHAR(255), - "document_uuid" VARCHAR(255) NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "document_history_pkey" PRIMARY KEY ("uuid") -); - --- CreateTable -CREATE TABLE "files" ( - "uuid" TEXT NOT NULL, - "document_uuid" VARCHAR(255) NOT NULL, - "file_path" VARCHAR(255), - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "files_pkey" PRIMARY KEY ("uuid") -); - --- CreateTable -CREATE TABLE "blockchain_anchors" ( - "uuid" TEXT NOT NULL, - "smartSigJobId" VARCHAR(255) NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "blockchain_anchors_pkey" PRIMARY KEY ("uuid") -); - --- CreateTable -CREATE TABLE "document_types" ( - "uuid" TEXT NOT NULL, - "name" VARCHAR(255) NOT NULL, - "public_description" VARCHAR(255) NOT NULL, - "private_description" VARCHAR(255), - "archived_at" TIMESTAMP(3), - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "document_types_pkey" PRIMARY KEY ("uuid") -); - --- CreateTable -CREATE TABLE "deed_has_document_types" ( - "uuid" TEXT NOT NULL, - "document_type_uuid" VARCHAR(255) NOT NULL, - "deed_uuid" VARCHAR(255) NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "deed_has_document_types_pkey" PRIMARY KEY ("uuid") -); - --- CreateTable -CREATE TABLE "deed" ( - "uuid" TEXT NOT NULL, - "deed_type_uuid" VARCHAR(255) NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "deed_pkey" PRIMARY KEY ("uuid") -); - --- CreateTable -CREATE TABLE "deed_types" ( - "uuid" TEXT NOT NULL, - "name" VARCHAR(255) NOT NULL, - "description" VARCHAR(255) NOT NULL, - "archived_at" TIMESTAMP(3), - "office_uuid" VARCHAR(255) NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "deed_types_pkey" PRIMARY KEY ("uuid") -); - --- CreateTable -CREATE TABLE "deed_type_has_document_types" ( - "uuid" TEXT NOT NULL, - "document_type_uuid" VARCHAR(255) NOT NULL, - "deed_type_uuid" VARCHAR(255) NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updated_at" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "deed_type_has_document_types_pkey" PRIMARY KEY ("uuid") -); - --- CreateIndex -CREATE UNIQUE INDEX "addresses_uuid_key" ON "addresses"("uuid"); - --- CreateIndex -CREATE UNIQUE INDEX "contacts_uuid_key" ON "contacts"("uuid"); - --- CreateIndex -CREATE UNIQUE INDEX "contacts_address_uuid_key" ON "contacts"("address_uuid"); - --- CreateIndex -CREATE UNIQUE INDEX "users_uuid_key" ON "users"("uuid"); - --- CreateIndex -CREATE UNIQUE INDEX "users_idNot_key" ON "users"("idNot"); - --- CreateIndex -CREATE UNIQUE INDEX "users_contact_uuid_key" ON "users"("contact_uuid"); - --- CreateIndex -CREATE UNIQUE INDEX "offices_uuid_key" ON "offices"("uuid"); - --- CreateIndex -CREATE UNIQUE INDEX "offices_idNot_key" ON "offices"("idNot"); - --- CreateIndex -CREATE UNIQUE INDEX "offices_crpcen_key" ON "offices"("crpcen"); - --- CreateIndex -CREATE UNIQUE INDEX "offices_address_uuid_key" ON "offices"("address_uuid"); - --- CreateIndex -CREATE UNIQUE INDEX "customers_uuid_key" ON "customers"("uuid"); - --- CreateIndex -CREATE UNIQUE INDEX "customers_contact_uuid_key" ON "customers"("contact_uuid"); - --- CreateIndex -CREATE UNIQUE INDEX "user_has_notifications_uuid_key" ON "user_has_notifications"("uuid"); - --- CreateIndex -CREATE UNIQUE INDEX "notifications_uuid_key" ON "notifications"("uuid"); - --- CreateIndex -CREATE UNIQUE INDEX "office_folders_uuid_key" ON "office_folders"("uuid"); - --- CreateIndex -CREATE UNIQUE INDEX "office_folders_deed_uuid_key" ON "office_folders"("deed_uuid"); - --- CreateIndex -CREATE UNIQUE INDEX "office_folder_has_customers_uuid_key" ON "office_folder_has_customers"("uuid"); - --- CreateIndex -CREATE UNIQUE INDEX "office_folder_has_stakeholder_uuid_key" ON "office_folder_has_stakeholder"("uuid"); - --- CreateIndex -CREATE UNIQUE INDEX "documents_uuid_key" ON "documents"("uuid"); - --- CreateIndex -CREATE UNIQUE INDEX "document_history_uuid_key" ON "document_history"("uuid"); - --- CreateIndex -CREATE UNIQUE INDEX "files_uuid_key" ON "files"("uuid"); - --- CreateIndex -CREATE UNIQUE INDEX "files_file_path_key" ON "files"("file_path"); - --- CreateIndex -CREATE UNIQUE INDEX "blockchain_anchors_uuid_key" ON "blockchain_anchors"("uuid"); - --- CreateIndex -CREATE UNIQUE INDEX "blockchain_anchors_smartSigJobId_key" ON "blockchain_anchors"("smartSigJobId"); - --- CreateIndex -CREATE UNIQUE INDEX "document_types_uuid_key" ON "document_types"("uuid"); - --- CreateIndex -CREATE UNIQUE INDEX "deed_has_document_types_uuid_key" ON "deed_has_document_types"("uuid"); - --- CreateIndex -CREATE UNIQUE INDEX "deed_uuid_key" ON "deed"("uuid"); - --- CreateIndex -CREATE UNIQUE INDEX "deed_deed_type_uuid_key" ON "deed"("deed_type_uuid"); - --- CreateIndex -CREATE UNIQUE INDEX "deed_types_uuid_key" ON "deed_types"("uuid"); - --- CreateIndex -CREATE UNIQUE INDEX "deed_type_has_document_types_uuid_key" ON "deed_type_has_document_types"("uuid"); - --- AddForeignKey -ALTER TABLE "contacts" ADD CONSTRAINT "contacts_address_uuid_fkey" FOREIGN KEY ("address_uuid") REFERENCES "addresses"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "users" ADD CONSTRAINT "users_contact_uuid_fkey" FOREIGN KEY ("contact_uuid") REFERENCES "contacts"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "users" ADD CONSTRAINT "users_office_uuid_fkey" FOREIGN KEY ("office_uuid") REFERENCES "offices"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "offices" ADD CONSTRAINT "offices_address_uuid_fkey" FOREIGN KEY ("address_uuid") REFERENCES "addresses"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "customers" ADD CONSTRAINT "customers_contact_uuid_fkey" FOREIGN KEY ("contact_uuid") REFERENCES "contacts"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "user_has_notifications" ADD CONSTRAINT "user_has_notifications_user_uuid_fkey" FOREIGN KEY ("user_uuid") REFERENCES "users"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "user_has_notifications" ADD CONSTRAINT "user_has_notifications_notification_uuid_fkey" FOREIGN KEY ("notification_uuid") REFERENCES "notifications"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "office_folders" ADD CONSTRAINT "office_folders_deed_uuid_fkey" FOREIGN KEY ("deed_uuid") REFERENCES "deed"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "office_folders" ADD CONSTRAINT "office_folders_office_uuid_fkey" FOREIGN KEY ("office_uuid") REFERENCES "offices"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "office_folder_has_customers" ADD CONSTRAINT "office_folder_has_customers_customer_uuid_fkey" FOREIGN KEY ("customer_uuid") REFERENCES "customers"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "office_folder_has_customers" ADD CONSTRAINT "office_folder_has_customers_office_folder_uuid_fkey" FOREIGN KEY ("office_folder_uuid") REFERENCES "office_folders"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "office_folder_has_stakeholder" ADD CONSTRAINT "office_folder_has_stakeholder_office_folder_uuid_fkey" FOREIGN KEY ("office_folder_uuid") REFERENCES "office_folders"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "office_folder_has_stakeholder" ADD CONSTRAINT "office_folder_has_stakeholder_user_stakeholder_uuid_fkey" FOREIGN KEY ("user_stakeholder_uuid") REFERENCES "users"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "documents" ADD CONSTRAINT "documents_type_uuid_fkey" FOREIGN KEY ("type_uuid") REFERENCES "document_types"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "documents" ADD CONSTRAINT "documents_blockchain_anchor_uuid_fkey" FOREIGN KEY ("blockchain_anchor_uuid") REFERENCES "blockchain_anchors"("uuid") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "documents" ADD CONSTRAINT "documents_folder_uuid_fkey" FOREIGN KEY ("folder_uuid") REFERENCES "office_folders"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "documents" ADD CONSTRAINT "documents_depositor_uuid_fkey" FOREIGN KEY ("depositor_uuid") REFERENCES "customers"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "document_history" ADD CONSTRAINT "document_history_document_uuid_fkey" FOREIGN KEY ("document_uuid") REFERENCES "documents"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "files" ADD CONSTRAINT "files_document_uuid_fkey" FOREIGN KEY ("document_uuid") REFERENCES "documents"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "deed_has_document_types" ADD CONSTRAINT "deed_has_document_types_document_type_uuid_fkey" FOREIGN KEY ("document_type_uuid") REFERENCES "document_types"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "deed_has_document_types" ADD CONSTRAINT "deed_has_document_types_deed_uuid_fkey" FOREIGN KEY ("deed_uuid") REFERENCES "deed"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "deed" ADD CONSTRAINT "deed_deed_type_uuid_fkey" FOREIGN KEY ("deed_type_uuid") REFERENCES "deed_types"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "deed_types" ADD CONSTRAINT "deed_types_office_uuid_fkey" FOREIGN KEY ("office_uuid") REFERENCES "offices"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "deed_type_has_document_types" ADD CONSTRAINT "deed_type_has_document_types_document_type_uuid_fkey" FOREIGN KEY ("document_type_uuid") REFERENCES "document_types"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "deed_type_has_document_types" ADD CONSTRAINT "deed_type_has_document_types_deed_type_uuid_fkey" FOREIGN KEY ("deed_type_uuid") REFERENCES "deed_types"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/src/common/databases/migrations/20230324125436_20230324102005_v1/migration.sql b/src/common/databases/migrations/20230324125436_20230324102005_v1/migration.sql deleted file mode 100644 index decf61d6..00000000 --- a/src/common/databases/migrations/20230324125436_20230324102005_v1/migration.sql +++ /dev/null @@ -1,92 +0,0 @@ -/* - Warnings: - - - A unique constraint covering the columns `[address]` on the table `addresses` will be added. If there are existing duplicate values, this will fail. - - A unique constraint covering the columns `[email]` on the table `contacts` will be added. If there are existing duplicate values, this will fail. - - A unique constraint covering the columns `[cell_phone_number]` on the table `contacts` will be added. If there are existing duplicate values, this will fail. - -*/ --- AlterTable -ALTER TABLE "addresses" ALTER COLUMN "created_at" DROP NOT NULL, -ALTER COLUMN "updated_at" DROP NOT NULL; - --- AlterTable -ALTER TABLE "blockchain_anchors" ALTER COLUMN "created_at" DROP NOT NULL, -ALTER COLUMN "updated_at" DROP NOT NULL; - --- AlterTable -ALTER TABLE "contacts" ALTER COLUMN "created_at" DROP NOT NULL, -ALTER COLUMN "updated_at" DROP NOT NULL; - --- AlterTable -ALTER TABLE "customers" ALTER COLUMN "created_at" DROP NOT NULL, -ALTER COLUMN "updated_at" DROP NOT NULL; - --- AlterTable -ALTER TABLE "deed" ALTER COLUMN "created_at" DROP NOT NULL, -ALTER COLUMN "updated_at" DROP NOT NULL; - --- AlterTable -ALTER TABLE "deed_has_document_types" ALTER COLUMN "created_at" DROP NOT NULL, -ALTER COLUMN "updated_at" DROP NOT NULL; - --- AlterTable -ALTER TABLE "deed_type_has_document_types" ALTER COLUMN "created_at" DROP NOT NULL, -ALTER COLUMN "updated_at" DROP NOT NULL; - --- AlterTable -ALTER TABLE "deed_types" ALTER COLUMN "created_at" DROP NOT NULL, -ALTER COLUMN "updated_at" DROP NOT NULL; - --- AlterTable -ALTER TABLE "document_history" ALTER COLUMN "created_at" DROP NOT NULL, -ALTER COLUMN "updated_at" DROP NOT NULL; - --- AlterTable -ALTER TABLE "document_types" ALTER COLUMN "created_at" DROP NOT NULL, -ALTER COLUMN "updated_at" DROP NOT NULL; - --- AlterTable -ALTER TABLE "documents" ALTER COLUMN "created_at" DROP NOT NULL, -ALTER COLUMN "updated_at" DROP NOT NULL; - --- AlterTable -ALTER TABLE "files" ALTER COLUMN "created_at" DROP NOT NULL, -ALTER COLUMN "updated_at" DROP NOT NULL; - --- AlterTable -ALTER TABLE "notifications" ALTER COLUMN "created_at" DROP NOT NULL, -ALTER COLUMN "updated_at" DROP NOT NULL; - --- AlterTable -ALTER TABLE "office_folder_has_customers" ALTER COLUMN "created_at" DROP NOT NULL, -ALTER COLUMN "updated_at" DROP NOT NULL; - --- AlterTable -ALTER TABLE "office_folder_has_stakeholder" ALTER COLUMN "created_at" DROP NOT NULL, -ALTER COLUMN "updated_at" DROP NOT NULL; - --- AlterTable -ALTER TABLE "office_folders" ALTER COLUMN "created_at" DROP NOT NULL, -ALTER COLUMN "updated_at" DROP NOT NULL; - --- AlterTable -ALTER TABLE "offices" ALTER COLUMN "created_at" DROP NOT NULL, -ALTER COLUMN "updated_at" DROP NOT NULL; - --- AlterTable -ALTER TABLE "user_has_notifications" ALTER COLUMN "created_at" DROP NOT NULL, -ALTER COLUMN "updated_at" DROP NOT NULL; - --- AlterTable -ALTER TABLE "users" ALTER COLUMN "created_at" DROP NOT NULL, -ALTER COLUMN "updated_at" DROP NOT NULL; - --- CreateIndex -CREATE UNIQUE INDEX "addresses_address_key" ON "addresses"("address"); - --- CreateIndex -CREATE UNIQUE INDEX "contacts_email_key" ON "contacts"("email"); - --- CreateIndex -CREATE UNIQUE INDEX "contacts_cell_phone_number_key" ON "contacts"("cell_phone_number"); diff --git a/src/common/databases/migrations/20230324130335_20230324_v2/migration.sql b/src/common/databases/migrations/20230324130335_20230324_v2/migration.sql deleted file mode 100644 index 9fd68230..00000000 --- a/src/common/databases/migrations/20230324130335_20230324_v2/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- DropIndex -DROP INDEX "addresses_address_key"; diff --git a/src/common/databases/migrations/20230324171729_v3/migration.sql b/src/common/databases/migrations/20230324171729_v3/migration.sql deleted file mode 100644 index 0c38c4c9..00000000 --- a/src/common/databases/migrations/20230324171729_v3/migration.sql +++ /dev/null @@ -1,119 +0,0 @@ --- DropForeignKey -ALTER TABLE "contacts" DROP CONSTRAINT "contacts_address_uuid_fkey"; - --- DropForeignKey -ALTER TABLE "customers" DROP CONSTRAINT "customers_contact_uuid_fkey"; - --- DropForeignKey -ALTER TABLE "deed" DROP CONSTRAINT "deed_deed_type_uuid_fkey"; - --- DropForeignKey -ALTER TABLE "deed_has_document_types" DROP CONSTRAINT "deed_has_document_types_deed_uuid_fkey"; - --- DropForeignKey -ALTER TABLE "deed_has_document_types" DROP CONSTRAINT "deed_has_document_types_document_type_uuid_fkey"; - --- DropForeignKey -ALTER TABLE "deed_type_has_document_types" DROP CONSTRAINT "deed_type_has_document_types_deed_type_uuid_fkey"; - --- DropForeignKey -ALTER TABLE "deed_type_has_document_types" DROP CONSTRAINT "deed_type_has_document_types_document_type_uuid_fkey"; - --- DropForeignKey -ALTER TABLE "deed_types" DROP CONSTRAINT "deed_types_office_uuid_fkey"; - --- DropForeignKey -ALTER TABLE "document_history" DROP CONSTRAINT "document_history_document_uuid_fkey"; - --- DropForeignKey -ALTER TABLE "documents" DROP CONSTRAINT "documents_depositor_uuid_fkey"; - --- DropForeignKey -ALTER TABLE "files" DROP CONSTRAINT "files_document_uuid_fkey"; - --- DropForeignKey -ALTER TABLE "office_folder_has_customers" DROP CONSTRAINT "office_folder_has_customers_customer_uuid_fkey"; - --- DropForeignKey -ALTER TABLE "office_folder_has_customers" DROP CONSTRAINT "office_folder_has_customers_office_folder_uuid_fkey"; - --- DropForeignKey -ALTER TABLE "office_folder_has_stakeholder" DROP CONSTRAINT "office_folder_has_stakeholder_office_folder_uuid_fkey"; - --- DropForeignKey -ALTER TABLE "office_folder_has_stakeholder" DROP CONSTRAINT "office_folder_has_stakeholder_user_stakeholder_uuid_fkey"; - --- DropForeignKey -ALTER TABLE "office_folders" DROP CONSTRAINT "office_folders_deed_uuid_fkey"; - --- DropForeignKey -ALTER TABLE "office_folders" DROP CONSTRAINT "office_folders_office_uuid_fkey"; - --- DropForeignKey -ALTER TABLE "offices" DROP CONSTRAINT "offices_address_uuid_fkey"; - --- DropForeignKey -ALTER TABLE "user_has_notifications" DROP CONSTRAINT "user_has_notifications_notification_uuid_fkey"; - --- DropForeignKey -ALTER TABLE "users" DROP CONSTRAINT "users_contact_uuid_fkey"; - --- AddForeignKey -ALTER TABLE "contacts" ADD CONSTRAINT "contacts_address_uuid_fkey" FOREIGN KEY ("address_uuid") REFERENCES "addresses"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "users" ADD CONSTRAINT "users_contact_uuid_fkey" FOREIGN KEY ("contact_uuid") REFERENCES "contacts"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "offices" ADD CONSTRAINT "offices_address_uuid_fkey" FOREIGN KEY ("address_uuid") REFERENCES "addresses"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "customers" ADD CONSTRAINT "customers_contact_uuid_fkey" FOREIGN KEY ("contact_uuid") REFERENCES "contacts"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "user_has_notifications" ADD CONSTRAINT "user_has_notifications_notification_uuid_fkey" FOREIGN KEY ("notification_uuid") REFERENCES "notifications"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "office_folders" ADD CONSTRAINT "office_folders_deed_uuid_fkey" FOREIGN KEY ("deed_uuid") REFERENCES "deed"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "office_folders" ADD CONSTRAINT "office_folders_office_uuid_fkey" FOREIGN KEY ("office_uuid") REFERENCES "offices"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "office_folder_has_customers" ADD CONSTRAINT "office_folder_has_customers_customer_uuid_fkey" FOREIGN KEY ("customer_uuid") REFERENCES "customers"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "office_folder_has_customers" ADD CONSTRAINT "office_folder_has_customers_office_folder_uuid_fkey" FOREIGN KEY ("office_folder_uuid") REFERENCES "office_folders"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "office_folder_has_stakeholder" ADD CONSTRAINT "office_folder_has_stakeholder_office_folder_uuid_fkey" FOREIGN KEY ("office_folder_uuid") REFERENCES "office_folders"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "office_folder_has_stakeholder" ADD CONSTRAINT "office_folder_has_stakeholder_user_stakeholder_uuid_fkey" FOREIGN KEY ("user_stakeholder_uuid") REFERENCES "users"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "documents" ADD CONSTRAINT "documents_depositor_uuid_fkey" FOREIGN KEY ("depositor_uuid") REFERENCES "customers"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "document_history" ADD CONSTRAINT "document_history_document_uuid_fkey" FOREIGN KEY ("document_uuid") REFERENCES "documents"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "files" ADD CONSTRAINT "files_document_uuid_fkey" FOREIGN KEY ("document_uuid") REFERENCES "documents"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "deed_has_document_types" ADD CONSTRAINT "deed_has_document_types_document_type_uuid_fkey" FOREIGN KEY ("document_type_uuid") REFERENCES "document_types"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "deed_has_document_types" ADD CONSTRAINT "deed_has_document_types_deed_uuid_fkey" FOREIGN KEY ("deed_uuid") REFERENCES "deed"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "deed" ADD CONSTRAINT "deed_deed_type_uuid_fkey" FOREIGN KEY ("deed_type_uuid") REFERENCES "deed_types"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "deed_types" ADD CONSTRAINT "deed_types_office_uuid_fkey" FOREIGN KEY ("office_uuid") REFERENCES "offices"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "deed_type_has_document_types" ADD CONSTRAINT "deed_type_has_document_types_document_type_uuid_fkey" FOREIGN KEY ("document_type_uuid") REFERENCES "document_types"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "deed_type_has_document_types" ADD CONSTRAINT "deed_type_has_document_types_deed_type_uuid_fkey" FOREIGN KEY ("deed_type_uuid") REFERENCES "deed_types"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/src/common/databases/migrations/20230328095747_v4/migration.sql b/src/common/databases/migrations/20230328095747_v4/migration.sql deleted file mode 100644 index feb43abb..00000000 --- a/src/common/databases/migrations/20230328095747_v4/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ --- DropForeignKey -ALTER TABLE "users" DROP CONSTRAINT "users_office_uuid_fkey"; - --- DropIndex -DROP INDEX "deed_deed_type_uuid_key"; - --- AddForeignKey -ALTER TABLE "users" ADD CONSTRAINT "users_office_uuid_fkey" FOREIGN KEY ("office_uuid") REFERENCES "offices"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/src/common/databases/migrations/20230329084446_v5/migration.sql b/src/common/databases/migrations/20230329084446_v5/migration.sql deleted file mode 100644 index 8671fd3a..00000000 --- a/src/common/databases/migrations/20230329084446_v5/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ -/* - Warnings: - - - A unique constraint covering the columns `[name,office_uuid]` on the table `deed_types` will be added. If there are existing duplicate values, this will fail. - -*/ --- CreateIndex -CREATE UNIQUE INDEX "deed_types_name_office_uuid_key" ON "deed_types"("name", "office_uuid"); diff --git a/src/common/databases/migrations/20230329145139_v6/migration.sql b/src/common/databases/migrations/20230329145139_v6/migration.sql deleted file mode 100644 index 13597e8e..00000000 --- a/src/common/databases/migrations/20230329145139_v6/migration.sql +++ /dev/null @@ -1,15 +0,0 @@ -/* - Warnings: - - - A unique constraint covering the columns `[name,office_uuid]` on the table `document_types` will be added. If there are existing duplicate values, this will fail. - - Added the required column `office_uuid` to the `document_types` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "document_types" ADD COLUMN "office_uuid" VARCHAR(255) NOT NULL; - --- CreateIndex -CREATE UNIQUE INDEX "document_types_name_office_uuid_key" ON "document_types"("name", "office_uuid"); - --- AddForeignKey -ALTER TABLE "document_types" ADD CONSTRAINT "document_types_office_uuid_fkey" FOREIGN KEY ("office_uuid") REFERENCES "offices"("uuid") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/src/common/databases/migrations/20230330150236_v8/migration.sql b/src/common/databases/migrations/20230330150236_v8/migration.sql deleted file mode 100644 index 5bda5e34..00000000 --- a/src/common/databases/migrations/20230330150236_v8/migration.sql +++ /dev/null @@ -1,24 +0,0 @@ -/* - Warnings: - - - A unique constraint covering the columns `[deed_uuid,document_type_uuid]` on the table `deed_has_document_types` will be added. If there are existing duplicate values, this will fail. - - A unique constraint covering the columns `[deed_type_uuid,document_type_uuid]` on the table `deed_type_has_document_types` will be added. If there are existing duplicate values, this will fail. - - A unique constraint covering the columns `[customer_uuid,office_folder_uuid]` on the table `office_folder_has_customers` will be added. If there are existing duplicate values, this will fail. - - A unique constraint covering the columns `[office_folder_uuid,user_stakeholder_uuid]` on the table `office_folder_has_stakeholder` will be added. If there are existing duplicate values, this will fail. - - A unique constraint covering the columns `[notification_uuid,user_uuid]` on the table `user_has_notifications` will be added. If there are existing duplicate values, this will fail. - -*/ --- CreateIndex -CREATE UNIQUE INDEX "deed_has_document_types_deed_uuid_document_type_uuid_key" ON "deed_has_document_types"("deed_uuid", "document_type_uuid"); - --- CreateIndex -CREATE UNIQUE INDEX "deed_type_has_document_types_deed_type_uuid_document_type_u_key" ON "deed_type_has_document_types"("deed_type_uuid", "document_type_uuid"); - --- CreateIndex -CREATE UNIQUE INDEX "office_folder_has_customers_customer_uuid_office_folder_uui_key" ON "office_folder_has_customers"("customer_uuid", "office_folder_uuid"); - --- CreateIndex -CREATE UNIQUE INDEX "office_folder_has_stakeholder_office_folder_uuid_user_stake_key" ON "office_folder_has_stakeholder"("office_folder_uuid", "user_stakeholder_uuid"); - --- CreateIndex -CREATE UNIQUE INDEX "user_has_notifications_notification_uuid_user_uuid_key" ON "user_has_notifications"("notification_uuid", "user_uuid"); diff --git a/src/common/databases/migrations/20230417100704_v9/migration.sql b/src/common/databases/migrations/20230417100704_v9/migration.sql deleted file mode 100644 index 6a1b9b40..00000000 --- a/src/common/databases/migrations/20230417100704_v9/migration.sql +++ /dev/null @@ -1,20 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `type_uuid` on the `documents` table. All the data in the column will be lost. - - Added the required column `document_type_uuid` to the `documents` table without a default value. This is not possible if the table is not empty. - - Made the column `file_path` on table `files` required. This step will fail if there are existing NULL values in that column. - -*/ --- DropForeignKey -ALTER TABLE "documents" DROP CONSTRAINT "documents_type_uuid_fkey"; - --- AlterTable -ALTER TABLE "documents" DROP COLUMN "type_uuid", -ADD COLUMN "document_type_uuid" VARCHAR(255) NOT NULL; - --- AlterTable -ALTER TABLE "files" ALTER COLUMN "file_path" SET NOT NULL; - --- AddForeignKey -ALTER TABLE "documents" ADD CONSTRAINT "documents_document_type_uuid_fkey" FOREIGN KEY ("document_type_uuid") REFERENCES "document_types"("uuid") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/src/common/databases/migrations/20230421130524_v10/migration.sql b/src/common/databases/migrations/20230421130524_v10/migration.sql deleted file mode 100644 index 43926a8f..00000000 --- a/src/common/databases/migrations/20230421130524_v10/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE "contacts" ADD COLUMN "birthdate" TIMESTAMP(3); diff --git a/src/common/databases/migrations/20230426144239_init/migration.sql b/src/common/databases/migrations/20230426144239_init/migration.sql new file mode 100644 index 00000000..a7c0a49f --- /dev/null +++ b/src/common/databases/migrations/20230426144239_init/migration.sql @@ -0,0 +1,445 @@ +-- CreateEnum +CREATE TYPE "ECivility" AS ENUM ('MALE', 'FEMALE', 'OTHERS'); + +-- CreateEnum +CREATE TYPE "EFolderStatus" AS ENUM ('LIVE', 'ARCHIVED'); + +-- CreateEnum +CREATE TYPE "EOfficeStatus" AS ENUM ('ACTIVATED', 'DESACTIVATED'); + +-- CreateEnum +CREATE TYPE "ENotificationStatus" AS ENUM ('READ', 'UNREAD'); + +-- CreateEnum +CREATE TYPE "ECustomerStatus" AS ENUM ('VALIDATED', 'PENDING', 'ERRONED'); + +-- CreateEnum +CREATE TYPE "EDocumentStatus" AS ENUM ('ASKED', 'DEPOSITED', 'VALIDATED', 'ANCHORED', 'REFUSED'); + +-- CreateTable +CREATE TABLE "addresses" ( + "uid" TEXT NOT NULL, + "address" VARCHAR(255) NOT NULL, + "city" VARCHAR(255) NOT NULL, + "zip_code" INTEGER NOT NULL, + "created_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3), + + CONSTRAINT "addresses_pkey" PRIMARY KEY ("uid") +); + +-- CreateTable +CREATE TABLE "contacts" ( + "uid" TEXT NOT NULL, + "first_name" VARCHAR(255) NOT NULL, + "last_name" VARCHAR(255) NOT NULL, + "email" VARCHAR(255) NOT NULL, + "phone_number" VARCHAR(50), + "cell_phone_number" VARCHAR(50), + "civility" "ECivility" NOT NULL DEFAULT 'MALE', + "address_uid" VARCHAR(255) NOT NULL, + "birthdate" TIMESTAMP(3), + "created_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3), + + CONSTRAINT "contacts_pkey" PRIMARY KEY ("uid") +); + +-- CreateTable +CREATE TABLE "users" ( + "uid" TEXT NOT NULL, + "idNot" VARCHAR(255) NOT NULL, + "contact_uid" VARCHAR(255) NOT NULL, + "created_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3), + "office_uid" VARCHAR(255) NOT NULL, + + CONSTRAINT "users_pkey" PRIMARY KEY ("uid") +); + +-- CreateTable +CREATE TABLE "offices" ( + "uid" TEXT NOT NULL, + "idNot" VARCHAR(255) NOT NULL, + "name" VARCHAR(255) NOT NULL, + "crpcen" VARCHAR(255) NOT NULL, + "address_uid" VARCHAR(255) NOT NULL, + "office_status" "EOfficeStatus" NOT NULL DEFAULT 'DESACTIVATED', + "created_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3), + + CONSTRAINT "offices_pkey" PRIMARY KEY ("uid") +); + +-- CreateTable +CREATE TABLE "customers" ( + "uid" TEXT NOT NULL, + "status" "ECustomerStatus" NOT NULL DEFAULT 'PENDING', + "contact_uid" VARCHAR(255) NOT NULL, + "created_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3), + + CONSTRAINT "customers_pkey" PRIMARY KEY ("uid") +); + +-- CreateTable +CREATE TABLE "user_has_notifications" ( + "uid" TEXT NOT NULL, + "user_uid" VARCHAR(255) NOT NULL, + "notification_uid" VARCHAR(255) NOT NULL, + "notification_status" "ENotificationStatus" NOT NULL DEFAULT 'UNREAD', + "created_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3), + + CONSTRAINT "user_has_notifications_pkey" PRIMARY KEY ("uid") +); + +-- CreateTable +CREATE TABLE "notifications" ( + "uid" TEXT NOT NULL, + "message" VARCHAR(255) NOT NULL, + "redirection_url" VARCHAR(255) NOT NULL, + "created_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3), + + CONSTRAINT "notifications_pkey" PRIMARY KEY ("uid") +); + +-- CreateTable +CREATE TABLE "office_folders" ( + "uid" TEXT NOT NULL, + "folder_number" VARCHAR(255) NOT NULL, + "name" VARCHAR(255) NOT NULL, + "description" VARCHAR(255), + "archived_description" VARCHAR(255), + "status" "EFolderStatus" NOT NULL DEFAULT 'LIVE', + "deed_uid" VARCHAR(255) NOT NULL, + "office_uid" VARCHAR(255) NOT NULL, + "created_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3), + + CONSTRAINT "office_folders_pkey" PRIMARY KEY ("uid") +); + +-- CreateTable +CREATE TABLE "office_folder_has_customers" ( + "uid" TEXT NOT NULL, + "customer_uid" VARCHAR(255) NOT NULL, + "office_folder_uid" VARCHAR(255) NOT NULL, + "created_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3), + + CONSTRAINT "office_folder_has_customers_pkey" PRIMARY KEY ("uid") +); + +-- CreateTable +CREATE TABLE "office_folder_has_stakeholder" ( + "uid" TEXT NOT NULL, + "office_folder_uid" VARCHAR(255) NOT NULL, + "user_stakeholder_uid" VARCHAR(255) NOT NULL, + "created_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3), + + CONSTRAINT "office_folder_has_stakeholder_pkey" PRIMARY KEY ("uid") +); + +-- CreateTable +CREATE TABLE "documents" ( + "uid" TEXT NOT NULL, + "document_status" "EDocumentStatus" NOT NULL DEFAULT 'ASKED', + "document_type_uid" VARCHAR(255) NOT NULL, + "blockchain_anchor_uid" VARCHAR(255), + "folder_uid" VARCHAR(255) NOT NULL, + "depositor_uid" VARCHAR(255) NOT NULL, + "created_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3), + + CONSTRAINT "documents_pkey" PRIMARY KEY ("uid") +); + +-- CreateTable +CREATE TABLE "document_history" ( + "uid" TEXT NOT NULL, + "document_status" "EDocumentStatus" NOT NULL DEFAULT 'ASKED', + "refused_reason" VARCHAR(255), + "document_uid" VARCHAR(255) NOT NULL, + "created_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3), + + CONSTRAINT "document_history_pkey" PRIMARY KEY ("uid") +); + +-- CreateTable +CREATE TABLE "files" ( + "uid" TEXT NOT NULL, + "document_uid" VARCHAR(255) NOT NULL, + "file_path" VARCHAR(255) NOT NULL, + "created_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3), + + CONSTRAINT "files_pkey" PRIMARY KEY ("uid") +); + +-- CreateTable +CREATE TABLE "blockchain_anchors" ( + "uid" TEXT NOT NULL, + "smartSigJobId" VARCHAR(255) NOT NULL, + "created_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3), + + CONSTRAINT "blockchain_anchors_pkey" PRIMARY KEY ("uid") +); + +-- CreateTable +CREATE TABLE "document_types" ( + "uid" TEXT NOT NULL, + "name" VARCHAR(255) NOT NULL, + "public_description" VARCHAR(255) NOT NULL, + "private_description" VARCHAR(255), + "office_uid" VARCHAR(255) NOT NULL, + "archived_at" TIMESTAMP(3), + "created_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3), + + CONSTRAINT "document_types_pkey" PRIMARY KEY ("uid") +); + +-- CreateTable +CREATE TABLE "deed_has_document_types" ( + "uid" TEXT NOT NULL, + "document_type_uid" VARCHAR(255) NOT NULL, + "deed_uid" VARCHAR(255) NOT NULL, + "created_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3), + + CONSTRAINT "deed_has_document_types_pkey" PRIMARY KEY ("uid") +); + +-- CreateTable +CREATE TABLE "deed" ( + "uid" TEXT NOT NULL, + "deed_type_uid" VARCHAR(255) NOT NULL, + "created_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3), + + CONSTRAINT "deed_pkey" PRIMARY KEY ("uid") +); + +-- CreateTable +CREATE TABLE "deed_types" ( + "uid" TEXT NOT NULL, + "name" VARCHAR(255) NOT NULL, + "description" VARCHAR(255) NOT NULL, + "archived_at" TIMESTAMP(3), + "office_uid" VARCHAR(255) NOT NULL, + "created_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3), + + CONSTRAINT "deed_types_pkey" PRIMARY KEY ("uid") +); + +-- CreateTable +CREATE TABLE "deed_type_has_document_types" ( + "uid" TEXT NOT NULL, + "document_type_uid" VARCHAR(255) NOT NULL, + "deed_type_uid" VARCHAR(255) NOT NULL, + "created_at" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3), + + CONSTRAINT "deed_type_has_document_types_pkey" PRIMARY KEY ("uid") +); + +-- CreateIndex +CREATE UNIQUE INDEX "addresses_uid_key" ON "addresses"("uid"); + +-- CreateIndex +CREATE UNIQUE INDEX "contacts_uid_key" ON "contacts"("uid"); + +-- CreateIndex +CREATE UNIQUE INDEX "contacts_email_key" ON "contacts"("email"); + +-- CreateIndex +CREATE UNIQUE INDEX "contacts_cell_phone_number_key" ON "contacts"("cell_phone_number"); + +-- CreateIndex +CREATE UNIQUE INDEX "contacts_address_uid_key" ON "contacts"("address_uid"); + +-- CreateIndex +CREATE UNIQUE INDEX "users_uid_key" ON "users"("uid"); + +-- CreateIndex +CREATE UNIQUE INDEX "users_idNot_key" ON "users"("idNot"); + +-- CreateIndex +CREATE UNIQUE INDEX "users_contact_uid_key" ON "users"("contact_uid"); + +-- CreateIndex +CREATE UNIQUE INDEX "offices_uid_key" ON "offices"("uid"); + +-- CreateIndex +CREATE UNIQUE INDEX "offices_idNot_key" ON "offices"("idNot"); + +-- CreateIndex +CREATE UNIQUE INDEX "offices_crpcen_key" ON "offices"("crpcen"); + +-- CreateIndex +CREATE UNIQUE INDEX "offices_address_uid_key" ON "offices"("address_uid"); + +-- CreateIndex +CREATE UNIQUE INDEX "customers_uid_key" ON "customers"("uid"); + +-- CreateIndex +CREATE UNIQUE INDEX "customers_contact_uid_key" ON "customers"("contact_uid"); + +-- CreateIndex +CREATE UNIQUE INDEX "user_has_notifications_uid_key" ON "user_has_notifications"("uid"); + +-- CreateIndex +CREATE UNIQUE INDEX "user_has_notifications_notification_uid_user_uid_key" ON "user_has_notifications"("notification_uid", "user_uid"); + +-- CreateIndex +CREATE UNIQUE INDEX "notifications_uid_key" ON "notifications"("uid"); + +-- CreateIndex +CREATE UNIQUE INDEX "office_folders_uid_key" ON "office_folders"("uid"); + +-- CreateIndex +CREATE UNIQUE INDEX "office_folders_deed_uid_key" ON "office_folders"("deed_uid"); + +-- CreateIndex +CREATE UNIQUE INDEX "office_folders_folder_number_office_uid_key" ON "office_folders"("folder_number", "office_uid"); + +-- CreateIndex +CREATE UNIQUE INDEX "office_folder_has_customers_uid_key" ON "office_folder_has_customers"("uid"); + +-- CreateIndex +CREATE UNIQUE INDEX "office_folder_has_customers_office_folder_uid_customer_uid_key" ON "office_folder_has_customers"("office_folder_uid", "customer_uid"); + +-- CreateIndex +CREATE UNIQUE INDEX "office_folder_has_stakeholder_uid_key" ON "office_folder_has_stakeholder"("uid"); + +-- CreateIndex +CREATE UNIQUE INDEX "office_folder_has_stakeholder_office_folder_uid_user_stakeh_key" ON "office_folder_has_stakeholder"("office_folder_uid", "user_stakeholder_uid"); + +-- CreateIndex +CREATE UNIQUE INDEX "documents_uid_key" ON "documents"("uid"); + +-- CreateIndex +CREATE UNIQUE INDEX "document_history_uid_key" ON "document_history"("uid"); + +-- CreateIndex +CREATE UNIQUE INDEX "files_uid_key" ON "files"("uid"); + +-- CreateIndex +CREATE UNIQUE INDEX "files_file_path_key" ON "files"("file_path"); + +-- CreateIndex +CREATE UNIQUE INDEX "blockchain_anchors_uid_key" ON "blockchain_anchors"("uid"); + +-- CreateIndex +CREATE UNIQUE INDEX "blockchain_anchors_smartSigJobId_key" ON "blockchain_anchors"("smartSigJobId"); + +-- CreateIndex +CREATE UNIQUE INDEX "document_types_uid_key" ON "document_types"("uid"); + +-- CreateIndex +CREATE UNIQUE INDEX "document_types_name_office_uid_key" ON "document_types"("name", "office_uid"); + +-- CreateIndex +CREATE UNIQUE INDEX "deed_has_document_types_uid_key" ON "deed_has_document_types"("uid"); + +-- CreateIndex +CREATE UNIQUE INDEX "deed_has_document_types_deed_uid_document_type_uid_key" ON "deed_has_document_types"("deed_uid", "document_type_uid"); + +-- CreateIndex +CREATE UNIQUE INDEX "deed_uid_key" ON "deed"("uid"); + +-- CreateIndex +CREATE UNIQUE INDEX "deed_types_uid_key" ON "deed_types"("uid"); + +-- CreateIndex +CREATE UNIQUE INDEX "deed_types_name_office_uid_key" ON "deed_types"("name", "office_uid"); + +-- CreateIndex +CREATE UNIQUE INDEX "deed_type_has_document_types_uid_key" ON "deed_type_has_document_types"("uid"); + +-- CreateIndex +CREATE UNIQUE INDEX "deed_type_has_document_types_deed_type_uid_document_type_ui_key" ON "deed_type_has_document_types"("deed_type_uid", "document_type_uid"); + +-- AddForeignKey +ALTER TABLE "contacts" ADD CONSTRAINT "contacts_address_uid_fkey" FOREIGN KEY ("address_uid") REFERENCES "addresses"("uid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "users" ADD CONSTRAINT "users_contact_uid_fkey" FOREIGN KEY ("contact_uid") REFERENCES "contacts"("uid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "users" ADD CONSTRAINT "users_office_uid_fkey" FOREIGN KEY ("office_uid") REFERENCES "offices"("uid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "offices" ADD CONSTRAINT "offices_address_uid_fkey" FOREIGN KEY ("address_uid") REFERENCES "addresses"("uid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "customers" ADD CONSTRAINT "customers_contact_uid_fkey" FOREIGN KEY ("contact_uid") REFERENCES "contacts"("uid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "user_has_notifications" ADD CONSTRAINT "user_has_notifications_user_uid_fkey" FOREIGN KEY ("user_uid") REFERENCES "users"("uid") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "user_has_notifications" ADD CONSTRAINT "user_has_notifications_notification_uid_fkey" FOREIGN KEY ("notification_uid") REFERENCES "notifications"("uid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "office_folders" ADD CONSTRAINT "office_folders_deed_uid_fkey" FOREIGN KEY ("deed_uid") REFERENCES "deed"("uid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "office_folders" ADD CONSTRAINT "office_folders_office_uid_fkey" FOREIGN KEY ("office_uid") REFERENCES "offices"("uid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "office_folder_has_customers" ADD CONSTRAINT "office_folder_has_customers_customer_uid_fkey" FOREIGN KEY ("customer_uid") REFERENCES "customers"("uid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "office_folder_has_customers" ADD CONSTRAINT "office_folder_has_customers_office_folder_uid_fkey" FOREIGN KEY ("office_folder_uid") REFERENCES "office_folders"("uid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "office_folder_has_stakeholder" ADD CONSTRAINT "office_folder_has_stakeholder_office_folder_uid_fkey" FOREIGN KEY ("office_folder_uid") REFERENCES "office_folders"("uid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "office_folder_has_stakeholder" ADD CONSTRAINT "office_folder_has_stakeholder_user_stakeholder_uid_fkey" FOREIGN KEY ("user_stakeholder_uid") REFERENCES "users"("uid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "documents" ADD CONSTRAINT "documents_document_type_uid_fkey" FOREIGN KEY ("document_type_uid") REFERENCES "document_types"("uid") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "documents" ADD CONSTRAINT "documents_blockchain_anchor_uid_fkey" FOREIGN KEY ("blockchain_anchor_uid") REFERENCES "blockchain_anchors"("uid") ON DELETE SET NULL ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "documents" ADD CONSTRAINT "documents_folder_uid_fkey" FOREIGN KEY ("folder_uid") REFERENCES "office_folders"("uid") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "documents" ADD CONSTRAINT "documents_depositor_uid_fkey" FOREIGN KEY ("depositor_uid") REFERENCES "customers"("uid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "document_history" ADD CONSTRAINT "document_history_document_uid_fkey" FOREIGN KEY ("document_uid") REFERENCES "documents"("uid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "files" ADD CONSTRAINT "files_document_uid_fkey" FOREIGN KEY ("document_uid") REFERENCES "documents"("uid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "document_types" ADD CONSTRAINT "document_types_office_uid_fkey" FOREIGN KEY ("office_uid") REFERENCES "offices"("uid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "deed_has_document_types" ADD CONSTRAINT "deed_has_document_types_document_type_uid_fkey" FOREIGN KEY ("document_type_uid") REFERENCES "document_types"("uid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "deed_has_document_types" ADD CONSTRAINT "deed_has_document_types_deed_uid_fkey" FOREIGN KEY ("deed_uid") REFERENCES "deed"("uid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "deed" ADD CONSTRAINT "deed_deed_type_uid_fkey" FOREIGN KEY ("deed_type_uid") REFERENCES "deed_types"("uid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "deed_types" ADD CONSTRAINT "deed_types_office_uid_fkey" FOREIGN KEY ("office_uid") REFERENCES "offices"("uid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "deed_type_has_document_types" ADD CONSTRAINT "deed_type_has_document_types_document_type_uid_fkey" FOREIGN KEY ("document_type_uid") REFERENCES "document_types"("uid") ON DELETE CASCADE ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "deed_type_has_document_types" ADD CONSTRAINT "deed_type_has_document_types_deed_type_uid_fkey" FOREIGN KEY ("deed_type_uid") REFERENCES "deed_types"("uid") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/src/common/databases/schema.prisma b/src/common/databases/schema.prisma index 113b282f..e0293f41 100644 --- a/src/common/databases/schema.prisma +++ b/src/common/databases/schema.prisma @@ -18,7 +18,7 @@ datasource db { // id String @unique @default(auto()) @map("_id") @db.ObjectId // @map de la table checker le naming avec le tiret model Addresses { - uuid String @id @unique @default(uuid()) + uid String @id @unique @default(uuid()) address String @db.VarChar(255) city String @db.VarChar(255) zip_code Int @@ -31,15 +31,15 @@ model Addresses { } model Contacts { - uuid String @id @unique @default(uuid()) + uid String @id @unique @default(uuid()) first_name String @db.VarChar(255) last_name String @db.VarChar(255) email String @unique @db.VarChar(255) phone_number String? @db.VarChar(50) cell_phone_number String? @unique @db.VarChar(50) civility ECivility @default(MALE) - address Addresses? @relation(fields: [address_uuid], references: [uuid], onDelete: Cascade) - address_uuid String @unique @db.VarChar(255) + address Addresses? @relation(fields: [address_uid], references: [uid], onDelete: Cascade) + address_uid String @unique @db.VarChar(255) birthdate DateTime? created_at DateTime? @default(now()) updated_at DateTime? @updatedAt @@ -50,14 +50,14 @@ model Contacts { } model Users { - uuid String @id @unique @default(uuid()) + uid String @id @unique @default(uuid()) @map("uid") idNot String @unique @db.VarChar(255) - contact Contacts @relation(fields: [contact_uuid], references: [uuid], onDelete: Cascade) - contact_uuid String @unique @db.VarChar(255) + contact Contacts @relation(fields: [contact_uid], references: [uid], onDelete: Cascade) + contact_uid String @unique @db.VarChar(255) created_at DateTime? @default(now()) updated_at DateTime? @updatedAt - office_membership Offices @relation(fields: [office_uuid], references: [uuid], onDelete: Cascade) - office_uuid String @db.VarChar(255) + office_membership Offices @relation(fields: [office_uid], references: [uid], onDelete: Cascade) + office_uid String @db.VarChar(255) user_has_notifications UserHasNotifications[] office_folder_has_stakeholder OfficeFolderHasStakeholders[] @@ -65,12 +65,12 @@ model Users { } model Offices { - uuid String @id @unique @default(uuid()) + uid String @id @unique @default(uuid()) idNot String @unique @db.VarChar(255) name String @db.VarChar(255) crpcen String @unique @db.VarChar(255) - address Addresses @relation(fields: [address_uuid], references: [uuid], onDelete: Cascade) - address_uuid String @unique @db.VarChar(255) + address Addresses @relation(fields: [address_uid], references: [uid], onDelete: Cascade) + address_uid String @unique @db.VarChar(255) office_status EOfficeStatus @default(DESACTIVATED) created_at DateTime? @default(now()) updated_at DateTime? @updatedAt @@ -83,10 +83,10 @@ model Offices { } model Customers { - uuid String @id @unique @default(uuid()) + uid String @id @unique @default(uuid()) status ECustomerStatus @default(PENDING) - contact Contacts @relation(fields: [contact_uuid], references: [uuid], onDelete: Cascade) - contact_uuid String @unique @db.VarChar(255) + contact Contacts @relation(fields: [contact_uid], references: [uid], onDelete: Cascade) + contact_uid String @unique @db.VarChar(255) created_at DateTime? @default(now()) updated_at DateTime? @updatedAt office_folder_has_customers OfficeFolderHasCustomers[] @@ -96,21 +96,21 @@ model Customers { } model UserHasNotifications { - uuid String @id @unique @default(uuid()) - user Users @relation(fields: [user_uuid], references: [uuid]) - user_uuid String @db.VarChar(255) - notification Notifications @relation(fields: [notification_uuid], references: [uuid], onDelete: Cascade) - notification_uuid String @db.VarChar(255) + uid String @id @unique @default(uuid()) + user Users @relation(fields: [user_uid], references: [uid]) + user_uid String @db.VarChar(255) + notification Notifications @relation(fields: [notification_uid], references: [uid], onDelete: Cascade) + notification_uid String @db.VarChar(255) notification_status ENotificationStatus @default(UNREAD) created_at DateTime? @default(now()) updated_at DateTime? @updatedAt - @@unique([notification_uuid, user_uuid]) + @@unique([notification_uid, user_uid]) @@map("user_has_notifications") } model Notifications { - uuid String @id @unique @default(uuid()) + uid String @id @unique @default(uuid()) message String @db.VarChar(255) redirection_url String @db.VarChar(255) created_at DateTime? @default(now()) @@ -121,63 +121,63 @@ model Notifications { } model OfficeFolders { - uuid String @id @unique @default(uuid()) + uid String @id @unique @default(uuid()) folder_number String @db.VarChar(255) name String @db.VarChar(255) description String? @db.VarChar(255) archived_description String? @db.VarChar(255) status EFolderStatus @default(LIVE) - deed Deeds @relation(fields: [deed_uuid], references: [uuid], onDelete: Cascade) - deed_uuid String @unique @db.VarChar(255) - office Offices @relation(fields: [office_uuid], references: [uuid], onDelete: Cascade) - office_uuid String @db.VarChar(255) + deed Deeds @relation(fields: [deed_uid], references: [uid], onDelete: Cascade) + deed_uid String @unique @db.VarChar(255) + office Offices @relation(fields: [office_uid], references: [uid], onDelete: Cascade) + office_uid String @db.VarChar(255) created_at DateTime? @default(now()) updated_at DateTime? @updatedAt office_folder_has_customers OfficeFolderHasCustomers[] office_folder_has_stakeholder OfficeFolderHasStakeholders[] documents Documents[] - @@unique([folder_number, office_uuid]) + @@unique([folder_number, office_uid]) @@map("office_folders") } model OfficeFolderHasCustomers { - uuid String @id @unique @default(uuid()) - customer Customers @relation(fields: [customer_uuid], references: [uuid], onDelete: Cascade) - customer_uuid String @db.VarChar(255) - office_folder OfficeFolders @relation(fields: [office_folder_uuid], references: [uuid], onDelete: Cascade) - office_folder_uuid String @db.VarChar(255) + uid String @id @unique @default(uuid()) + customer Customers @relation(fields: [customer_uid], references: [uid], onDelete: Cascade) + customer_uid String @db.VarChar(255) + office_folder OfficeFolders @relation(fields: [office_folder_uid], references: [uid], onDelete: Cascade) + office_folder_uid String @db.VarChar(255) created_at DateTime? @default(now()) updated_at DateTime? @updatedAt - @@unique([office_folder_uuid, customer_uuid]) + @@unique([office_folder_uid, customer_uid]) @@map("office_folder_has_customers") } model OfficeFolderHasStakeholders { - uuid String @id @unique @default(uuid()) - office_folder OfficeFolders @relation(fields: [office_folder_uuid], references: [uuid], onDelete: Cascade) - office_folder_uuid String @db.VarChar(255) - user_stakeholder Users @relation(fields: [user_stakeholder_uuid], references: [uuid], onDelete: Cascade) - user_stakeholder_uuid String @db.VarChar(255) + uid String @id @unique @default(uuid()) + office_folder OfficeFolders @relation(fields: [office_folder_uid], references: [uid], onDelete: Cascade) + office_folder_uid String @db.VarChar(255) + user_stakeholder Users @relation(fields: [user_stakeholder_uid], references: [uid], onDelete: Cascade) + user_stakeholder_uid String @db.VarChar(255) created_at DateTime? @default(now()) updated_at DateTime? @updatedAt - @@unique([office_folder_uuid, user_stakeholder_uuid]) + @@unique([office_folder_uid, user_stakeholder_uid]) @@map("office_folder_has_stakeholder") } model Documents { - uuid String @id @unique @default(uuid()) + uid String @id @unique @default(uuid()) document_status EDocumentStatus @default(ASKED) - document_type DocumentTypes @relation(fields: [document_type_uuid], references: [uuid]) - document_type_uuid String @db.VarChar(255) - blockchain_anchor BlockchainAnchors? @relation(fields: [blockchain_anchor_uuid], references: [uuid]) - blockchain_anchor_uuid String? @db.VarChar(255) - folder OfficeFolders @relation(fields: [folder_uuid], references: [uuid]) - folder_uuid String @db.VarChar(255) - depositor Customers @relation(fields: [depositor_uuid], references: [uuid], onDelete: Cascade) - depositor_uuid String @db.VarChar(255) + document_type DocumentTypes @relation(fields: [document_type_uid], references: [uid]) + document_type_uid String @db.VarChar(255) + blockchain_anchor BlockchainAnchors? @relation(fields: [blockchain_anchor_uid], references: [uid]) + blockchain_anchor_uid String? @db.VarChar(255) + folder OfficeFolders @relation(fields: [folder_uid], references: [uid]) + folder_uid String @db.VarChar(255) + depositor Customers @relation(fields: [depositor_uid], references: [uid], onDelete: Cascade) + depositor_uid String @db.VarChar(255) created_at DateTime? @default(now()) updated_at DateTime? @updatedAt files Files[] @@ -187,11 +187,11 @@ model Documents { } model DocumentHistory { - uuid String @id @unique @default(uuid()) + uid String @id @unique @default(uuid()) document_status EDocumentStatus @default(ASKED) refused_reason String? @db.VarChar(255) - document Documents @relation(fields: [document_uuid], references: [uuid], onDelete: Cascade) - document_uuid String @db.VarChar(255) + document Documents @relation(fields: [document_uid], references: [uid], onDelete: Cascade) + document_uid String @db.VarChar(255) created_at DateTime? @default(now()) updated_at DateTime? @updatedAt @@ -199,9 +199,9 @@ model DocumentHistory { } model Files { - uuid String @id @unique @default(uuid()) - document Documents @relation(fields: [document_uuid], references: [uuid], onDelete: Cascade) - document_uuid String @db.VarChar(255) + uid String @id @unique @default(uuid()) + document Documents @relation(fields: [document_uid], references: [uid], onDelete: Cascade) + document_uid String @db.VarChar(255) file_path String @unique @db.VarChar(255) created_at DateTime? @default(now()) updated_at DateTime? @updatedAt @@ -210,7 +210,7 @@ model Files { } model BlockchainAnchors { - uuid String @id @unique @default(uuid()) + uid String @id @unique @default(uuid()) smartSigJobId String @unique @db.VarChar(255) created_at DateTime? @default(now()) updated_at DateTime? @updatedAt @@ -220,12 +220,12 @@ model BlockchainAnchors { } model DocumentTypes { - uuid String @id @unique @default(uuid()) + uid String @id @unique @default(uuid()) name String @db.VarChar(255) public_description String @db.VarChar(255) private_description String? @db.VarChar(255) - office Offices @relation(fields: [office_uuid], references: [uuid], onDelete: Cascade) - office_uuid String @db.VarChar(255) + office Offices @relation(fields: [office_uid], references: [uid], onDelete: Cascade) + office_uid String @db.VarChar(255) archived_at DateTime? created_at DateTime? @default(now()) updated_at DateTime? @updatedAt @@ -233,27 +233,27 @@ model DocumentTypes { deed_has_document_types DeedHasDocumentTypes[] deed_type_has_document_types DeedTypeHasDocumentTypes[] - @@unique([name, office_uuid]) + @@unique([name, office_uid]) @@map("document_types") } model DeedHasDocumentTypes { - uuid String @id @unique @default(uuid()) - document_type DocumentTypes @relation(fields: [document_type_uuid], references: [uuid], onDelete: Cascade) - document_type_uuid String @db.VarChar(255) - deed Deeds @relation(fields: [deed_uuid], references: [uuid], onDelete: Cascade) - deed_uuid String @db.VarChar(255) + uid String @id @unique @default(uuid()) + document_type DocumentTypes @relation(fields: [document_type_uid], references: [uid], onDelete: Cascade) + document_type_uid String @db.VarChar(255) + deed Deeds @relation(fields: [deed_uid], references: [uid], onDelete: Cascade) + deed_uid String @db.VarChar(255) created_at DateTime? @default(now()) updated_at DateTime? @updatedAt - @@unique([deed_uuid, document_type_uuid]) + @@unique([deed_uid, document_type_uid]) @@map("deed_has_document_types") } model Deeds { - uuid String @id @unique @default(uuid()) - deed_type DeedTypes @relation(fields: [deed_type_uuid], references: [uuid], onDelete: Cascade) - deed_type_uuid String @db.VarChar(255) + uid String @id @unique @default(uuid()) + deed_type DeedTypes @relation(fields: [deed_type_uid], references: [uid], onDelete: Cascade) + deed_type_uid String @db.VarChar(255) created_at DateTime? @default(now()) updated_at DateTime? @updatedAt deed_has_document_types DeedHasDocumentTypes[] @@ -263,31 +263,31 @@ model Deeds { } model DeedTypes { - uuid String @id @unique @default(uuid()) + uid String @id @unique @default(uuid()) name String @db.VarChar(255) description String @db.VarChar(255) archived_at DateTime? - office Offices @relation(fields: [office_uuid], references: [uuid], onDelete: Cascade) - office_uuid String @db.VarChar(255) + office Offices @relation(fields: [office_uid], references: [uid], onDelete: Cascade) + office_uid String @db.VarChar(255) created_at DateTime? @default(now()) updated_at DateTime? @updatedAt deed Deeds[] deed_type_has_document_types DeedTypeHasDocumentTypes[] - @@unique([name, office_uuid]) + @@unique([name, office_uid]) @@map("deed_types") } model DeedTypeHasDocumentTypes { - uuid String @id @unique @default(uuid()) - document_type DocumentTypes @relation(fields: [document_type_uuid], references: [uuid], onDelete: Cascade) - document_type_uuid String @db.VarChar(255) - deed_type DeedTypes @relation(fields: [deed_type_uuid], references: [uuid], onDelete: Cascade) - deed_type_uuid String @db.VarChar(255) + uid String @id @unique @default(uuid()) + document_type DocumentTypes @relation(fields: [document_type_uid], references: [uid], onDelete: Cascade) + document_type_uid String @db.VarChar(255) + deed_type DeedTypes @relation(fields: [deed_type_uid], references: [uid], onDelete: Cascade) + deed_type_uid String @db.VarChar(255) created_at DateTime? @default(now()) updated_at DateTime? @updatedAt - @@unique([deed_type_uuid, document_type_uuid]) + @@unique([deed_type_uid, document_type_uid]) @@map("deed_type_has_document_types") } diff --git a/src/common/databases/seeders/seeder.ts b/src/common/databases/seeders/seeder.ts index 7bff7d73..d76ede13 100644 --- a/src/common/databases/seeders/seeder.ts +++ b/src/common/databases/seeders/seeder.ts @@ -38,62 +38,68 @@ import { for (let i = 10; i > 0; --i) result += chars[Math.floor(Math.random() * chars.length)]; return result; }; - const uuidCustomer1: string = randomString(); - const uuidCustomer2: string = randomString(); + const uidCustomer1: string = randomString(); + const uidCustomer2: string = randomString(); - const uuidContact1: string = randomString(); - const uuidContact2: string = randomString(); + const uidContact1: string = randomString(); + const uidContact2: string = randomString(); - const uuidAddress1: string = randomString(); - const uuidAddress2: string = randomString(); + const uidAddress1: string = randomString(); + const uidAddress2: string = randomString(); - const uuidOffice1: string = randomString(); - const uuidOffice2: string = randomString(); + const uidOffice1: string = randomString(); + const uidOffice2: string = randomString(); - const uuidUser1: string = randomString(); - const uuidUser2: string = randomString(); + const uidUser1: string = randomString(); + const uidUser2: string = randomString(); - const uuidOfficeFolder1: string = randomString(); - const uuidOfficeFolder2: string = randomString(); + const uidOfficeFolder1: string = randomString(); + const uidOfficeFolder2: string = randomString(); + const uidOfficeFolder3: string = randomString(); + const uidOfficeFolder4: string = randomString(); + const uidOfficeFolder5: string = randomString(); - const uuidDeed1: string = randomString(); - const uuidDeed2: string = randomString(); + const uidDeed1: string = randomString(); + const uidDeed2: string = randomString(); + const uidDeed3: string = randomString(); + const uidDeed4: string = randomString(); + const uidDeed5: string = randomString(); - const uuidDeedType1: string = randomString(); - const uuidDeedType2: string = randomString(); + const uidDeedType1: string = randomString(); + const uidDeedType2: string = randomString(); - const uuidDocument1: string = randomString(); - const uuidDocument2: string = randomString(); + const uidDocument1: string = randomString(); + const uidDocument2: string = randomString(); - const uuidDocumentType1: string = randomString(); - const uuidDocumentType2: string = randomString(); + const uidDocumentType1: string = randomString(); + const uidDocumentType2: string = randomString(); - const uuidOfficeFolderHasCustomer1: string = randomString(); - const uuidOfficeFolderHasCustomer2: string = randomString(); + const uidOfficeFolderHasCustomer1: string = randomString(); + const uidOfficeFolderHasCustomer2: string = randomString(); - const uuidFiles1: string = randomString(); - const uuidFiles2: string = randomString(); + const uidFiles1: string = randomString(); + const uidFiles2: string = randomString(); - const uuidDeedHasDocumentType1: string = randomString(); - const uuidDeedHasDocumentType2: string = randomString(); + const uidDeedHasDocumentType1: string = randomString(); + const uidDeedHasDocumentType2: string = randomString(); - const uuidDeedTypeHasDocumentType1: string = randomString(); - const uuidDeedTypeHasDocumentType2: string = randomString(); + const uidDeedTypeHasDocumentType1: string = randomString(); + const uidDeedTypeHasDocumentType2: string = randomString(); - const uuidDocumentHistory1: string = randomString(); - const uuidDocumentHistory2: string = randomString(); + const uidDocumentHistory1: string = randomString(); + const uidDocumentHistory2: string = randomString(); const customers: Customers[] = [ { - uuid: uuidCustomer1, - contact_uuid: uuidContact1, + uid: uidCustomer1, + contact_uid: uidContact1, created_at: new Date(), updated_at: new Date(), status: ECustomerStatus.PENDING, }, { - uuid: uuidCustomer2, - contact_uuid: uuidContact2, + uid: uidCustomer2, + contact_uid: uidContact2, created_at: new Date(), updated_at: new Date(), status: ECustomerStatus.PENDING, @@ -102,7 +108,7 @@ import { const addresses: Addresses[] = [ { - uuid: uuidAddress1, + uid: uidAddress1, address: "123 Main St", city: "Los Angeles", zip_code: 90001, @@ -110,7 +116,7 @@ import { updated_at: new Date(), }, { - uuid: uuidAddress2, + uid: uidAddress2, address: "Rue Pierre Emillion", city: "Paris", zip_code: 75003, @@ -121,8 +127,8 @@ import { const contacts: Contacts[] = [ { - uuid: uuidContact1, - address_uuid: uuidAddress1, + uid: uidContact1, + address_uid: uidAddress1, first_name: "John", last_name: "Doe", email: "john.doe@example.com", @@ -134,8 +140,8 @@ import { civility: ECivility.MALE, }, { - uuid: uuidContact2, - address_uuid: uuidAddress2, + uid: uidContact2, + address_uid: uidAddress2, first_name: "Jane", last_name: "Doe", email: "jane.doe@example.com", @@ -150,21 +156,21 @@ import { const offices: Offices[] = [ { - uuid: uuidOffice1, + uid: uidOffice1, idNot: randomString(), name: "LA Office", crpcen: randomString(), - address_uuid: uuidAddress1, + address_uid: uidAddress1, created_at: new Date(), updated_at: new Date(), office_status: EOfficeStatus.ACTIVATED, }, { - uuid: uuidOffice2, + uid: uidOffice2, idNot: randomString(), name: "NYC Office", crpcen: randomString(), - address_uuid: uuidAddress2, + address_uid: uidAddress2, created_at: new Date(), updated_at: new Date(), office_status: EOfficeStatus.DESACTIVATED, @@ -173,81 +179,135 @@ import { const users: Users[] = [ { - uuid: uuidUser1, + uid: uidUser1, created_at: new Date(), updated_at: new Date(), idNot: randomString(), - contact_uuid: uuidContact1, - office_uuid: uuidOffice1, + contact_uid: uidContact1, + office_uid: uidOffice1, }, { - uuid: uuidUser2, + uid: uidUser2, created_at: new Date(), updated_at: new Date(), idNot: randomString(), - contact_uuid: uuidContact2, - office_uuid: uuidOffice2, + contact_uid: uidContact2, + office_uid: uidOffice2, }, ]; const officeFolders: OfficeFolders[] = [ { - uuid: uuidOfficeFolder1, - folder_number: randomString(), - name: "0001", - deed_uuid: uuidDeed1, + uid: uidOfficeFolder1, + folder_number: "0001", + name: "Dossier", + deed_uid: uidDeed1, status: EFolderStatus.LIVE, created_at: new Date(), updated_at: new Date(), - office_uuid: uuidOffice1, + office_uid: uidOffice1, description: null, archived_description: null, }, { - uuid: uuidOfficeFolder2, - folder_number: randomString(), - name: "0001", - deed_uuid: uuidDeed2, + uid: uidOfficeFolder2, + folder_number: "0002", + name: "Dossier", + deed_uid: uidDeed2, status: EFolderStatus.LIVE, created_at: new Date(), updated_at: new Date(), - office_uuid: uuidOffice2, + office_uid: uidOffice2, description: null, archived_description: null, }, + { + uid: uidOfficeFolder3, + folder_number: "0003", + name: "Dossier", + deed_uid: uidDeed3, + status: EFolderStatus.LIVE, + created_at: new Date(), + updated_at: new Date(), + office_uid: uidOffice2, + description: null, + archived_description: null, + }, + { + uid: uidOfficeFolder4, + folder_number: "0004", + name: "Dossier", + deed_uid: uidDeed4, + status: EFolderStatus.ARCHIVED, + created_at: new Date(), + updated_at: new Date(), + office_uid: uidOffice2, + description: null, + archived_description: null, + }, + { + uid: uidOfficeFolder5, + folder_number: "0005", + name: "Dossier", + deed_uid: uidDeed5, + status: EFolderStatus.ARCHIVED, + created_at: new Date(), + updated_at: new Date(), + office_uid: uidOffice2, + description: null, + archived_description: null, + } ]; const deeds: Deeds[] = [ { - uuid: uuidDeed1, - deed_type_uuid: uuidDeedType1, + uid: uidDeed1, + deed_type_uid: uidDeedType1, created_at: new Date(), updated_at: new Date(), }, { - uuid: uuidDeed2, - deed_type_uuid: uuidDeedType2, + uid: uidDeed2, + deed_type_uid: uidDeedType2, created_at: new Date(), updated_at: new Date(), }, + { + uid: uidDeed3, + deed_type_uid: uidDeedType2, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeed4, + deed_type_uid: uidDeedType2, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeed5, + deed_type_uid: uidDeedType2, + created_at: new Date(), + updated_at: new Date(), + } ]; const deedTypes: DeedTypes[] = [ { - uuid: uuidDeedType1, + uid: uidDeedType1, name: "Acte de mariage", archived_at: null, description: "Acte regroupant deux personnes en mariage", - office_uuid: uuidOffice1, + office_uid: uidOffice1, created_at: new Date(), updated_at: new Date(), }, { - uuid: uuidDeedType2, + uid: uidDeedType2, name: "Vente d'un bien immobilier", archived_at: null, description: "Permet de vendre un bien immobilier à une entité ou une personne physique", - office_uuid: uuidOffice2, + office_uid: uidOffice2, created_at: new Date(), updated_at: new Date(), }, @@ -255,22 +315,22 @@ import { const documents: Documents[] = [ { - uuid: uuidDocument1, - blockchain_anchor_uuid: null, - depositor_uuid: uuidCustomer1, + uid: uidDocument1, + blockchain_anchor_uid: null, + depositor_uid: uidCustomer1, document_status: EDocumentStatus.ASKED, - folder_uuid: uuidOfficeFolder1, - document_type_uuid: uuidDocumentType1, + folder_uid: uidOfficeFolder1, + document_type_uid: uidDocumentType1, created_at: new Date(), updated_at: new Date(), }, { - uuid: uuidDocument2, - blockchain_anchor_uuid: null, - depositor_uuid: uuidCustomer2, + uid: uidDocument2, + blockchain_anchor_uid: null, + depositor_uid: uidCustomer2, document_status: EDocumentStatus.ASKED, - folder_uuid: uuidOfficeFolder2, - document_type_uuid: uuidDocumentType2, + folder_uid: uidOfficeFolder2, + document_type_uid: uidDocumentType2, created_at: new Date(), updated_at: new Date(), }, @@ -278,20 +338,20 @@ import { const documentTypes: DocumentTypes[] = [ { - uuid: uuidDocumentType1, + uid: uidDocumentType1, archived_at: null, name: "Acte de naissance", - office_uuid: uuidOffice1, + office_uid: uidOffice1, private_description: "Ce document est confidentiel, et ne doit pas être divulgué", public_description: "Acte de naissance est un document officiel qui atteste de la naissance d'une personne", created_at: new Date(), updated_at: new Date(), }, { - uuid: uuidDocumentType2, + uid: uidDocumentType2, archived_at: null, name: "Carte d'identité", - office_uuid: uuidOffice2, + office_uid: uidOffice2, private_description: "Ce document est confidentiel, demander un recto-verso au client", public_description: "Carte d'identité est un document officiel qui atteste de l'identité d'une personne", created_at: new Date(), @@ -301,16 +361,16 @@ import { const officeFolderHasCustomers: OfficeFolderHasCustomers[] = [ { - uuid: uuidOfficeFolderHasCustomer1, - customer_uuid: uuidCustomer1, - office_folder_uuid: uuidOfficeFolder1, + uid: uidOfficeFolderHasCustomer1, + customer_uid: uidCustomer1, + office_folder_uid: uidOfficeFolder1, created_at: new Date(), updated_at: new Date(), }, { - uuid: uuidOfficeFolderHasCustomer2, - customer_uuid: uuidCustomer2, - office_folder_uuid: uuidOfficeFolder2, + uid: uidOfficeFolderHasCustomer2, + customer_uid: uidCustomer2, + office_folder_uid: uidOfficeFolder2, created_at: new Date(), updated_at: new Date(), }, @@ -318,15 +378,15 @@ import { const files: Files[] = [ { - uuid: uuidFiles1, - document_uuid: uuidDocument1, + uid: uidFiles1, + document_uid: uidDocument1, file_path: "https://www.google1.com", created_at: new Date(), updated_at: new Date(), }, { - uuid: uuidFiles2, - document_uuid: uuidDocument2, + uid: uidFiles2, + document_uid: uidDocument2, file_path: "https://www.google2.com", created_at: new Date(), updated_at: new Date(), @@ -335,16 +395,16 @@ import { const deedHasDocumentTypes: DeedHasDocumentTypes[] = [ { - uuid: uuidDeedHasDocumentType1, - deed_uuid: uuidDeed1, - document_type_uuid: uuidDocumentType1, + uid: uidDeedHasDocumentType1, + deed_uid: uidDeed1, + document_type_uid: uidDocumentType1, created_at: new Date(), updated_at: new Date(), }, { - uuid: uuidDeedHasDocumentType2, - deed_uuid: uuidDeed2, - document_type_uuid: uuidDocumentType2, + uid: uidDeedHasDocumentType2, + deed_uid: uidDeed2, + document_type_uid: uidDocumentType2, created_at: new Date(), updated_at: new Date(), }, @@ -352,16 +412,16 @@ import { const deedTypeHasDocumentTypes: DeedTypeHasDocumentTypes[] = [ { - uuid: uuidDeedTypeHasDocumentType1, - deed_type_uuid: uuidDeedType1, - document_type_uuid: uuidDocumentType1, + uid: uidDeedTypeHasDocumentType1, + deed_type_uid: uidDeedType1, + document_type_uid: uidDocumentType1, created_at: new Date(), updated_at: new Date(), }, { - uuid: uuidDeedTypeHasDocumentType2, - deed_type_uuid: uuidDeedType2, - document_type_uuid: uuidDocumentType2, + uid: uidDeedTypeHasDocumentType2, + deed_type_uid: uidDeedType2, + document_type_uid: uidDocumentType2, created_at: new Date(), updated_at: new Date(), }, @@ -369,17 +429,17 @@ import { const documentHistories: DocumentHistory[] = [ { - uuid: uuidDocumentHistory1, + uid: uidDocumentHistory1, document_status: EDocumentStatus.ASKED, - document_uuid: uuidDocument1, + document_uid: uidDocument1, refused_reason: "Le document n'est pas conforme", created_at: new Date(), updated_at: new Date(), }, { - uuid: uuidDocumentHistory2, + uid: uidDocumentHistory2, document_status: EDocumentStatus.DEPOSITED, - document_uuid: uuidDocument1, + document_uid: uidDocument1, refused_reason: "Le document n'est pas conforme", created_at: new Date(), updated_at: new Date(), diff --git a/src/common/helpers/ObjectHydrate.ts b/src/common/helpers/ObjectHydrate.ts index d8f3121c..199b8733 100644 --- a/src/common/helpers/ObjectHydrate.ts +++ b/src/common/helpers/ObjectHydrate.ts @@ -1,4 +1,4 @@ -import { type ClassTransformOptions, plainToClass, plainToClassFromExist } from "class-transformer"; +import { type ClassTransformOptions, plainToClassFromExist, plainToInstance } from "class-transformer"; export default abstract class ObjectHydrate { public static hydrate(object: T, from: Partial, options?: ClassTransformOptions): T { @@ -7,7 +7,7 @@ export default abstract class ObjectHydrate { public static map(ClassEntity: { new (): T }, fromArray: Partial[], options?: ClassTransformOptions): T[] { return fromArray.map((from) => { - return plainToClass(ClassEntity, from, options); + return plainToInstance(ClassEntity, from, options); }); } } diff --git a/src/common/repositories/AddressesRepository.ts b/src/common/repositories/AddressesRepository.ts index 6a5cdba3..7bd53e84 100644 --- a/src/common/repositories/AddressesRepository.ts +++ b/src/common/repositories/AddressesRepository.ts @@ -29,7 +29,7 @@ export default class AddressesRepository extends BaseRepository { public async findOneByUid(uid: string): Promise { const addressEntity = await this.model.findUnique({ where: { - uuid: uid, + uid: uid, }, }); diff --git a/src/common/repositories/ContactsRepository.ts b/src/common/repositories/ContactsRepository.ts index 836b17d5..b302d1f6 100644 --- a/src/common/repositories/ContactsRepository.ts +++ b/src/common/repositories/ContactsRepository.ts @@ -29,7 +29,7 @@ export default class ContactsRepository extends BaseRepository { public async findOneByUid(uid: string): Promise { const contactEntity = await this.model.findUnique({ where: { - uuid: uid, + uid: uid, }, }); diff --git a/src/common/repositories/CustomersRepository.ts b/src/common/repositories/CustomersRepository.ts index 7dc3e1ee..b08bc0d5 100644 --- a/src/common/repositories/CustomersRepository.ts +++ b/src/common/repositories/CustomersRepository.ts @@ -61,7 +61,7 @@ export default class CustomersRepository extends BaseRepository { public async update(uid: string, customer: Customer): Promise { const updateArgs: Prisma.CustomersUpdateArgs = { where: { - uuid: uid, + uid: uid, }, data: { status: ECustomerStatus[customer.status as keyof typeof ECustomerStatus], @@ -91,12 +91,16 @@ export default class CustomersRepository extends BaseRepository { /** * @description : Find unique customer */ - public async findOneByUid(uid: string): Promise { - const customerEntity = await this.model.findUnique({ + public async findOneByUid(uid: string, query?: any): Promise { + const findOneArgs: Prisma.CustomersFindUniqueArgs = { where: { - uuid: uid, - }, - }); + uid: uid, + } + }; + if(query) { + findOneArgs.include = query + } + const customerEntity = await this.model.findUnique(findOneArgs); if (!customerEntity) { throw new Error("Customer not found"); diff --git a/src/common/repositories/DeedTypesHasDocumentTypesRepository.ts b/src/common/repositories/DeedTypesHasDocumentTypesRepository.ts index 975842c0..53cb40a7 100644 --- a/src/common/repositories/DeedTypesHasDocumentTypesRepository.ts +++ b/src/common/repositories/DeedTypesHasDocumentTypesRepository.ts @@ -29,7 +29,7 @@ export default class DeedTypeHasDocumentTypesRepository extends BaseRepository { public async findOneByUid(uid: string): Promise { const deedTypeHasDoculmentTypesEntity = await this.model.findUnique({ where: { - uuid: uid, + uid: uid, }, }); diff --git a/src/common/repositories/DeedTypesRepository.ts b/src/common/repositories/DeedTypesRepository.ts index 28bc1e7a..47ea54c1 100644 --- a/src/common/repositories/DeedTypesRepository.ts +++ b/src/common/repositories/DeedTypesRepository.ts @@ -34,7 +34,7 @@ export default class DeedTypesRepository extends BaseRepository { description: deedType.description, office: { connect: { - uuid: deedType.office.uid, + uid: deedType.office.uid, }, }, } @@ -43,7 +43,7 @@ export default class DeedTypesRepository extends BaseRepository { createArgs.data.deed_type_has_document_types = { createMany: { data: deedType.deed_type_has_document_types.map((relation) => ({ - document_type_uuid: relation.document_type.uid!, + document_type_uid: relation.document_type.uid!, })), skipDuplicates: true, }, @@ -58,7 +58,7 @@ export default class DeedTypesRepository extends BaseRepository { public async update(uid: string, deedType: DeedType): Promise { const updateArgs: Prisma.DeedTypesUpdateArgs = { where: { - uuid: uid, + uid: uid, }, data: { name: deedType.name, @@ -66,7 +66,7 @@ export default class DeedTypesRepository extends BaseRepository { archived_at: deedType.archived_at, office: { connect: { - uuid: deedType.office.uid, + uid: deedType.office.uid, }, }, }, @@ -76,10 +76,10 @@ export default class DeedTypesRepository extends BaseRepository { }; if (deedType.deed_type_has_document_types) { updateArgs.data.deed_type_has_document_types = { - deleteMany: { deed_type_uuid: uid }, + deleteMany: { deed_type_uid: uid }, createMany: { data: deedType.deed_type_has_document_types.map((relation) => ({ - document_type_uuid: relation.document_type.uid!, + document_type_uid: relation.document_type.uid!, })), skipDuplicates: true, }, @@ -91,15 +91,16 @@ export default class DeedTypesRepository extends BaseRepository { /** * @description : Find unique deed type */ - public async findOneByUid(uid: string): Promise { - const deedTypeEntity = await this.model.findUnique({ + public async findOneByUid(uid: string, query?: any): Promise { + const findOneArgs: Prisma.DeedTypesFindUniqueArgs = { where: { - uuid: uid, - }, - include: { - deed_type_has_document_types: true, - }, - }); + uid: uid, + } + }; + if(query) { + findOneArgs.include = query + } + const deedTypeEntity = await this.model.findUnique(findOneArgs); if (!deedTypeEntity) { throw new Error("deed type not found"); diff --git a/src/common/repositories/DeedsHasDocumentTypesRepository.ts b/src/common/repositories/DeedsHasDocumentTypesRepository.ts index 8f3c1712..65bac2c0 100644 --- a/src/common/repositories/DeedsHasDocumentTypesRepository.ts +++ b/src/common/repositories/DeedsHasDocumentTypesRepository.ts @@ -29,7 +29,7 @@ export default class DeedHasDocumentTypesRepository extends BaseRepository { public async findOneByUid(uid: string): Promise { const deedHasDocumentTypesEntity = await this.model.findUnique({ where: { - uuid: uid, + uid: uid, }, }); diff --git a/src/common/repositories/DeedsRepository.ts b/src/common/repositories/DeedsRepository.ts index b430000f..71c37b47 100644 --- a/src/common/repositories/DeedsRepository.ts +++ b/src/common/repositories/DeedsRepository.ts @@ -32,14 +32,14 @@ export default class DeedsRepository extends BaseRepository { data: { deed_type: { connect: { - uuid: deed.deed_type.uid, + uid: deed.deed_type.uid, }, }, }, }; const deedTypeWithDocumentTypes = await this.instanceDb.deedTypes.findUniqueOrThrow({ where: { - uuid: deed.deed_type.uid, + uid: deed.deed_type.uid, }, include: { deed_type_has_document_types: true }, }); @@ -50,7 +50,7 @@ export default class DeedsRepository extends BaseRepository { createArgs.data.deed_has_document_types = { createMany: { data: deedTypeWithDocumentTypes.deed_type_has_document_types.map((relation) => ({ - document_type_uuid: relation.document_type_uuid, + document_type_uid: relation.document_type_uid, })), skipDuplicates: true, }, @@ -65,7 +65,7 @@ export default class DeedsRepository extends BaseRepository { public async update(uid: string, deed: Deed): Promise { const updateArgs: Prisma.DeedsUpdateArgs = { where: { - uuid: uid, + uid: uid, }, data: {}, include: { @@ -74,10 +74,10 @@ export default class DeedsRepository extends BaseRepository { }; if (deed.deed_has_document_types) { updateArgs.data.deed_has_document_types = { - deleteMany: { deed_uuid: uid }, + deleteMany: { deed_uid: uid }, createMany: { data: deed.deed_has_document_types.map((relation) => ({ - document_type_uuid: relation.document_type.uid!, + document_type_uid: relation.document_type.uid!, })), skipDuplicates: true, }, @@ -92,7 +92,7 @@ export default class DeedsRepository extends BaseRepository { public async findOneByUid(uid: string): Promise { const deedTypeEntity = await this.model.findUnique({ where: { - uuid: uid, + uid: uid, }, }); diff --git a/src/common/repositories/DocumentTypesRepository.ts b/src/common/repositories/DocumentTypesRepository.ts index a502b47a..d29259cb 100644 --- a/src/common/repositories/DocumentTypesRepository.ts +++ b/src/common/repositories/DocumentTypesRepository.ts @@ -1,7 +1,7 @@ import Database from "@Common/databases/database"; import BaseRepository from "@Repositories/BaseRepository"; import { Service } from "typedi"; -import { DocumentTypes } from "prisma/prisma-client"; +import { DocumentTypes, Prisma } from "prisma/prisma-client"; import { DocumentType } from "le-coffre-resources/dist/SuperAdmin"; @Service() @@ -35,7 +35,7 @@ export default class DocumentTypesRepository extends BaseRepository { private_description: documentType.private_description, office: { connect: { - uuid: documentType.office.uid, + uid: documentType.office.uid, }, }, }, @@ -45,10 +45,10 @@ export default class DocumentTypesRepository extends BaseRepository { /** * @description : update given document type */ - public async update(uuid: string, documentType: DocumentType): Promise { + public async update(uid: string, documentType: DocumentType): Promise { return this.model.update({ where: { - uuid: uuid, + uid: uid, }, data: { name: documentType.name, @@ -57,7 +57,7 @@ export default class DocumentTypesRepository extends BaseRepository { archived_at: documentType.archived_at, office: { connect: { - uuid: documentType.office.uid, + uid: documentType.office.uid, }, }, }, @@ -67,12 +67,16 @@ export default class DocumentTypesRepository extends BaseRepository { /** * @description : find unique document type */ - public async findOneByUid(uid: string): Promise { - const documentTypeEntity = await this.model.findUnique({ + public async findOneByUid(uid: string, query?: any): Promise { + const findOneArgs: Prisma.DocumentTypesFindUniqueArgs = { where: { - uuid: uid, - }, - }); + uid: uid, + } + }; + if(query) { + findOneArgs.include = query + } + const documentTypeEntity = await this.model.findUnique(findOneArgs); if (!documentTypeEntity) { throw new Error("Document Type not found"); diff --git a/src/common/repositories/DocumentsRepository.ts b/src/common/repositories/DocumentsRepository.ts index 310ab78a..e9c631f2 100644 --- a/src/common/repositories/DocumentsRepository.ts +++ b/src/common/repositories/DocumentsRepository.ts @@ -32,17 +32,17 @@ export default class DocumentsRepository extends BaseRepository { data: { folder: { connect: { - uuid: document.folder.uid, + uid: document.folder.uid, }, }, depositor: { connect: { - uuid: document.depositor.uid, + uid: document.depositor.uid, }, }, document_type: { connect: { - uuid: document.document_type.uid, + uid: document.document_type.uid, }, }, }, @@ -52,7 +52,7 @@ export default class DocumentsRepository extends BaseRepository { data: { document: { connect: { - uuid: documentCreated.uuid, + uid: documentCreated.uid, }, }, }, @@ -67,9 +67,9 @@ export default class DocumentsRepository extends BaseRepository { public async createMany(documents: Document[]): Promise { return this.model.createMany({ data: documents.map((document) => ({ - folder_uuid: document.folder.uid!, - depositor_uuid: document.depositor.uid!, - document_type_uuid: document.document_type.uid!, + folder_uid: document.folder.uid!, + depositor_uid: document.depositor.uid!, + document_type_uid: document.document_type.uid!, })), skipDuplicates: true, }); @@ -81,7 +81,7 @@ export default class DocumentsRepository extends BaseRepository { public async update(uid: string, document: Document, refusedReason?: string): Promise { return this.model.update({ where: { - uuid: uid, + uid: uid, }, data: { document_status: EDocumentStatus[document.document_status as keyof typeof EDocumentStatus], @@ -93,7 +93,7 @@ export default class DocumentsRepository extends BaseRepository { }, depositor: { connect: { - uuid: document.depositor.uid, + uid: document.depositor.uid, }, }, }, @@ -106,7 +106,7 @@ export default class DocumentsRepository extends BaseRepository { public async delete(uid: string): Promise { return this.model.delete({ where: { - uuid: uid, + uid: uid, }, }); } @@ -114,13 +114,16 @@ export default class DocumentsRepository extends BaseRepository { /** * @description : Find unique document */ - public async findOneByUid(uid: string): Promise { - const documentEntity = await this.model.findUnique({ + public async findOneByUid(uid: string, query?: any): Promise { + const findOneArgs: Prisma.DocumentsFindUniqueArgs = { where: { - uuid: uid, - }, - }); - + uid: uid, + } + }; + if(query) { + findOneArgs.include = query + } + const documentEntity = await this.model.findUnique(findOneArgs); if (!documentEntity) { throw new Error("Document not found"); } diff --git a/src/common/repositories/FilesRepository.ts b/src/common/repositories/FilesRepository.ts index b6431dff..d91da097 100644 --- a/src/common/repositories/FilesRepository.ts +++ b/src/common/repositories/FilesRepository.ts @@ -32,7 +32,7 @@ export default class FilesRepository extends BaseRepository { data: { document: { connect: { - uuid: file.document.uid + uid: file.document.uid } }, file_path: file.file_path @@ -46,7 +46,7 @@ export default class FilesRepository extends BaseRepository { public async update(uid: string, file: File): Promise { return this.model.update({ where: { - uuid: uid, + uid: uid, }, data: { file_path: file.file_path @@ -60,7 +60,7 @@ export default class FilesRepository extends BaseRepository { public async delete(uid: string): Promise { return this.model.delete({ where: { - uuid: uid, + uid: uid, } }); } @@ -71,7 +71,7 @@ export default class FilesRepository extends BaseRepository { public async findOneByUid(uid: string): Promise { const fileEntity = await this.model.findUnique({ where: { - uuid: uid, + uid: uid, }, }); diff --git a/src/common/repositories/OfficeFoldersHasCustomerRepository.ts b/src/common/repositories/OfficeFoldersHasCustomerRepository.ts index cb879b32..aa83e947 100644 --- a/src/common/repositories/OfficeFoldersHasCustomerRepository.ts +++ b/src/common/repositories/OfficeFoldersHasCustomerRepository.ts @@ -30,7 +30,7 @@ export default class OfficeFoldersHasCustomerRepository extends BaseRepository { public async findOneByUid(uid: string): Promise { const officeFolderHasCustomersEntity = await this.model.findUnique({ where: { - uuid: uid, + uid: uid, }, }); diff --git a/src/common/repositories/OfficeFoldersHasStakeholderRepository.ts b/src/common/repositories/OfficeFoldersHasStakeholderRepository.ts index 576e9cd0..02b2bb11 100644 --- a/src/common/repositories/OfficeFoldersHasStakeholderRepository.ts +++ b/src/common/repositories/OfficeFoldersHasStakeholderRepository.ts @@ -29,7 +29,7 @@ export default class OfficeFoldersHasStakeholderRepository extends BaseRepositor public async findOneByUid(uid: string): Promise { const officeFolderHasStakeholdersEntity = await this.model.findUnique({ where: { - uuid: uid, + uid: uid, }, }); diff --git a/src/common/repositories/OfficeFoldersRepository.ts b/src/common/repositories/OfficeFoldersRepository.ts index 5f7032ab..06e8d87a 100644 --- a/src/common/repositories/OfficeFoldersRepository.ts +++ b/src/common/repositories/OfficeFoldersRepository.ts @@ -38,7 +38,7 @@ export default class OfficeFoldersRepository extends BaseRepository { create: { deed_type: { connect: { - uuid: officeFolder.deed.deed_type.uid, + uid: officeFolder.deed.deed_type.uid, }, }, }, @@ -57,7 +57,7 @@ export default class OfficeFoldersRepository extends BaseRepository { createArgs.data.office_folder_has_stakeholder = { createMany: { data: officeFolder.office_folder_has_stakeholder.map((relation) => ({ - user_stakeholder_uuid: relation.user_stakeholder.uid!, + user_stakeholder_uid: relation.user_stakeholder.uid!, })), skipDuplicates: true }, @@ -69,10 +69,10 @@ export default class OfficeFoldersRepository extends BaseRepository { /** * @description : Update data of an office folder */ - public async update(officeFolderUuid: string, officeFolder: OfficeFolder): Promise { + public async update(officeFolderuid: string, officeFolder: OfficeFolder): Promise { const updateArgs: Prisma.OfficeFoldersUpdateArgs = { where: { - uuid: officeFolderUuid, + uid: officeFolderuid, }, data: { folder_number: officeFolder.folder_number, @@ -89,10 +89,10 @@ export default class OfficeFoldersRepository extends BaseRepository { }; if (officeFolder.office_folder_has_stakeholder) { updateArgs.data.office_folder_has_stakeholder = { - deleteMany: { office_folder_uuid: officeFolderUuid }, + deleteMany: { office_folder_uid: officeFolderuid }, createMany: { data: officeFolder.office_folder_has_stakeholder.map((relation) => ({ - user_stakeholder_uuid: relation.user_stakeholder.uid!, + user_stakeholder_uid: relation.user_stakeholder.uid!, })), skipDuplicates: true }, @@ -100,10 +100,10 @@ export default class OfficeFoldersRepository extends BaseRepository { } if (officeFolder.office_folder_has_customers) { updateArgs.data.office_folder_has_customers = { - deleteMany: { office_folder_uuid: officeFolderUuid }, + deleteMany: { office_folder_uid: officeFolderuid }, createMany: { data: officeFolder.office_folder_has_customers.map((relation) => ({ - customer_uuid: relation.customer.uid!, + customer_uid: relation.customer.uid!, })), skipDuplicates: true }, @@ -113,8 +113,8 @@ export default class OfficeFoldersRepository extends BaseRepository { updateArgs.data.documents = { createMany: { data: officeFolder.documents.map((relation) => ({ - document_type_uuid: relation.document_type.uid!, - depositor_uuid: relation.depositor.uid! + document_type_uid: relation.document_type.uid!, + depositor_uid: relation.depositor.uid! })), skipDuplicates: true }, @@ -126,12 +126,16 @@ export default class OfficeFoldersRepository extends BaseRepository { /** * @description : Find one office folder */ - public async findOneByUid(uid: string): Promise { - const officeFolderEntity = await this.model.findUnique({ + public async findOneByUid(uid: string, query?: any): Promise { + const findOneArgs: Prisma.OfficeFoldersFindUniqueArgs = { where: { - uuid: uid, - }, - }); + uid: uid, + } + }; + if(query) { + findOneArgs.include = query + } + const officeFolderEntity = await this.model.findUnique(findOneArgs); if (!officeFolderEntity) { throw new Error("office folder not found"); diff --git a/src/common/repositories/OfficesRepository.ts b/src/common/repositories/OfficesRepository.ts index 741bdd10..1bd11cf0 100644 --- a/src/common/repositories/OfficesRepository.ts +++ b/src/common/repositories/OfficesRepository.ts @@ -1,7 +1,7 @@ import Database from "@Common/databases/database"; import BaseRepository from "@Repositories/BaseRepository"; import { Service } from "typedi"; -import { EOfficeStatus, Offices } from "@prisma/client"; +import { EOfficeStatus, Offices, Prisma } from "@prisma/client"; import { Office as OfficeRessource } from "le-coffre-resources/dist/SuperAdmin"; @Service() @@ -52,7 +52,7 @@ export default class OfficesRepository extends BaseRepository { public async update(uid: string, office: OfficeRessource): Promise { return this.model.update({ where: { - uuid: uid, + uid: uid, }, data: { name: office.name, @@ -71,15 +71,20 @@ export default class OfficesRepository extends BaseRepository { /** * @description : Find one office */ - public async findOneByUid(uid: string): Promise { - const officeEntity = await this.model.findUnique({ + public async findOneByUid(uid: string, query?: any): Promise { + const findOneArgs: Prisma.OfficesFindUniqueArgs = { where: { - uuid: uid, - }, - }); + uid: uid, + } + }; + if(query) { + findOneArgs.include = query + } + const officeEntity = await this.model.findUnique(findOneArgs); + if (!officeEntity) { - throw new Error("User not found"); + throw new Error("office not found"); } return officeEntity; diff --git a/src/common/repositories/UsersRepository.ts b/src/common/repositories/UsersRepository.ts index 8d1dedb7..72a521c0 100644 --- a/src/common/repositories/UsersRepository.ts +++ b/src/common/repositories/UsersRepository.ts @@ -79,7 +79,7 @@ export default class UsersRepository extends BaseRepository { public async update(uid: string, user: User): Promise { const updateArgs: Prisma.UsersUpdateArgs = { where: { - uuid: uid, + uid: uid, }, data: { idNot: user.idNot, @@ -128,12 +128,16 @@ export default class UsersRepository extends BaseRepository { /** * @description : Find one user */ - public async findOneByUid(uid: string): Promise { - const userEntity = await this.model.findUnique({ + public async findOneByUid(uid: string, query?: any): Promise { + const findOneArgs: Prisma.UsersFindUniqueArgs = { where: { - uuid: uid, - }, - }); + uid: uid, + } + }; + if(query) { + findOneArgs.include = query + } + const userEntity = await this.model.findUnique(findOneArgs); if (!userEntity) { throw new Error("User not found"); diff --git a/src/services/private-services/AddressesService/AddressesService.ts b/src/services/private-services/AddressesService/AddressesService.ts index 8d3886c3..41e53765 100644 --- a/src/services/private-services/AddressesService/AddressesService.ts +++ b/src/services/private-services/AddressesService/AddressesService.ts @@ -20,7 +20,7 @@ export default class AddressesService extends BaseService { * @description : Get a address by uid * @throws {Error} If address cannot be get */ - public async getByUid(uuid: string) { - return this.addressRepository.findOneByUid(uuid); + public async getByUid(uid: string) { + return this.addressRepository.findOneByUid(uid); } } diff --git a/src/services/private-services/ContactsService/ContactsService.ts b/src/services/private-services/ContactsService/ContactsService.ts index 4c1df6d1..4d381a84 100644 --- a/src/services/private-services/ContactsService/ContactsService.ts +++ b/src/services/private-services/ContactsService/ContactsService.ts @@ -20,7 +20,7 @@ export default class ContactsService extends BaseService { * @description : Get a contact by uid * @throws {Error} If contact cannot be get */ - public async getByUid(uuid: string) { - return this.contactRepository.findOneByUid(uuid); + public async getByUid(uid: string) { + return this.contactRepository.findOneByUid(uid); } } diff --git a/src/services/super-admin/CustomersService/CustomersService.ts b/src/services/super-admin/CustomersService/CustomersService.ts index f096654e..20470182 100644 --- a/src/services/super-admin/CustomersService/CustomersService.ts +++ b/src/services/super-admin/CustomersService/CustomersService.ts @@ -38,7 +38,7 @@ export default class CustomersService extends BaseService { * @description : Get a customer by uid * @throws {Error} If customer cannot be get by uid */ - public async getByUid(uid: string): Promise { - return this.customerRepository.findOneByUid(uid); + public async getByUid(uid: string, query?: any): Promise { + return this.customerRepository.findOneByUid(uid, query); } } diff --git a/src/services/super-admin/DeedTypesService/DeedTypesService.ts b/src/services/super-admin/DeedTypesService/DeedTypesService.ts index c52f3278..da71909e 100644 --- a/src/services/super-admin/DeedTypesService/DeedTypesService.ts +++ b/src/services/super-admin/DeedTypesService/DeedTypesService.ts @@ -40,7 +40,7 @@ export default class DeedTypesService extends BaseService { * @description : Get a deedtype by uid * @throws {Error} If deed-type cannot be get by uid */ - public async getByUid(uid: string) { - return this.deedTypeRepository.findOneByUid(uid); + public async getByUid(uid: string, query?: any) { + return this.deedTypeRepository.findOneByUid(uid, query); } } diff --git a/src/services/super-admin/DeedsService/DeedsService.ts b/src/services/super-admin/DeedsService/DeedsService.ts index 5d144b14..bb133369 100644 --- a/src/services/super-admin/DeedsService/DeedsService.ts +++ b/src/services/super-admin/DeedsService/DeedsService.ts @@ -30,8 +30,8 @@ export default class DeedsService extends BaseService { * @description : Update data of a deed with document types * @throws {Error} If deeds cannot be updated with document types or one of them */ - public async update(deedUuid: string, deed: Deed): Promise { - return this.deedRepository.update(deedUuid, deed); + public async update(deeduid: string, deed: Deed): Promise { + return this.deedRepository.update(deeduid, deed); } /** diff --git a/src/services/super-admin/DocumentTypesService/DocumentTypesService.ts b/src/services/super-admin/DocumentTypesService/DocumentTypesService.ts index ccf13a05..dacfe17f 100644 --- a/src/services/super-admin/DocumentTypesService/DocumentTypesService.ts +++ b/src/services/super-admin/DocumentTypesService/DocumentTypesService.ts @@ -38,7 +38,7 @@ export default class DocumentTypesService extends BaseService { * @description : Get a document-type by uid * @throws {Error} If document-type is not found */ - public async getByUid(uid: string) { - return this.documentTypeRepository.findOneByUid(uid); + public async getByUid(uid: string, query?: any) { + return this.documentTypeRepository.findOneByUid(uid, query); } } diff --git a/src/services/super-admin/DocumentsService/DocumentsService.ts b/src/services/super-admin/DocumentsService/DocumentsService.ts index 38bed1f8..4e466535 100644 --- a/src/services/super-admin/DocumentsService/DocumentsService.ts +++ b/src/services/super-admin/DocumentsService/DocumentsService.ts @@ -54,7 +54,7 @@ export default class DocumentsService extends BaseService { * @description : Get a document by uid * @throws {Error} If document cannot be get by uid */ - public async getByUid(uid: string) { - return this.documentsRepository.findOneByUid(uid); + public async getByUid(uid: string, query?: any) { + return this.documentsRepository.findOneByUid(uid, query); } } diff --git a/src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts b/src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts index bcc7147d..06388662 100644 --- a/src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts +++ b/src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts @@ -37,15 +37,15 @@ export default class OfficeFoldersService extends BaseService { * @description : Modify a folder * @throws {Error} If folder cannot be modified */ - public async update(officeFolderUuid: string, officeFolderEntity: OfficeFolder): Promise { - return this.officeFoldersRepository.update(officeFolderUuid, officeFolderEntity); + public async update(officeFolderuid: string, officeFolderEntity: OfficeFolder): Promise { + return this.officeFoldersRepository.update(officeFolderuid, officeFolderEntity); } /** * @description : Get a folder by uid * @throws {Error} If folder cannot be get by uid */ - public async getByUid(uid: string) { - return this.officeFoldersRepository.findOneByUid(uid); + public async getByUid(uid: string, query?: any) { + return this.officeFoldersRepository.findOneByUid(uid, query); } } diff --git a/src/services/super-admin/OfficesService/OfficesService.ts b/src/services/super-admin/OfficesService/OfficesService.ts index 6bb49a15..4de766be 100644 --- a/src/services/super-admin/OfficesService/OfficesService.ts +++ b/src/services/super-admin/OfficesService/OfficesService.ts @@ -38,7 +38,7 @@ export default class OfficesService extends BaseService { * @description : Get a office by uid * @throws {Error} If office cannot be get */ - public async getByUid(uid: string): Promise { - return this.officeRepository.findOneByUid(uid); + public async getByUid(uid: string, query?: any): Promise { + return this.officeRepository.findOneByUid(uid, query); } } diff --git a/src/services/super-admin/UsersService/UsersService.ts b/src/services/super-admin/UsersService/UsersService.ts index 62e11871..1e9c4445 100644 --- a/src/services/super-admin/UsersService/UsersService.ts +++ b/src/services/super-admin/UsersService/UsersService.ts @@ -31,15 +31,15 @@ export default class UsersService extends BaseService { * @description : Modify a user * @throws {Error} If user modification failed */ - public update(uuid: string, userEntity: User): Promise { - return this.userRepository.update(uuid, userEntity); + public update(uid: string, userEntity: User): Promise { + return this.userRepository.update(uid, userEntity); } /** * @description : Get a user by uid * @throws {Error} If user cannot be get by uid */ - public getByUid(uid: string): Promise { - return this.userRepository.findOneByUid(uid); + public getByUid(uid: string, query?: any): Promise { + return this.userRepository.findOneByUid(uid, query); } } diff --git a/src/test/config/Init.ts b/src/test/config/Init.ts index 0d6d0380..8be002d5 100644 --- a/src/test/config/Init.ts +++ b/src/test/config/Init.ts @@ -27,7 +27,7 @@ export const initDocumentType = (documentType: DocumentType, office: Office): Pr public_description: documentType.public_description, private_description: documentType.private_description, archived_at: null, - office_uuid: office.uid!, + office_uid: office.uid!, }, }); }; @@ -38,11 +38,11 @@ export const initDeedType = (deedType: DeedType, office: Office, documentTypes?: name: deedType.name, description: deedType.description, archived_at: null, - office_uuid: office.uid!, + office_uid: office.uid!, deed_type_has_document_types: { createMany: { data: documentTypes!.map((documentType) => ({ - document_type_uuid: documentType, + document_type_uid: documentType, })), skipDuplicates: true, }, diff --git a/src/test/services/super-admin/CustomersService.test.ts b/src/test/services/super-admin/CustomersService.test.ts index 6d7282bc..1ebccd55 100644 --- a/src/test/services/super-admin/CustomersService.test.ts +++ b/src/test/services/super-admin/CustomersService.test.ts @@ -28,7 +28,7 @@ describe("test create function", () => { expect(customerCreated?.status).toEqual("PENDING"); // verify if customer contact is created in db - const contactCreated = await prisma.contacts.findUnique({ where: { uuid: customerCreated.contact_uuid } }); + const contactCreated = await prisma.contacts.findUnique({ where: { uid: customerCreated.contact_uid } }); expect(contactCreated?.first_name).toEqual(customer.contact.first_name); expect(contactCreated?.last_name).toEqual(customer.contact.last_name); expect(contactCreated?.cell_phone_number).toEqual(customer.contact.cell_phone_number); @@ -37,7 +37,7 @@ describe("test create function", () => { expect(contactCreated?.email).toEqual(customer.contact.email); // verify if customer address is created in db - const addressForContactCreated = await prisma.addresses.findUnique({ where: { uuid: contactCreated?.address_uuid } }); + const addressForContactCreated = await prisma.addresses.findUnique({ where: { uid: contactCreated?.address_uid } }); expect(addressForContactCreated?.address).toEqual(customer.contact.address?.address); expect(addressForContactCreated?.zip_code).toEqual(customer.contact.address?.zip_code); expect(addressForContactCreated?.city).toEqual(customer.contact.address?.city); @@ -83,7 +83,7 @@ describe("test create function", () => { expect(customerCreated?.status).toEqual("PENDING"); // verify if customer_ contact is created in db - const contactCreated = await prisma.contacts.findUnique({ where: { uuid: customerCreated.contact_uuid } }); + const contactCreated = await prisma.contacts.findUnique({ where: { uid: customerCreated.contact_uid } }); expect(contactCreated?.first_name).toEqual(customer.contact.first_name); expect(contactCreated?.last_name).toEqual(customer.contact.last_name); expect(contactCreated?.cell_phone_number).toEqual(customer_.contact.cell_phone_number); @@ -92,7 +92,7 @@ describe("test create function", () => { expect(contactCreated?.email).toEqual(customer_.contact.email); // verify if customer_ address is created in db - const addressForContactCreated = await prisma.addresses.findUnique({ where: { uuid: contactCreated?.address_uuid } }); + const addressForContactCreated = await prisma.addresses.findUnique({ where: { uid: contactCreated?.address_uid } }); expect(addressForContactCreated?.address).toEqual(customer.contact.address?.address); expect(addressForContactCreated?.zip_code).toEqual(customer.contact.address?.zip_code); expect(addressForContactCreated?.city).toEqual(customer.contact.address?.city); @@ -104,12 +104,12 @@ describe("test update function", () => { const customerCreated = await prisma.customers.findFirstOrThrow({ where: { contact: { email: customer_.contact.email } } }); // update the last customer created with his own new office and own contact - const updatedCustomer = await CustomersServiceTest.update(customerCreated.uuid, customer_); + const updatedCustomer = await CustomersServiceTest.update(customerCreated.uid, customer_); expect(updatedCustomer?.status).toEqual("ERRONED"); // verify if customer_ contact is created in db - const existingContact = await prisma.contacts.findUnique({ where: { uuid: updatedCustomer.contact_uuid } }); + const existingContact = await prisma.contacts.findUnique({ where: { uid: updatedCustomer.contact_uid } }); expect(existingContact?.first_name).toEqual(customer_.contact.first_name); expect(existingContact?.last_name).toEqual(customer_.contact.last_name); expect(existingContact?.cell_phone_number).toEqual(customer_.contact.cell_phone_number); @@ -118,14 +118,14 @@ describe("test update function", () => { expect(existingContact?.email).toEqual(customer_.contact.email); // verify if customer_ address is created in db - const addressForExistingContact = await prisma.addresses.findUnique({ where: { uuid: existingContact?.address_uuid } }); + const addressForExistingContact = await prisma.addresses.findUnique({ where: { uid: existingContact?.address_uid } }); expect(addressForExistingContact?.address).toEqual(customer_.contact.address?.address); expect(addressForExistingContact?.zip_code).toEqual(customer_.contact.address?.zip_code); expect(addressForExistingContact?.city).toEqual(customer_.contact.address?.city); }); it("should not update an customer with an email already used", async () => { - const customerUid = (await prisma.customers.findFirstOrThrow({ where: { contact: { email: customer_.contact.email } } })).uuid; + const customerUid = (await prisma.customers.findFirstOrThrow({ where: { contact: { email: customer_.contact.email } } })).uid; let updatedCustomer: Customer = JSON.parse(JSON.stringify(customer_)); updatedCustomer.contact.email = customerContact.email; @@ -137,7 +137,7 @@ describe("test update function", () => { }); it("should not update an customer with an phone number already used", async () => { - const customerUid = (await prisma.customers.findFirstOrThrow({ where: { contact: { email: customer_.contact.email } } })).uuid; + const customerUid = (await prisma.customers.findFirstOrThrow({ where: { contact: { email: customer_.contact.email } } })).uid; let updatedCustomer: Customer = JSON.parse(JSON.stringify(customer_)); updatedCustomer.contact.cell_phone_number = customerContact.cell_phone_number; diff --git a/src/test/services/super-admin/DeedService.test.ts b/src/test/services/super-admin/DeedService.test.ts index f208958f..58511ebb 100644 --- a/src/test/services/super-admin/DeedService.test.ts +++ b/src/test/services/super-admin/DeedService.test.ts @@ -13,10 +13,10 @@ const prisma = new PrismaClient(); const DeedServiceTest = new DeedService(Container.get(DeedsRepository)); beforeAll(async () => { - office.uid = (await initOffice(office)).uuid; - documentType.uid = (await initDocumentType(documentType, office)).uuid; - documentType_.uid = (await initDocumentType(documentType_, office)).uuid; - deedType.uid = (await initDeedType(deedType, office, [documentType.uid])).uuid; + office.uid = (await initOffice(office)).uid; + documentType.uid = (await initDocumentType(documentType, office)).uid; + documentType_.uid = (await initDocumentType(documentType_, office)).uid; + deedType.uid = (await initDeedType(deedType, office, [documentType.uid])).uid; }); afterAll(async () => { @@ -29,7 +29,7 @@ afterAll(async () => { describe("test create function", () => { it("should not create a new deed if deed type is unknown", async () => { let deedWithoutDeedTypeUid: Deed = JSON.parse(JSON.stringify(deed)); - deedWithoutDeedTypeUid.deed_type.uid = "random uuid"; + deedWithoutDeedTypeUid.deed_type.uid = "random uid"; // try to create a new deed with unknown deed type async function createDeedWithUnknownDeedType() { await DeedServiceTest.create(deedWithoutDeedTypeUid); @@ -42,13 +42,13 @@ describe("test create function", () => { deedWithDeedTypeUid.deed_type.uid = deedType.uid; const deedCreated = await DeedServiceTest.create(deedWithDeedTypeUid); - expect(deedCreated.deed_type_uuid).toEqual(deedType.uid); + expect(deedCreated.deed_type_uid).toEqual(deedType.uid); }); it("should have by default the same document types as its deed type ", async () => { const deedWithDocumentTypes = await prisma.deeds.findFirstOrThrow({ include: { deed_has_document_types: true } }); expect(deedWithDocumentTypes.deed_has_document_types.length).toEqual(1); - expect(deedWithDocumentTypes.deed_has_document_types[0]?.document_type_uuid).toEqual(documentType.uid); + expect(deedWithDocumentTypes.deed_has_document_types[0]?.document_type_uid).toEqual(documentType.uid); }); it("should create a the same deed based on existing deed type", async () => { @@ -56,7 +56,7 @@ describe("test create function", () => { deedWithDeedTypeUid.deed_type.uid = deedType.uid; const deedCreated = await DeedServiceTest.create(deedWithDeedTypeUid); - expect(deedCreated.deed_type_uuid).toEqual(deedType.uid); + expect(deedCreated.deed_type_uid).toEqual(deedType.uid); }); it("should not create a new deed based on archivated deed type", async () => { @@ -64,7 +64,7 @@ describe("test create function", () => { deedArchivated.deed_type.uid = deedType.uid; await prisma.deedTypes.update({ - where: { uuid: deedType.uid }, + where: { uid: deedType.uid }, data: { archived_at: new Date(Date.now()), }, @@ -80,7 +80,7 @@ describe("test create function", () => { describe("test update function", () => { it("should add document types to a deed", async () => { - const deedUid = (await prisma.deeds.findFirstOrThrow({ where: { deed_type_uuid: deedType.uid } })).uuid; + const deedUid = (await prisma.deeds.findFirstOrThrow({ where: { deed_type_uid: deedType.uid } })).uid; let deedToUpdate: Deed = JSON.parse(JSON.stringify(deed)); deedToUpdate.deed_has_document_types = [ @@ -102,7 +102,7 @@ describe("test update function", () => { const deedUpdated = await prisma.deeds.findFirstOrThrow({ where: { - uuid: deedUid, + uid: deedUid, }, include: { deed_has_document_types: true, @@ -112,7 +112,7 @@ describe("test update function", () => { }); it("should not add document types to a deed type that already has those document types ", async () => { - const deedUid = (await prisma.deeds.findFirstOrThrow({ where: { deed_type_uuid: deedType.uid } })).uuid; + const deedUid = (await prisma.deeds.findFirstOrThrow({ where: { deed_type_uid: deedType.uid } })).uid; let deedToUpdate: Deed = JSON.parse(JSON.stringify(deed)); deedToUpdate.deed_has_document_types = [ @@ -134,7 +134,7 @@ describe("test update function", () => { const deedUpdated = await prisma.deeds.findFirstOrThrow({ where: { - uuid: deedUid, + uid: deedUid, }, include: { deed_has_document_types: true, @@ -144,7 +144,7 @@ describe("test update function", () => { }); it("should delete document types from a deed", async () => { - const deedUid = (await prisma.deeds.findFirstOrThrow({ where: { deed_type_uuid: deedType.uid } })).uuid; + const deedUid = (await prisma.deeds.findFirstOrThrow({ where: { deed_type_uid: deedType.uid } })).uid; let deedToUpdate: Deed = JSON.parse(JSON.stringify(deed)); // set relation between deed and document types empty @@ -154,7 +154,7 @@ describe("test update function", () => { const deedUpdated = await prisma.deeds.findFirstOrThrow({ where: { - uuid: deedUid, + uid: deedUid, }, include: { deed_has_document_types: true, @@ -173,7 +173,7 @@ describe("test get function", () => { expect(deeds.length).toEqual(2); // verify result content - expect(deeds[0]?.deed_type_uuid).toEqual(deedType.uid); - expect(deeds[1]?.deed_type_uuid).toEqual(deedType.uid); + expect(deeds[0]?.deed_type_uid).toEqual(deedType.uid); + expect(deeds[1]?.deed_type_uid).toEqual(deedType.uid); }); }); diff --git a/src/test/services/super-admin/DeedTypesService.test.ts b/src/test/services/super-admin/DeedTypesService.test.ts index 28b99eb6..5cf11f7f 100644 --- a/src/test/services/super-admin/DeedTypesService.test.ts +++ b/src/test/services/super-admin/DeedTypesService.test.ts @@ -13,10 +13,10 @@ const prisma = new PrismaClient(); const DeedTypeServiceTest = new DeedTypeService(Container.get(DeedTypesRepository)); beforeAll(async () => { - office.uid = (await initOffice(office)).uuid; - office_.uid = (await initOffice(office_)).uuid; - documentType.uid = (await initDocumentType(documentType, office)).uuid; - documentType_.uid = (await initDocumentType(documentType_, office)).uuid; + office.uid = (await initOffice(office)).uid; + office_.uid = (await initOffice(office_)).uid; + documentType.uid = (await initDocumentType(documentType, office)).uid; + documentType_.uid = (await initDocumentType(documentType_, office)).uid; }); afterAll(async () => { @@ -29,7 +29,7 @@ afterAll(async () => { describe("test create function", () => { it("should not create a new deed type if office is unknown", async () => { let deedTypeWithoutOfficeUid: DeedType = JSON.parse(JSON.stringify(deedType)); - deedTypeWithoutOfficeUid.office.uid = "random uuid"; + deedTypeWithoutOfficeUid.office.uid = "random uid"; // try to create a new deed type with unknown office async function createDeedTypeWithUnknownOffice() { await DeedTypeServiceTest.create(deedTypeWithoutOfficeUid); @@ -43,7 +43,7 @@ describe("test create function", () => { expect(deedTypeCreated.name).toEqual(deedType.name); expect(deedTypeCreated.description).toEqual(deedType.description); expect(deedTypeCreated.archived_at).toBeNull(); - expect(deedTypeCreated.office_uuid).toEqual(office.uid); + expect(deedTypeCreated.office_uid).toEqual(office.uid); }); it("should not create a new deed type with a name already used for a given office", async () => { @@ -66,7 +66,7 @@ describe("test create function", () => { expect(deedTypeCreated.name).toEqual(deedType.name); expect(deedTypeCreated.description).toEqual(deedType.description); expect(deedTypeCreated.archived_at).toBeNull(); - expect(deedTypeCreated.office_uuid).toEqual(office_.uid); + expect(deedTypeCreated.office_uid).toEqual(office_.uid); }); it("should create the a new deed type version with a different name for a given office", async () => { @@ -78,33 +78,33 @@ describe("test create function", () => { expect(deedTypeCreated.name).toEqual(deedType_.name); expect(deedTypeCreated.description).toEqual(deedType.description); expect(deedTypeCreated.archived_at).toBeNull(); - expect(deedTypeCreated.office_uuid).toEqual(office.uid); + expect(deedTypeCreated.office_uid).toEqual(office.uid); }); }); describe("test update function", () => { it("should update a deed type data", async () => { - const deedTypeCreated = await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType_.name, office_uuid: office.uid } }); + const deedTypeCreated = await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType_.name, office_uid: office.uid } }); expect(deedTypeCreated.name).toEqual(deedType_.name); expect(deedTypeCreated.description).toEqual(deedType.description); expect(deedTypeCreated.archived_at).toBeNull(); - expect(deedTypeCreated.office_uuid).toEqual(deedType.office.uid); + expect(deedTypeCreated.office_uid).toEqual(deedType.office.uid); let deedTypeWithNewDescription: DeedType = JSON.parse(JSON.stringify(deedType_)); deedTypeWithNewDescription.office = office; // update the last deed type created with his the right description - const deedTypeUpdated = await DeedTypeServiceTest.update(deedTypeCreated.uuid, deedTypeWithNewDescription); + const deedTypeUpdated = await DeedTypeServiceTest.update(deedTypeCreated.uid, deedTypeWithNewDescription); expect(deedTypeUpdated.name).toEqual(deedType_.name); expect(deedTypeUpdated.description).toEqual(deedType_.description); expect(deedTypeUpdated.archived_at).toBeNull(); - expect(deedTypeUpdated.office_uuid).toEqual(deedType.office.uid); + expect(deedTypeUpdated.office_uid).toEqual(deedType.office.uid); }); it("should not update a deed type name with an already used name for given office", async () => { - const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType_.name, office_uuid: office.uid } })).uuid; + const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType_.name, office_uid: office.uid } })).uid; let deedTypeWithSameNameAndOffice: DeedType = JSON.parse(JSON.stringify(deedType_)); deedTypeWithSameNameAndOffice.office.uid = office.uid; deedTypeWithSameNameAndOffice.name = deedType.name; @@ -117,7 +117,7 @@ describe("test update function", () => { }); it("should not update a deed type office membership if the office already have this document type", async () => { - const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType_.name, office_uuid: office.uid } })).uuid; + const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType_.name, office_uid: office.uid } })).uid; let deedTypeWithSameNameAndOffice: DeedType = JSON.parse(JSON.stringify(deedType_)); deedTypeWithSameNameAndOffice.office.uid = office.uid; deedTypeWithSameNameAndOffice.name = deedType.name; @@ -130,62 +130,62 @@ describe("test update function", () => { }); it("should update a deed type office membership", async () => { - const deedTypeCreated = await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType_.name, office_uuid: office.uid } }); + const deedTypeCreated = await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType_.name, office_uid: office.uid } }); expect(deedTypeCreated.name).toEqual(deedType_.name); expect(deedTypeCreated.description).toEqual(deedType_.description); expect(deedTypeCreated.archived_at).toBeNull(); - expect(deedTypeCreated.office_uuid).toEqual(office.uid); + expect(deedTypeCreated.office_uid).toEqual(office.uid); // update the last deed type updated with a new office membership - const deedTypeUpdated = await DeedTypeServiceTest.update(deedTypeCreated.uuid, deedType_); + const deedTypeUpdated = await DeedTypeServiceTest.update(deedTypeCreated.uid, deedType_); expect(deedTypeUpdated.name).toEqual(deedType_.name); expect(deedTypeUpdated.description).toEqual(deedType_.description); expect(deedTypeUpdated.archived_at).toBeNull(); - expect(deedTypeUpdated.office_uuid).toEqual(deedType_.office.uid); + expect(deedTypeUpdated.office_uid).toEqual(deedType_.office.uid); }); it("should archivate a deed type", async () => { - const deedTypeCreated = await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType_.name, office_uuid: office_.uid } }); + const deedTypeCreated = await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType_.name, office_uid: office_.uid } }); expect(deedTypeCreated.name).toEqual(deedType_.name); expect(deedTypeCreated.description).toEqual(deedType_.description); expect(deedTypeCreated.archived_at).toBeNull(); - expect(deedTypeCreated.office_uuid).toEqual(deedType_.office.uid); + expect(deedTypeCreated.office_uid).toEqual(deedType_.office.uid); let deedTypeArchivated: DeedType = JSON.parse(JSON.stringify(deedType_)); const currentDate = new Date(Date.now()); deedTypeArchivated.archived_at = new Date(Date.now()); // archivate a deed type by giving a non null date for archivated_at attribute - const deedTypeUpdated = await DeedTypeServiceTest.update(deedTypeCreated.uuid, deedTypeArchivated); + const deedTypeUpdated = await DeedTypeServiceTest.update(deedTypeCreated.uid, deedTypeArchivated); expect(deedTypeUpdated.name).toEqual(deedType_.name); expect(deedTypeUpdated.description).toEqual(deedType_.description); expect(deedTypeUpdated.archived_at).toEqual(currentDate); - expect(deedTypeUpdated.office_uuid).toEqual(office_.uid); + expect(deedTypeUpdated.office_uid).toEqual(office_.uid); }); it("should unarchivate a deed type", async () => { - const deedTypeCreated = await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType_.name, office_uuid: office_.uid } }); + const deedTypeCreated = await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType_.name, office_uid: office_.uid } }); expect(deedTypeCreated.name).toEqual(deedType_.name); expect(deedTypeCreated.description).toEqual(deedType_.description); expect(deedTypeCreated.archived_at).not.toBeNull(); - expect(deedTypeCreated.office_uuid).toEqual(deedType_.office.uid); + expect(deedTypeCreated.office_uid).toEqual(deedType_.office.uid); // unarchivate a deed type by giving a null date for archivated_at attribute - const deedTypeUpdated = await DeedTypeServiceTest.update(deedTypeCreated.uuid, deedType_); + const deedTypeUpdated = await DeedTypeServiceTest.update(deedTypeCreated.uid, deedType_); expect(deedTypeUpdated.name).toEqual(deedType_.name); expect(deedTypeUpdated.description).toEqual(deedType_.description); expect(deedTypeUpdated.archived_at).toBeNull(); - expect(deedTypeUpdated.office_uuid).toEqual(office_.uid); + expect(deedTypeUpdated.office_uid).toEqual(office_.uid); }); it("should add document types to a deed type", async () => { - const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType.name, office_uuid: office.uid } })).uuid; + const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType.name, office_uid: office.uid } })).uid; let deedTypeToUpdate: DeedType = JSON.parse(JSON.stringify(deedType)); deedTypeToUpdate.deed_type_has_document_types = [ @@ -207,7 +207,7 @@ describe("test update function", () => { const deedTypeUpdated = await prisma.deedTypes.findFirstOrThrow({ where: { - uuid: deedTypeUid, + uid: deedTypeUid, }, include: { deed_type_has_document_types: true, @@ -217,7 +217,7 @@ describe("test update function", () => { }); it("should not add document types to a deed type that already has those document types ", async () => { - const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType.name, office_uuid: office.uid } })).uuid; + const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType.name, office_uid: office.uid } })).uid; let deedTypeToUpdate: DeedType = JSON.parse(JSON.stringify(deedType)); deedTypeToUpdate.deed_type_has_document_types = [ @@ -239,7 +239,7 @@ describe("test update function", () => { const deedTypeUpdated = await prisma.deedTypes.findFirstOrThrow({ where: { - uuid: deedTypeUid, + uid: deedTypeUid, }, include: { deed_type_has_document_types: true, @@ -249,7 +249,7 @@ describe("test update function", () => { }); it("should delete document types from a deed", async () => { - const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType.name, office_uuid: office.uid } })).uuid; + const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType.name, office_uid: office.uid } })).uid; let deedTypeToUpdate: DeedType = JSON.parse(JSON.stringify(deedType)); // set relation between deed and document types empty @@ -259,7 +259,7 @@ describe("test update function", () => { const deedTypeUpdated = await prisma.deedTypes.findFirstOrThrow({ where: { - uuid: deedTypeUid, + uid: deedTypeUid, }, include: { deed_type_has_document_types: true, @@ -281,21 +281,21 @@ describe("test get function", () => { expect(deedTypes[0]?.name).toEqual(deedType_.name); expect(deedTypes[0]?.description).toEqual(deedType_.description); expect(deedTypes[0]?.archived_at).toBeNull(); - expect(deedTypes[0]?.office_uuid).toEqual(office_.uid); + expect(deedTypes[0]?.office_uid).toEqual(office_.uid); expect(deedTypes[1]?.name).toEqual(deedType.name); expect(deedTypes[1]?.description).toEqual(deedType.description); expect(deedTypes[1]?.archived_at).toBeNull(); - expect(deedTypes[1]?.office_uuid).toEqual(office.uid); + expect(deedTypes[1]?.office_uid).toEqual(office.uid); expect(deedTypes[2]?.name).toEqual(deedType.name); expect(deedTypes[2]?.description).toEqual(deedType.description); expect(deedTypes[2]?.archived_at).toBeNull(); - expect(deedTypes[2]?.office_uuid).toEqual(office_.uid); + expect(deedTypes[2]?.office_uid).toEqual(office_.uid); }); it("should return an array of DeedTypes per offices", async () => { - const deedTypesForFirstOffice = await DeedTypeServiceTest.get({ where: { office: {uuid: office.uid} }, orderBy: { name: "asc" } }); + const deedTypesForFirstOffice = await DeedTypeServiceTest.get({ where: { office: {uid: office.uid} }, orderBy: { name: "asc" } }); expect(deedTypesForFirstOffice.length).toEqual(1); @@ -303,9 +303,9 @@ describe("test get function", () => { expect(deedTypesForFirstOffice[0]?.name).toEqual(deedType.name); expect(deedTypesForFirstOffice[0]?.description).toEqual(deedType.description); expect(deedTypesForFirstOffice[0]?.archived_at).toBeNull(); - expect(deedTypesForFirstOffice[0]?.office_uuid).toEqual(office.uid); + expect(deedTypesForFirstOffice[0]?.office_uid).toEqual(office.uid); - const deedTypesForSecondOffice = await DeedTypeServiceTest.get({ where: { office: {uuid: office_.uid} }, orderBy: { name: "asc" } }); + const deedTypesForSecondOffice = await DeedTypeServiceTest.get({ where: { office: {uid: office_.uid} }, orderBy: { name: "asc" } }); expect(deedTypesForSecondOffice.length).toEqual(2); @@ -313,11 +313,11 @@ describe("test get function", () => { expect(deedTypesForSecondOffice[0]?.name).toEqual(deedType_.name); expect(deedTypesForSecondOffice[0]?.description).toEqual(deedType_.description); expect(deedTypesForSecondOffice[0]?.archived_at).toBeNull(); - expect(deedTypesForSecondOffice[0]?.office_uuid).toEqual(office_.uid); + expect(deedTypesForSecondOffice[0]?.office_uid).toEqual(office_.uid); expect(deedTypesForSecondOffice[1]?.name).toEqual(deedType.name); expect(deedTypesForSecondOffice[1]?.description).toEqual(deedType.description); expect(deedTypesForSecondOffice[1]?.archived_at).toBeNull(); - expect(deedTypesForSecondOffice[1]?.office_uuid).toEqual(office_.uid); + expect(deedTypesForSecondOffice[1]?.office_uid).toEqual(office_.uid); }); }); diff --git a/src/test/services/super-admin/DocumentTypesService.test.ts b/src/test/services/super-admin/DocumentTypesService.test.ts index bc7c40e8..e8c88d17 100644 --- a/src/test/services/super-admin/DocumentTypesService.test.ts +++ b/src/test/services/super-admin/DocumentTypesService.test.ts @@ -13,8 +13,8 @@ const prisma = new PrismaClient(); const DocumentTypesServiceTest = new DocumentTypesService(Container.get(DocumentTypesRepository)); beforeAll(async () => { - office.uid = (await initOffice(office)).uuid; - office_.uid = (await initOffice(office_)).uuid; + office.uid = (await initOffice(office)).uid; + office_.uid = (await initOffice(office_)).uid; }); afterAll(async () => { @@ -27,7 +27,7 @@ afterAll(async () => { describe("test create function", () => { it("should not create a new document type if office is unknown", async () => { let documentTypeWithoutOfficeUid: DocumentType = JSON.parse(JSON.stringify(documentType)); - documentTypeWithoutOfficeUid.office.uid = "random uuid"; + documentTypeWithoutOfficeUid.office.uid = "random uid"; // try to create a new document type with unknown office async function createDocumentTypeWithUnknownOffice() { await DocumentTypesServiceTest.create(documentTypeWithoutOfficeUid); @@ -44,7 +44,7 @@ describe("test create function", () => { expect(documentTypeCreated.public_description).toEqual(documentType.public_description); expect(documentTypeCreated.private_description).toEqual(documentType.private_description); expect(documentTypeCreated.archived_at).toBeNull(); - expect(documentTypeCreated.office_uuid).toEqual(office.uid); + expect(documentTypeCreated.office_uid).toEqual(office.uid); }); it("should not create a new document type with a name already used for a given office", async () => { @@ -68,7 +68,7 @@ describe("test create function", () => { expect(documentTypeCreated.public_description).toEqual(documentType.public_description); expect(documentTypeCreated.private_description).toEqual(documentType.private_description); expect(documentTypeCreated.archived_at).toBeNull(); - expect(documentTypeCreated.office_uuid).toEqual(office_.uid); + expect(documentTypeCreated.office_uid).toEqual(office_.uid); }); it("should create a new document type version with a different name for a given office", async () => { @@ -82,37 +82,37 @@ describe("test create function", () => { expect(documentTypeCreated.public_description).toEqual(documentType.public_description); expect(documentTypeCreated.private_description).toEqual(documentType.private_description); expect(documentTypeCreated.archived_at).toBeNull(); - expect(documentTypeCreated.office_uuid).toEqual(office.uid); + expect(documentTypeCreated.office_uid).toEqual(office.uid); }); }); describe("test update function", () => { it("should update a document type", async () => { const documentTypeCreated = await prisma.documentTypes.findFirstOrThrow({ - where: { name: documentType_.name, office_uuid: office.uid }, + where: { name: documentType_.name, office_uid: office.uid }, }); expect(documentTypeCreated.name).toEqual(documentType_.name); expect(documentTypeCreated.public_description).toEqual(documentType.public_description); expect(documentTypeCreated.private_description).toEqual(documentType.private_description); expect(documentTypeCreated.archived_at).toBeNull(); - expect(documentTypeCreated.office_uuid).toEqual(office.uid); + expect(documentTypeCreated.office_uid).toEqual(office.uid); let documentTypeWithNewDescription: DocumentType = JSON.parse(JSON.stringify(documentType_)); documentTypeWithNewDescription.office.uid = office.uid; // update the last document type created with his the right descriptions - const documentTypeUpdated = await DocumentTypesServiceTest.update(documentTypeCreated.uuid, documentTypeWithNewDescription); + const documentTypeUpdated = await DocumentTypesServiceTest.update(documentTypeCreated.uid, documentTypeWithNewDescription); expect(documentTypeUpdated.name).toEqual(documentType_.name); expect(documentTypeUpdated.public_description).toEqual(documentType_.public_description); expect(documentTypeUpdated.private_description).toEqual(documentType_.private_description); expect(documentTypeUpdated.archived_at).toBeNull(); - expect(documentTypeUpdated.office_uuid).toEqual(office.uid); + expect(documentTypeUpdated.office_uid).toEqual(office.uid); }); it("should not update a document type name with an already used name for given office", async () => { const documentTypeUid = ( - await prisma.documentTypes.findFirstOrThrow({ where: { name: documentType_.name, office_uuid: office.uid } }) - ).uuid; + await prisma.documentTypes.findFirstOrThrow({ where: { name: documentType_.name, office_uid: office.uid } }) + ).uid; let documentTypeWithSameNameAndOffice: DocumentType = JSON.parse(JSON.stringify(documentType_)); documentTypeWithSameNameAndOffice.office.uid = office.uid; documentTypeWithSameNameAndOffice.name = documentType.name; @@ -126,8 +126,8 @@ describe("test update function", () => { it("should not update a document type office membership if the office already has this document type", async () => { const documentTypeUid = ( - await prisma.documentTypes.findFirstOrThrow({ where: { name: documentType_.name, office_uuid: office.uid } }) - ).uuid; + await prisma.documentTypes.findFirstOrThrow({ where: { name: documentType_.name, office_uid: office.uid } }) + ).uid; let documentTypeWithSameNameAndOffice: DocumentType = JSON.parse(JSON.stringify(documentType_)); documentTypeWithSameNameAndOffice.office.uid = office.uid; documentTypeWithSameNameAndOffice.name = documentType.name; @@ -141,74 +141,74 @@ describe("test update function", () => { it("should update a document type office membership", async () => { const documentTypeCreated = await prisma.documentTypes.findFirstOrThrow({ - where: { name: documentType_.name, office_uuid: office.uid }, + where: { name: documentType_.name, office_uid: office.uid }, }); expect(documentTypeCreated.name).toEqual(documentType_.name); expect(documentTypeCreated.public_description).toEqual(documentType_.public_description); expect(documentTypeCreated.private_description).toEqual(documentType_.private_description); expect(documentTypeCreated.archived_at).toBeNull(); - expect(documentTypeCreated.office_uuid).toEqual(office.uid); + expect(documentTypeCreated.office_uid).toEqual(office.uid); let documentTypeTransferedToNewOffice: DocumentType = JSON.parse(JSON.stringify(documentType_)); documentTypeTransferedToNewOffice.office.uid = office_.uid; // update the last document type updated with a new office membership - const documentTypeUpdated = await DocumentTypesServiceTest.update(documentTypeCreated.uuid, documentTypeTransferedToNewOffice); + const documentTypeUpdated = await DocumentTypesServiceTest.update(documentTypeCreated.uid, documentTypeTransferedToNewOffice); expect(documentTypeUpdated.name).toEqual(documentType_.name); expect(documentTypeUpdated.public_description).toEqual(documentType_.public_description); expect(documentTypeUpdated.private_description).toEqual(documentType_.private_description); expect(documentTypeUpdated.archived_at).toBeNull(); - expect(documentTypeUpdated.office_uuid).toEqual(office_.uid); + expect(documentTypeUpdated.office_uid).toEqual(office_.uid); }); it("should archivate a document type", async () => { const documentTypeCreated = await prisma.documentTypes.findFirstOrThrow({ - where: { name: documentType_.name, office_uuid: office_.uid }, + where: { name: documentType_.name, office_uid: office_.uid }, }); expect(documentTypeCreated.name).toEqual(documentType_.name); expect(documentTypeCreated.public_description).toEqual(documentType_.public_description); expect(documentTypeCreated.private_description).toEqual(documentType_.private_description); expect(documentTypeCreated.archived_at).toBeNull(); - expect(documentTypeCreated.office_uuid).toEqual(office_.uid); + expect(documentTypeCreated.office_uid).toEqual(office_.uid); let documentTypeArchivated: DocumentType = JSON.parse(JSON.stringify(documentType_)); documentTypeArchivated.office.uid = office_.uid; const currentDate = new Date(Date.now()); documentTypeArchivated.archived_at = currentDate; // archivate a document type by giving a non null date for archivated_at attribute - const documentTypeUpdated = await DocumentTypesServiceTest.update(documentTypeCreated.uuid, documentTypeArchivated); + const documentTypeUpdated = await DocumentTypesServiceTest.update(documentTypeCreated.uid, documentTypeArchivated); expect(documentTypeUpdated.name).toEqual(documentType_.name); expect(documentTypeUpdated.public_description).toEqual(documentType_.public_description); expect(documentTypeUpdated.private_description).toEqual(documentType_.private_description); expect(documentTypeUpdated.archived_at).toEqual(currentDate); - expect(documentTypeUpdated.office_uuid).toEqual(office_.uid); + expect(documentTypeUpdated.office_uid).toEqual(office_.uid); }); it("should unarchivate a document type", async () => { const documentTypeCreated = await prisma.documentTypes.findFirstOrThrow({ - where: { name: documentType_.name, office_uuid: office_.uid }, + where: { name: documentType_.name, office_uid: office_.uid }, }); expect(documentTypeCreated.name).toEqual(documentType_.name); expect(documentTypeCreated.public_description).toEqual(documentType_.public_description); expect(documentTypeCreated.private_description).toEqual(documentType_.private_description); expect(documentTypeCreated.archived_at).not.toBeNull(); - expect(documentTypeCreated.office_uuid).toEqual(office_.uid); + expect(documentTypeCreated.office_uid).toEqual(office_.uid); let documentTypeUnarchivated: DocumentType = JSON.parse(JSON.stringify(documentType_)); documentTypeUnarchivated.office.uid = office_.uid; // unarchivate a document type by giving a null date for archivated_at attribute - const documentTypeUpdated = await DocumentTypesServiceTest.update(documentTypeCreated.uuid, documentTypeUnarchivated); + const documentTypeUpdated = await DocumentTypesServiceTest.update(documentTypeCreated.uid, documentTypeUnarchivated); expect(documentTypeUpdated.name).toEqual(documentType_.name); expect(documentTypeUpdated.public_description).toEqual(documentType_.public_description); expect(documentTypeUpdated.private_description).toEqual(documentType_.private_description); expect(documentTypeUpdated.archived_at).toBeNull(); - expect(documentTypeUpdated.office_uuid).toEqual(office_.uid); + expect(documentTypeUpdated.office_uid).toEqual(office_.uid); }); }); @@ -225,23 +225,23 @@ describe("test get function", () => { expect(documentTypes[0]?.public_description).toEqual(documentType_.public_description); expect(documentTypes[0]?.private_description).toEqual(documentType_.private_description); expect(documentTypes[0]?.archived_at).toBeNull(); - expect(documentTypes[0]?.office_uuid).toEqual(office_.uid); + expect(documentTypes[0]?.office_uid).toEqual(office_.uid); expect(documentTypes[1]?.name).toEqual(documentType.name); expect(documentTypes[1]?.public_description).toEqual(documentType.public_description); expect(documentTypes[1]?.private_description).toEqual(documentType.private_description); expect(documentTypes[1]?.archived_at).toBeNull(); - expect(documentTypes[1]?.office_uuid).toEqual(office.uid); + expect(documentTypes[1]?.office_uid).toEqual(office.uid); expect(documentTypes[2]?.name).toEqual(documentType.name); expect(documentTypes[2]?.public_description).toEqual(documentType.public_description); expect(documentTypes[2]?.private_description).toEqual(documentType.private_description); expect(documentTypes[2]?.archived_at).toBeNull(); - expect(documentTypes[2]?.office_uuid).toEqual(office_.uid); + expect(documentTypes[2]?.office_uid).toEqual(office_.uid); }); it("should return an array of DocumentTypes per offices", async () => { - const documentTypesForFirstOffice = await DocumentTypesServiceTest.get({ where: { office: {uuid : office.uid }}, orderBy: { name: "asc" } }); + const documentTypesForFirstOffice = await DocumentTypesServiceTest.get({ where: { office: {uid : office.uid }}, orderBy: { name: "asc" } }); expect(documentTypesForFirstOffice.length).toEqual(1); @@ -250,9 +250,9 @@ describe("test get function", () => { expect(documentTypesForFirstOffice[0]?.public_description).toEqual(documentType.public_description); expect(documentTypesForFirstOffice[0]?.private_description).toEqual(documentType.private_description); expect(documentTypesForFirstOffice[0]?.archived_at).toBeNull(); - expect(documentTypesForFirstOffice[0]?.office_uuid).toEqual(office.uid); + expect(documentTypesForFirstOffice[0]?.office_uid).toEqual(office.uid); - const documentTypesForSecondOffice = await DocumentTypesServiceTest.get({ where: { office: {uuid : office_.uid }}, orderBy: { name: "asc" } }); + const documentTypesForSecondOffice = await DocumentTypesServiceTest.get({ where: { office: {uid : office_.uid }}, orderBy: { name: "asc" } }); expect(documentTypesForSecondOffice.length).toEqual(2); @@ -261,12 +261,12 @@ describe("test get function", () => { expect(documentTypesForSecondOffice[0]?.public_description).toEqual(documentType_.public_description); expect(documentTypesForSecondOffice[0]?.private_description).toEqual(documentType_.private_description); expect(documentTypesForSecondOffice[0]?.archived_at).toBeNull(); - expect(documentTypesForSecondOffice[0]?.office_uuid).toEqual(office_.uid); + expect(documentTypesForSecondOffice[0]?.office_uid).toEqual(office_.uid); expect(documentTypesForSecondOffice[1]?.name).toEqual(documentType.name); expect(documentTypesForSecondOffice[1]?.public_description).toEqual(documentType.public_description); expect(documentTypesForSecondOffice[1]?.private_description).toEqual(documentType.private_description); expect(documentTypesForSecondOffice[1]?.archived_at).toBeNull(); - expect(documentTypesForSecondOffice[1]?.office_uuid).toEqual(office_.uid); + expect(documentTypesForSecondOffice[1]?.office_uid).toEqual(office_.uid); }); }); diff --git a/src/test/services/super-admin/OfficeFolderService.test.ts b/src/test/services/super-admin/OfficeFolderService.test.ts index 6aa7451f..6011f30e 100644 --- a/src/test/services/super-admin/OfficeFolderService.test.ts +++ b/src/test/services/super-admin/OfficeFolderService.test.ts @@ -1,18 +1,7 @@ import "module-alias/register"; import "reflect-metadata"; import { OfficeFolderHasCustomers, OfficeFolderHasStakeholders, PrismaClient } from "prisma/prisma-client"; -import { - customer, - customer_, - deedType, - documentType, - documentType_, - office, - officeFolder, - officeFolder_, - user, - user_, -} from "@Test/config/MockedData"; +import { customer, customer_, deedType, documentType, documentType_, office, officeFolder, officeFolder_, user, user_ } from "@Test/config/MockedData"; import Container from "typedi"; import OfficeFoldersRepository from "@Repositories/OfficeFoldersRepository"; import OfficeFolderService from "@Services/super-admin/OfficeFoldersService/OfficeFoldersService"; @@ -25,14 +14,14 @@ const prisma = new PrismaClient(); const OfficeFolderServiceTest = new OfficeFolderService(Container.get(OfficeFoldersRepository), Container.get(DeedTypesService)); beforeAll(async () => { - office.uid = (await initOffice(office)).uuid; - documentType.uid = (await initDocumentType(documentType, office)).uuid; - documentType_.uid = (await initDocumentType(documentType_, office)).uuid; - deedType.uid = (await initDeedType(deedType, office, [documentType.uid])).uuid; - user.uid = (await initUsers(user)).uuid; - user_.uid = (await initUsers(user_)).uuid; - customer.uid = (await initCustomers(customer)).uuid; - customer_.uid = (await initCustomers(customer_)).uuid; + office.uid = (await initOffice(office)).uid; + documentType.uid = (await initDocumentType(documentType, office)).uid; + documentType_.uid = (await initDocumentType(documentType_, office)).uid; + deedType.uid = (await initDeedType(deedType, office, [documentType.uid])).uid; + user.uid = (await initUsers(user)).uid; + user_.uid = (await initUsers(user_)).uid; + customer.uid = (await initCustomers(customer)).uid; + customer_.uid = (await initCustomers(customer_)).uid; }); afterAll(async () => { @@ -49,7 +38,7 @@ afterAll(async () => { describe("test create function", () => { it("should not create a new office folder if deed type is unknown", async () => { let officeFolderWithoutDeedTypeUid: OfficeFolder = JSON.parse(JSON.stringify(officeFolder)); - officeFolderWithoutDeedTypeUid.deed.deed_type.uid = "random uuid"; + officeFolderWithoutDeedTypeUid.deed.deed_type.uid = "random uid"; // try to create a new deed with unknown deed type async function createOfficeFolderWithUnknownDeedType() { await OfficeFolderServiceTest.create(officeFolderWithoutDeedTypeUid); @@ -57,18 +46,27 @@ describe("test create function", () => { await expect(createOfficeFolderWithUnknownDeedType).rejects.toThrow(); }); + it("should not create a new office folder if deed type is archived", async () => { + let officeFolderWithArchivatedDeedType: OfficeFolder = JSON.parse(JSON.stringify(officeFolder)); + // try to create a new deed with unknown deed type + async function createOfficeFolderWithArchivedDeedType() { + await OfficeFolderServiceTest.create(officeFolderWithArchivatedDeedType); + } + await expect(createOfficeFolderWithArchivedDeedType).rejects.toThrow("deed type is archived"); + }); + it("should create a new office folder based on existing deed type", async () => { const officeFolderCreated = await OfficeFolderServiceTest.create(officeFolder); - const deedCreated = await prisma.deeds.findUniqueOrThrow({ where: { uuid: officeFolderCreated.deed_uuid } }); + const deedCreated = await prisma.deeds.findUniqueOrThrow({ where: { uid: officeFolderCreated.deed_uid } }); expect(officeFolderCreated.name).toEqual(officeFolder.name); expect(officeFolderCreated.folder_number).toEqual(officeFolder.folder_number); expect(officeFolderCreated.description).toEqual(officeFolder.description); expect(officeFolderCreated.archived_description).toEqual(null); expect(officeFolderCreated.status).toEqual("LIVE"); - expect(officeFolderCreated.office_uuid).toEqual(officeFolder.office.uid); - expect(deedCreated.deed_type_uuid).toEqual(officeFolder.deed.deed_type.uid); + expect(officeFolderCreated.office_uid).toEqual(officeFolder.office.uid); + expect(deedCreated.deed_type_uid).toEqual(officeFolder.deed.deed_type.uid); }); it("should contains stakeholders", async () => { @@ -77,32 +75,32 @@ describe("test create function", () => { }); const stakeholderRelation = await prisma.officeFolderHasStakeholders.findUniqueOrThrow({ where: { - office_folder_uuid_user_stakeholder_uuid: { - user_stakeholder_uuid: user.uid!, - office_folder_uuid: officeFolderCreated.uuid, + office_folder_uid_user_stakeholder_uid: { + user_stakeholder_uid: user.uid!, + office_folder_uid: officeFolderCreated.uid, }, }, }); const stakeholderRelation_ = await prisma.officeFolderHasStakeholders.findUniqueOrThrow({ where: { - office_folder_uuid_user_stakeholder_uuid: { - user_stakeholder_uuid: user_.uid!, - office_folder_uuid: officeFolderCreated.uuid, + office_folder_uid_user_stakeholder_uid: { + user_stakeholder_uid: user_.uid!, + office_folder_uid: officeFolderCreated.uid, }, }, }); expect(officeFolderCreated.office_folder_has_stakeholder.length).toEqual(2); const stakeholder: OfficeFolderHasStakeholders = { - uuid: stakeholderRelation.uuid, - office_folder_uuid: officeFolderCreated.uuid, - user_stakeholder_uuid: user.uid!, + uid: stakeholderRelation.uid, + office_folder_uid: officeFolderCreated.uid, + user_stakeholder_uid: user.uid!, created_at: officeFolderCreated.created_at, updated_at: officeFolderCreated.updated_at, }; const stakeholder_: OfficeFolderHasStakeholders = { - uuid: stakeholderRelation_.uuid, - office_folder_uuid: officeFolderCreated.uuid, - user_stakeholder_uuid: user_.uid!, + uid: stakeholderRelation_.uid, + office_folder_uid: officeFolderCreated.uid, + user_stakeholder_uid: user_.uid!, created_at: officeFolderCreated.created_at, updated_at: officeFolderCreated.updated_at, }; @@ -120,7 +118,7 @@ describe("test create function", () => { }); it("should not create a new office folder if deed type is archived", async () => { - await prisma.deedTypes.update({ where: { uuid: deedType.uid }, data: { archived_at: new Date(Date.now()) } }); + await prisma.deedTypes.update({ where: { uid: deedType.uid }, data: { archived_at: new Date(Date.now()) } }); // try to create a new deed with archivated deed type async function createDeedWithArchivatedDeedType() { await OfficeFolderServiceTest.create(officeFolder); @@ -137,21 +135,21 @@ describe("test update function", () => { expect(officeFolderCreated.office_folder_has_customers).toEqual([]); // mocked data contains the customers - await OfficeFolderServiceTest.update(officeFolderCreated.uuid, officeFolder); + await OfficeFolderServiceTest.update(officeFolderCreated.uid, officeFolder); const customerRelation = await prisma.officeFolderHasCustomers.findUniqueOrThrow({ where: { - office_folder_uuid_customer_uuid: { - customer_uuid: customer.uid!, - office_folder_uuid: officeFolderCreated.uuid, + office_folder_uid_customer_uid: { + customer_uid: customer.uid!, + office_folder_uid: officeFolderCreated.uid, }, }, }); const customerRelation_ = await prisma.officeFolderHasCustomers.findUniqueOrThrow({ where: { - office_folder_uuid_customer_uuid: { - customer_uuid: customer_.uid!, - office_folder_uuid: officeFolderCreated.uuid, + office_folder_uid_customer_uid: { + customer_uid: customer_.uid!, + office_folder_uid: officeFolderCreated.uid, }, }, }); @@ -162,16 +160,16 @@ describe("test update function", () => { expect(officeFolderCreated.office_folder_has_customers.length).toEqual(2); const officeFolderHasCustomer: OfficeFolderHasCustomers = { - uuid: customerRelation.uuid, - office_folder_uuid: officeFolderCreated.uuid, - customer_uuid: customer.uid!, + uid: customerRelation.uid, + office_folder_uid: officeFolderCreated.uid, + customer_uid: customer.uid!, created_at: customerRelation.created_at, updated_at: customerRelation.updated_at, }; const officeFolderHasCustomer_: OfficeFolderHasCustomers = { - uuid: customerRelation_.uuid, - office_folder_uuid: officeFolderCreated.uuid, - customer_uuid: customer_.uid!, + uid: customerRelation_.uid, + office_folder_uid: officeFolderCreated.uid, + customer_uid: customer_.uid!, created_at: customerRelation_.created_at, updated_at: customerRelation_.updated_at, }; @@ -190,13 +188,13 @@ describe("test update function", () => { let officeFolderWithLessCustomers: OfficeFolder = JSON.parse(JSON.stringify(officeFolder)); officeFolderWithLessCustomers.office_folder_has_customers!.pop(); // mocked data contains the customers - await OfficeFolderServiceTest.update(officeFolderCreated.uuid, officeFolderWithLessCustomers); + await OfficeFolderServiceTest.update(officeFolderCreated.uid, officeFolderWithLessCustomers); const customerRelation = await prisma.officeFolderHasCustomers.findUniqueOrThrow({ where: { - office_folder_uuid_customer_uuid: { - customer_uuid: customer.uid!, - office_folder_uuid: officeFolderCreated.uuid, + office_folder_uid_customer_uid: { + customer_uid: customer.uid!, + office_folder_uid: officeFolderCreated.uid, }, }, }); @@ -207,9 +205,9 @@ describe("test update function", () => { expect(officeFolderCreated.office_folder_has_customers.length).toEqual(1); const officeFolderHasCustomer: OfficeFolderHasCustomers = { - uuid: customerRelation.uuid, - office_folder_uuid: officeFolderCreated.uuid, - customer_uuid: customer.uid!, + uid: customerRelation.uid, + office_folder_uid: officeFolderCreated.uid, + customer_uid: customer.uid!, created_at: customerRelation.created_at, updated_at: customerRelation.updated_at, }; @@ -225,13 +223,13 @@ describe("test update function", () => { let officeFolderWithLessStakeholders: OfficeFolder = JSON.parse(JSON.stringify(officeFolder)); officeFolderWithLessStakeholders.office_folder_has_stakeholder!.pop(); // mocked data contains the customers - await OfficeFolderServiceTest.update(officeFolderCreated.uuid, officeFolderWithLessStakeholders); + await OfficeFolderServiceTest.update(officeFolderCreated.uid, officeFolderWithLessStakeholders); const stakeholderRelation = await prisma.officeFolderHasStakeholders.findUniqueOrThrow({ where: { - office_folder_uuid_user_stakeholder_uuid: { - user_stakeholder_uuid: user.uid!, - office_folder_uuid: officeFolderCreated.uuid, + office_folder_uid_user_stakeholder_uid: { + user_stakeholder_uid: user.uid!, + office_folder_uid: officeFolderCreated.uid, }, }, }); @@ -242,9 +240,9 @@ describe("test update function", () => { expect(officeFolderCreated.office_folder_has_stakeholder.length).toEqual(1); const officeFolderHasStakeholder: OfficeFolderHasStakeholders = { - uuid: stakeholderRelation.uuid, - office_folder_uuid: officeFolderCreated.uuid, - user_stakeholder_uuid: user.uid!, + uid: stakeholderRelation.uid, + office_folder_uid: officeFolderCreated.uid, + user_stakeholder_uid: user.uid!, created_at: stakeholderRelation.created_at, updated_at: stakeholderRelation.updated_at, }; @@ -256,7 +254,7 @@ describe("test update function", () => { // mocked data for this office folder is "ARCHIVATED" by default officeFolderArchived.archived_description = "folder complete"; - const officeFolderUpdated = await OfficeFolderServiceTest.update(officeFolderCreated.uuid, officeFolderArchived); + const officeFolderUpdated = await OfficeFolderServiceTest.update(officeFolderCreated.uid, officeFolderArchived); expect(officeFolderUpdated.archived_description).toEqual(officeFolderArchived.archived_description); expect(officeFolderUpdated.status).toEqual("ARCHIVED"); @@ -270,7 +268,7 @@ describe("test update function", () => { let officeFolderUnarchived: OfficeFolder = JSON.parse(JSON.stringify(officeFolder)); officeFolderUnarchived.status = "LIVE"; - const officeFolderUpdated = await OfficeFolderServiceTest.update(officeFolderCreated.uuid, officeFolderUnarchived); + const officeFolderUpdated = await OfficeFolderServiceTest.update(officeFolderCreated.uid, officeFolderUnarchived); expect(officeFolderUpdated.archived_description).toBeNull(); expect(officeFolderUpdated.status).toEqual("LIVE"); diff --git a/src/test/services/super-admin/UsersService.test.ts b/src/test/services/super-admin/UsersService.test.ts index ca1bb88f..a4ce6f06 100644 --- a/src/test/services/super-admin/UsersService.test.ts +++ b/src/test/services/super-admin/UsersService.test.ts @@ -28,7 +28,7 @@ describe("test create function", () => { expect(userCreated?.idNot).toEqual(user.idNot); // verify if user contact is created in db - const contactCreated = await prisma.contacts.findUnique({ where: { uuid: userCreated.contact_uuid } }); + const contactCreated = await prisma.contacts.findUnique({ where: { uid: userCreated.contact_uid } }); expect(contactCreated?.first_name).toEqual(user.contact.first_name); expect(contactCreated?.last_name).toEqual(user.contact.last_name); expect(contactCreated?.cell_phone_number).toEqual(user.contact.cell_phone_number); @@ -37,20 +37,20 @@ describe("test create function", () => { expect(contactCreated?.email).toEqual(user.contact.email); // verify if user address is created in db - const addressForContactCreated = await prisma.addresses.findUnique({ where: { uuid: contactCreated?.address_uuid } }); + const addressForContactCreated = await prisma.addresses.findUnique({ where: { uid: contactCreated?.address_uid } }); expect(addressForContactCreated?.address).toEqual(user.contact.address?.address); expect(addressForContactCreated?.zip_code).toEqual(user.contact.address?.zip_code); expect(addressForContactCreated?.city).toEqual(user.contact.address?.city); // verify if user office is created in db - const officeCreated = await prisma.offices.findUnique({ where: { uuid: userCreated.office_uuid } }); + const officeCreated = await prisma.offices.findUnique({ where: { uid: userCreated.office_uid } }); expect(officeCreated?.idNot).toEqual(user.office_membership.idNot); expect(officeCreated?.name).toEqual(user.office_membership.name); expect(officeCreated?.crpcen).toEqual(user.office_membership.crpcen); expect(officeCreated?.office_status).toEqual("DESACTIVATED"); // verify if user office's address is created in db - const addressForOfficeCreated = await prisma.addresses.findUnique({ where: { uuid: officeCreated?.address_uuid } }); + const addressForOfficeCreated = await prisma.addresses.findUnique({ where: { uid: officeCreated?.address_uid } }); expect(addressForOfficeCreated?.address).toEqual(user.office_membership.address.address); expect(addressForOfficeCreated?.zip_code).toEqual(user.office_membership.address.zip_code); expect(addressForOfficeCreated?.city).toEqual(user.office_membership.address.city); @@ -97,7 +97,7 @@ describe("test create function", () => { expect(userCreated?.idNot).toEqual(user_.idNot); // verify if user_ contact is created in db - const contactCreated = await prisma.contacts.findUnique({ where: { uuid: userCreated.contact_uuid } }); + const contactCreated = await prisma.contacts.findUnique({ where: { uid: userCreated.contact_uid } }); expect(contactCreated?.first_name).toEqual(user.contact.first_name); expect(contactCreated?.last_name).toEqual(user.contact.last_name); expect(contactCreated?.cell_phone_number).toEqual(user_.contact.cell_phone_number); @@ -106,13 +106,13 @@ describe("test create function", () => { expect(contactCreated?.email).toEqual(user_.contact.email); // verify if user_ address is created in db - const addressForContactCreated = await prisma.addresses.findUnique({ where: { uuid: contactCreated?.address_uuid } }); + const addressForContactCreated = await prisma.addresses.findUnique({ where: { uid: contactCreated?.address_uid } }); expect(addressForContactCreated?.address).toEqual(user.contact.address?.address); expect(addressForContactCreated?.zip_code).toEqual(user.contact.address?.zip_code); expect(addressForContactCreated?.city).toEqual(user.contact.address?.city); // verify if user joined the existing office - const officeJoined = await prisma.offices.findUnique({ where: { uuid: userCreated.office_uuid } }); + const officeJoined = await prisma.offices.findUnique({ where: { uid: userCreated.office_uid } }); expect(officeJoined?.idNot).toEqual(user.office_membership.idNot); expect(officeJoined?.name).toEqual(user.office_membership.name); expect(officeJoined?.crpcen).toEqual(user.office_membership.crpcen); @@ -124,19 +124,19 @@ describe("test update function", () => { it("should update an user's data", async () => { const userCreated = await prisma.users.findFirstOrThrow({ where: { idNot: user_.idNot } }); - const officeJoined = await prisma.offices.findUnique({ where: { uuid: userCreated.office_uuid } }); + const officeJoined = await prisma.offices.findUnique({ where: { uid: userCreated.office_uid } }); expect(officeJoined?.idNot).toEqual(user.office_membership.idNot); expect(officeJoined?.name).toEqual(user.office_membership.name); expect(officeJoined?.crpcen).toEqual(user.office_membership.crpcen); expect(officeJoined?.office_status).toEqual("DESACTIVATED"); // update the last user created with his own new office and own contact - const updatedUser = await UsersServiceTest.update(userCreated.uuid, user_); + const updatedUser = await UsersServiceTest.update(userCreated.uid, user_); expect(updatedUser?.idNot).toEqual(user_.idNot); // verify if user_ contact is created in db - const existingContact = await prisma.contacts.findUnique({ where: { uuid: updatedUser.contact_uuid } }); + const existingContact = await prisma.contacts.findUnique({ where: { uid: updatedUser.contact_uid } }); expect(existingContact?.first_name).toEqual(user_.contact.first_name); expect(existingContact?.last_name).toEqual(user_.contact.last_name); expect(existingContact?.cell_phone_number).toEqual(user_.contact.cell_phone_number); @@ -145,27 +145,27 @@ describe("test update function", () => { expect(existingContact?.email).toEqual(user_.contact.email); // verify if user_ address is created in db - const addressForExistingContact = await prisma.addresses.findUnique({ where: { uuid: existingContact?.address_uuid } }); + const addressForExistingContact = await prisma.addresses.findUnique({ where: { uid: existingContact?.address_uid } }); expect(addressForExistingContact?.address).toEqual(user_.contact.address?.address); expect(addressForExistingContact?.zip_code).toEqual(user_.contact.address?.zip_code); expect(addressForExistingContact?.city).toEqual(user_.contact.address?.city); // verify if user_ joined the new office - const officeCreated = await prisma.offices.findUnique({ where: { uuid: updatedUser.office_uuid } }); + const officeCreated = await prisma.offices.findUnique({ where: { uid: updatedUser.office_uid } }); expect(officeCreated?.idNot).toEqual(user_.office_membership.idNot); expect(officeCreated?.name).toEqual(user_.office_membership.name); expect(officeCreated?.crpcen).toEqual(user_.office_membership.crpcen); expect(officeCreated?.office_status).toEqual("DESACTIVATED"); // verify is user_ office's address is created in db - const addressForOfficeCreated = await prisma.addresses.findUnique({ where: { uuid: officeCreated?.address_uuid } }); + const addressForOfficeCreated = await prisma.addresses.findUnique({ where: { uid: officeCreated?.address_uid } }); expect(addressForOfficeCreated?.address).toEqual(user_.office_membership.address.address); expect(addressForOfficeCreated?.zip_code).toEqual(user_.office_membership.address.zip_code); expect(addressForOfficeCreated?.city).toEqual(user_.office_membership.address.city); }); it("should not update an user with an email already used", async () => { - const userUid = (await prisma.users.findFirstOrThrow({ where: { idNot: user_.idNot } })).uuid; + const userUid = (await prisma.users.findFirstOrThrow({ where: { idNot: user_.idNot } })).uid; let updatedUser: User = JSON.parse(JSON.stringify(user_)); updatedUser.contact.email = userContact.email; @@ -177,7 +177,7 @@ describe("test update function", () => { }); it("should not update an user with an phone number already used", async () => { - const userUid = (await prisma.users.findFirstOrThrow({ where: { idNot: user_.idNot } })).uuid; + const userUid = (await prisma.users.findFirstOrThrow({ where: { idNot: user_.idNot } })).uid; let updatedUser: User = JSON.parse(JSON.stringify(user_)); updatedUser.contact.cell_phone_number = userContact.cell_phone_number; @@ -206,7 +206,7 @@ describe("test get function", () => { it("should return an array of Users per offices", async () => { const officesCreated = await prisma.offices.findMany(); - const reqForFirstOffice = { where: { office_uuid: officesCreated[0]?.uuid } }; + const reqForFirstOffice = { where: { office_uid: officesCreated[0]?.uid } }; const usersForFirstOffice = await UsersServiceTest.get(reqForFirstOffice); expect(usersForFirstOffice.length).toEqual(1); @@ -214,7 +214,7 @@ describe("test get function", () => { // verify result content expect(usersForFirstOffice[0]?.idNot).toEqual(user.idNot); - const reqForSecondOffice = { where: { office_uuid: officesCreated[1]?.uuid } }; + const reqForSecondOffice = { where: { office_uid: officesCreated[1]?.uid } }; const usersForSecondOffice = await UsersServiceTest.get(reqForSecondOffice); expect(usersForSecondOffice.length).toEqual(1); From 2b3f7c0df1b0ffba0db32496b640859c7f152dfd Mon Sep 17 00:00:00 2001 From: OxSaitama Date: Fri, 28 Apr 2023 13:58:07 +0200 Subject: [PATCH 20/72] add api:start script --- package.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package.json b/package.json index 58892f98..e4da04d1 100644 --- a/package.json +++ b/package.json @@ -20,9 +20,11 @@ "build-db": "npx prisma migrate dev", "build": "tsc", "start": "tsc && node ./dist/entries/App.js", + "api:start": "npm run migrate && npm run start", "dev": "nodemon -V", "build:test": "tsc && mocha ./dist/entries/Test.js", "format": "prettier --write src", + "migrate": "npx prisma migrate deploy", "migrate:test": "dotenv -e .env.test -- npx prisma migrate deploy", "docker:up:test": "docker-compose -f docker-compose-test.yml up -d", "docker:down:test": "docker-compose down", From 2ea09003bd6717cc97b3ccd05607833e96aadd5a Mon Sep 17 00:00:00 2001 From: Vincent Alamelle Date: Tue, 2 May 2023 11:27:26 +0200 Subject: [PATCH 21/72] Done --- src/app/api/customer/DocumentsController.ts | 161 ++++++++++++++++++ src/app/index.ts | 5 + .../DocumentsService/DocumentsService.ts | 60 +++++++ 3 files changed, 226 insertions(+) create mode 100644 src/app/api/customer/DocumentsController.ts create mode 100644 src/services/customer/DocumentsService/DocumentsService.ts diff --git a/src/app/api/customer/DocumentsController.ts b/src/app/api/customer/DocumentsController.ts new file mode 100644 index 00000000..2ed3aa64 --- /dev/null +++ b/src/app/api/customer/DocumentsController.ts @@ -0,0 +1,161 @@ +import { Response, Request } from "express"; +import { Controller, Delete, Get, Post, Put } from "@ControllerPattern/index"; +import ApiController from "@Common/system/controller-pattern/ApiController"; +import { Service } from "typedi"; +import DocumentsService from "@Services/customer/DocumentsService/DocumentsService"; +import { Documents } from "@prisma/client"; +import ObjectHydrate from "@Common/helpers/ObjectHydrate"; +import { Document } from "le-coffre-resources/dist/Customer"; +import { validateOrReject } from "class-validator"; + +@Controller() +@Service() +export default class DocumentsController extends ApiController { + constructor(private documentsService: DocumentsService) { + super(); + } + + /** + * @description Get all documents + * @returns IDocument[] list of documents + */ + @Get("/api/v1/customer/documents") + protected async get(req: Request, response: Response) { + try { + //get query + const query = JSON.parse(req.query["q"] as string); + + + //call service to get prisma entity + const prismaEntity: Documents[] = await this.documentsService.get(query); + + //Hydrate ressource with prisma entity + const documents = ObjectHydrate.map(Document, prismaEntity, { strategy: "exposeAll" }); + + //success + this.httpSuccess(response, documents); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } + + /** + * @description Create a new document + * @returns IDocument created + */ + @Post("/api/v1/customer/documents") + protected async post(req: Request, response: Response) { + try { + //init Document resource with request body values + const documentEntity = new Document(); + ObjectHydrate.hydrate(documentEntity, req.body); + + //validate document + await validateOrReject(documentEntity, { groups: ["create"] }); + + //call service to get prisma entity + const prismaEntityCreated = await this.documentsService.create(documentEntity); + + //Hydrate ressource with prisma entity + const documentEntityCreated = ObjectHydrate.hydrate(new Document(), prismaEntityCreated, { + strategy: "exposeAll", + }); + + //success + this.httpSuccess(response, documentEntityCreated); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } + + /** + * @description Update a specific document + */ + @Put("/api/v1/customer/documents/:uid") + protected async update(req: Request, response: Response) { + try { + const uid = req.params["uid"]; + if (!uid) { + throw new Error("No uid provided"); + } + + //init Document resource with request body values + const documentEntity = new Document(); + ObjectHydrate.hydrate(documentEntity, req.body); + + //validate document + await validateOrReject(documentEntity, { groups: ["create"] }); + + //call service to get prisma entity + const prismaEntityUpdated: Documents = await this.documentsService.update(uid, documentEntity); + + //Hydrate ressource with prisma entity + const document = ObjectHydrate.hydrate(new Document(), prismaEntityUpdated, { strategy: "exposeAll" }); + + //success + this.httpSuccess(response, document); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } + + /** + * @description Delete a specific document + */ + @Delete("/api/v1/customer/documents/:uid") + protected async delete(req: Request, response: Response) { + try { + const uid = req.params["uid"]; + if (!uid) { + throw new Error("No uid provided"); + } + + //call service to get prisma entity + const documentEntity: Documents = await this.documentsService.delete(uid); + + //Hydrate ressource with prisma entity + const document = ObjectHydrate.hydrate(new Document(), documentEntity, { strategy: "exposeAll" }); + + //success + this.httpSuccess(response, document); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } + + /** + * @description Get a specific document by uid + */ + @Get("/api/v1/customer/documents/:uid") + protected async getOneByUid(req: Request, response: Response) { + try { + const uid = req.params["uid"]; + if (!uid) { + throw new Error("No uid provided"); + } + + let documentEntity: Documents; + //get query + if (req.query["q"]) { + const query = JSON.parse(req.query["q"] as string); + documentEntity = await this.documentsService.getByUid(uid, query); + } else { + //call service to get prisma entity + documentEntity = await this.documentsService.getByUid(uid); + } + + //Hydrate ressource with prisma entity + const document = ObjectHydrate.hydrate(new Document(), documentEntity, { strategy: "exposeAll" }); + + //success + this.httpSuccess(response, document); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } +} diff --git a/src/app/index.ts b/src/app/index.ts index d81c7281..01e173ed 100644 --- a/src/app/index.ts +++ b/src/app/index.ts @@ -10,6 +10,9 @@ import DocumentsController from "./api/super-admin/DocumentsController"; import DocumentTypesController from "./api/super-admin/DocumentTypesController"; import IdNotUserInfoController from "./api/idnot-user/UserInfoController"; +import DocumentsControllerCustomer from "./api/customer/DocumentsController"; + + /** * @description This allow to declare all controllers used in the application */ @@ -25,5 +28,7 @@ export default { Container.get(DocumentsController); Container.get(DocumentTypesController); Container.get(IdNotUserInfoController); + + Container.get(DocumentsControllerCustomer); }, }; diff --git a/src/services/customer/DocumentsService/DocumentsService.ts b/src/services/customer/DocumentsService/DocumentsService.ts new file mode 100644 index 00000000..b5d470e0 --- /dev/null +++ b/src/services/customer/DocumentsService/DocumentsService.ts @@ -0,0 +1,60 @@ +import { Documents, Prisma } from "@prisma/client"; +import { Document } from "le-coffre-resources/dist/Customer"; +import DocumentsRepository from "@Repositories/DocumentsRepository"; +import BaseService from "@Services/BaseService"; +import { Service } from "typedi"; + +@Service() +export default class DocumentsService extends BaseService { + constructor(private documentsRepository: DocumentsRepository) { + super(); + } + + /** + * @description : Get all documents + * @throws {Error} If documents cannot be get + */ + public async get(query: any) { + return this.documentsRepository.findMany(query); + } + + /** + * @description : Create a new document + * @throws {Error} If document cannot be created + */ + public async create(document: Document): Promise { + return this.documentsRepository.create(document); + } + + /** + * @description : Create new documents + * @throws {Error} If documents or one of them cannot be created + */ + public async createMany(documents: Document[]): Promise { + return this.documentsRepository.createMany(documents); + } + + /** + * @description : Modify a document + * @throws {Error} If document cannot be modified + */ + public async update(uid: string, document: Document): Promise { + return this.documentsRepository.update(uid, document); + } + + /** + * @description : Delete a document + * @throws {Error} If document cannot be deleted + */ + public async delete(uid: string): Promise { + return this.documentsRepository.delete(uid); + } + + /** + * @description : Get a document by uid + * @throws {Error} If document cannot be get by uid + */ + public async getByUid(uid: string, query?: any) { + return this.documentsRepository.findOneByUid(uid, query); + } +} From a1425acdc39945a2bb5c491a42766dc5e33b7991 Mon Sep 17 00:00:00 2001 From: Vincent Alamelle Date: Tue, 2 May 2023 16:42:45 +0200 Subject: [PATCH 22/72] Add new validators group for all post request and Customer/Folder put request --- src/app/api/super-admin/CustomersController.ts | 4 ++-- src/app/api/super-admin/DeedTypesController.ts | 2 +- src/app/api/super-admin/DocumentTypesController.ts | 2 +- src/app/api/super-admin/DocumentsController.ts | 2 +- src/app/api/super-admin/OfficeFoldersController.ts | 2 +- src/app/api/super-admin/OfficesController.ts | 2 +- src/common/repositories/OfficeFoldersRepository.ts | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/app/api/super-admin/CustomersController.ts b/src/app/api/super-admin/CustomersController.ts index b43c76e6..6a7c5414 100644 --- a/src/app/api/super-admin/CustomersController.ts +++ b/src/app/api/super-admin/CustomersController.ts @@ -49,7 +49,7 @@ export default class CustomersController extends ApiController { ObjectHydrate.hydrate(customerEntity, req.body); //validate user - await validateOrReject(customerEntity, { groups: ["create"] }); + await validateOrReject(customerEntity, { groups: ["createCustomer"], forbidUnknownValues: false}); //call service to get prisma entity const prismaEntityCreated = await this.customersService.create(customerEntity); @@ -81,7 +81,7 @@ export default class CustomersController extends ApiController { const customerEntity = new Customer(); ObjectHydrate.hydrate(customerEntity, req.body); //validate user - await validateOrReject(customerEntity, { groups: ["update"] }); + await validateOrReject(customerEntity, { groups: ["updateCustomer"] , forbidUnknownValues: false}); //call service to get prisma entity const prismaEntityUpdated = await this.customersService.update(uid, customerEntity); diff --git a/src/app/api/super-admin/DeedTypesController.ts b/src/app/api/super-admin/DeedTypesController.ts index ac4bf9c6..0ef3b83b 100644 --- a/src/app/api/super-admin/DeedTypesController.ts +++ b/src/app/api/super-admin/DeedTypesController.ts @@ -50,7 +50,7 @@ export default class DeedTypesController extends ApiController { ObjectHydrate.hydrate(deedTypeEntity, req.body); //validate deed type - await validateOrReject(deedTypeEntity, { groups: ["create"] }); + await validateOrReject(deedTypeEntity, { groups: ["createDeedType"], forbidUnknownValues: false }); //call service to get prisma entity const prismaEntityCreated = await this.deedTypesService.create(deedTypeEntity); diff --git a/src/app/api/super-admin/DocumentTypesController.ts b/src/app/api/super-admin/DocumentTypesController.ts index e8fe1cc3..a862e697 100644 --- a/src/app/api/super-admin/DocumentTypesController.ts +++ b/src/app/api/super-admin/DocumentTypesController.ts @@ -51,7 +51,7 @@ export default class DocumentTypesController extends ApiController { const documentTypeEntity = new DocumentType(); ObjectHydrate.hydrate(documentTypeEntity, req.body); //validate user - await validateOrReject(documentTypeEntity, { groups: ["create"] }); + await validateOrReject(documentTypeEntity, { groups: ["createDocumentType"] , forbidUnknownValues: false}); //call service to get prisma entity const prismaEntityCreated = await this.documentTypesService.create(documentTypeEntity); //Hydrate ressource with prisma entity diff --git a/src/app/api/super-admin/DocumentsController.ts b/src/app/api/super-admin/DocumentsController.ts index f1d2c798..aa9af242 100644 --- a/src/app/api/super-admin/DocumentsController.ts +++ b/src/app/api/super-admin/DocumentsController.ts @@ -51,7 +51,7 @@ export default class DocumentsController extends ApiController { ObjectHydrate.hydrate(documentEntity, req.body); //validate document - await validateOrReject(documentEntity, { groups: ["create"] }); + await validateOrReject(documentEntity, { groups: ["createDocument"] , forbidUnknownValues: false}); //call service to get prisma entity const prismaEntityCreated = await this.documentsService.create(documentEntity); diff --git a/src/app/api/super-admin/OfficeFoldersController.ts b/src/app/api/super-admin/OfficeFoldersController.ts index b123e8cb..100f85a3 100644 --- a/src/app/api/super-admin/OfficeFoldersController.ts +++ b/src/app/api/super-admin/OfficeFoldersController.ts @@ -78,7 +78,7 @@ export default class OfficeFoldersController extends ApiController { ObjectHydrate.hydrate(officeFolderEntity, req.body); //validate user - await validateOrReject(officeFolderEntity, { groups: ["update"] }); + await validateOrReject(officeFolderEntity, { groups: ["updateFolder"], forbidUnknownValues: false }); //call service to get prisma entity const prismaEntityUpdated = await this.officeFoldersService.update(uid, officeFolderEntity); diff --git a/src/app/api/super-admin/OfficesController.ts b/src/app/api/super-admin/OfficesController.ts index 3d0c835e..dc4e52d8 100644 --- a/src/app/api/super-admin/OfficesController.ts +++ b/src/app/api/super-admin/OfficesController.ts @@ -43,7 +43,7 @@ export default class OfficesController extends ApiController { const officeEntity = new OfficeRessource(); ObjectHydrate.hydrate(officeEntity, req.body); //validate user - await validateOrReject(officeEntity, { groups: ["create"] }); + await validateOrReject(officeEntity, { groups: ["createOffice"], forbidUnknownValues: false }); //call service to get prisma entity const prismaEntityCreated = await this.officesService.create(officeEntity); //Hydrate ressource with prisma entity diff --git a/src/common/repositories/OfficeFoldersRepository.ts b/src/common/repositories/OfficeFoldersRepository.ts index 06e8d87a..e09ad3d2 100644 --- a/src/common/repositories/OfficeFoldersRepository.ts +++ b/src/common/repositories/OfficeFoldersRepository.ts @@ -45,7 +45,7 @@ export default class OfficeFoldersRepository extends BaseRepository { }, office: { connect: { - idNot: officeFolder.office.idNot, + uid: officeFolder.office.uid, }, }, }, From eab04fb12e4c2127cb31f6023d6508d95a4ccb24 Mon Sep 17 00:00:00 2001 From: OxSaitama Date: Mon, 17 Apr 2023 18:35:19 +0200 Subject: [PATCH 23/72] refacto: naming uuid to uid --- package.json | 3 +- .../api/super-admin/CustomersController.ts | 20 +-- src/app/api/super-admin/UsersController.ts | 8 +- .../20230426144239_init/migration.sql | 1 + src/common/databases/schema.prisma | 116 +++++++++--------- src/common/databases/seeders/seeder.ts | 23 ++++ .../repositories/CustomersRepository.ts | 36 ++++-- src/common/repositories/UsersRepository.ts | 32 +++-- .../CustomersService/CustomersService.ts | 23 +++- .../super-admin/UsersService/UsersService.ts | 17 ++- 10 files changed, 176 insertions(+), 103 deletions(-) diff --git a/package.json b/package.json index e4da04d1..84e273fa 100644 --- a/package.json +++ b/package.json @@ -22,10 +22,9 @@ "start": "tsc && node ./dist/entries/App.js", "api:start": "npm run migrate && npm run start", "dev": "nodemon -V", - "build:test": "tsc && mocha ./dist/entries/Test.js", "format": "prettier --write src", - "migrate": "npx prisma migrate deploy", "migrate:test": "dotenv -e .env.test -- npx prisma migrate deploy", + "migrate": "npx prisma migrate deploy", "docker:up:test": "docker-compose -f docker-compose-test.yml up -d", "docker:down:test": "docker-compose down", "test": "tsc && npm run docker:up:test && npm run migrate:test && dotenv -e .env.test -- jest -i --verbose ./dist/test/* && npm run docker:down:test" diff --git a/src/app/api/super-admin/CustomersController.ts b/src/app/api/super-admin/CustomersController.ts index 6a7c5414..9066c904 100644 --- a/src/app/api/super-admin/CustomersController.ts +++ b/src/app/api/super-admin/CustomersController.ts @@ -3,11 +3,11 @@ import { Controller, Get, Post, Put } from "@ControllerPattern/index"; import ApiController from "@Common/system/controller-pattern/ApiController"; import CustomersService from "@Services/super-admin/CustomersService/CustomersService"; import { Service } from "typedi"; -import ObjectHydrate from "@Common/helpers/ObjectHydrate"; import { Customer } from "le-coffre-resources/dist/SuperAdmin"; import { Customers } from "@prisma/client"; import { validateOrReject } from "class-validator"; + @Controller() @Service() export default class CustomersController extends ApiController { @@ -23,12 +23,12 @@ export default class CustomersController extends ApiController { try { //get query const query = JSON.parse(req.query["q"] as string); - + //call service to get prisma entity - const customersEntity: Customers[] = await this.customersService.get(query); + const customersEntity = await this.customersService.get(query); //Hydrate ressource with prisma entity - const customers = ObjectHydrate.map(Customer, customersEntity, { strategy: "exposeAll" }); + const customers = Customer.map(Customer, customersEntity, { strategy: "excludeAll" }); //success this.httpSuccess(response, customers); @@ -46,7 +46,7 @@ export default class CustomersController extends ApiController { try { //init IUser resource with request body values const customerEntity = new Customer(); - ObjectHydrate.hydrate(customerEntity, req.body); + Customer.hydrate(customerEntity, req.body); //validate user await validateOrReject(customerEntity, { groups: ["createCustomer"], forbidUnknownValues: false}); @@ -55,8 +55,8 @@ export default class CustomersController extends ApiController { const prismaEntityCreated = await this.customersService.create(customerEntity); //Hydrate ressource with prisma entity - const customerEntityCreated = ObjectHydrate.hydrate(new Customer(), prismaEntityCreated, { - strategy: "exposeAll", + const customerEntityCreated = Customer.hydrate(prismaEntityCreated, { + strategy: "excludeAll", }); //success @@ -79,7 +79,7 @@ export default class CustomersController extends ApiController { } //init IUser resource with request body values const customerEntity = new Customer(); - ObjectHydrate.hydrate(customerEntity, req.body); + Customer.hydrate(customerEntity, req.body); //validate user await validateOrReject(customerEntity, { groups: ["updateCustomer"] , forbidUnknownValues: false}); @@ -87,7 +87,7 @@ export default class CustomersController extends ApiController { const prismaEntityUpdated = await this.customersService.update(uid, customerEntity); //Hydrate ressource with prisma entity - const customerEntityUpdated = ObjectHydrate.hydrate(new Customer(), prismaEntityUpdated, { + const customerEntityUpdated = Customer.hydrate(prismaEntityUpdated, { strategy: "exposeAll", }); @@ -121,7 +121,7 @@ export default class CustomersController extends ApiController { } //Hydrate ressource with prisma entity - const customer = ObjectHydrate.hydrate(new Customer(), customerEntity, { strategy: "exposeAll" }); + const customer = Customer.hydrate(customerEntity, { strategy: "exposeAll" }); //success this.httpSuccess(response, customer); diff --git a/src/app/api/super-admin/UsersController.ts b/src/app/api/super-admin/UsersController.ts index 9726c8e1..0ed184d0 100644 --- a/src/app/api/super-admin/UsersController.ts +++ b/src/app/api/super-admin/UsersController.ts @@ -7,7 +7,6 @@ import ObjectHydrate from "@Common/helpers/ObjectHydrate"; import { validateOrReject } from "class-validator"; import User from "le-coffre-resources/dist/Notary"; import { Users } from "@prisma/client"; -import { plainToInstance } from "class-transformer"; @Controller() @Service() @@ -27,12 +26,9 @@ export default class UsersController extends ApiController { //call service to get prisma entity const usersEntity: Users[] = await this.usersService.get(query); - + //Hydrate ressource with prisma entity - const users = plainToInstance(User, usersEntity, { - enableImplicitConversion: true, - excludeExtraneousValues: false, - }); + const users = User.map(User, usersEntity, {excludeExtraneousValues: true}) //success this.httpSuccess(response, users); diff --git a/src/common/databases/migrations/20230426144239_init/migration.sql b/src/common/databases/migrations/20230426144239_init/migration.sql index a7c0a49f..5244e927 100644 --- a/src/common/databases/migrations/20230426144239_init/migration.sql +++ b/src/common/databases/migrations/20230426144239_init/migration.sql @@ -443,3 +443,4 @@ ALTER TABLE "deed_type_has_document_types" ADD CONSTRAINT "deed_type_has_documen -- AddForeignKey ALTER TABLE "deed_type_has_document_types" ADD CONSTRAINT "deed_type_has_document_types_deed_type_uid_fkey" FOREIGN KEY ("deed_type_uid") REFERENCES "deed_types"("uid") ON DELETE CASCADE ON UPDATE CASCADE; + diff --git a/src/common/databases/schema.prisma b/src/common/databases/schema.prisma index e0293f41..bace5ed4 100644 --- a/src/common/databases/schema.prisma +++ b/src/common/databases/schema.prisma @@ -18,7 +18,7 @@ datasource db { // id String @unique @default(auto()) @map("_id") @db.ObjectId // @map de la table checker le naming avec le tiret model Addresses { - uid String @id @unique @default(uuid()) + uid String @id @unique @default(uuid()) address String @db.VarChar(255) city String @db.VarChar(255) zip_code Int @@ -31,15 +31,15 @@ model Addresses { } model Contacts { - uid String @id @unique @default(uuid()) + uid String @id @unique @default(uuid()) first_name String @db.VarChar(255) last_name String @db.VarChar(255) email String @unique @db.VarChar(255) phone_number String? @db.VarChar(50) - cell_phone_number String? @unique @db.VarChar(50) + cell_phone_number String @unique @db.VarChar(50) civility ECivility @default(MALE) - address Addresses? @relation(fields: [address_uid], references: [uid], onDelete: Cascade) - address_uid String @unique @db.VarChar(255) + address Addresses? @relation(fields: [address_uid], references: [uid], onDelete: Cascade) + address_uid String @unique @db.VarChar(255) birthdate DateTime? created_at DateTime? @default(now()) updated_at DateTime? @updatedAt @@ -50,14 +50,14 @@ model Contacts { } model Users { - uid String @id @unique @default(uuid()) @map("uid") + uid String @id @unique @default(uuid()) @map("uid") idNot String @unique @db.VarChar(255) contact Contacts @relation(fields: [contact_uid], references: [uid], onDelete: Cascade) - contact_uid String @unique @db.VarChar(255) + contact_uid String @unique @db.VarChar(255) created_at DateTime? @default(now()) updated_at DateTime? @updatedAt office_membership Offices @relation(fields: [office_uid], references: [uid], onDelete: Cascade) - office_uid String @db.VarChar(255) + office_uid String @db.VarChar(255) user_has_notifications UserHasNotifications[] office_folder_has_stakeholder OfficeFolderHasStakeholders[] @@ -65,28 +65,28 @@ model Users { } model Offices { - uid String @id @unique @default(uuid()) + uid String @id @unique @default(uuid()) idNot String @unique @db.VarChar(255) name String @db.VarChar(255) crpcen String @unique @db.VarChar(255) address Addresses @relation(fields: [address_uid], references: [uid], onDelete: Cascade) - address_uid String @unique @db.VarChar(255) + address_uid String @unique @db.VarChar(255) office_status EOfficeStatus @default(DESACTIVATED) created_at DateTime? @default(now()) updated_at DateTime? @updatedAt deed_types DeedTypes[] users Users[] office_folders OfficeFolders[] - document_types DocumentTypes[] + document_types DocumentTypes[] @@map("offices") } model Customers { - uid String @id @unique @default(uuid()) + uid String @id @unique @default(uuid()) status ECustomerStatus @default(PENDING) contact Contacts @relation(fields: [contact_uid], references: [uid], onDelete: Cascade) - contact_uid String @unique @db.VarChar(255) + contact_uid String @unique @db.VarChar(255) created_at DateTime? @default(now()) updated_at DateTime? @updatedAt office_folder_has_customers OfficeFolderHasCustomers[] @@ -96,11 +96,11 @@ model Customers { } model UserHasNotifications { - uid String @id @unique @default(uuid()) + uid String @id @unique @default(uuid()) user Users @relation(fields: [user_uid], references: [uid]) - user_uid String @db.VarChar(255) + user_uid String @db.VarChar(255) notification Notifications @relation(fields: [notification_uid], references: [uid], onDelete: Cascade) - notification_uid String @db.VarChar(255) + notification_uid String @db.VarChar(255) notification_status ENotificationStatus @default(UNREAD) created_at DateTime? @default(now()) updated_at DateTime? @updatedAt @@ -110,7 +110,7 @@ model UserHasNotifications { } model Notifications { - uid String @id @unique @default(uuid()) + uid String @id @unique @default(uuid()) message String @db.VarChar(255) redirection_url String @db.VarChar(255) created_at DateTime? @default(now()) @@ -121,16 +121,16 @@ model Notifications { } model OfficeFolders { - uid String @id @unique @default(uuid()) + uid String @id @unique @default(uuid()) folder_number String @db.VarChar(255) name String @db.VarChar(255) description String? @db.VarChar(255) archived_description String? @db.VarChar(255) status EFolderStatus @default(LIVE) deed Deeds @relation(fields: [deed_uid], references: [uid], onDelete: Cascade) - deed_uid String @unique @db.VarChar(255) + deed_uid String @unique @db.VarChar(255) office Offices @relation(fields: [office_uid], references: [uid], onDelete: Cascade) - office_uid String @db.VarChar(255) + office_uid String @db.VarChar(255) created_at DateTime? @default(now()) updated_at DateTime? @updatedAt office_folder_has_customers OfficeFolderHasCustomers[] @@ -143,12 +143,12 @@ model OfficeFolders { model OfficeFolderHasCustomers { uid String @id @unique @default(uuid()) - customer Customers @relation(fields: [customer_uid], references: [uid], onDelete: Cascade) + customer Customers @relation(fields: [customer_uid], references: [uid], onDelete: Cascade) customer_uid String @db.VarChar(255) - office_folder OfficeFolders @relation(fields: [office_folder_uid], references: [uid], onDelete: Cascade) + office_folder OfficeFolders @relation(fields: [office_folder_uid], references: [uid], onDelete: Cascade) office_folder_uid String @db.VarChar(255) - created_at DateTime? @default(now()) - updated_at DateTime? @updatedAt + created_at DateTime? @default(now()) + updated_at DateTime? @updatedAt @@unique([office_folder_uid, customer_uid]) @@map("office_folder_has_customers") @@ -156,12 +156,12 @@ model OfficeFolderHasCustomers { model OfficeFolderHasStakeholders { uid String @id @unique @default(uuid()) - office_folder OfficeFolders @relation(fields: [office_folder_uid], references: [uid], onDelete: Cascade) + office_folder OfficeFolders @relation(fields: [office_folder_uid], references: [uid], onDelete: Cascade) office_folder_uid String @db.VarChar(255) - user_stakeholder Users @relation(fields: [user_stakeholder_uid], references: [uid], onDelete: Cascade) + user_stakeholder Users @relation(fields: [user_stakeholder_uid], references: [uid], onDelete: Cascade) user_stakeholder_uid String @db.VarChar(255) - created_at DateTime? @default(now()) - updated_at DateTime? @updatedAt + created_at DateTime? @default(now()) + updated_at DateTime? @updatedAt @@unique([office_folder_uid, user_stakeholder_uid]) @@map("office_folder_has_stakeholder") @@ -169,29 +169,29 @@ model OfficeFolderHasStakeholders { model Documents { uid String @id @unique @default(uuid()) - document_status EDocumentStatus @default(ASKED) - document_type DocumentTypes @relation(fields: [document_type_uid], references: [uid]) + document_status EDocumentStatus @default(ASKED) + document_type DocumentTypes @relation(fields: [document_type_uid], references: [uid]) document_type_uid String @db.VarChar(255) - blockchain_anchor BlockchainAnchors? @relation(fields: [blockchain_anchor_uid], references: [uid]) + blockchain_anchor BlockchainAnchors? @relation(fields: [blockchain_anchor_uid], references: [uid]) blockchain_anchor_uid String? @db.VarChar(255) - folder OfficeFolders @relation(fields: [folder_uid], references: [uid]) + folder OfficeFolders @relation(fields: [folder_uid], references: [uid]) folder_uid String @db.VarChar(255) - depositor Customers @relation(fields: [depositor_uid], references: [uid], onDelete: Cascade) + depositor Customers @relation(fields: [depositor_uid], references: [uid], onDelete: Cascade) depositor_uid String @db.VarChar(255) - created_at DateTime? @default(now()) - updated_at DateTime? @updatedAt - files Files[] - document_history DocumentHistory[] + created_at DateTime? @default(now()) + updated_at DateTime? @updatedAt + files Files[] + document_history DocumentHistory[] @@map("documents") } model DocumentHistory { - uid String @id @unique @default(uuid()) + uid String @id @unique @default(uuid()) document_status EDocumentStatus @default(ASKED) refused_reason String? @db.VarChar(255) document Documents @relation(fields: [document_uid], references: [uid], onDelete: Cascade) - document_uid String @db.VarChar(255) + document_uid String @db.VarChar(255) created_at DateTime? @default(now()) updated_at DateTime? @updatedAt @@ -200,17 +200,17 @@ model DocumentHistory { model Files { uid String @id @unique @default(uuid()) - document Documents @relation(fields: [document_uid], references: [uid], onDelete: Cascade) + document Documents @relation(fields: [document_uid], references: [uid], onDelete: Cascade) document_uid String @db.VarChar(255) - file_path String @unique @db.VarChar(255) - created_at DateTime? @default(now()) - updated_at DateTime? @updatedAt + file_path String @unique @db.VarChar(255) + created_at DateTime? @default(now()) + updated_at DateTime? @updatedAt @@map("files") } model BlockchainAnchors { - uid String @id @unique @default(uuid()) + uid String @id @unique @default(uuid()) smartSigJobId String @unique @db.VarChar(255) created_at DateTime? @default(now()) updated_at DateTime? @updatedAt @@ -220,12 +220,12 @@ model BlockchainAnchors { } model DocumentTypes { - uid String @id @unique @default(uuid()) + uid String @id @unique @default(uuid()) name String @db.VarChar(255) public_description String @db.VarChar(255) private_description String? @db.VarChar(255) office Offices @relation(fields: [office_uid], references: [uid], onDelete: Cascade) - office_uid String @db.VarChar(255) + office_uid String @db.VarChar(255) archived_at DateTime? created_at DateTime? @default(now()) updated_at DateTime? @updatedAt @@ -239,21 +239,21 @@ model DocumentTypes { model DeedHasDocumentTypes { uid String @id @unique @default(uuid()) - document_type DocumentTypes @relation(fields: [document_type_uid], references: [uid], onDelete: Cascade) + document_type DocumentTypes @relation(fields: [document_type_uid], references: [uid], onDelete: Cascade) document_type_uid String @db.VarChar(255) - deed Deeds @relation(fields: [deed_uid], references: [uid], onDelete: Cascade) + deed Deeds @relation(fields: [deed_uid], references: [uid], onDelete: Cascade) deed_uid String @db.VarChar(255) - created_at DateTime? @default(now()) - updated_at DateTime? @updatedAt + created_at DateTime? @default(now()) + updated_at DateTime? @updatedAt @@unique([deed_uid, document_type_uid]) @@map("deed_has_document_types") } model Deeds { - uid String @id @unique @default(uuid()) + uid String @id @unique @default(uuid()) deed_type DeedTypes @relation(fields: [deed_type_uid], references: [uid], onDelete: Cascade) - deed_type_uid String @db.VarChar(255) + deed_type_uid String @db.VarChar(255) created_at DateTime? @default(now()) updated_at DateTime? @updatedAt deed_has_document_types DeedHasDocumentTypes[] @@ -263,12 +263,12 @@ model Deeds { } model DeedTypes { - uid String @id @unique @default(uuid()) + uid String @id @unique @default(uuid()) name String @db.VarChar(255) description String @db.VarChar(255) archived_at DateTime? office Offices @relation(fields: [office_uid], references: [uid], onDelete: Cascade) - office_uid String @db.VarChar(255) + office_uid String @db.VarChar(255) created_at DateTime? @default(now()) updated_at DateTime? @updatedAt deed Deeds[] @@ -280,12 +280,12 @@ model DeedTypes { model DeedTypeHasDocumentTypes { uid String @id @unique @default(uuid()) - document_type DocumentTypes @relation(fields: [document_type_uid], references: [uid], onDelete: Cascade) + document_type DocumentTypes @relation(fields: [document_type_uid], references: [uid], onDelete: Cascade) document_type_uid String @db.VarChar(255) - deed_type DeedTypes @relation(fields: [deed_type_uid], references: [uid], onDelete: Cascade) + deed_type DeedTypes @relation(fields: [deed_type_uid], references: [uid], onDelete: Cascade) deed_type_uid String @db.VarChar(255) - created_at DateTime? @default(now()) - updated_at DateTime? @updatedAt + created_at DateTime? @default(now()) + updated_at DateTime? @updatedAt @@unique([deed_type_uid, document_type_uid]) @@map("deed_type_has_document_types") diff --git a/src/common/databases/seeders/seeder.ts b/src/common/databases/seeders/seeder.ts index d76ede13..577511ca 100644 --- a/src/common/databases/seeders/seeder.ts +++ b/src/common/databases/seeders/seeder.ts @@ -55,6 +55,7 @@ import { const uidOfficeFolder1: string = randomString(); const uidOfficeFolder2: string = randomString(); +<<<<<<< HEAD const uidOfficeFolder3: string = randomString(); const uidOfficeFolder4: string = randomString(); const uidOfficeFolder5: string = randomString(); @@ -64,6 +65,11 @@ import { const uidDeed3: string = randomString(); const uidDeed4: string = randomString(); const uidDeed5: string = randomString(); +======= + + const uidDeed1: string = randomString(); + const uidDeed2: string = randomString(); +>>>>>>> 7122ff1 (uuid --> uid) const uidDeedType1: string = randomString(); const uidDeedType2: string = randomString(); @@ -199,8 +205,13 @@ import { const officeFolders: OfficeFolders[] = [ { uid: uidOfficeFolder1, +<<<<<<< HEAD folder_number: "0001", name: "Dossier", +======= + folder_number: randomString(), + name: "0001", +>>>>>>> 7122ff1 (uuid --> uid) deed_uid: uidDeed1, status: EFolderStatus.LIVE, created_at: new Date(), @@ -211,8 +222,13 @@ import { }, { uid: uidOfficeFolder2, +<<<<<<< HEAD folder_number: "0002", name: "Dossier", +======= + folder_number: randomString(), + name: "0001", +>>>>>>> 7122ff1 (uuid --> uid) deed_uid: uidDeed2, status: EFolderStatus.LIVE, created_at: new Date(), @@ -263,17 +279,24 @@ import { { uid: uidDeed1, deed_type_uid: uidDeedType1, +<<<<<<< HEAD created_at: new Date(), updated_at: new Date(), }, { uid: uidDeed2, deed_type_uid: uidDeedType2, +======= +>>>>>>> 7122ff1 (uuid --> uid) created_at: new Date(), updated_at: new Date(), }, { +<<<<<<< HEAD uid: uidDeed3, +======= + uid: uidDeed2, +>>>>>>> 7122ff1 (uuid --> uid) deed_type_uid: uidDeedType2, created_at: new Date(), updated_at: new Date(), diff --git a/src/common/repositories/CustomersRepository.ts b/src/common/repositories/CustomersRepository.ts index b08bc0d5..e4414f65 100644 --- a/src/common/repositories/CustomersRepository.ts +++ b/src/common/repositories/CustomersRepository.ts @@ -1,7 +1,7 @@ import Database from "@Common/databases/database"; import BaseRepository from "@Repositories/BaseRepository"; import { Service } from "typedi"; -import { Customers, ECivility, ECustomerStatus, Prisma } from "@prisma/client"; +import { Contacts, Customers, ECivility, ECustomerStatus, Prisma } from "@prisma/client"; import { Customer } from "le-coffre-resources/dist/SuperAdmin"; @Service() @@ -19,15 +19,24 @@ export default class CustomersRepository extends BaseRepository { /** * @description : Find many customers */ - public async findMany(query: any): Promise { + public async findMany(query: Prisma.CustomersFindManyArgs): Promise< + (Customers & { + contact: Contacts; + })[] + > { query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); - return this.model.findMany(query); + if (!query.include) return this.model.findMany({ ...query, include: { contact: true } }); + return this.model.findMany({ ...query, include: { contact: { include: { address: true } } } }); } /** * @description : Create a customer */ - public async create(customer: Customer): Promise { + public async create(customer: Customer): Promise< + Customers & { + contact: Contacts; + } + > { const createArgs: Prisma.CustomersCreateArgs = { data: { status: ECustomerStatus.PENDING, @@ -39,7 +48,7 @@ export default class CustomersRepository extends BaseRepository { phone_number: customer.contact.phone_number, cell_phone_number: customer.contact?.cell_phone_number, civility: ECivility[customer.contact.civility as keyof typeof ECivility], - address: {} + address: {}, }, }, }, @@ -52,13 +61,20 @@ export default class CustomersRepository extends BaseRepository { city: customer.contact.address!.city, }; } - return this.model.create(createArgs); + return this.model.create({ ...createArgs, include: { contact: true } }); } /** * @description : Update data from a customer */ - public async update(uid: string, customer: Customer): Promise { + public async update( + uid: string, + customer: Customer, + ): Promise< + Customers & { + contact: Contacts; + } + > { const updateArgs: Prisma.CustomersUpdateArgs = { where: { uid: uid, @@ -73,11 +89,11 @@ export default class CustomersRepository extends BaseRepository { phone_number: customer.contact.phone_number, cell_phone_number: customer.contact.cell_phone_number, civility: ECivility[customer.contact.civility as keyof typeof ECivility], - address: {} + address: {}, }, }, }, - } + }; if (customer.contact.address) { updateArgs.data.contact!.update!.address!.update = { address: customer.contact.address!.address, @@ -85,7 +101,7 @@ export default class CustomersRepository extends BaseRepository { city: customer.contact.address!.city, }; } - return this.model.update(updateArgs); + return this.model.update({ ...updateArgs, include: { contact: true } }); } /** diff --git a/src/common/repositories/UsersRepository.ts b/src/common/repositories/UsersRepository.ts index 72a521c0..90240e3a 100644 --- a/src/common/repositories/UsersRepository.ts +++ b/src/common/repositories/UsersRepository.ts @@ -1,7 +1,7 @@ import Database from "@Common/databases/database"; import BaseRepository from "@Repositories/BaseRepository"; import { Service } from "typedi"; -import { ECivility, Prisma, Users } from "@prisma/client"; +import { Addresses, Contacts, ECivility, Offices, Prisma, Users } from "@prisma/client"; import User from "le-coffre-resources/dist/SuperAdmin"; @Service() @@ -19,15 +19,26 @@ export default class UsersRepository extends BaseRepository { /** * @description : Find many users */ - public async findMany(query: any): Promise { + public async findMany(query: Prisma.UsersFindManyArgs): Promise< + (Users & { + contact: Contacts; + office_membership: Offices & { + address: Addresses + }; + })[] + > { query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); - return this.model.findMany(query); + if (!query.include) return this.model.findMany({ ...query, include: { contact: true, office_membership: { include: { address: true } } } }); + return this.model.findMany({ ...query, include: { contact: { include: { address: true } }, office_membership: { include: { address: true } } } }); } /** * @description : Create a user */ - public async create(user: User): Promise { + public async create(user: User): Promise { const createArgs: Prisma.UsersCreateArgs = { data: { idNot: user.idNot, @@ -62,7 +73,7 @@ export default class UsersRepository extends BaseRepository { }, }, }, - } + }; if (user.contact.address) { createArgs.data.contact!.create!.address!.create = { address: user.contact.address!.address, @@ -70,13 +81,16 @@ export default class UsersRepository extends BaseRepository { city: user.contact.address!.city, }; } - return this.model.create(createArgs); + return this.model.create({...createArgs, include : { contact: true, office_membership: true}}); } /** * @description : Update data from a user */ - public async update(uid: string, user: User): Promise { + public async update(uid: string, user: User): Promise { const updateArgs: Prisma.UsersUpdateArgs = { where: { uid: uid, @@ -110,7 +124,7 @@ export default class UsersRepository extends BaseRepository { phone_number: user.contact.phone_number, cell_phone_number: user.contact.cell_phone_number, civility: ECivility[user.contact.civility as keyof typeof ECivility], - address: {} + address: {}, }, }, }, @@ -122,7 +136,7 @@ export default class UsersRepository extends BaseRepository { city: user.contact.address!.city, }; } - return this.model.update(updateArgs); + return this.model.update({...updateArgs, include : { contact: true, office_membership: true}}); } /** diff --git a/src/services/super-admin/CustomersService/CustomersService.ts b/src/services/super-admin/CustomersService/CustomersService.ts index 20470182..10ee7231 100644 --- a/src/services/super-admin/CustomersService/CustomersService.ts +++ b/src/services/super-admin/CustomersService/CustomersService.ts @@ -1,4 +1,4 @@ -import { Customers } from "@prisma/client"; +import { Contacts, Customers } from "@prisma/client"; import CustomersRepository from "@Repositories/CustomersRepository"; import BaseService from "@Services/BaseService"; import { Customer } from "le-coffre-resources/dist/SuperAdmin"; @@ -14,7 +14,11 @@ export default class CustomersService extends BaseService { * @description : Get all Customers * @throws {Error} If Customers cannot be get */ - public async get(query: any) { + public async get(query: any): Promise< + (Customers & { + contact: Contacts; + })[] + > { return this.customerRepository.findMany(query); } @@ -22,7 +26,11 @@ export default class CustomersService extends BaseService { * @description : Create a new customer * @throws {Error} If customer cannot be created */ - public async create(customerEntity: Customer): Promise { + public async create(customerEntity: Customer): Promise< + Customers & { + contact: Contacts; + } + > { return this.customerRepository.create(customerEntity); } @@ -30,7 +38,14 @@ export default class CustomersService extends BaseService { * @description : Modify a customer * @throws {Error} If customer cannot be modified */ - public async update(uid: string, customerEntity: Customer): Promise { + public async update( + uid: string, + customerEntity: Customer, + ): Promise< + Customers & { + contact: Contacts; + } + > { return this.customerRepository.update(uid, customerEntity); } diff --git a/src/services/super-admin/UsersService/UsersService.ts b/src/services/super-admin/UsersService/UsersService.ts index 1e9c4445..f8e914a2 100644 --- a/src/services/super-admin/UsersService/UsersService.ts +++ b/src/services/super-admin/UsersService/UsersService.ts @@ -3,7 +3,7 @@ import "reflect-metadata"; import { Service } from "typedi"; import UsersRepository from "@Repositories/UsersRepository"; import User from "le-coffre-resources/dist/SuperAdmin"; -import { Users } from "@prisma/client"; +import { Contacts, Offices, Prisma, Users } from "@prisma/client"; @Service() export default class UsersService extends BaseService { @@ -15,7 +15,10 @@ export default class UsersService extends BaseService { * @description : Get all users * @throws {Error} If users cannot be get */ - public get(query: any): Promise { + public get(query: Prisma.UsersFindManyArgs): Promise<(Users & { + contact: Contacts; + office_membership: Offices; + })[]> { return this.userRepository.findMany(query); } @@ -23,7 +26,10 @@ export default class UsersService extends BaseService { * @description : Create a user * @throws {Error} If user couldn't be created */ - public create(userEntity: User): Promise { + public create(userEntity: User): Promise { return this.userRepository.create(userEntity); } @@ -31,7 +37,10 @@ export default class UsersService extends BaseService { * @description : Modify a user * @throws {Error} If user modification failed */ - public update(uid: string, userEntity: User): Promise { + public update(uid: string, userEntity: User): Promise { return this.userRepository.update(uid, userEntity); } From a2d68d62c348612bf7a9aedf582355708dfca421 Mon Sep 17 00:00:00 2001 From: OxSaitama Date: Wed, 3 May 2023 17:51:11 +0200 Subject: [PATCH 24/72] fix hydratation and make nested fields optionnal --- package.json | 2 +- .../api/super-admin/CustomersController.ts | 11 +- .../api/super-admin/DeedTypesController.ts | 14 +- src/app/api/super-admin/DeedsController.ts | 7 +- .../super-admin/DocumentTypesController.ts | 18 +-- .../api/super-admin/DocumentsController.ts | 14 +- .../super-admin/OfficeFoldersController.ts | 14 +- src/app/api/super-admin/OfficesController.ts | 18 +-- src/app/api/super-admin/UsersController.ts | 18 +-- src/common/databases/seeders/seeder.ts | 133 +++++++----------- .../repositories/CustomersRepository.ts | 56 ++++---- .../repositories/DeedTypesRepository.ts | 12 +- src/common/repositories/DeedsRepository.ts | 4 +- .../repositories/DocumentTypesRepository.ts | 10 +- .../repositories/DocumentsRepository.ts | 20 +-- src/common/repositories/FilesRepository.ts | 16 +-- .../OfficeFoldersHasCustomerRepository.ts | 1 - .../repositories/OfficeFoldersRepository.ts | 32 ++--- src/common/repositories/OfficesRepository.ts | 19 ++- src/common/repositories/UsersRepository.ts | 126 +++++++++-------- .../CustomersService/CustomersService.ts | 23 +-- .../OfficeFoldersService.ts | 2 +- .../super-admin/UsersService/UsersService.ts | 17 +-- src/test/config/Init.ts | 56 ++++---- .../super-admin/CustomersService.test.ts | 72 +++++----- .../services/super-admin/DeedService.test.ts | 8 +- .../super-admin/DeedTypesService.test.ts | 22 +-- .../super-admin/DocumentTypesService.test.ts | 22 +-- .../super-admin/OfficeFolderService.test.ts | 6 +- .../services/super-admin/UsersService.test.ts | 102 +++++++------- 30 files changed, 415 insertions(+), 460 deletions(-) diff --git a/package.json b/package.json index 84e273fa..bee4740a 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "cors": "^2.8.5", "express": "^4.18.2", "jsonwebtoken": "^9.0.0", - "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.24", + "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.29", "module-alias": "^2.2.2", "next": "^13.1.5", "node-cache": "^5.1.2", diff --git a/src/app/api/super-admin/CustomersController.ts b/src/app/api/super-admin/CustomersController.ts index 9066c904..9e4a1732 100644 --- a/src/app/api/super-admin/CustomersController.ts +++ b/src/app/api/super-admin/CustomersController.ts @@ -7,7 +7,6 @@ import { Customer } from "le-coffre-resources/dist/SuperAdmin"; import { Customers } from "@prisma/client"; import { validateOrReject } from "class-validator"; - @Controller() @Service() export default class CustomersController extends ApiController { @@ -23,7 +22,7 @@ export default class CustomersController extends ApiController { try { //get query const query = JSON.parse(req.query["q"] as string); - + //call service to get prisma entity const customersEntity = await this.customersService.get(query); @@ -49,7 +48,7 @@ export default class CustomersController extends ApiController { Customer.hydrate(customerEntity, req.body); //validate user - await validateOrReject(customerEntity, { groups: ["createCustomer"], forbidUnknownValues: false}); + await validateOrReject(customerEntity, { groups: ["createCustomer"], forbidUnknownValues: false }); //call service to get prisma entity const prismaEntityCreated = await this.customersService.create(customerEntity); @@ -81,14 +80,14 @@ export default class CustomersController extends ApiController { const customerEntity = new Customer(); Customer.hydrate(customerEntity, req.body); //validate user - await validateOrReject(customerEntity, { groups: ["updateCustomer"] , forbidUnknownValues: false}); + await validateOrReject(customerEntity, { groups: ["updateCustomer"], forbidUnknownValues: false }); //call service to get prisma entity const prismaEntityUpdated = await this.customersService.update(uid, customerEntity); //Hydrate ressource with prisma entity const customerEntityUpdated = Customer.hydrate(prismaEntityUpdated, { - strategy: "exposeAll", + strategy: "excludeAll", }); //success @@ -121,7 +120,7 @@ export default class CustomersController extends ApiController { } //Hydrate ressource with prisma entity - const customer = Customer.hydrate(customerEntity, { strategy: "exposeAll" }); + const customer = Customer.hydrate(customerEntity, { strategy: "excludeAll" }); //success this.httpSuccess(response, customer); diff --git a/src/app/api/super-admin/DeedTypesController.ts b/src/app/api/super-admin/DeedTypesController.ts index 0ef3b83b..1a5f1a0d 100644 --- a/src/app/api/super-admin/DeedTypesController.ts +++ b/src/app/api/super-admin/DeedTypesController.ts @@ -28,7 +28,7 @@ export default class DeedTypesController extends ApiController { const prismaEntity: DeedTypes[] = await this.deedTypesService.get(query); //Hydrate ressource with prisma entity - const DeedTypes = ObjectHydrate.map(DeedType, prismaEntity, { strategy: "exposeAll" }); + const DeedTypes = DeedType.map(DeedType, prismaEntity, { strategy: "excludeAll" }); //success this.httpSuccess(response, DeedTypes); @@ -56,8 +56,8 @@ export default class DeedTypesController extends ApiController { const prismaEntityCreated = await this.deedTypesService.create(deedTypeEntity); //Hydrate ressource with prisma entity - const deedTypeEntityCreated = ObjectHydrate.hydrate(new DeedType(), prismaEntityCreated, { - strategy: "exposeAll", + const deedTypeEntityCreated = DeedType.hydrate(prismaEntityCreated, { + strategy: "excludeAll", }); //success @@ -84,14 +84,14 @@ export default class DeedTypesController extends ApiController { ObjectHydrate.hydrate(deedTypeEntity, req.body); //validate deed type - await validateOrReject(deedTypeEntity, { groups: ["update"] }); + await validateOrReject(deedTypeEntity, { groups: ["updateDeedType"] }); //call service to get prisma entity const prismaEntityUpdated = await this.deedTypesService.update(uid, deedTypeEntity); //Hydrate ressource with prisma entity - const deedTypeEntityUpdated = ObjectHydrate.hydrate(new DeedType(), prismaEntityUpdated, { - strategy: "exposeAll", + const deedTypeEntityUpdated = DeedType.hydrate(prismaEntityUpdated, { + strategy: "excludeAll", }); //success @@ -125,7 +125,7 @@ export default class DeedTypesController extends ApiController { } //Hydrate ressource with prisma entity - const deedType = ObjectHydrate.hydrate(new DeedType(), deedTypeEntity, { strategy: "exposeAll" }); + const deedType = DeedType.hydrate(deedTypeEntity, { strategy: "excludeAll" }); //success this.httpSuccess(response, deedType); diff --git a/src/app/api/super-admin/DeedsController.ts b/src/app/api/super-admin/DeedsController.ts index df6a836d..382c9e7d 100644 --- a/src/app/api/super-admin/DeedsController.ts +++ b/src/app/api/super-admin/DeedsController.ts @@ -4,8 +4,7 @@ import ApiController from "@Common/system/controller-pattern/ApiController"; import DeedsService from "@Services/super-admin/DeedsService/DeedsService"; import { Service } from "typedi"; import { Deeds } from "@prisma/client"; -import Deed from "le-coffre-resources/dist/SuperAdmin"; -import ObjectHydrate from "@Common/helpers/ObjectHydrate"; +import { Deed } from "le-coffre-resources/dist/SuperAdmin"; @Controller() @Service() @@ -27,7 +26,7 @@ export default class DeedsController extends ApiController { const prismaEntity: Deeds[] = await this.deedsService.get(query); //Hydrate ressource with prisma entity - const deeds = ObjectHydrate.map(Deed, prismaEntity, { strategy: "exposeAll" }); + const deeds = Deed.map(Deed, prismaEntity, { strategy: "excludeAll" }); //success this.httpSuccess(response, deeds); @@ -53,7 +52,7 @@ export default class DeedsController extends ApiController { const deedEntity: Deeds = await this.deedsService.getByUid(uid); //Hydrate ressource with prisma entity - const deed = ObjectHydrate.hydrate(new Deed(), deedEntity, { strategy: "exposeAll" }); + const deed = Deed.hydrate(deedEntity, { strategy: "excludeAll" }); //success this.httpSuccess(response, deed); diff --git a/src/app/api/super-admin/DocumentTypesController.ts b/src/app/api/super-admin/DocumentTypesController.ts index a862e697..e5ebfa64 100644 --- a/src/app/api/super-admin/DocumentTypesController.ts +++ b/src/app/api/super-admin/DocumentTypesController.ts @@ -29,8 +29,8 @@ export default class DocumentTypesController extends ApiController { const prismaEntity: DocumentTypes[] = await this.documentTypesService.get(query); //Hydrate ressource with prisma entity - const documentTypes = ObjectHydrate.map(DocumentType, prismaEntity, { - strategy: "exposeAll", + const documentTypes = DocumentType.map(DocumentType, prismaEntity, { + strategy: "excludeAll", }); //success @@ -51,12 +51,12 @@ export default class DocumentTypesController extends ApiController { const documentTypeEntity = new DocumentType(); ObjectHydrate.hydrate(documentTypeEntity, req.body); //validate user - await validateOrReject(documentTypeEntity, { groups: ["createDocumentType"] , forbidUnknownValues: false}); + await validateOrReject(documentTypeEntity, { groups: ["createDocumentType"], forbidUnknownValues: false }); //call service to get prisma entity const prismaEntityCreated = await this.documentTypesService.create(documentTypeEntity); //Hydrate ressource with prisma entity - const userEntityCreated = ObjectHydrate.hydrate(new DocumentType(), prismaEntityCreated, { - strategy: "exposeAll", + const userEntityCreated = DocumentType.hydrate(prismaEntityCreated, { + strategy: "excludeAll", }); //success this.httpSuccess(response, userEntityCreated); @@ -87,8 +87,8 @@ export default class DocumentTypesController extends ApiController { const prismaEntityUpdated = await this.documentTypesService.update(uid, documentTypeEntity); //Hydrate ressource with prisma entity - const documentTypeEntityUpdated = ObjectHydrate.hydrate(new DocumentType(), prismaEntityUpdated, { - strategy: "exposeAll", + const documentTypeEntityUpdated = DocumentType.hydrate(prismaEntityUpdated, { + strategy: "excludeAll", }); //success @@ -119,9 +119,9 @@ export default class DocumentTypesController extends ApiController { //call service to get prisma entity documentTypeEntity = await this.documentTypesService.getByUid(uid); } - + //Hydrate ressource with prisma entity - const user = ObjectHydrate.hydrate(new DocumentType(), documentTypeEntity, { strategy: "exposeAll" }); + const user = ObjectHydrate.hydrate(new DocumentType(), documentTypeEntity, { strategy: "excludeAll" }); //success this.httpSuccess(response, user); diff --git a/src/app/api/super-admin/DocumentsController.ts b/src/app/api/super-admin/DocumentsController.ts index aa9af242..74122d25 100644 --- a/src/app/api/super-admin/DocumentsController.ts +++ b/src/app/api/super-admin/DocumentsController.ts @@ -29,7 +29,7 @@ export default class DocumentsController extends ApiController { const prismaEntity: Documents[] = await this.documentsService.get(query); //Hydrate ressource with prisma entity - const documents = ObjectHydrate.map(Document, prismaEntity, { strategy: "exposeAll" }); + const documents = Document.map(Document, prismaEntity, { strategy: "excludeAll" }); //success this.httpSuccess(response, documents); @@ -51,14 +51,14 @@ export default class DocumentsController extends ApiController { ObjectHydrate.hydrate(documentEntity, req.body); //validate document - await validateOrReject(documentEntity, { groups: ["createDocument"] , forbidUnknownValues: false}); + await validateOrReject(documentEntity, { groups: ["createDocument"], forbidUnknownValues: false }); //call service to get prisma entity const prismaEntityCreated = await this.documentsService.create(documentEntity); //Hydrate ressource with prisma entity - const documentEntityCreated = ObjectHydrate.hydrate(new Document(), prismaEntityCreated, { - strategy: "exposeAll", + const documentEntityCreated = Document.hydrate(prismaEntityCreated, { + strategy: "excludeAll", }); //success @@ -91,7 +91,7 @@ export default class DocumentsController extends ApiController { const prismaEntityUpdated: Documents = await this.documentsService.update(uid, documentEntity); //Hydrate ressource with prisma entity - const document = ObjectHydrate.hydrate(new Document(), prismaEntityUpdated, { strategy: "exposeAll" }); + const document = Document.hydrate(prismaEntityUpdated, { strategy: "excludeAll" }); //success this.httpSuccess(response, document); @@ -116,7 +116,7 @@ export default class DocumentsController extends ApiController { const documentEntity: Documents = await this.documentsService.delete(uid); //Hydrate ressource with prisma entity - const document = ObjectHydrate.hydrate(new Document(), documentEntity, { strategy: "exposeAll" }); + const document = Document.hydrate(documentEntity, { strategy: "excludeAll" }); //success this.httpSuccess(response, document); @@ -148,7 +148,7 @@ export default class DocumentsController extends ApiController { } //Hydrate ressource with prisma entity - const document = ObjectHydrate.hydrate(new Document(), documentEntity, { strategy: "exposeAll" }); + const document = Document.hydrate(documentEntity, { strategy: "excludeAll" }); //success this.httpSuccess(response, document); diff --git a/src/app/api/super-admin/OfficeFoldersController.ts b/src/app/api/super-admin/OfficeFoldersController.ts index 100f85a3..94265252 100644 --- a/src/app/api/super-admin/OfficeFoldersController.ts +++ b/src/app/api/super-admin/OfficeFoldersController.ts @@ -26,8 +26,8 @@ export default class OfficeFoldersController extends ApiController { //call service to get prisma entity const prismaEntity: OfficeFolders[] = await this.officeFoldersService.get(query); //Hydrate ressource with prisma entity - const officeFolders = ObjectHydrate.map(OfficeFolder, prismaEntity, { - strategy: "exposeAll", enableImplicitConversion: true + const officeFolders = OfficeFolder.map(OfficeFolder, prismaEntity, { + strategy: "excludeAll", }); //success this.httpSuccess(response, officeFolders); @@ -52,8 +52,8 @@ export default class OfficeFoldersController extends ApiController { //call service to get prisma entity const prismaEntityCreated = await this.officeFoldersService.create(officeFolderEntity); //Hydrate ressource with prisma entity - const officeFolderEntityCreated = ObjectHydrate.hydrate(new OfficeFolder(), prismaEntityCreated, { - strategy: "exposeAll", enableImplicitConversion: true + const officeFolderEntityCreated = OfficeFolder.hydrate(prismaEntityCreated, { + strategy: "excludeAll", }); //success this.httpSuccess(response, officeFolderEntityCreated); @@ -84,8 +84,8 @@ export default class OfficeFoldersController extends ApiController { const prismaEntityUpdated = await this.officeFoldersService.update(uid, officeFolderEntity); //Hydrate ressource with prisma entity - const officeFolderEntityUpdated = ObjectHydrate.hydrate(new OfficeFolder(), prismaEntityUpdated, { - strategy: "exposeAll", + const officeFolderEntityUpdated = OfficeFolder.hydrate(prismaEntityUpdated, { + strategy: "excludeAll", }); //success @@ -119,7 +119,7 @@ export default class OfficeFoldersController extends ApiController { } //Hydrate ressource with prisma entity - const officeFolder = ObjectHydrate.hydrate(new OfficeFolder(), officeFolderEntity, { strategy: "exposeAll" }); + const officeFolder = OfficeFolder.hydrate(officeFolderEntity, { strategy: "excludeAll" }); //success this.httpSuccess(response, officeFolder); diff --git a/src/app/api/super-admin/OfficesController.ts b/src/app/api/super-admin/OfficesController.ts index dc4e52d8..05b3af1b 100644 --- a/src/app/api/super-admin/OfficesController.ts +++ b/src/app/api/super-admin/OfficesController.ts @@ -5,7 +5,7 @@ import OfficesService from "@Services/super-admin/OfficesService/OfficesService" import { Service } from "typedi"; import { Offices } from "@prisma/client"; import ObjectHydrate from "@Common/helpers/ObjectHydrate"; -import { Office as OfficeRessource } from "le-coffre-resources/dist/SuperAdmin"; +import { Office as OfficeResource } from "le-coffre-resources/dist/SuperAdmin"; import { validateOrReject } from "class-validator"; @Controller() @@ -25,7 +25,7 @@ export default class OfficesController extends ApiController { //call service to get prisma entity const officesEntity: Offices[] = await this.officesService.get(query); //Hydrate ressource with prisma entity - const offices = ObjectHydrate.map(OfficeRessource, officesEntity, { strategy: "exposeAll" }); + const offices = OfficeResource.map(OfficeResource, officesEntity, { strategy: "excludeAll" }); //success this.httpSuccess(response, offices); } catch (error) { @@ -40,15 +40,15 @@ export default class OfficesController extends ApiController { protected async post(req: Request, response: Response) { try { //init IUser resource with request body values - const officeEntity = new OfficeRessource(); + const officeEntity = new OfficeResource(); ObjectHydrate.hydrate(officeEntity, req.body); //validate user await validateOrReject(officeEntity, { groups: ["createOffice"], forbidUnknownValues: false }); //call service to get prisma entity const prismaEntityCreated = await this.officesService.create(officeEntity); //Hydrate ressource with prisma entity - const officeEntityCreated = ObjectHydrate.hydrate(new OfficeRessource(), prismaEntityCreated, { - strategy: "exposeAll", + const officeEntityCreated = OfficeResource.hydrate(prismaEntityCreated, { + strategy: "excludeAll", }); //success this.httpSuccess(response, officeEntityCreated); @@ -68,15 +68,15 @@ export default class OfficesController extends ApiController { throw new Error("No uid provided"); } //init IUser resource with request body values - const officeEntity = new OfficeRessource(); + const officeEntity = new OfficeResource(); ObjectHydrate.hydrate(officeEntity, req.body); //validate user await validateOrReject(officeEntity, { groups: ["update"] }); //call service to get prisma entity const prismaEntityUpdated = await this.officesService.update(uid, officeEntity); //Hydrate ressource with prisma entity - const officeEntityUpdated = ObjectHydrate.hydrate(new OfficeRessource(), prismaEntityUpdated, { - strategy: "exposeAll", + const officeEntityUpdated = OfficeResource.hydrate(prismaEntityUpdated, { + strategy: "excludeAll", }); //success this.httpSuccess(response, officeEntityUpdated); @@ -105,7 +105,7 @@ export default class OfficesController extends ApiController { officeEntity = await this.officesService.getByUid(uid); } //Hydrate ressource with prisma entity - const office = ObjectHydrate.hydrate(new OfficeRessource(), officeEntity, { strategy: "exposeAll" }); + const office = OfficeResource.hydrate(officeEntity, { strategy: "excludeAll" }); //success this.httpSuccess(response, office); } catch (error) { diff --git a/src/app/api/super-admin/UsersController.ts b/src/app/api/super-admin/UsersController.ts index 0ed184d0..13b2c8c3 100644 --- a/src/app/api/super-admin/UsersController.ts +++ b/src/app/api/super-admin/UsersController.ts @@ -25,10 +25,10 @@ export default class UsersController extends ApiController { const query = JSON.parse(req.query["q"] as string); //call service to get prisma entity - const usersEntity: Users[] = await this.usersService.get(query); - + const usersEntity = await this.usersService.get(query); + //Hydrate ressource with prisma entity - const users = User.map(User, usersEntity, {excludeExtraneousValues: true}) + const users = User.map(User, usersEntity, { strategy: "excludeAll" }); //success this.httpSuccess(response, users); @@ -49,14 +49,14 @@ export default class UsersController extends ApiController { ObjectHydrate.hydrate(userEntity, req.body); //validate user - await validateOrReject(userEntity, { groups: ["create"] }); + await validateOrReject(userEntity, { groups: ["createUser"] }); //call service to get prisma entity const prismaEntityCreated = await this.usersService.create(userEntity); //Hydrate ressource with prisma entity - const userEntityCreated = ObjectHydrate.hydrate(new User(), prismaEntityCreated, { - strategy: "exposeAll", + const userEntityCreated = User.hydrate(prismaEntityCreated, { + strategy: "excludeAll", }); //success @@ -88,8 +88,8 @@ export default class UsersController extends ApiController { const prismaEntityUpdated = await this.usersService.update(uid, userEntity); //Hydrate ressource with prisma entity - const userEntityUpdated = ObjectHydrate.hydrate(new User(), prismaEntityUpdated, { - strategy: "exposeAll", + const userEntityUpdated = User.hydrate(prismaEntityUpdated, { + strategy: "excludeAll", }); //success @@ -121,7 +121,7 @@ export default class UsersController extends ApiController { } //Hydrate ressource with prisma entity - const user = ObjectHydrate.hydrate(new User(), userEntity, { strategy: "exposeAll" }); + const user = User.hydrate(userEntity, { strategy: "excludeAll" }); //success this.httpSuccess(response, user); diff --git a/src/common/databases/seeders/seeder.ts b/src/common/databases/seeders/seeder.ts index 577511ca..35df0bbd 100644 --- a/src/common/databases/seeders/seeder.ts +++ b/src/common/databases/seeders/seeder.ts @@ -1,7 +1,7 @@ import { Addresses, Contacts, - Customers, + Customers, DeedHasDocumentTypes, DeedTypeHasDocumentTypes, DeedTypes, @@ -17,27 +17,26 @@ import { OfficeFolders, Offices, Users, - ECivility, - ECustomerStatus, - PrismaClient + ECivility, + ECustomerStatus, + PrismaClient, } from "@prisma/client"; (async () => { - const prisma = new PrismaClient(); - const existingData = await prisma.contacts.findFirst({ where: { email: "john.doe@example.com" } }); - if (existingData) { - console.log('Seed data already exists. Skipping seeding process.'); - return; - } + const existingData = await prisma.contacts.findFirst({ where: { email: "john.doe@example.com" } }); + if (existingData) { + console.log("Seed data already exists. Skipping seeding process."); + return; + } - const randomString = () => { - const chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; - let result = ""; - for (let i = 10; i > 0; --i) result += chars[Math.floor(Math.random() * chars.length)]; - return result; - }; + const randomString = () => { + const chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; + let result = ""; + for (let i = 10; i > 0; --i) result += chars[Math.floor(Math.random() * chars.length)]; + return result; + }; const uidCustomer1: string = randomString(); const uidCustomer2: string = randomString(); @@ -55,7 +54,6 @@ import { const uidOfficeFolder1: string = randomString(); const uidOfficeFolder2: string = randomString(); -<<<<<<< HEAD const uidOfficeFolder3: string = randomString(); const uidOfficeFolder4: string = randomString(); const uidOfficeFolder5: string = randomString(); @@ -65,11 +63,6 @@ import { const uidDeed3: string = randomString(); const uidDeed4: string = randomString(); const uidDeed5: string = randomString(); -======= - - const uidDeed1: string = randomString(); - const uidDeed2: string = randomString(); ->>>>>>> 7122ff1 (uuid --> uid) const uidDeedType1: string = randomString(); const uidDeedType2: string = randomString(); @@ -205,13 +198,8 @@ import { const officeFolders: OfficeFolders[] = [ { uid: uidOfficeFolder1, -<<<<<<< HEAD folder_number: "0001", name: "Dossier", -======= - folder_number: randomString(), - name: "0001", ->>>>>>> 7122ff1 (uuid --> uid) deed_uid: uidDeed1, status: EFolderStatus.LIVE, created_at: new Date(), @@ -222,13 +210,8 @@ import { }, { uid: uidOfficeFolder2, -<<<<<<< HEAD folder_number: "0002", name: "Dossier", -======= - folder_number: randomString(), - name: "0001", ->>>>>>> 7122ff1 (uuid --> uid) deed_uid: uidDeed2, status: EFolderStatus.LIVE, created_at: new Date(), @@ -272,31 +255,24 @@ import { office_uid: uidOffice2, description: null, archived_description: null, - } + }, ]; const deeds: Deeds[] = [ { uid: uidDeed1, deed_type_uid: uidDeedType1, -<<<<<<< HEAD created_at: new Date(), updated_at: new Date(), }, { uid: uidDeed2, deed_type_uid: uidDeedType2, -======= ->>>>>>> 7122ff1 (uuid --> uid) created_at: new Date(), updated_at: new Date(), }, { -<<<<<<< HEAD uid: uidDeed3, -======= - uid: uidDeed2, ->>>>>>> 7122ff1 (uuid --> uid) deed_type_uid: uidDeedType2, created_at: new Date(), updated_at: new Date(), @@ -312,7 +288,7 @@ import { deed_type_uid: uidDeedType2, created_at: new Date(), updated_at: new Date(), - } + }, ]; const deedTypes: DeedTypes[] = [ @@ -469,67 +445,64 @@ import { }, ]; - for (const address of addresses) { - await prisma.addresses.create({data: address}); + await prisma.addresses.create({ data: address }); } for (const contact of contacts) { await prisma.contacts.create({ data: contact }); } - - for (const office of offices) { - await prisma.offices.create({ data: office }); - } + + for (const office of offices) { + await prisma.offices.create({ data: office }); + } for (const user of users) { await prisma.users.create({ data: user }); } - for (const customer of customers) { await prisma.customers.create({ data: customer }); } - for (const deedType of deedTypes) { - await prisma.deedTypes.create({ data: deedType }); - } + for (const deedType of deedTypes) { + await prisma.deedTypes.create({ data: deedType }); + } - for (const deed of deeds) { - await prisma.deeds.create({ data: deed }); - - } - for (const officeFolder of officeFolders) { - await prisma.officeFolders.create({ data: officeFolder }); - } + for (const deed of deeds) { + await prisma.deeds.create({ data: deed }); + } + for (const officeFolder of officeFolders) { + await prisma.officeFolders.create({ data: officeFolder }); + } - for (const documentType of documentTypes) { - await prisma.documentTypes.create({ data: documentType }); - } + for (const documentType of documentTypes) { + await prisma.documentTypes.create({ data: documentType }); + } - for (const document of documents) { - await prisma.documents.create({ data: document }); - } + for (const document of documents) { + await prisma.documents.create({ data: document }); + } - for (const file of files) { - await prisma.files.create({ data: file }); - } + for (const file of files) { + await prisma.files.create({ data: file }); + } - for (const documentHistory of documentHistories) { - await prisma.documentHistory.create({ data: documentHistory }); - } + for (const documentHistory of documentHistories) { + await prisma.documentHistory.create({ data: documentHistory }); + } - for (const officeFolderHasCustomer of officeFolderHasCustomers) { - await prisma.officeFolderHasCustomers.create({ data: officeFolderHasCustomer }); - } + for (const officeFolderHasCustomer of officeFolderHasCustomers) { + await prisma.officeFolderHasCustomers.create({ data: officeFolderHasCustomer }); + } - for (const deedHasDocumentType of deedHasDocumentTypes) { - await prisma.deedHasDocumentTypes.create({ data: deedHasDocumentType }); - } + for (const deedHasDocumentType of deedHasDocumentTypes) { + await prisma.deedHasDocumentTypes.create({ data: deedHasDocumentType }); + } - for (const deedTypeHasDocumentType of deedTypeHasDocumentTypes) { - await prisma.deedTypeHasDocumentTypes.create({ data: deedTypeHasDocumentType }); - } + for (const deedTypeHasDocumentType of deedTypeHasDocumentTypes) { + await prisma.deedTypeHasDocumentTypes.create({ data: deedTypeHasDocumentType }); + } console.log(">MOCK DATA - Seeding completed!"); -})(); \ No newline at end of file +})(); diff --git a/src/common/repositories/CustomersRepository.ts b/src/common/repositories/CustomersRepository.ts index e4414f65..ddca2087 100644 --- a/src/common/repositories/CustomersRepository.ts +++ b/src/common/repositories/CustomersRepository.ts @@ -42,23 +42,23 @@ export default class CustomersRepository extends BaseRepository { status: ECustomerStatus.PENDING, contact: { create: { - first_name: customer.contact.first_name, - last_name: customer.contact.last_name, - email: customer.contact.email, - phone_number: customer.contact.phone_number, - cell_phone_number: customer.contact?.cell_phone_number, - civility: ECivility[customer.contact.civility as keyof typeof ECivility], + first_name: customer.contact!.first_name, + last_name: customer.contact!.last_name, + email: customer.contact!.email, + phone_number: customer.contact!.phone_number, + cell_phone_number: customer.contact!?.cell_phone_number, + civility: ECivility[customer.contact!.civility as keyof typeof ECivility], address: {}, }, }, }, }; - if (customer.contact.address) { + if (customer.contact!.address) { createArgs.data.contact!.create!.address!.create = { - address: customer.contact.address!.address, - zip_code: customer.contact.address!.zip_code, - city: customer.contact.address!.city, + address: customer.contact!.address!.address, + zip_code: customer.contact!.address!.zip_code, + city: customer.contact!.address!.city, }; } return this.model.create({ ...createArgs, include: { contact: true } }); @@ -83,22 +83,22 @@ export default class CustomersRepository extends BaseRepository { status: ECustomerStatus[customer.status as keyof typeof ECustomerStatus], contact: { update: { - first_name: customer.contact.first_name, - last_name: customer.contact.last_name, - email: customer.contact.email, - phone_number: customer.contact.phone_number, - cell_phone_number: customer.contact.cell_phone_number, - civility: ECivility[customer.contact.civility as keyof typeof ECivility], + first_name: customer.contact!.first_name, + last_name: customer.contact!.last_name, + email: customer.contact!.email, + phone_number: customer.contact!.phone_number, + cell_phone_number: customer.contact!.cell_phone_number, + civility: ECivility[customer.contact!.civility as keyof typeof ECivility], address: {}, }, }, }, }; - if (customer.contact.address) { + if (customer.contact!.address) { updateArgs.data.contact!.update!.address!.update = { - address: customer.contact.address!.address, - zip_code: customer.contact.address!.zip_code, - city: customer.contact.address!.city, + address: customer.contact!.address!.address, + zip_code: customer.contact!.address!.zip_code, + city: customer.contact!.address!.city, }; } return this.model.update({ ...updateArgs, include: { contact: true } }); @@ -107,16 +107,20 @@ export default class CustomersRepository extends BaseRepository { /** * @description : Find unique customer */ - public async findOneByUid(uid: string, query?: any): Promise { + public async findOneByUid( + uid: string, + query?: any, + ): Promise< + Customers & { + contact: Contacts; + } + > { const findOneArgs: Prisma.CustomersFindUniqueArgs = { where: { uid: uid, - } + }, }; - if(query) { - findOneArgs.include = query - } - const customerEntity = await this.model.findUnique(findOneArgs); + const customerEntity = await this.model.findUnique({ ...findOneArgs, include: { contact: true } }); if (!customerEntity) { throw new Error("Customer not found"); diff --git a/src/common/repositories/DeedTypesRepository.ts b/src/common/repositories/DeedTypesRepository.ts index 47ea54c1..6f38421d 100644 --- a/src/common/repositories/DeedTypesRepository.ts +++ b/src/common/repositories/DeedTypesRepository.ts @@ -34,10 +34,10 @@ export default class DeedTypesRepository extends BaseRepository { description: deedType.description, office: { connect: { - uid: deedType.office.uid, + uid: deedType.office!.uid, }, }, - } + }, }; if (deedType.deed_type_has_document_types) { createArgs.data.deed_type_has_document_types = { @@ -66,7 +66,7 @@ export default class DeedTypesRepository extends BaseRepository { archived_at: deedType.archived_at, office: { connect: { - uid: deedType.office.uid, + uid: deedType.office!.uid, }, }, }, @@ -95,10 +95,10 @@ export default class DeedTypesRepository extends BaseRepository { const findOneArgs: Prisma.DeedTypesFindUniqueArgs = { where: { uid: uid, - } + }, }; - if(query) { - findOneArgs.include = query + if (query) { + findOneArgs.include = query; } const deedTypeEntity = await this.model.findUnique(findOneArgs); diff --git a/src/common/repositories/DeedsRepository.ts b/src/common/repositories/DeedsRepository.ts index 71c37b47..dcbe3203 100644 --- a/src/common/repositories/DeedsRepository.ts +++ b/src/common/repositories/DeedsRepository.ts @@ -32,14 +32,14 @@ export default class DeedsRepository extends BaseRepository { data: { deed_type: { connect: { - uid: deed.deed_type.uid, + uid: deed.deed_type!.uid, }, }, }, }; const deedTypeWithDocumentTypes = await this.instanceDb.deedTypes.findUniqueOrThrow({ where: { - uid: deed.deed_type.uid, + uid: deed.deed_type!.uid, }, include: { deed_type_has_document_types: true }, }); diff --git a/src/common/repositories/DocumentTypesRepository.ts b/src/common/repositories/DocumentTypesRepository.ts index d29259cb..e9cb3fef 100644 --- a/src/common/repositories/DocumentTypesRepository.ts +++ b/src/common/repositories/DocumentTypesRepository.ts @@ -35,7 +35,7 @@ export default class DocumentTypesRepository extends BaseRepository { private_description: documentType.private_description, office: { connect: { - uid: documentType.office.uid, + uid: documentType.office!.uid, }, }, }, @@ -57,7 +57,7 @@ export default class DocumentTypesRepository extends BaseRepository { archived_at: documentType.archived_at, office: { connect: { - uid: documentType.office.uid, + uid: documentType.office!.uid, }, }, }, @@ -71,10 +71,10 @@ export default class DocumentTypesRepository extends BaseRepository { const findOneArgs: Prisma.DocumentTypesFindUniqueArgs = { where: { uid: uid, - } + }, }; - if(query) { - findOneArgs.include = query + if (query) { + findOneArgs.include = query; } const documentTypeEntity = await this.model.findUnique(findOneArgs); diff --git a/src/common/repositories/DocumentsRepository.ts b/src/common/repositories/DocumentsRepository.ts index e9c631f2..f48a0030 100644 --- a/src/common/repositories/DocumentsRepository.ts +++ b/src/common/repositories/DocumentsRepository.ts @@ -32,17 +32,17 @@ export default class DocumentsRepository extends BaseRepository { data: { folder: { connect: { - uid: document.folder.uid, + uid: document.folder!.uid, }, }, depositor: { connect: { - uid: document.depositor.uid, + uid: document.depositor!.uid, }, }, document_type: { connect: { - uid: document.document_type.uid, + uid: document.document_type!.uid, }, }, }, @@ -67,9 +67,9 @@ export default class DocumentsRepository extends BaseRepository { public async createMany(documents: Document[]): Promise { return this.model.createMany({ data: documents.map((document) => ({ - folder_uid: document.folder.uid!, - depositor_uid: document.depositor.uid!, - document_type_uid: document.document_type.uid!, + folder_uid: document.folder!.uid!, + depositor_uid: document.depositor!.uid!, + document_type_uid: document.document_type!.uid!, })), skipDuplicates: true, }); @@ -93,7 +93,7 @@ export default class DocumentsRepository extends BaseRepository { }, depositor: { connect: { - uid: document.depositor.uid, + uid: document.depositor!.uid, }, }, }, @@ -118,10 +118,10 @@ export default class DocumentsRepository extends BaseRepository { const findOneArgs: Prisma.DocumentsFindUniqueArgs = { where: { uid: uid, - } + }, }; - if(query) { - findOneArgs.include = query + if (query) { + findOneArgs.include = query; } const documentEntity = await this.model.findUnique(findOneArgs); if (!documentEntity) { diff --git a/src/common/repositories/FilesRepository.ts b/src/common/repositories/FilesRepository.ts index d91da097..ebc0fb77 100644 --- a/src/common/repositories/FilesRepository.ts +++ b/src/common/repositories/FilesRepository.ts @@ -2,7 +2,7 @@ import Database from "@Common/databases/database"; import BaseRepository from "@Repositories/BaseRepository"; import { Service } from "typedi"; import { Files } from "@prisma/client"; -import { File } from "le-coffre-resources/dist/SuperAdmin" +import { File } from "le-coffre-resources/dist/SuperAdmin"; @Service() export default class FilesRepository extends BaseRepository { @@ -32,16 +32,16 @@ export default class FilesRepository extends BaseRepository { data: { document: { connect: { - uid: file.document.uid - } + uid: file.document.uid, + }, }, - file_path: file.file_path + file_path: file.file_path, }, }); } /** - * @description : Update data of a file + * @description : Update data of a file */ public async update(uid: string, file: File): Promise { return this.model.update({ @@ -49,19 +49,19 @@ export default class FilesRepository extends BaseRepository { uid: uid, }, data: { - file_path: file.file_path + file_path: file.file_path, }, }); } /** - * @description : Delete a file + * @description : Delete a file */ public async delete(uid: string): Promise { return this.model.delete({ where: { uid: uid, - } + }, }); } diff --git a/src/common/repositories/OfficeFoldersHasCustomerRepository.ts b/src/common/repositories/OfficeFoldersHasCustomerRepository.ts index aa83e947..2d4b403d 100644 --- a/src/common/repositories/OfficeFoldersHasCustomerRepository.ts +++ b/src/common/repositories/OfficeFoldersHasCustomerRepository.ts @@ -23,7 +23,6 @@ export default class OfficeFoldersHasCustomerRepository extends BaseRepository { return this.model.findMany(query); } - /** * @description : Find a unique relation between an office folder and customers */ diff --git a/src/common/repositories/OfficeFoldersRepository.ts b/src/common/repositories/OfficeFoldersRepository.ts index e09ad3d2..2a752d7f 100644 --- a/src/common/repositories/OfficeFoldersRepository.ts +++ b/src/common/repositories/OfficeFoldersRepository.ts @@ -38,20 +38,20 @@ export default class OfficeFoldersRepository extends BaseRepository { create: { deed_type: { connect: { - uid: officeFolder.deed.deed_type.uid, + uid: officeFolder.deed!.deed_type!.uid, }, }, }, }, office: { connect: { - uid: officeFolder.office.uid, + uid: officeFolder.office!.uid, }, }, }, include: { office_folder_has_stakeholder: true, - } + }, }; if (officeFolder.office_folder_has_stakeholder) { createArgs.data.office_folder_has_stakeholder = { @@ -59,7 +59,7 @@ export default class OfficeFoldersRepository extends BaseRepository { data: officeFolder.office_folder_has_stakeholder.map((relation) => ({ user_stakeholder_uid: relation.user_stakeholder.uid!, })), - skipDuplicates: true + skipDuplicates: true, }, }; } @@ -85,7 +85,7 @@ export default class OfficeFoldersRepository extends BaseRepository { office_folder_has_stakeholder: true, office_folder_has_customers: true, documents: true, - } + }, }; if (officeFolder.office_folder_has_stakeholder) { updateArgs.data.office_folder_has_stakeholder = { @@ -94,9 +94,9 @@ export default class OfficeFoldersRepository extends BaseRepository { data: officeFolder.office_folder_has_stakeholder.map((relation) => ({ user_stakeholder_uid: relation.user_stakeholder.uid!, })), - skipDuplicates: true + skipDuplicates: true, }, - } + }; } if (officeFolder.office_folder_has_customers) { updateArgs.data.office_folder_has_customers = { @@ -105,20 +105,20 @@ export default class OfficeFoldersRepository extends BaseRepository { data: officeFolder.office_folder_has_customers.map((relation) => ({ customer_uid: relation.customer.uid!, })), - skipDuplicates: true + skipDuplicates: true, }, - } + }; } if (officeFolder.documents) { updateArgs.data.documents = { createMany: { data: officeFolder.documents.map((relation) => ({ - document_type_uid: relation.document_type.uid!, - depositor_uid: relation.depositor.uid! + document_type_uid: relation.document_type!.uid!, + depositor_uid: relation.depositor!.uid!, })), - skipDuplicates: true + skipDuplicates: true, }, - } + }; } return this.model.update(updateArgs); } @@ -130,10 +130,10 @@ export default class OfficeFoldersRepository extends BaseRepository { const findOneArgs: Prisma.OfficeFoldersFindUniqueArgs = { where: { uid: uid, - } + }, }; - if(query) { - findOneArgs.include = query + if (query) { + findOneArgs.include = query; } const officeFolderEntity = await this.model.findUnique(findOneArgs); diff --git a/src/common/repositories/OfficesRepository.ts b/src/common/repositories/OfficesRepository.ts index 1bd11cf0..7595a1f5 100644 --- a/src/common/repositories/OfficesRepository.ts +++ b/src/common/repositories/OfficesRepository.ts @@ -36,9 +36,9 @@ export default class OfficesRepository extends BaseRepository { crpcen: office.crpcen, address: { create: { - address: office.address.address, - zip_code: office.address.zip_code, - city: office.address.city, + address: office.address!.address, + zip_code: office.address!.zip_code, + city: office.address!.city, }, }, office_status: EOfficeStatus.DESACTIVATED, @@ -58,9 +58,9 @@ export default class OfficesRepository extends BaseRepository { name: office.name, address: { create: { - address: office.address.address, - zip_code: office.address.zip_code, - city: office.address.city, + address: office.address!.address, + zip_code: office.address!.zip_code, + city: office.address!.city, }, }, office_status: EOfficeStatus[office.office_status as keyof typeof EOfficeStatus], @@ -75,14 +75,13 @@ export default class OfficesRepository extends BaseRepository { const findOneArgs: Prisma.OfficesFindUniqueArgs = { where: { uid: uid, - } + }, }; - if(query) { - findOneArgs.include = query + if (query) { + findOneArgs.include = query; } const officeEntity = await this.model.findUnique(findOneArgs); - if (!officeEntity) { throw new Error("office not found"); } diff --git a/src/common/repositories/UsersRepository.ts b/src/common/repositories/UsersRepository.ts index 90240e3a..f59c2385 100644 --- a/src/common/repositories/UsersRepository.ts +++ b/src/common/repositories/UsersRepository.ts @@ -19,43 +19,32 @@ export default class UsersRepository extends BaseRepository { /** * @description : Find many users */ - public async findMany(query: Prisma.UsersFindManyArgs): Promise< - (Users & { - contact: Contacts; - office_membership: Offices & { - address: Addresses - }; - })[] - > { + public async findMany(query: Prisma.UsersFindManyArgs): Promise { query.take = Math.min(query.take || this.defaultFetchRows, this.maxFetchRows); - if (!query.include) return this.model.findMany({ ...query, include: { contact: true, office_membership: { include: { address: true } } } }); - return this.model.findMany({ ...query, include: { contact: { include: { address: true } }, office_membership: { include: { address: true } } } }); + return this.model.findMany(query); } /** * @description : Create a user */ - public async create(user: User): Promise { + public async create(user: User): Promise { const createArgs: Prisma.UsersCreateArgs = { data: { idNot: user.idNot, office_membership: { connectOrCreate: { where: { - idNot: user.office_membership.idNot, + idNot: user.office_membership!.idNot, }, create: { - idNot: user.office_membership.idNot, - name: user.office_membership.name, - crpcen: user.office_membership.crpcen, + idNot: user.office_membership!.idNot, + name: user.office_membership!.name, + crpcen: user.office_membership!.crpcen, address: { create: { - address: user.office_membership.address.address, - zip_code: user.office_membership.address.zip_code, - city: user.office_membership.address.city, + address: user.office_membership!.address!.address, + zip_code: user.office_membership!.address!.zip_code, + city: user.office_membership!.address!.city, }, }, }, @@ -63,34 +52,41 @@ export default class UsersRepository extends BaseRepository { }, contact: { create: { - first_name: user.contact.first_name, - last_name: user.contact.last_name, - email: user.contact.email, - phone_number: user.contact.phone_number, - cell_phone_number: user.contact.cell_phone_number, - civility: ECivility[user.contact.civility as keyof typeof ECivility], + first_name: user.contact!.first_name, + last_name: user.contact!.last_name, + email: user.contact!.email, + phone_number: user.contact!.phone_number, + cell_phone_number: user.contact!.cell_phone_number, + civility: ECivility[user.contact!.civility as keyof typeof ECivility], address: {}, }, }, }, }; - if (user.contact.address) { + if (user.contact!.address) { createArgs.data.contact!.create!.address!.create = { - address: user.contact.address!.address, - zip_code: user.contact.address!.zip_code, - city: user.contact.address!.city, + address: user.contact!.address.address, + zip_code: user.contact!.address.zip_code, + city: user.contact!.address.city, }; } - return this.model.create({...createArgs, include : { contact: true, office_membership: true}}); + return this.model.create({ ...createArgs, include: { contact: true, office_membership: { include: { address: true } } } }); } /** * @description : Update data from a user */ - public async update(uid: string, user: User): Promise { + public async update( + uid: string, + user: User, + ): Promise< + Users & { + contact: Contacts; + office_membership: Offices & { + address: Addresses; + }; + } + > { const updateArgs: Prisma.UsersUpdateArgs = { where: { uid: uid, @@ -100,17 +96,17 @@ export default class UsersRepository extends BaseRepository { office_membership: { connectOrCreate: { where: { - idNot: user.office_membership.idNot, + idNot: user.office_membership!.idNot, }, create: { - idNot: user.office_membership.idNot, - name: user.office_membership.name, - crpcen: user.office_membership.crpcen, + idNot: user.office_membership!.idNot, + name: user.office_membership!.name, + crpcen: user.office_membership!.crpcen, address: { create: { - address: user.office_membership.address.address, - zip_code: user.office_membership.address.zip_code, - city: user.office_membership.address.city, + address: user.office_membership!.address!.address, + zip_code: user.office_membership!.address!.zip_code, + city: user.office_membership!.address!.city, }, }, }, @@ -118,40 +114,50 @@ export default class UsersRepository extends BaseRepository { }, contact: { update: { - first_name: user.contact.first_name, - last_name: user.contact.last_name, - email: user.contact.email, - phone_number: user.contact.phone_number, - cell_phone_number: user.contact.cell_phone_number, - civility: ECivility[user.contact.civility as keyof typeof ECivility], + first_name: user.contact!.first_name, + last_name: user.contact!.last_name, + email: user.contact!.email, + phone_number: user.contact!.phone_number, + cell_phone_number: user.contact!.cell_phone_number, + civility: ECivility[user.contact!.civility as keyof typeof ECivility], address: {}, }, }, }, }; - if (user.contact.address) { + if (user.contact!.address) { updateArgs.data.contact!.update!.address!.update = { - address: user.contact.address!.address, - zip_code: user.contact.address!.zip_code, - city: user.contact.address!.city, + address: user.contact!.address!.address, + zip_code: user.contact!.address!.zip_code, + city: user.contact!.address!.city, }; } - return this.model.update({...updateArgs, include : { contact: true, office_membership: true}}); + return this.model.update({ ...updateArgs, include: { contact: true, office_membership: { include: { address: true } } } }); } /** * @description : Find one user */ - public async findOneByUid(uid: string, query?: any): Promise { + public async findOneByUid( + uid: string, + query?: any, + ): Promise< + Users & { + contact: Contacts; + office_membership: Offices & { + address: Addresses; + }; + } + > { const findOneArgs: Prisma.UsersFindUniqueArgs = { where: { uid: uid, - } + }, }; - if(query) { - findOneArgs.include = query - } - const userEntity = await this.model.findUnique(findOneArgs); + const userEntity = await this.model.findUnique({ + ...findOneArgs, + include: { contact: true, office_membership: { include: { address: true } } }, + }); if (!userEntity) { throw new Error("User not found"); diff --git a/src/services/super-admin/CustomersService/CustomersService.ts b/src/services/super-admin/CustomersService/CustomersService.ts index 10ee7231..80765051 100644 --- a/src/services/super-admin/CustomersService/CustomersService.ts +++ b/src/services/super-admin/CustomersService/CustomersService.ts @@ -1,4 +1,4 @@ -import { Contacts, Customers } from "@prisma/client"; +import { Customers, Prisma } from "@prisma/client"; import CustomersRepository from "@Repositories/CustomersRepository"; import BaseService from "@Services/BaseService"; import { Customer } from "le-coffre-resources/dist/SuperAdmin"; @@ -14,11 +14,7 @@ export default class CustomersService extends BaseService { * @description : Get all Customers * @throws {Error} If Customers cannot be get */ - public async get(query: any): Promise< - (Customers & { - contact: Contacts; - })[] - > { + public async get(query: Prisma.CustomersFindManyArgs): Promise { return this.customerRepository.findMany(query); } @@ -26,11 +22,7 @@ export default class CustomersService extends BaseService { * @description : Create a new customer * @throws {Error} If customer cannot be created */ - public async create(customerEntity: Customer): Promise< - Customers & { - contact: Contacts; - } - > { + public async create(customerEntity: Customer): Promise { return this.customerRepository.create(customerEntity); } @@ -38,14 +30,7 @@ export default class CustomersService extends BaseService { * @description : Modify a customer * @throws {Error} If customer cannot be modified */ - public async update( - uid: string, - customerEntity: Customer, - ): Promise< - Customers & { - contact: Contacts; - } - > { + public async update(uid: string, customerEntity: Customer): Promise { return this.customerRepository.update(uid, customerEntity); } diff --git a/src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts b/src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts index 06388662..78e86a84 100644 --- a/src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts +++ b/src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts @@ -28,7 +28,7 @@ export default class OfficeFoldersService extends BaseService { * @throws {Error} If folder cannot be created */ public async create(officeFolderEntity: OfficeFolder): Promise { - const deedType = await this.deedTypeService.getByUid(officeFolderEntity.deed.deed_type.uid!); + const deedType = await this.deedTypeService.getByUid(officeFolderEntity.deed!.deed_type!.uid!); if(deedType.archived_at) throw new Error('deed type is archived'); return this.officeFoldersRepository.create(officeFolderEntity); } diff --git a/src/services/super-admin/UsersService/UsersService.ts b/src/services/super-admin/UsersService/UsersService.ts index f8e914a2..fcdbf428 100644 --- a/src/services/super-admin/UsersService/UsersService.ts +++ b/src/services/super-admin/UsersService/UsersService.ts @@ -3,7 +3,7 @@ import "reflect-metadata"; import { Service } from "typedi"; import UsersRepository from "@Repositories/UsersRepository"; import User from "le-coffre-resources/dist/SuperAdmin"; -import { Contacts, Offices, Prisma, Users } from "@prisma/client"; +import {Prisma, Users } from "@prisma/client"; @Service() export default class UsersService extends BaseService { @@ -15,10 +15,7 @@ export default class UsersService extends BaseService { * @description : Get all users * @throws {Error} If users cannot be get */ - public get(query: Prisma.UsersFindManyArgs): Promise<(Users & { - contact: Contacts; - office_membership: Offices; - })[]> { + public get(query: Prisma.UsersFindManyArgs): Promise { return this.userRepository.findMany(query); } @@ -26,10 +23,7 @@ export default class UsersService extends BaseService { * @description : Create a user * @throws {Error} If user couldn't be created */ - public create(userEntity: User): Promise { + public create(userEntity: User): Promise { return this.userRepository.create(userEntity); } @@ -37,10 +31,7 @@ export default class UsersService extends BaseService { * @description : Modify a user * @throws {Error} If user modification failed */ - public update(uid: string, userEntity: User): Promise { + public update(uid: string, userEntity: User): Promise { return this.userRepository.update(uid, userEntity); } diff --git a/src/test/config/Init.ts b/src/test/config/Init.ts index 8be002d5..033fc8f1 100644 --- a/src/test/config/Init.ts +++ b/src/test/config/Init.ts @@ -11,9 +11,9 @@ export const initOffice = (office: Office): Promise => { crpcen: office.crpcen, address: { create: { - address: office.address.address, - zip_code: office.address.zip_code, - city: office.address.city, + address: office.address!.address, + zip_code: office.address!.zip_code, + city: office.address!.city, }, }, }, @@ -57,17 +57,17 @@ export const initCustomers = (customer: Customer): Promise => { status: ECustomerStatus.PENDING, contact: { create: { - first_name: customer.contact.first_name, - last_name: customer.contact.last_name, - email: customer.contact.email, - phone_number: customer.contact.phone_number, - cell_phone_number: customer.contact?.cell_phone_number, - civility: ECivility[customer.contact.civility as keyof typeof ECivility], + first_name: customer.contact!.first_name, + last_name: customer.contact!.last_name, + email: customer.contact!.email, + phone_number: customer.contact!.phone_number, + cell_phone_number: customer.contact!?.cell_phone_number, + civility: ECivility[customer.contact!.civility as keyof typeof ECivility], address: { create: { - address: customer.contact.address!.address, - zip_code: customer.contact.address!.zip_code, - city: customer.contact.address!.city, + address: customer.contact!.address!.address, + zip_code: customer.contact!.address!.zip_code, + city: customer.contact!.address!.city, }, }, }, @@ -83,17 +83,17 @@ export const initUsers = (user: User): Promise => { office_membership: { connectOrCreate: { where: { - idNot: user.office_membership.idNot, + idNot: user.office_membership!.idNot, }, create: { - idNot: user.office_membership.idNot, - name: user.office_membership.name, - crpcen: user.office_membership.crpcen, + idNot: user.office_membership!.idNot, + name: user.office_membership!.name, + crpcen: user.office_membership!.crpcen, address: { create: { - address: user.office_membership.address.address, - zip_code: user.office_membership.address.zip_code, - city: user.office_membership.address.city, + address: user.office_membership!.address!.address, + zip_code: user.office_membership!.address!.zip_code, + city: user.office_membership!.address!.city, }, }, }, @@ -101,17 +101,17 @@ export const initUsers = (user: User): Promise => { }, contact: { create: { - first_name: user.contact.first_name, - last_name: user.contact.last_name, - email: user.contact.email, - phone_number: user.contact.phone_number, - cell_phone_number: user.contact.cell_phone_number, - civility: ECivility[user.contact.civility as keyof typeof ECivility], + first_name: user.contact!.first_name, + last_name: user.contact!.last_name, + email: user.contact!.email, + phone_number: user.contact!.phone_number, + cell_phone_number: user.contact!.cell_phone_number, + civility: ECivility[user.contact!.civility as keyof typeof ECivility], address: { create: { - address: user.contact.address!.address, - zip_code: user.contact.address!.zip_code, - city: user.contact.address!.city, + address: user.contact!.address!.address, + zip_code: user.contact!.address!.zip_code, + city: user.contact!.address!.city, }, }, }, diff --git a/src/test/services/super-admin/CustomersService.test.ts b/src/test/services/super-admin/CustomersService.test.ts index 1ebccd55..84172325 100644 --- a/src/test/services/super-admin/CustomersService.test.ts +++ b/src/test/services/super-admin/CustomersService.test.ts @@ -29,18 +29,18 @@ describe("test create function", () => { // verify if customer contact is created in db const contactCreated = await prisma.contacts.findUnique({ where: { uid: customerCreated.contact_uid } }); - expect(contactCreated?.first_name).toEqual(customer.contact.first_name); - expect(contactCreated?.last_name).toEqual(customer.contact.last_name); - expect(contactCreated?.cell_phone_number).toEqual(customer.contact.cell_phone_number); - expect(contactCreated?.phone_number).toEqual(customer.contact.phone_number); - expect(contactCreated?.civility).toEqual(customer.contact.civility); - expect(contactCreated?.email).toEqual(customer.contact.email); + expect(contactCreated?.first_name).toEqual(customer.contact!.first_name); + expect(contactCreated?.last_name).toEqual(customer.contact!.last_name); + expect(contactCreated?.cell_phone_number).toEqual(customer.contact!.cell_phone_number); + expect(contactCreated?.phone_number).toEqual(customer.contact!.phone_number); + expect(contactCreated?.civility).toEqual(customer.contact!.civility); + expect(contactCreated?.email).toEqual(customer.contact!.email); // verify if customer address is created in db const addressForContactCreated = await prisma.addresses.findUnique({ where: { uid: contactCreated?.address_uid } }); - expect(addressForContactCreated?.address).toEqual(customer.contact.address?.address); - expect(addressForContactCreated?.zip_code).toEqual(customer.contact.address?.zip_code); - expect(addressForContactCreated?.city).toEqual(customer.contact.address?.city); + expect(addressForContactCreated?.address).toEqual(customer.contact!.address?.address); + expect(addressForContactCreated?.zip_code).toEqual(customer.contact!.address?.zip_code); + expect(addressForContactCreated?.city).toEqual(customer.contact!.address?.city); }); it("should not create an customer already created", async () => { @@ -53,7 +53,7 @@ describe("test create function", () => { it("should not create an new customer with an email already created", async () => { let newCustomer: Customer = JSON.parse(JSON.stringify(customer_)); - newCustomer.contact.email = customerContact.email; + newCustomer.contact!.email = customerContact.email; // try to create a new customer with already used email async function createCustomerWithDuplicateEmail() { @@ -64,7 +64,7 @@ describe("test create function", () => { it("should not create an customer with an phone number already created", async () => { let newCustomer: Customer = JSON.parse(JSON.stringify(customer_)); - newCustomer.contact.cell_phone_number = customerContact.cell_phone_number; + newCustomer.contact!.cell_phone_number = customerContact.cell_phone_number; // try to create a new customer with already used cellphone number async function duplicateCustomer() { @@ -75,8 +75,8 @@ describe("test create function", () => { it("should create an new customer if unique attributes differ from existing customers", async () => { let newCustomer: Customer = JSON.parse(JSON.stringify(customer)); - newCustomer.contact.email = customerContact_.email; - newCustomer.contact.cell_phone_number = customerContact_.cell_phone_number; + newCustomer.contact!.email = customerContact_.email; + newCustomer.contact!.cell_phone_number = customerContact_.cell_phone_number; const customerCreated = await CustomersServiceTest.create(newCustomer); @@ -84,24 +84,24 @@ describe("test create function", () => { // verify if customer_ contact is created in db const contactCreated = await prisma.contacts.findUnique({ where: { uid: customerCreated.contact_uid } }); - expect(contactCreated?.first_name).toEqual(customer.contact.first_name); - expect(contactCreated?.last_name).toEqual(customer.contact.last_name); - expect(contactCreated?.cell_phone_number).toEqual(customer_.contact.cell_phone_number); - expect(contactCreated?.phone_number).toEqual(customer.contact.phone_number); - expect(contactCreated?.civility).toEqual(customer.contact.civility); - expect(contactCreated?.email).toEqual(customer_.contact.email); + expect(contactCreated?.first_name).toEqual(customer.contact!.first_name); + expect(contactCreated?.last_name).toEqual(customer.contact!.last_name); + expect(contactCreated?.cell_phone_number).toEqual(customer_.contact!.cell_phone_number); + expect(contactCreated?.phone_number).toEqual(customer.contact!.phone_number); + expect(contactCreated?.civility).toEqual(customer.contact!.civility); + expect(contactCreated?.email).toEqual(customer_.contact!.email); // verify if customer_ address is created in db const addressForContactCreated = await prisma.addresses.findUnique({ where: { uid: contactCreated?.address_uid } }); - expect(addressForContactCreated?.address).toEqual(customer.contact.address?.address); - expect(addressForContactCreated?.zip_code).toEqual(customer.contact.address?.zip_code); - expect(addressForContactCreated?.city).toEqual(customer.contact.address?.city); + expect(addressForContactCreated?.address).toEqual(customer.contact!.address?.address); + expect(addressForContactCreated?.zip_code).toEqual(customer.contact!.address?.zip_code); + expect(addressForContactCreated?.city).toEqual(customer.contact!.address?.city); }); }); describe("test update function", () => { it("should update an customer's data", async () => { - const customerCreated = await prisma.customers.findFirstOrThrow({ where: { contact: { email: customer_.contact.email } } }); + const customerCreated = await prisma.customers.findFirstOrThrow({ where: { contact: { email: customer_.contact!.email } } }); // update the last customer created with his own new office and own contact const updatedCustomer = await CustomersServiceTest.update(customerCreated.uid, customer_); @@ -110,24 +110,24 @@ describe("test update function", () => { // verify if customer_ contact is created in db const existingContact = await prisma.contacts.findUnique({ where: { uid: updatedCustomer.contact_uid } }); - expect(existingContact?.first_name).toEqual(customer_.contact.first_name); - expect(existingContact?.last_name).toEqual(customer_.contact.last_name); - expect(existingContact?.cell_phone_number).toEqual(customer_.contact.cell_phone_number); - expect(existingContact?.phone_number).toEqual(customer_.contact.phone_number); - expect(existingContact?.civility).toEqual(customer_.contact.civility); - expect(existingContact?.email).toEqual(customer_.contact.email); + expect(existingContact?.first_name).toEqual(customer_.contact!.first_name); + expect(existingContact?.last_name).toEqual(customer_.contact!.last_name); + expect(existingContact?.cell_phone_number).toEqual(customer_.contact!.cell_phone_number); + expect(existingContact?.phone_number).toEqual(customer_.contact!.phone_number); + expect(existingContact?.civility).toEqual(customer_.contact!.civility); + expect(existingContact?.email).toEqual(customer_.contact!.email); // verify if customer_ address is created in db const addressForExistingContact = await prisma.addresses.findUnique({ where: { uid: existingContact?.address_uid } }); - expect(addressForExistingContact?.address).toEqual(customer_.contact.address?.address); - expect(addressForExistingContact?.zip_code).toEqual(customer_.contact.address?.zip_code); - expect(addressForExistingContact?.city).toEqual(customer_.contact.address?.city); + expect(addressForExistingContact?.address).toEqual(customer_.contact!.address?.address); + expect(addressForExistingContact?.zip_code).toEqual(customer_.contact!.address?.zip_code); + expect(addressForExistingContact?.city).toEqual(customer_.contact!.address?.city); }); it("should not update an customer with an email already used", async () => { - const customerUid = (await prisma.customers.findFirstOrThrow({ where: { contact: { email: customer_.contact.email } } })).uid; + const customerUid = (await prisma.customers.findFirstOrThrow({ where: { contact: { email: customer_.contact!.email } } })).uid; let updatedCustomer: Customer = JSON.parse(JSON.stringify(customer_)); - updatedCustomer.contact.email = customerContact.email; + updatedCustomer.contact!.email = customerContact.email; // try to create a new customer with already used email async function updateCustomerWithDuplicateEmail() { @@ -137,9 +137,9 @@ describe("test update function", () => { }); it("should not update an customer with an phone number already used", async () => { - const customerUid = (await prisma.customers.findFirstOrThrow({ where: { contact: { email: customer_.contact.email } } })).uid; + const customerUid = (await prisma.customers.findFirstOrThrow({ where: { contact: { email: customer_.contact!.email } } })).uid; let updatedCustomer: Customer = JSON.parse(JSON.stringify(customer_)); - updatedCustomer.contact.cell_phone_number = customerContact.cell_phone_number; + updatedCustomer.contact!.cell_phone_number = customerContact.cell_phone_number; // try to create a new customer with already used email async function updateCustomerWithDuplicateEmail() { diff --git a/src/test/services/super-admin/DeedService.test.ts b/src/test/services/super-admin/DeedService.test.ts index 58511ebb..6e67e3fd 100644 --- a/src/test/services/super-admin/DeedService.test.ts +++ b/src/test/services/super-admin/DeedService.test.ts @@ -29,7 +29,7 @@ afterAll(async () => { describe("test create function", () => { it("should not create a new deed if deed type is unknown", async () => { let deedWithoutDeedTypeUid: Deed = JSON.parse(JSON.stringify(deed)); - deedWithoutDeedTypeUid.deed_type.uid = "random uid"; + deedWithoutDeedTypeUid.deed_type!.uid = "random uid"; // try to create a new deed with unknown deed type async function createDeedWithUnknownDeedType() { await DeedServiceTest.create(deedWithoutDeedTypeUid); @@ -39,7 +39,7 @@ describe("test create function", () => { it("should create a new deed based on existing deed type", async () => { let deedWithDeedTypeUid: Deed = JSON.parse(JSON.stringify(deed)); - deedWithDeedTypeUid.deed_type.uid = deedType.uid; + deedWithDeedTypeUid.deed_type!.uid = deedType.uid; const deedCreated = await DeedServiceTest.create(deedWithDeedTypeUid); expect(deedCreated.deed_type_uid).toEqual(deedType.uid); @@ -53,7 +53,7 @@ describe("test create function", () => { it("should create a the same deed based on existing deed type", async () => { let deedWithDeedTypeUid: Deed = JSON.parse(JSON.stringify(deed)); - deedWithDeedTypeUid.deed_type.uid = deedType.uid; + deedWithDeedTypeUid.deed_type!.uid = deedType.uid; const deedCreated = await DeedServiceTest.create(deedWithDeedTypeUid); expect(deedCreated.deed_type_uid).toEqual(deedType.uid); @@ -61,7 +61,7 @@ describe("test create function", () => { it("should not create a new deed based on archivated deed type", async () => { let deedArchivated: Deed = JSON.parse(JSON.stringify(deed)); - deedArchivated.deed_type.uid = deedType.uid; + deedArchivated.deed_type!.uid = deedType.uid; await prisma.deedTypes.update({ where: { uid: deedType.uid }, diff --git a/src/test/services/super-admin/DeedTypesService.test.ts b/src/test/services/super-admin/DeedTypesService.test.ts index 5cf11f7f..af923ad1 100644 --- a/src/test/services/super-admin/DeedTypesService.test.ts +++ b/src/test/services/super-admin/DeedTypesService.test.ts @@ -29,7 +29,7 @@ afterAll(async () => { describe("test create function", () => { it("should not create a new deed type if office is unknown", async () => { let deedTypeWithoutOfficeUid: DeedType = JSON.parse(JSON.stringify(deedType)); - deedTypeWithoutOfficeUid.office.uid = "random uid"; + deedTypeWithoutOfficeUid.office!.uid = "random uid"; // try to create a new deed type with unknown office async function createDeedTypeWithUnknownOffice() { await DeedTypeServiceTest.create(deedTypeWithoutOfficeUid); @@ -48,7 +48,7 @@ describe("test create function", () => { it("should not create a new deed type with a name already used for a given office", async () => { let deedTypeWithSameNameAndOffice: DeedType = JSON.parse(JSON.stringify(deedType_)); - deedTypeWithSameNameAndOffice.office = office; + deedTypeWithSameNameAndOffice.office! = office; deedTypeWithSameNameAndOffice.name = deedType.name; async function createDeedTypeWithSameNameAndOffice() { @@ -59,7 +59,7 @@ describe("test create function", () => { it("should create the same deed type for a different office", async () => { let deedTypeDuplicatedForNewOffice: DeedType = JSON.parse(JSON.stringify(deedType)); - deedTypeDuplicatedForNewOffice.office = office_; + deedTypeDuplicatedForNewOffice.office! = office_; const deedTypeCreated = await DeedTypeServiceTest.create(deedTypeDuplicatedForNewOffice); @@ -89,10 +89,10 @@ describe("test update function", () => { expect(deedTypeCreated.name).toEqual(deedType_.name); expect(deedTypeCreated.description).toEqual(deedType.description); expect(deedTypeCreated.archived_at).toBeNull(); - expect(deedTypeCreated.office_uid).toEqual(deedType.office.uid); + expect(deedTypeCreated.office_uid).toEqual(deedType.office!.uid); let deedTypeWithNewDescription: DeedType = JSON.parse(JSON.stringify(deedType_)); - deedTypeWithNewDescription.office = office; + deedTypeWithNewDescription.office! = office; // update the last deed type created with his the right description const deedTypeUpdated = await DeedTypeServiceTest.update(deedTypeCreated.uid, deedTypeWithNewDescription); @@ -100,13 +100,13 @@ describe("test update function", () => { expect(deedTypeUpdated.name).toEqual(deedType_.name); expect(deedTypeUpdated.description).toEqual(deedType_.description); expect(deedTypeUpdated.archived_at).toBeNull(); - expect(deedTypeUpdated.office_uid).toEqual(deedType.office.uid); + expect(deedTypeUpdated.office_uid).toEqual(deedType.office!.uid); }); it("should not update a deed type name with an already used name for given office", async () => { const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType_.name, office_uid: office.uid } })).uid; let deedTypeWithSameNameAndOffice: DeedType = JSON.parse(JSON.stringify(deedType_)); - deedTypeWithSameNameAndOffice.office.uid = office.uid; + deedTypeWithSameNameAndOffice.office!.uid = office.uid; deedTypeWithSameNameAndOffice.name = deedType.name; // update the last deed type created with his the right description @@ -119,7 +119,7 @@ describe("test update function", () => { it("should not update a deed type office membership if the office already have this document type", async () => { const deedTypeUid = (await prisma.deedTypes.findFirstOrThrow({ where: { name: deedType_.name, office_uid: office.uid } })).uid; let deedTypeWithSameNameAndOffice: DeedType = JSON.parse(JSON.stringify(deedType_)); - deedTypeWithSameNameAndOffice.office.uid = office.uid; + deedTypeWithSameNameAndOffice.office!.uid = office.uid; deedTypeWithSameNameAndOffice.name = deedType.name; // try to duplicate deed type in a given office @@ -143,7 +143,7 @@ describe("test update function", () => { expect(deedTypeUpdated.name).toEqual(deedType_.name); expect(deedTypeUpdated.description).toEqual(deedType_.description); expect(deedTypeUpdated.archived_at).toBeNull(); - expect(deedTypeUpdated.office_uid).toEqual(deedType_.office.uid); + expect(deedTypeUpdated.office_uid).toEqual(deedType_.office!.uid); }); it("should archivate a deed type", async () => { @@ -152,7 +152,7 @@ describe("test update function", () => { expect(deedTypeCreated.name).toEqual(deedType_.name); expect(deedTypeCreated.description).toEqual(deedType_.description); expect(deedTypeCreated.archived_at).toBeNull(); - expect(deedTypeCreated.office_uid).toEqual(deedType_.office.uid); + expect(deedTypeCreated.office_uid).toEqual(deedType_.office!.uid); let deedTypeArchivated: DeedType = JSON.parse(JSON.stringify(deedType_)); const currentDate = new Date(Date.now()); @@ -173,7 +173,7 @@ describe("test update function", () => { expect(deedTypeCreated.name).toEqual(deedType_.name); expect(deedTypeCreated.description).toEqual(deedType_.description); expect(deedTypeCreated.archived_at).not.toBeNull(); - expect(deedTypeCreated.office_uid).toEqual(deedType_.office.uid); + expect(deedTypeCreated.office_uid).toEqual(deedType_.office!.uid); // unarchivate a deed type by giving a null date for archivated_at attribute const deedTypeUpdated = await DeedTypeServiceTest.update(deedTypeCreated.uid, deedType_); diff --git a/src/test/services/super-admin/DocumentTypesService.test.ts b/src/test/services/super-admin/DocumentTypesService.test.ts index e8c88d17..b6d98045 100644 --- a/src/test/services/super-admin/DocumentTypesService.test.ts +++ b/src/test/services/super-admin/DocumentTypesService.test.ts @@ -27,7 +27,7 @@ afterAll(async () => { describe("test create function", () => { it("should not create a new document type if office is unknown", async () => { let documentTypeWithoutOfficeUid: DocumentType = JSON.parse(JSON.stringify(documentType)); - documentTypeWithoutOfficeUid.office.uid = "random uid"; + documentTypeWithoutOfficeUid.office!.uid = "random uid"; // try to create a new document type with unknown office async function createDocumentTypeWithUnknownOffice() { await DocumentTypesServiceTest.create(documentTypeWithoutOfficeUid); @@ -37,7 +37,7 @@ describe("test create function", () => { it("should create a new document type", async () => { let documentTypeWithOfficeUid: DocumentType = JSON.parse(JSON.stringify(documentType)); - documentTypeWithOfficeUid.office.uid = office.uid; + documentTypeWithOfficeUid.office!.uid = office.uid; const documentTypeCreated = await DocumentTypesServiceTest.create(documentTypeWithOfficeUid); expect(documentTypeCreated.name).toEqual(documentType.name); @@ -49,7 +49,7 @@ describe("test create function", () => { it("should not create a new document type with a name already used for a given office", async () => { let documentTypeWithSameNameAndOffice: DocumentType = JSON.parse(JSON.stringify(documentType_)); - documentTypeWithSameNameAndOffice.office.uid = office.uid; + documentTypeWithSameNameAndOffice.office!.uid = office.uid; documentTypeWithSameNameAndOffice.name = documentType.name; async function createDocumentTypeWithSameNameAndOffice() { @@ -60,7 +60,7 @@ describe("test create function", () => { it("should create the same document type for a different office", async () => { let documentTypeDuplicatedForNewOffice: DocumentType = JSON.parse(JSON.stringify(documentType)); - documentTypeDuplicatedForNewOffice.office.uid = office_.uid; + documentTypeDuplicatedForNewOffice.office!.uid = office_.uid; const documentTypeCreated = await DocumentTypesServiceTest.create(documentTypeDuplicatedForNewOffice); @@ -73,7 +73,7 @@ describe("test create function", () => { it("should create a new document type version with a different name for a given office", async () => { let documentTypeWithSameDescription: DocumentType = JSON.parse(JSON.stringify(documentType)); - documentTypeWithSameDescription.office.uid = office.uid; + documentTypeWithSameDescription.office!.uid = office.uid; documentTypeWithSameDescription.name = documentType_.name; const documentTypeCreated = await DocumentTypesServiceTest.create(documentTypeWithSameDescription); @@ -98,7 +98,7 @@ describe("test update function", () => { expect(documentTypeCreated.office_uid).toEqual(office.uid); let documentTypeWithNewDescription: DocumentType = JSON.parse(JSON.stringify(documentType_)); - documentTypeWithNewDescription.office.uid = office.uid; + documentTypeWithNewDescription.office!.uid = office.uid; // update the last document type created with his the right descriptions const documentTypeUpdated = await DocumentTypesServiceTest.update(documentTypeCreated.uid, documentTypeWithNewDescription); @@ -114,7 +114,7 @@ describe("test update function", () => { await prisma.documentTypes.findFirstOrThrow({ where: { name: documentType_.name, office_uid: office.uid } }) ).uid; let documentTypeWithSameNameAndOffice: DocumentType = JSON.parse(JSON.stringify(documentType_)); - documentTypeWithSameNameAndOffice.office.uid = office.uid; + documentTypeWithSameNameAndOffice.office!.uid = office.uid; documentTypeWithSameNameAndOffice.name = documentType.name; // update the last document type created with his the right description @@ -129,7 +129,7 @@ describe("test update function", () => { await prisma.documentTypes.findFirstOrThrow({ where: { name: documentType_.name, office_uid: office.uid } }) ).uid; let documentTypeWithSameNameAndOffice: DocumentType = JSON.parse(JSON.stringify(documentType_)); - documentTypeWithSameNameAndOffice.office.uid = office.uid; + documentTypeWithSameNameAndOffice.office!.uid = office.uid; documentTypeWithSameNameAndOffice.name = documentType.name; // try to duplicate document type in a given office @@ -151,7 +151,7 @@ describe("test update function", () => { expect(documentTypeCreated.office_uid).toEqual(office.uid); let documentTypeTransferedToNewOffice: DocumentType = JSON.parse(JSON.stringify(documentType_)); - documentTypeTransferedToNewOffice.office.uid = office_.uid; + documentTypeTransferedToNewOffice.office!.uid = office_.uid; // update the last document type updated with a new office membership const documentTypeUpdated = await DocumentTypesServiceTest.update(documentTypeCreated.uid, documentTypeTransferedToNewOffice); @@ -175,7 +175,7 @@ describe("test update function", () => { expect(documentTypeCreated.office_uid).toEqual(office_.uid); let documentTypeArchivated: DocumentType = JSON.parse(JSON.stringify(documentType_)); - documentTypeArchivated.office.uid = office_.uid; + documentTypeArchivated.office!.uid = office_.uid; const currentDate = new Date(Date.now()); documentTypeArchivated.archived_at = currentDate; // archivate a document type by giving a non null date for archivated_at attribute @@ -199,7 +199,7 @@ describe("test update function", () => { expect(documentTypeCreated.office_uid).toEqual(office_.uid); let documentTypeUnarchivated: DocumentType = JSON.parse(JSON.stringify(documentType_)); - documentTypeUnarchivated.office.uid = office_.uid; + documentTypeUnarchivated.office!.uid = office_.uid; // unarchivate a document type by giving a null date for archivated_at attribute const documentTypeUpdated = await DocumentTypesServiceTest.update(documentTypeCreated.uid, documentTypeUnarchivated); diff --git a/src/test/services/super-admin/OfficeFolderService.test.ts b/src/test/services/super-admin/OfficeFolderService.test.ts index 6011f30e..8c8394a1 100644 --- a/src/test/services/super-admin/OfficeFolderService.test.ts +++ b/src/test/services/super-admin/OfficeFolderService.test.ts @@ -38,7 +38,7 @@ afterAll(async () => { describe("test create function", () => { it("should not create a new office folder if deed type is unknown", async () => { let officeFolderWithoutDeedTypeUid: OfficeFolder = JSON.parse(JSON.stringify(officeFolder)); - officeFolderWithoutDeedTypeUid.deed.deed_type.uid = "random uid"; + officeFolderWithoutDeedTypeUid.deed!.deed_type!.uid = "random uid"; // try to create a new deed with unknown deed type async function createOfficeFolderWithUnknownDeedType() { await OfficeFolderServiceTest.create(officeFolderWithoutDeedTypeUid); @@ -65,8 +65,8 @@ describe("test create function", () => { expect(officeFolderCreated.description).toEqual(officeFolder.description); expect(officeFolderCreated.archived_description).toEqual(null); expect(officeFolderCreated.status).toEqual("LIVE"); - expect(officeFolderCreated.office_uid).toEqual(officeFolder.office.uid); - expect(deedCreated.deed_type_uid).toEqual(officeFolder.deed.deed_type.uid); + expect(officeFolderCreated.office_uid).toEqual(officeFolder.office!.uid); + expect(deedCreated.deed_type_uid).toEqual(officeFolder.deed!.deed_type!.uid); }); it("should contains stakeholders", async () => { diff --git a/src/test/services/super-admin/UsersService.test.ts b/src/test/services/super-admin/UsersService.test.ts index a4ce6f06..a6255c4c 100644 --- a/src/test/services/super-admin/UsersService.test.ts +++ b/src/test/services/super-admin/UsersService.test.ts @@ -29,31 +29,31 @@ describe("test create function", () => { // verify if user contact is created in db const contactCreated = await prisma.contacts.findUnique({ where: { uid: userCreated.contact_uid } }); - expect(contactCreated?.first_name).toEqual(user.contact.first_name); - expect(contactCreated?.last_name).toEqual(user.contact.last_name); - expect(contactCreated?.cell_phone_number).toEqual(user.contact.cell_phone_number); - expect(contactCreated?.phone_number).toEqual(user.contact.phone_number); - expect(contactCreated?.civility).toEqual(user.contact.civility); - expect(contactCreated?.email).toEqual(user.contact.email); + expect(contactCreated?.first_name).toEqual(user.contact!.first_name); + expect(contactCreated?.last_name).toEqual(user.contact!.last_name); + expect(contactCreated?.cell_phone_number).toEqual(user.contact!.cell_phone_number); + expect(contactCreated?.phone_number).toEqual(user.contact!.phone_number); + expect(contactCreated?.civility).toEqual(user.contact!.civility); + expect(contactCreated?.email).toEqual(user.contact!.email); // verify if user address is created in db const addressForContactCreated = await prisma.addresses.findUnique({ where: { uid: contactCreated?.address_uid } }); - expect(addressForContactCreated?.address).toEqual(user.contact.address?.address); - expect(addressForContactCreated?.zip_code).toEqual(user.contact.address?.zip_code); - expect(addressForContactCreated?.city).toEqual(user.contact.address?.city); + expect(addressForContactCreated?.address).toEqual(user.contact!.address?.address); + expect(addressForContactCreated?.zip_code).toEqual(user.contact!.address?.zip_code); + expect(addressForContactCreated?.city).toEqual(user.contact!.address?.city); // verify if user office is created in db const officeCreated = await prisma.offices.findUnique({ where: { uid: userCreated.office_uid } }); - expect(officeCreated?.idNot).toEqual(user.office_membership.idNot); - expect(officeCreated?.name).toEqual(user.office_membership.name); - expect(officeCreated?.crpcen).toEqual(user.office_membership.crpcen); + expect(officeCreated?.idNot).toEqual(user.office_membership!!.idNot); + expect(officeCreated?.name).toEqual(user.office_membership!!.name); + expect(officeCreated?.crpcen).toEqual(user.office_membership!!.crpcen); expect(officeCreated?.office_status).toEqual("DESACTIVATED"); // verify if user office's address is created in db const addressForOfficeCreated = await prisma.addresses.findUnique({ where: { uid: officeCreated?.address_uid } }); - expect(addressForOfficeCreated?.address).toEqual(user.office_membership.address.address); - expect(addressForOfficeCreated?.zip_code).toEqual(user.office_membership.address.zip_code); - expect(addressForOfficeCreated?.city).toEqual(user.office_membership.address.city); + expect(addressForOfficeCreated?.address).toEqual(user.office_membership!.address!.address); + expect(addressForOfficeCreated?.zip_code).toEqual(user.office_membership!.address!.zip_code); + expect(addressForOfficeCreated?.city).toEqual(user.office_membership!.address!.city); }); it("should not create an user already created", async () => { @@ -66,7 +66,7 @@ describe("test create function", () => { it("should not create an new user with an email already created", async () => { let newUser: User = JSON.parse(JSON.stringify(user_)); - newUser.contact.email = userContact.email; + newUser.contact!.email = userContact.email; // try to create a new user with already used email async function createUserWithDuplicateEmail() { @@ -77,7 +77,7 @@ describe("test create function", () => { it("should not create an user with an phone number already created", async () => { let newUser: User = JSON.parse(JSON.stringify(user_)); - newUser.contact.cell_phone_number = userContact.cell_phone_number; + newUser.contact!.cell_phone_number = userContact.cell_phone_number; // try to create a new user with already used cellphone number async function duplicateUser() { @@ -89,8 +89,8 @@ describe("test create function", () => { it("should create an new user if unique attributes differ from existing users", async () => { let newUser: User = JSON.parse(JSON.stringify(user)); newUser.idNot = user_.idNot; - newUser.contact.email = userContact_.email; - newUser.contact.cell_phone_number = userContact_.cell_phone_number; + newUser.contact!.email = userContact_.email; + newUser.contact!.cell_phone_number = userContact_.cell_phone_number; const userCreated = await UsersServiceTest.create(newUser); @@ -98,24 +98,24 @@ describe("test create function", () => { // verify if user_ contact is created in db const contactCreated = await prisma.contacts.findUnique({ where: { uid: userCreated.contact_uid } }); - expect(contactCreated?.first_name).toEqual(user.contact.first_name); - expect(contactCreated?.last_name).toEqual(user.contact.last_name); - expect(contactCreated?.cell_phone_number).toEqual(user_.contact.cell_phone_number); - expect(contactCreated?.phone_number).toEqual(user.contact.phone_number); - expect(contactCreated?.civility).toEqual(user.contact.civility); - expect(contactCreated?.email).toEqual(user_.contact.email); + expect(contactCreated?.first_name).toEqual(user.contact!.first_name); + expect(contactCreated?.last_name).toEqual(user.contact!.last_name); + expect(contactCreated?.cell_phone_number).toEqual(user_.contact!.cell_phone_number); + expect(contactCreated?.phone_number).toEqual(user.contact!.phone_number); + expect(contactCreated?.civility).toEqual(user.contact!.civility); + expect(contactCreated?.email).toEqual(user_.contact!.email); // verify if user_ address is created in db const addressForContactCreated = await prisma.addresses.findUnique({ where: { uid: contactCreated?.address_uid } }); - expect(addressForContactCreated?.address).toEqual(user.contact.address?.address); - expect(addressForContactCreated?.zip_code).toEqual(user.contact.address?.zip_code); - expect(addressForContactCreated?.city).toEqual(user.contact.address?.city); + expect(addressForContactCreated?.address).toEqual(user.contact!.address?.address); + expect(addressForContactCreated?.zip_code).toEqual(user.contact!.address?.zip_code); + expect(addressForContactCreated?.city).toEqual(user.contact!.address?.city); // verify if user joined the existing office const officeJoined = await prisma.offices.findUnique({ where: { uid: userCreated.office_uid } }); - expect(officeJoined?.idNot).toEqual(user.office_membership.idNot); - expect(officeJoined?.name).toEqual(user.office_membership.name); - expect(officeJoined?.crpcen).toEqual(user.office_membership.crpcen); + expect(officeJoined?.idNot).toEqual(user.office_membership!!.idNot); + expect(officeJoined?.name).toEqual(user.office_membership!!.name); + expect(officeJoined?.crpcen).toEqual(user.office_membership!!.crpcen); expect(officeJoined?.office_status).toEqual("DESACTIVATED"); }); }); @@ -125,9 +125,9 @@ describe("test update function", () => { const userCreated = await prisma.users.findFirstOrThrow({ where: { idNot: user_.idNot } }); const officeJoined = await prisma.offices.findUnique({ where: { uid: userCreated.office_uid } }); - expect(officeJoined?.idNot).toEqual(user.office_membership.idNot); - expect(officeJoined?.name).toEqual(user.office_membership.name); - expect(officeJoined?.crpcen).toEqual(user.office_membership.crpcen); + expect(officeJoined?.idNot).toEqual(user.office_membership!!.idNot); + expect(officeJoined?.name).toEqual(user.office_membership!!.name); + expect(officeJoined?.crpcen).toEqual(user.office_membership!!.crpcen); expect(officeJoined?.office_status).toEqual("DESACTIVATED"); // update the last user created with his own new office and own contact @@ -137,37 +137,37 @@ describe("test update function", () => { // verify if user_ contact is created in db const existingContact = await prisma.contacts.findUnique({ where: { uid: updatedUser.contact_uid } }); - expect(existingContact?.first_name).toEqual(user_.contact.first_name); - expect(existingContact?.last_name).toEqual(user_.contact.last_name); - expect(existingContact?.cell_phone_number).toEqual(user_.contact.cell_phone_number); - expect(existingContact?.phone_number).toEqual(user_.contact.phone_number); - expect(existingContact?.civility).toEqual(user_.contact.civility); - expect(existingContact?.email).toEqual(user_.contact.email); + expect(existingContact?.first_name).toEqual(user_.contact!.first_name); + expect(existingContact?.last_name).toEqual(user_.contact!.last_name); + expect(existingContact?.cell_phone_number).toEqual(user_.contact!.cell_phone_number); + expect(existingContact?.phone_number).toEqual(user_.contact!.phone_number); + expect(existingContact?.civility).toEqual(user_.contact!.civility); + expect(existingContact?.email).toEqual(user_.contact!.email); // verify if user_ address is created in db const addressForExistingContact = await prisma.addresses.findUnique({ where: { uid: existingContact?.address_uid } }); - expect(addressForExistingContact?.address).toEqual(user_.contact.address?.address); - expect(addressForExistingContact?.zip_code).toEqual(user_.contact.address?.zip_code); - expect(addressForExistingContact?.city).toEqual(user_.contact.address?.city); + expect(addressForExistingContact?.address).toEqual(user_.contact!.address?.address); + expect(addressForExistingContact?.zip_code).toEqual(user_.contact!.address?.zip_code); + expect(addressForExistingContact?.city).toEqual(user_.contact!.address?.city); // verify if user_ joined the new office const officeCreated = await prisma.offices.findUnique({ where: { uid: updatedUser.office_uid } }); - expect(officeCreated?.idNot).toEqual(user_.office_membership.idNot); - expect(officeCreated?.name).toEqual(user_.office_membership.name); - expect(officeCreated?.crpcen).toEqual(user_.office_membership.crpcen); + expect(officeCreated?.idNot).toEqual(user_.office_membership!.idNot); + expect(officeCreated?.name).toEqual(user_.office_membership!.name); + expect(officeCreated?.crpcen).toEqual(user_.office_membership!.crpcen); expect(officeCreated?.office_status).toEqual("DESACTIVATED"); // verify is user_ office's address is created in db const addressForOfficeCreated = await prisma.addresses.findUnique({ where: { uid: officeCreated?.address_uid } }); - expect(addressForOfficeCreated?.address).toEqual(user_.office_membership.address.address); - expect(addressForOfficeCreated?.zip_code).toEqual(user_.office_membership.address.zip_code); - expect(addressForOfficeCreated?.city).toEqual(user_.office_membership.address.city); + expect(addressForOfficeCreated?.address).toEqual(user_.office_membership!.address!.address); + expect(addressForOfficeCreated?.zip_code).toEqual(user_.office_membership!.address!.zip_code); + expect(addressForOfficeCreated?.city).toEqual(user_.office_membership!.address!.city); }); it("should not update an user with an email already used", async () => { const userUid = (await prisma.users.findFirstOrThrow({ where: { idNot: user_.idNot } })).uid; let updatedUser: User = JSON.parse(JSON.stringify(user_)); - updatedUser.contact.email = userContact.email; + updatedUser.contact!.email = userContact.email; // try to create a new user with already used email async function updateUserWithDuplicateEmail() { @@ -179,7 +179,7 @@ describe("test update function", () => { it("should not update an user with an phone number already used", async () => { const userUid = (await prisma.users.findFirstOrThrow({ where: { idNot: user_.idNot } })).uid; let updatedUser: User = JSON.parse(JSON.stringify(user_)); - updatedUser.contact.cell_phone_number = userContact.cell_phone_number; + updatedUser.contact!.cell_phone_number = userContact.cell_phone_number; // try to create a new user with already used email async function updateUserWithDuplicateEmail() { From c608de5adc4c8b162b4d27072d25f1869ebd29b0 Mon Sep 17 00:00:00 2001 From: OxSaitama Date: Thu, 4 May 2023 10:45:58 +0200 Subject: [PATCH 25/72] fix findOneByUid for users repository --- src/common/repositories/UsersRepository.ts | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/common/repositories/UsersRepository.ts b/src/common/repositories/UsersRepository.ts index f59c2385..b7643e18 100644 --- a/src/common/repositories/UsersRepository.ts +++ b/src/common/repositories/UsersRepository.ts @@ -138,26 +138,16 @@ export default class UsersRepository extends BaseRepository { /** * @description : Find one user */ - public async findOneByUid( - uid: string, - query?: any, - ): Promise< - Users & { - contact: Contacts; - office_membership: Offices & { - address: Addresses; - }; - } - > { + public async findOneByUid(uid: string, query?: any): Promise { const findOneArgs: Prisma.UsersFindUniqueArgs = { where: { uid: uid, }, }; - const userEntity = await this.model.findUnique({ - ...findOneArgs, - include: { contact: true, office_membership: { include: { address: true } } }, - }); + if (query) { + findOneArgs.include = query; + } + const userEntity = await this.model.findUnique(findOneArgs); if (!userEntity) { throw new Error("User not found"); From 22d0239306038196b1404de72711d774dbcb3ee6 Mon Sep 17 00:00:00 2001 From: OxSaitama Date: Thu, 4 May 2023 10:52:39 +0200 Subject: [PATCH 26/72] refacto hydratation for document controller --- src/app/api/customer/DocumentsController.ts | 22 +++++++++---------- .../api/super-admin/DocumentsController.ts | 2 +- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/app/api/customer/DocumentsController.ts b/src/app/api/customer/DocumentsController.ts index 2ed3aa64..40713c15 100644 --- a/src/app/api/customer/DocumentsController.ts +++ b/src/app/api/customer/DocumentsController.ts @@ -4,7 +4,6 @@ import ApiController from "@Common/system/controller-pattern/ApiController"; import { Service } from "typedi"; import DocumentsService from "@Services/customer/DocumentsService/DocumentsService"; import { Documents } from "@prisma/client"; -import ObjectHydrate from "@Common/helpers/ObjectHydrate"; import { Document } from "le-coffre-resources/dist/Customer"; import { validateOrReject } from "class-validator"; @@ -24,13 +23,12 @@ export default class DocumentsController extends ApiController { try { //get query const query = JSON.parse(req.query["q"] as string); - //call service to get prisma entity const prismaEntity: Documents[] = await this.documentsService.get(query); //Hydrate ressource with prisma entity - const documents = ObjectHydrate.map(Document, prismaEntity, { strategy: "exposeAll" }); + const documents = Document.map(Document, prismaEntity, { strategy: "excludeAll" }); //success this.httpSuccess(response, documents); @@ -49,17 +47,17 @@ export default class DocumentsController extends ApiController { try { //init Document resource with request body values const documentEntity = new Document(); - ObjectHydrate.hydrate(documentEntity, req.body); + Document.hydrate(documentEntity, req.body); //validate document - await validateOrReject(documentEntity, { groups: ["create"] }); + await validateOrReject(documentEntity, { groups: ["createDocument"] }); //call service to get prisma entity const prismaEntityCreated = await this.documentsService.create(documentEntity); //Hydrate ressource with prisma entity - const documentEntityCreated = ObjectHydrate.hydrate(new Document(), prismaEntityCreated, { - strategy: "exposeAll", + const documentEntityCreated = Document.hydrate(prismaEntityCreated, { + strategy: "excludeAll", }); //success @@ -83,16 +81,16 @@ export default class DocumentsController extends ApiController { //init Document resource with request body values const documentEntity = new Document(); - ObjectHydrate.hydrate(documentEntity, req.body); + Document.hydrate(documentEntity, req.body); //validate document - await validateOrReject(documentEntity, { groups: ["create"] }); + await validateOrReject(documentEntity, { groups: ["createDocument"] }); //call service to get prisma entity const prismaEntityUpdated: Documents = await this.documentsService.update(uid, documentEntity); //Hydrate ressource with prisma entity - const document = ObjectHydrate.hydrate(new Document(), prismaEntityUpdated, { strategy: "exposeAll" }); + const document = Document.hydrate(prismaEntityUpdated, { strategy: "excludeAll" }); //success this.httpSuccess(response, document); @@ -117,7 +115,7 @@ export default class DocumentsController extends ApiController { const documentEntity: Documents = await this.documentsService.delete(uid); //Hydrate ressource with prisma entity - const document = ObjectHydrate.hydrate(new Document(), documentEntity, { strategy: "exposeAll" }); + const document = Document.hydrate(documentEntity, { strategy: "excludeAll" }); //success this.httpSuccess(response, document); @@ -149,7 +147,7 @@ export default class DocumentsController extends ApiController { } //Hydrate ressource with prisma entity - const document = ObjectHydrate.hydrate(new Document(), documentEntity, { strategy: "exposeAll" }); + const document = Document.hydrate(documentEntity, { strategy: "excludeAll" }); //success this.httpSuccess(response, document); diff --git a/src/app/api/super-admin/DocumentsController.ts b/src/app/api/super-admin/DocumentsController.ts index 74122d25..35dea328 100644 --- a/src/app/api/super-admin/DocumentsController.ts +++ b/src/app/api/super-admin/DocumentsController.ts @@ -85,7 +85,7 @@ export default class DocumentsController extends ApiController { ObjectHydrate.hydrate(documentEntity, req.body); //validate document - await validateOrReject(documentEntity, { groups: ["create"] }); + await validateOrReject(documentEntity, { groups: ["createDocument"] }); //call service to get prisma entity const prismaEntityUpdated: Documents = await this.documentsService.update(uid, documentEntity); From ec98f3ac26a3ad3e0826922bdb9effce22f6c270 Mon Sep 17 00:00:00 2001 From: OxSaitama Date: Thu, 4 May 2023 12:17:03 +0200 Subject: [PATCH 27/72] refacto hydratation on post requests --- src/app/api/customer/DocumentsController.ts | 3 +- .../api/super-admin/CustomersController.ts | 5 +-- .../api/super-admin/DeedTypesController.ts | 7 +--- .../super-admin/DocumentTypesController.ts | 7 +--- .../api/super-admin/DocumentsController.ts | 7 +--- .../super-admin/OfficeFoldersController.ts | 11 ++--- src/app/api/super-admin/OfficesController.ts | 7 +--- src/app/api/super-admin/UsersController.ts | 7 +--- .../20230426144239_init/migration.sql | 3 ++ src/common/databases/schema.prisma | 2 +- .../repositories/CustomersRepository.ts | 42 +++++++------------ .../super-admin/CustomersService.test.ts | 6 +-- .../services/super-admin/UsersService.test.ts | 10 ++--- 13 files changed, 42 insertions(+), 75 deletions(-) diff --git a/src/app/api/customer/DocumentsController.ts b/src/app/api/customer/DocumentsController.ts index 40713c15..ebfccb15 100644 --- a/src/app/api/customer/DocumentsController.ts +++ b/src/app/api/customer/DocumentsController.ts @@ -46,8 +46,7 @@ export default class DocumentsController extends ApiController { protected async post(req: Request, response: Response) { try { //init Document resource with request body values - const documentEntity = new Document(); - Document.hydrate(documentEntity, req.body); + const documentEntity = Document.hydrate(req.body); //validate document await validateOrReject(documentEntity, { groups: ["createDocument"] }); diff --git a/src/app/api/super-admin/CustomersController.ts b/src/app/api/super-admin/CustomersController.ts index 9e4a1732..0508eb1b 100644 --- a/src/app/api/super-admin/CustomersController.ts +++ b/src/app/api/super-admin/CustomersController.ts @@ -44,15 +44,12 @@ export default class CustomersController extends ApiController { protected async post(req: Request, response: Response) { try { //init IUser resource with request body values - const customerEntity = new Customer(); - Customer.hydrate(customerEntity, req.body); - + const customerEntity = Customer.hydrate(req.body); //validate user await validateOrReject(customerEntity, { groups: ["createCustomer"], forbidUnknownValues: false }); //call service to get prisma entity const prismaEntityCreated = await this.customersService.create(customerEntity); - //Hydrate ressource with prisma entity const customerEntityCreated = Customer.hydrate(prismaEntityCreated, { strategy: "excludeAll", diff --git a/src/app/api/super-admin/DeedTypesController.ts b/src/app/api/super-admin/DeedTypesController.ts index 1a5f1a0d..aba5721c 100644 --- a/src/app/api/super-admin/DeedTypesController.ts +++ b/src/app/api/super-admin/DeedTypesController.ts @@ -4,7 +4,6 @@ import ApiController from "@Common/system/controller-pattern/ApiController"; import { Service } from "typedi"; import DeedTypesService from "@Services/super-admin/DeedTypesService/DeedTypesService"; import { DeedTypes } from "@prisma/client"; -import ObjectHydrate from "@Common/helpers/ObjectHydrate"; import { DeedType } from "le-coffre-resources/dist/SuperAdmin"; import { validateOrReject } from "class-validator"; @@ -46,8 +45,7 @@ export default class DeedTypesController extends ApiController { protected async post(req: Request, response: Response) { try { //init DeedType resource with request body values - const deedTypeEntity = new DeedType(); - ObjectHydrate.hydrate(deedTypeEntity, req.body); + const deedTypeEntity = DeedType.hydrate(req.body); //validate deed type await validateOrReject(deedTypeEntity, { groups: ["createDeedType"], forbidUnknownValues: false }); @@ -80,8 +78,7 @@ export default class DeedTypesController extends ApiController { throw new Error("No uid provided"); } //init DeedType resource with request body values - const deedTypeEntity = new DeedType(); - ObjectHydrate.hydrate(deedTypeEntity, req.body); + const deedTypeEntity = DeedType.hydrate(req.body); //validate deed type await validateOrReject(deedTypeEntity, { groups: ["updateDeedType"] }); diff --git a/src/app/api/super-admin/DocumentTypesController.ts b/src/app/api/super-admin/DocumentTypesController.ts index e5ebfa64..3ef79a93 100644 --- a/src/app/api/super-admin/DocumentTypesController.ts +++ b/src/app/api/super-admin/DocumentTypesController.ts @@ -7,7 +7,6 @@ import { DocumentTypes } from "@prisma/client"; import ObjectHydrate from "@Common/helpers/ObjectHydrate"; import { DocumentType } from "le-coffre-resources/dist/SuperAdmin"; import { validateOrReject } from "class-validator"; -//import { validateOrReject } from "class-validator"; @Controller() @Service() @@ -48,8 +47,7 @@ export default class DocumentTypesController extends ApiController { protected async post(req: Request, response: Response) { try { //init DocumentType resource with request body values - const documentTypeEntity = new DocumentType(); - ObjectHydrate.hydrate(documentTypeEntity, req.body); + const documentTypeEntity = DocumentType.hydrate(req.body); //validate user await validateOrReject(documentTypeEntity, { groups: ["createDocumentType"], forbidUnknownValues: false }); //call service to get prisma entity @@ -77,8 +75,7 @@ export default class DocumentTypesController extends ApiController { throw new Error("No uid provided"); } //init DocumentType resource with request body values - const documentTypeEntity = new DocumentType(); - ObjectHydrate.hydrate(documentTypeEntity, req.body); + const documentTypeEntity = DocumentType.hydrate(req.body); //validate user await validateOrReject(documentTypeEntity, { groups: ["update"] }); diff --git a/src/app/api/super-admin/DocumentsController.ts b/src/app/api/super-admin/DocumentsController.ts index 35dea328..cfe412ec 100644 --- a/src/app/api/super-admin/DocumentsController.ts +++ b/src/app/api/super-admin/DocumentsController.ts @@ -4,7 +4,6 @@ import ApiController from "@Common/system/controller-pattern/ApiController"; import { Service } from "typedi"; import DocumentsService from "@Services/super-admin/DocumentsService/DocumentsService"; import { Documents } from "@prisma/client"; -import ObjectHydrate from "@Common/helpers/ObjectHydrate"; import { Document } from "le-coffre-resources/dist/SuperAdmin"; import { validateOrReject } from "class-validator"; @@ -47,8 +46,7 @@ export default class DocumentsController extends ApiController { protected async post(req: Request, response: Response) { try { //init Document resource with request body values - const documentEntity = new Document(); - ObjectHydrate.hydrate(documentEntity, req.body); + const documentEntity = Document.hydrate(req.body); //validate document await validateOrReject(documentEntity, { groups: ["createDocument"], forbidUnknownValues: false }); @@ -81,8 +79,7 @@ export default class DocumentsController extends ApiController { } //init Document resource with request body values - const documentEntity = new Document(); - ObjectHydrate.hydrate(documentEntity, req.body); + const documentEntity = Document.hydrate(req.body); //validate document await validateOrReject(documentEntity, { groups: ["createDocument"] }); diff --git a/src/app/api/super-admin/OfficeFoldersController.ts b/src/app/api/super-admin/OfficeFoldersController.ts index 94265252..8ab10aaa 100644 --- a/src/app/api/super-admin/OfficeFoldersController.ts +++ b/src/app/api/super-admin/OfficeFoldersController.ts @@ -4,7 +4,6 @@ import ApiController from "@Common/system/controller-pattern/ApiController"; import OfficeFoldersService from "@Services/super-admin/OfficeFoldersService/OfficeFoldersService"; import { Service } from "typedi"; import { OfficeFolders } from "@prisma/client"; -import ObjectHydrate from "@Common/helpers/ObjectHydrate"; import { OfficeFolder } from "le-coffre-resources/dist/SuperAdmin"; import { validateOrReject } from "class-validator"; @@ -44,8 +43,7 @@ export default class OfficeFoldersController extends ApiController { protected async post(req: Request, response: Response) { try { //init OfficeFolder resource with request body values - const officeFolderEntity = new OfficeFolder(); - ObjectHydrate.hydrate(officeFolderEntity, req.body); + const officeFolderEntity = OfficeFolder.hydrate(req.body); //validate folder await validateOrReject(officeFolderEntity, { groups: ["create"] }); @@ -73,11 +71,10 @@ export default class OfficeFoldersController extends ApiController { if (!uid) { throw new Error("No uid provided"); } - //init IUser resource with request body values - const officeFolderEntity = new OfficeFolder(); - ObjectHydrate.hydrate(officeFolderEntity, req.body); + //init OfficeFolder resource with request body values + const officeFolderEntity = OfficeFolder.hydrate(req.body); - //validate user + //validate folder await validateOrReject(officeFolderEntity, { groups: ["updateFolder"], forbidUnknownValues: false }); //call service to get prisma entity diff --git a/src/app/api/super-admin/OfficesController.ts b/src/app/api/super-admin/OfficesController.ts index 05b3af1b..8520fe49 100644 --- a/src/app/api/super-admin/OfficesController.ts +++ b/src/app/api/super-admin/OfficesController.ts @@ -4,7 +4,6 @@ import ApiController from "@Common/system/controller-pattern/ApiController"; import OfficesService from "@Services/super-admin/OfficesService/OfficesService"; import { Service } from "typedi"; import { Offices } from "@prisma/client"; -import ObjectHydrate from "@Common/helpers/ObjectHydrate"; import { Office as OfficeResource } from "le-coffre-resources/dist/SuperAdmin"; import { validateOrReject } from "class-validator"; @@ -40,8 +39,7 @@ export default class OfficesController extends ApiController { protected async post(req: Request, response: Response) { try { //init IUser resource with request body values - const officeEntity = new OfficeResource(); - ObjectHydrate.hydrate(officeEntity, req.body); + const officeEntity = OfficeResource.hydrate(req.body); //validate user await validateOrReject(officeEntity, { groups: ["createOffice"], forbidUnknownValues: false }); //call service to get prisma entity @@ -68,8 +66,7 @@ export default class OfficesController extends ApiController { throw new Error("No uid provided"); } //init IUser resource with request body values - const officeEntity = new OfficeResource(); - ObjectHydrate.hydrate(officeEntity, req.body); + const officeEntity = OfficeResource.hydrate(req.body); //validate user await validateOrReject(officeEntity, { groups: ["update"] }); //call service to get prisma entity diff --git a/src/app/api/super-admin/UsersController.ts b/src/app/api/super-admin/UsersController.ts index 13b2c8c3..aee392e8 100644 --- a/src/app/api/super-admin/UsersController.ts +++ b/src/app/api/super-admin/UsersController.ts @@ -3,7 +3,6 @@ import { Controller, Get, Post, Put } from "@ControllerPattern/index"; import ApiController from "@Common/system/controller-pattern/ApiController"; import UsersService from "@Services/super-admin/UsersService/UsersService"; import { Service } from "typedi"; -import ObjectHydrate from "@Common/helpers/ObjectHydrate"; import { validateOrReject } from "class-validator"; import User from "le-coffre-resources/dist/Notary"; import { Users } from "@prisma/client"; @@ -45,8 +44,7 @@ export default class UsersController extends ApiController { protected async getAddresses(req: Request, response: Response) { try { //init IUser resource with request body values - const userEntity = new User(); - ObjectHydrate.hydrate(userEntity, req.body); + const userEntity = User.hydrate(req.body); //validate user await validateOrReject(userEntity, { groups: ["createUser"] }); @@ -78,8 +76,7 @@ export default class UsersController extends ApiController { throw new Error("No uid provided"); } //init IUser resource with request body values - const userEntity = new User(); - ObjectHydrate.hydrate(userEntity, req.body); + const userEntity = User.hydrate(req.body); //validate user await validateOrReject(userEntity, { groups: ["update"] }); diff --git a/src/common/databases/migrations/20230426144239_init/migration.sql b/src/common/databases/migrations/20230426144239_init/migration.sql index 5244e927..d017a9c4 100644 --- a/src/common/databases/migrations/20230426144239_init/migration.sql +++ b/src/common/databases/migrations/20230426144239_init/migration.sql @@ -444,3 +444,6 @@ ALTER TABLE "deed_type_has_document_types" ADD CONSTRAINT "deed_type_has_documen -- AddForeignKey ALTER TABLE "deed_type_has_document_types" ADD CONSTRAINT "deed_type_has_document_types_deed_type_uid_fkey" FOREIGN KEY ("deed_type_uid") REFERENCES "deed_types"("uid") ON DELETE CASCADE ON UPDATE CASCADE; +-- AlterTable +ALTER TABLE "contacts" ALTER COLUMN "cell_phone_number" SET NOT NULL, +ALTER COLUMN "address_uid" DROP NOT NULL; \ No newline at end of file diff --git a/src/common/databases/schema.prisma b/src/common/databases/schema.prisma index bace5ed4..08317b33 100644 --- a/src/common/databases/schema.prisma +++ b/src/common/databases/schema.prisma @@ -39,7 +39,7 @@ model Contacts { cell_phone_number String @unique @db.VarChar(50) civility ECivility @default(MALE) address Addresses? @relation(fields: [address_uid], references: [uid], onDelete: Cascade) - address_uid String @unique @db.VarChar(255) + address_uid String? @unique @db.VarChar(255) birthdate DateTime? created_at DateTime? @default(now()) updated_at DateTime? @updatedAt diff --git a/src/common/repositories/CustomersRepository.ts b/src/common/repositories/CustomersRepository.ts index ddca2087..4f846795 100644 --- a/src/common/repositories/CustomersRepository.ts +++ b/src/common/repositories/CustomersRepository.ts @@ -32,11 +32,7 @@ export default class CustomersRepository extends BaseRepository { /** * @description : Create a customer */ - public async create(customer: Customer): Promise< - Customers & { - contact: Contacts; - } - > { + public async create(customer: Customer): Promise { const createArgs: Prisma.CustomersCreateArgs = { data: { status: ECustomerStatus.PENDING, @@ -46,7 +42,7 @@ export default class CustomersRepository extends BaseRepository { last_name: customer.contact!.last_name, email: customer.contact!.email, phone_number: customer.contact!.phone_number, - cell_phone_number: customer.contact!?.cell_phone_number, + cell_phone_number: customer.contact!.cell_phone_number, civility: ECivility[customer.contact!.civility as keyof typeof ECivility], address: {}, }, @@ -55,10 +51,12 @@ export default class CustomersRepository extends BaseRepository { }; if (customer.contact!.address) { - createArgs.data.contact!.create!.address!.create = { - address: customer.contact!.address!.address, - zip_code: customer.contact!.address!.zip_code, - city: customer.contact!.address!.city, + createArgs.data.contact!.create!.address = { + create: { + address: customer.contact!.address!.address, + zip_code: customer.contact!.address!.zip_code, + city: customer.contact!.address!.city, + }, }; } return this.model.create({ ...createArgs, include: { contact: true } }); @@ -67,14 +65,7 @@ export default class CustomersRepository extends BaseRepository { /** * @description : Update data from a customer */ - public async update( - uid: string, - customer: Customer, - ): Promise< - Customers & { - contact: Contacts; - } - > { + public async update(uid: string, customer: Customer): Promise { const updateArgs: Prisma.CustomersUpdateArgs = { where: { uid: uid, @@ -107,21 +98,16 @@ export default class CustomersRepository extends BaseRepository { /** * @description : Find unique customer */ - public async findOneByUid( - uid: string, - query?: any, - ): Promise< - Customers & { - contact: Contacts; - } - > { + public async findOneByUid(uid: string, query?: any): Promise { const findOneArgs: Prisma.CustomersFindUniqueArgs = { where: { uid: uid, }, }; - const customerEntity = await this.model.findUnique({ ...findOneArgs, include: { contact: true } }); - + if (query) { + findOneArgs.include = query; + } + const customerEntity = await this.model.findUnique(findOneArgs); if (!customerEntity) { throw new Error("Customer not found"); } diff --git a/src/test/services/super-admin/CustomersService.test.ts b/src/test/services/super-admin/CustomersService.test.ts index 84172325..7ea5944c 100644 --- a/src/test/services/super-admin/CustomersService.test.ts +++ b/src/test/services/super-admin/CustomersService.test.ts @@ -37,7 +37,7 @@ describe("test create function", () => { expect(contactCreated?.email).toEqual(customer.contact!.email); // verify if customer address is created in db - const addressForContactCreated = await prisma.addresses.findUnique({ where: { uid: contactCreated?.address_uid } }); + const addressForContactCreated = await prisma.addresses.findUnique({ where: { uid: contactCreated?.address_uid! } }); expect(addressForContactCreated?.address).toEqual(customer.contact!.address?.address); expect(addressForContactCreated?.zip_code).toEqual(customer.contact!.address?.zip_code); expect(addressForContactCreated?.city).toEqual(customer.contact!.address?.city); @@ -92,7 +92,7 @@ describe("test create function", () => { expect(contactCreated?.email).toEqual(customer_.contact!.email); // verify if customer_ address is created in db - const addressForContactCreated = await prisma.addresses.findUnique({ where: { uid: contactCreated?.address_uid } }); + const addressForContactCreated = await prisma.addresses.findUnique({ where: { uid: contactCreated?.address_uid! } }); expect(addressForContactCreated?.address).toEqual(customer.contact!.address?.address); expect(addressForContactCreated?.zip_code).toEqual(customer.contact!.address?.zip_code); expect(addressForContactCreated?.city).toEqual(customer.contact!.address?.city); @@ -118,7 +118,7 @@ describe("test update function", () => { expect(existingContact?.email).toEqual(customer_.contact!.email); // verify if customer_ address is created in db - const addressForExistingContact = await prisma.addresses.findUnique({ where: { uid: existingContact?.address_uid } }); + const addressForExistingContact = await prisma.addresses.findUnique({ where: { uid: existingContact?.address_uid! } }); expect(addressForExistingContact?.address).toEqual(customer_.contact!.address?.address); expect(addressForExistingContact?.zip_code).toEqual(customer_.contact!.address?.zip_code); expect(addressForExistingContact?.city).toEqual(customer_.contact!.address?.city); diff --git a/src/test/services/super-admin/UsersService.test.ts b/src/test/services/super-admin/UsersService.test.ts index a6255c4c..5b7d6708 100644 --- a/src/test/services/super-admin/UsersService.test.ts +++ b/src/test/services/super-admin/UsersService.test.ts @@ -37,7 +37,7 @@ describe("test create function", () => { expect(contactCreated?.email).toEqual(user.contact!.email); // verify if user address is created in db - const addressForContactCreated = await prisma.addresses.findUnique({ where: { uid: contactCreated?.address_uid } }); + const addressForContactCreated = await prisma.addresses.findUnique({ where: { uid: contactCreated?.address_uid! } }); expect(addressForContactCreated?.address).toEqual(user.contact!.address?.address); expect(addressForContactCreated?.zip_code).toEqual(user.contact!.address?.zip_code); expect(addressForContactCreated?.city).toEqual(user.contact!.address?.city); @@ -50,7 +50,7 @@ describe("test create function", () => { expect(officeCreated?.office_status).toEqual("DESACTIVATED"); // verify if user office's address is created in db - const addressForOfficeCreated = await prisma.addresses.findUnique({ where: { uid: officeCreated?.address_uid } }); + const addressForOfficeCreated = await prisma.addresses.findUnique({ where: { uid: officeCreated?.address_uid! } }); expect(addressForOfficeCreated?.address).toEqual(user.office_membership!.address!.address); expect(addressForOfficeCreated?.zip_code).toEqual(user.office_membership!.address!.zip_code); expect(addressForOfficeCreated?.city).toEqual(user.office_membership!.address!.city); @@ -106,7 +106,7 @@ describe("test create function", () => { expect(contactCreated?.email).toEqual(user_.contact!.email); // verify if user_ address is created in db - const addressForContactCreated = await prisma.addresses.findUnique({ where: { uid: contactCreated?.address_uid } }); + const addressForContactCreated = await prisma.addresses.findUnique({ where: { uid: contactCreated?.address_uid! } }); expect(addressForContactCreated?.address).toEqual(user.contact!.address?.address); expect(addressForContactCreated?.zip_code).toEqual(user.contact!.address?.zip_code); expect(addressForContactCreated?.city).toEqual(user.contact!.address?.city); @@ -145,7 +145,7 @@ describe("test update function", () => { expect(existingContact?.email).toEqual(user_.contact!.email); // verify if user_ address is created in db - const addressForExistingContact = await prisma.addresses.findUnique({ where: { uid: existingContact?.address_uid } }); + const addressForExistingContact = await prisma.addresses.findUnique({ where: { uid: existingContact?.address_uid! } }); expect(addressForExistingContact?.address).toEqual(user_.contact!.address?.address); expect(addressForExistingContact?.zip_code).toEqual(user_.contact!.address?.zip_code); expect(addressForExistingContact?.city).toEqual(user_.contact!.address?.city); @@ -158,7 +158,7 @@ describe("test update function", () => { expect(officeCreated?.office_status).toEqual("DESACTIVATED"); // verify is user_ office's address is created in db - const addressForOfficeCreated = await prisma.addresses.findUnique({ where: { uid: officeCreated?.address_uid } }); + const addressForOfficeCreated = await prisma.addresses.findUnique({ where: { uid: officeCreated?.address_uid! } }); expect(addressForOfficeCreated?.address).toEqual(user_.office_membership!.address!.address); expect(addressForOfficeCreated?.zip_code).toEqual(user_.office_membership!.address!.zip_code); expect(addressForOfficeCreated?.city).toEqual(user_.office_membership!.address!.city); From 567d05c2728a0c5b1251dd2e6998b30c1243c0ad Mon Sep 17 00:00:00 2001 From: OxSaitama Date: Thu, 4 May 2023 13:46:38 +0200 Subject: [PATCH 28/72] refacto start script --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bee4740a..19f508d1 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "scripts": { "build-db": "npx prisma migrate dev", "build": "tsc", - "start": "tsc && node ./dist/entries/App.js", + "start": "npm run build && node ./dist/entries/App.js", "api:start": "npm run migrate && npm run start", "dev": "nodemon -V", "format": "prettier --write src", From 0de9717406eea234eb550266379af15d6c83ac14 Mon Sep 17 00:00:00 2001 From: OxSaitama Date: Thu, 4 May 2023 14:00:18 +0200 Subject: [PATCH 29/72] delete build command for start --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 19f508d1..322c722b 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "scripts": { "build-db": "npx prisma migrate dev", "build": "tsc", - "start": "npm run build && node ./dist/entries/App.js", + "start": "node ./dist/entries/App.js", "api:start": "npm run migrate && npm run start", "dev": "nodemon -V", "format": "prettier --write src", From 9fce8c6c1ab65d0263b9b70d3b7c99530312ed56 Mon Sep 17 00:00:00 2001 From: Vincent Alamelle Date: Thu, 4 May 2023 14:10:41 +0200 Subject: [PATCH 30/72] WIP --- src/app/api/super-admin/OfficeFoldersController.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/api/super-admin/OfficeFoldersController.ts b/src/app/api/super-admin/OfficeFoldersController.ts index 8ab10aaa..89b4dea4 100644 --- a/src/app/api/super-admin/OfficeFoldersController.ts +++ b/src/app/api/super-admin/OfficeFoldersController.ts @@ -46,7 +46,7 @@ export default class OfficeFoldersController extends ApiController { const officeFolderEntity = OfficeFolder.hydrate(req.body); //validate folder - await validateOrReject(officeFolderEntity, { groups: ["create"] }); + await validateOrReject(officeFolderEntity, { groups: ["createFolder"] }); //call service to get prisma entity const prismaEntityCreated = await this.officeFoldersService.create(officeFolderEntity); //Hydrate ressource with prisma entity From 570a789653bcb4a55d4188f762acdcbf1298d654 Mon Sep 17 00:00:00 2001 From: Vincent Alamelle Date: Thu, 4 May 2023 14:11:55 +0200 Subject: [PATCH 31/72] WIP --- src/app/api/super-admin/OfficeFoldersController.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/api/super-admin/OfficeFoldersController.ts b/src/app/api/super-admin/OfficeFoldersController.ts index 89b4dea4..211bd287 100644 --- a/src/app/api/super-admin/OfficeFoldersController.ts +++ b/src/app/api/super-admin/OfficeFoldersController.ts @@ -46,7 +46,7 @@ export default class OfficeFoldersController extends ApiController { const officeFolderEntity = OfficeFolder.hydrate(req.body); //validate folder - await validateOrReject(officeFolderEntity, { groups: ["createFolder"] }); + await validateOrReject(officeFolderEntity, { groups: ["createFolder"] , forbidUnknownValues:false}); //call service to get prisma entity const prismaEntityCreated = await this.officeFoldersService.create(officeFolderEntity); //Hydrate ressource with prisma entity From 1af0d378d174218b252c44aa0c1aaa78ff7e74e9 Mon Sep 17 00:00:00 2001 From: OxSaitama Date: Thu, 4 May 2023 14:26:16 +0200 Subject: [PATCH 32/72] remove migrations for start --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 85e1458c..178e062e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -42,5 +42,5 @@ COPY --from=builder --chown=lecoffreuser leCoffre/src/common/databases ./src/com USER lecoffreuser -CMD ["npm", "run", "api:start"] +CMD ["npm", "run", "start"] EXPOSE 3001 \ No newline at end of file From cd654641fb5408ca3d6ca0be3e65d9bc89a4f3a6 Mon Sep 17 00:00:00 2001 From: Vincent Alamelle Date: Thu, 4 May 2023 14:38:34 +0200 Subject: [PATCH 33/72] changed forbidUknowValue --- src/app/api/super-admin/OfficeFoldersController.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/api/super-admin/OfficeFoldersController.ts b/src/app/api/super-admin/OfficeFoldersController.ts index 211bd287..dc273d35 100644 --- a/src/app/api/super-admin/OfficeFoldersController.ts +++ b/src/app/api/super-admin/OfficeFoldersController.ts @@ -46,7 +46,7 @@ export default class OfficeFoldersController extends ApiController { const officeFolderEntity = OfficeFolder.hydrate(req.body); //validate folder - await validateOrReject(officeFolderEntity, { groups: ["createFolder"] , forbidUnknownValues:false}); + await validateOrReject(officeFolderEntity, { groups: ["createFolder"] , forbidUnknownValues: false }); //call service to get prisma entity const prismaEntityCreated = await this.officeFoldersService.create(officeFolderEntity); //Hydrate ressource with prisma entity @@ -75,7 +75,7 @@ export default class OfficeFoldersController extends ApiController { const officeFolderEntity = OfficeFolder.hydrate(req.body); //validate folder - await validateOrReject(officeFolderEntity, { groups: ["updateFolder"], forbidUnknownValues: false }); + await validateOrReject(officeFolderEntity, { groups: ["updateFolder"] }); //call service to get prisma entity const prismaEntityUpdated = await this.officeFoldersService.update(uid, officeFolderEntity); From f26ac432af7071c91466b456b39db026e77f6970 Mon Sep 17 00:00:00 2001 From: Vincent Alamelle Date: Thu, 4 May 2023 15:34:31 +0200 Subject: [PATCH 34/72] Fix put customer --- package-lock.json | 258 +++++++++--------- package.json | 2 +- .../api/super-admin/CustomersController.ts | 4 +- 3 files changed, 132 insertions(+), 132 deletions(-) diff --git a/package-lock.json b/package-lock.json index f20818b1..67d17234 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "cors": "^2.8.5", "express": "^4.18.2", "jsonwebtoken": "^9.0.0", - "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.24", + "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.33", "module-alias": "^2.2.2", "next": "^13.1.5", "node-cache": "^5.1.2", @@ -71,30 +71,30 @@ } }, "node_modules/@babel/compat-data": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.21.4.tgz", - "integrity": "sha512-/DYyDpeCfaVinT40FPGdkkb+lYSKvsVuMjDAG7jPOWWiM1ibOaB9CXJAlc4d1QpP/U2q2P9jbrSlClKSErd55g==", + "version": "7.21.7", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.21.7.tgz", + "integrity": "sha512-KYMqFYTaenzMK4yUtf4EW9wc4N9ef80FsbMtkwool5zpwl4YrT1SdWYSTRcT94KO4hannogdS+LxY7L+arP3gA==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/core": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.21.4.tgz", - "integrity": "sha512-qt/YV149Jman/6AfmlxJ04LMIu8bMoyl3RB91yTFrxQmgbrSvQMy7cI8Q62FHx1t8wJ8B5fu0UDoLwHAhUo1QA==", + "version": "7.21.8", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.21.8.tgz", + "integrity": "sha512-YeM22Sondbo523Sz0+CirSPnbj9bG3P0CdHcBZdqUuaeOaYEFbOLoGU7lebvGP6P5J/WE9wOn7u7C4J9HvS1xQ==", "dev": true, "dependencies": { "@ampproject/remapping": "^2.2.0", "@babel/code-frame": "^7.21.4", - "@babel/generator": "^7.21.4", - "@babel/helper-compilation-targets": "^7.21.4", - "@babel/helper-module-transforms": "^7.21.2", - "@babel/helpers": "^7.21.0", - "@babel/parser": "^7.21.4", + "@babel/generator": "^7.21.5", + "@babel/helper-compilation-targets": "^7.21.5", + "@babel/helper-module-transforms": "^7.21.5", + "@babel/helpers": "^7.21.5", + "@babel/parser": "^7.21.8", "@babel/template": "^7.20.7", - "@babel/traverse": "^7.21.4", - "@babel/types": "^7.21.4", + "@babel/traverse": "^7.21.5", + "@babel/types": "^7.21.5", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -139,12 +139,12 @@ "dev": true }, "node_modules/@babel/generator": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.21.4.tgz", - "integrity": "sha512-NieM3pVIYW2SwGzKoqfPrQsf4xGs9M9AIG3ThppsSRmO+m7eQhmI6amajKMUeIO37wFfsvnvcxQFx6x6iqxDnA==", + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.21.5.tgz", + "integrity": "sha512-SrKK/sRv8GesIW1bDagf9cCG38IOMYZusoe1dfg0D8aiUe3Amvoj1QtjTPAWcfrZFvIwlleLb0gxzQidL9w14w==", "dev": true, "dependencies": { - "@babel/types": "^7.21.4", + "@babel/types": "^7.21.5", "@jridgewell/gen-mapping": "^0.3.2", "@jridgewell/trace-mapping": "^0.3.17", "jsesc": "^2.5.1" @@ -154,12 +154,12 @@ } }, "node_modules/@babel/helper-compilation-targets": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.21.4.tgz", - "integrity": "sha512-Fa0tTuOXZ1iL8IeDFUWCzjZcn+sJGd9RZdH9esYVjEejGmzf+FFYQpMi/kZUk2kPy/q1H3/GPw7np8qar/stfg==", + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.21.5.tgz", + "integrity": "sha512-1RkbFGUKex4lvsB9yhIfWltJM5cZKUftB2eNajaDv3dCMEp49iBG0K14uH8NnX9IPux2+mK7JGEOB0jn48/J6w==", "dev": true, "dependencies": { - "@babel/compat-data": "^7.21.4", + "@babel/compat-data": "^7.21.5", "@babel/helper-validator-option": "^7.21.0", "browserslist": "^4.21.3", "lru-cache": "^5.1.1", @@ -173,9 +173,9 @@ } }, "node_modules/@babel/helper-environment-visitor": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz", - "integrity": "sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==", + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.21.5.tgz", + "integrity": "sha512-IYl4gZ3ETsWocUWgsFZLM5i1BYx9SoemminVEXadgLBa9TdeorzgLKm8wWLA6J1N/kT3Kch8XIk1laNzYoHKvQ==", "dev": true, "engines": { "node": ">=6.9.0" @@ -219,40 +219,40 @@ } }, "node_modules/@babel/helper-module-transforms": { - "version": "7.21.2", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.21.2.tgz", - "integrity": "sha512-79yj2AR4U/Oqq/WOV7Lx6hUjau1Zfo4cI+JLAVYeMV5XIlbOhmjEk5ulbTc9fMpmlojzZHkUUxAiK+UKn+hNQQ==", + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.21.5.tgz", + "integrity": "sha512-bI2Z9zBGY2q5yMHoBvJ2a9iX3ZOAzJPm7Q8Yz6YeoUjU/Cvhmi2G4QyTNyPBqqXSgTjUxRg3L0xV45HvkNWWBw==", "dev": true, "dependencies": { - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-module-imports": "^7.18.6", - "@babel/helper-simple-access": "^7.20.2", + "@babel/helper-environment-visitor": "^7.21.5", + "@babel/helper-module-imports": "^7.21.4", + "@babel/helper-simple-access": "^7.21.5", "@babel/helper-split-export-declaration": "^7.18.6", "@babel/helper-validator-identifier": "^7.19.1", "@babel/template": "^7.20.7", - "@babel/traverse": "^7.21.2", - "@babel/types": "^7.21.2" + "@babel/traverse": "^7.21.5", + "@babel/types": "^7.21.5" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.20.2", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.20.2.tgz", - "integrity": "sha512-8RvlJG2mj4huQ4pZ+rU9lqKi9ZKiRmuvGuM2HlWmkmgOhbs6zEAw6IEiJ5cQqGbDzGZOhwuOQNtZMi/ENLjZoQ==", + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.21.5.tgz", + "integrity": "sha512-0WDaIlXKOX/3KfBK/dwP1oQGiPh6rjMkT7HIRv7i5RR2VUMwrx5ZL0dwBkKx7+SW1zwNdgjHd34IMk5ZjTeHVg==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-simple-access": { - "version": "7.20.2", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.20.2.tgz", - "integrity": "sha512-+0woI/WPq59IrqDYbVGfshjT5Dmk/nnbdpcF8SnMhhXObpTq2KNBdLFRFrkVdbDOyUmHBCxzm5FHV1rACIkIbA==", + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.21.5.tgz", + "integrity": "sha512-ENPDAMC1wAjR0uaCUwliBdiSl1KBJAVnMTzXqi64c2MG8MPR6ii4qf7bSXDqSFbr4W6W028/rf5ivoHop5/mkg==", "dev": true, "dependencies": { - "@babel/types": "^7.20.2" + "@babel/types": "^7.21.5" }, "engines": { "node": ">=6.9.0" @@ -271,9 +271,9 @@ } }, "node_modules/@babel/helper-string-parser": { - "version": "7.19.4", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz", - "integrity": "sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==", + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.21.5.tgz", + "integrity": "sha512-5pTUx3hAJaZIdW99sJ6ZUUgWq/Y+Hja7TowEnLNMm1VivRgZQL3vpBY3qUACVsvw+yQU6+YgfBVmcbLaZtrA1w==", "dev": true, "engines": { "node": ">=6.9.0" @@ -298,14 +298,14 @@ } }, "node_modules/@babel/helpers": { - "version": "7.21.0", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.21.0.tgz", - "integrity": "sha512-XXve0CBtOW0pd7MRzzmoyuSj0e3SEzj8pgyFxnTT1NJZL38BD1MK7yYrm8yefRPIDvNNe14xR4FdbHwpInD4rA==", + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.21.5.tgz", + "integrity": "sha512-BSY+JSlHxOmGsPTydUkPf1MdMQ3M81x5xGCOVgWM3G8XH77sJ292Y2oqcp0CbbgxhqBuI46iUz1tT7hqP7EfgA==", "dev": true, "dependencies": { "@babel/template": "^7.20.7", - "@babel/traverse": "^7.21.0", - "@babel/types": "^7.21.0" + "@babel/traverse": "^7.21.5", + "@babel/types": "^7.21.5" }, "engines": { "node": ">=6.9.0" @@ -397,9 +397,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.21.4.tgz", - "integrity": "sha512-alVJj7k7zIxqBZ7BTRhz0IqJFxW1VJbm6N8JbcYhQ186df9ZBPbZBmWSqAMXwHGsCJdYks7z/voa3ibiS5bCIw==", + "version": "7.21.8", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.21.8.tgz", + "integrity": "sha512-6zavDGdzG3gUqAdWvlLFfk+36RilI+Pwyuuh7HItyeScCWP3k6i8vKclAQ0bM/0y/Kz/xiwvxhMv9MgTJP5gmA==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -600,19 +600,19 @@ } }, "node_modules/@babel/traverse": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.21.4.tgz", - "integrity": "sha512-eyKrRHKdyZxqDm+fV1iqL9UAHMoIg0nDaGqfIOd8rKH17m5snv7Gn4qgjBoFfLz9APvjFU/ICT00NVCv1Epp8Q==", + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.21.5.tgz", + "integrity": "sha512-AhQoI3YjWi6u/y/ntv7k48mcrCXmus0t79J9qPNlk/lAsFlCiJ047RmbfMOawySTHtywXhbXgpx/8nXMYd+oFw==", "dev": true, "dependencies": { "@babel/code-frame": "^7.21.4", - "@babel/generator": "^7.21.4", - "@babel/helper-environment-visitor": "^7.18.9", + "@babel/generator": "^7.21.5", + "@babel/helper-environment-visitor": "^7.21.5", "@babel/helper-function-name": "^7.21.0", "@babel/helper-hoist-variables": "^7.18.6", "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.21.4", - "@babel/types": "^7.21.4", + "@babel/parser": "^7.21.5", + "@babel/types": "^7.21.5", "debug": "^4.1.0", "globals": "^11.1.0" }, @@ -644,12 +644,12 @@ "dev": true }, "node_modules/@babel/types": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.21.4.tgz", - "integrity": "sha512-rU2oY501qDxE8Pyo7i/Orqma4ziCOrby0/9mvbDUGEfvZjb279Nk9k19e2fiCxHbRRpY2ZyrgW1eq22mvmOIzA==", + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.21.5.tgz", + "integrity": "sha512-m4AfNvVF2mVC/F7fDEdH2El3HzUg9It/XsCxZiOTTA3m3qYfcSVSbTfM6Q9xG+hYDniZssYhlXKKUMD5m8tF4Q==", "dev": true, "dependencies": { - "@babel/helper-string-parser": "^7.19.4", + "@babel/helper-string-parser": "^7.21.5", "@babel/helper-validator-identifier": "^7.19.1", "to-fast-properties": "^2.0.0" }, @@ -1039,14 +1039,14 @@ "dev": true }, "node_modules/@next/env": { - "version": "13.3.1", - "resolved": "https://registry.npmjs.org/@next/env/-/env-13.3.1.tgz", - "integrity": "sha512-EDtCoedIZC7JlUQ3uaQpSc4aVmyhbLHmQVALg7pFfQgOTjgSnn7mKtA0DiCMkYvvsx6aFb5octGMtWrOtGXW9A==" + "version": "13.3.4", + "resolved": "https://registry.npmjs.org/@next/env/-/env-13.3.4.tgz", + "integrity": "sha512-oTK/wRV2qga86m/4VdrR1+/56UA6U1Qv3sIgowB+bZjahniZLEG5BmmQjfoGv7ZuLXBZ8Eec6hkL9BqJcrEL2g==" }, "node_modules/@next/swc-darwin-arm64": { - "version": "13.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.3.1.tgz", - "integrity": "sha512-UXPtriEc/pBP8luSLSCZBcbzPeVv+SSjs9cH/KygTbhmACye8/OOXRZO13Z2Wq1G0gLmEAIHQAOuF+vafPd2lw==", + "version": "13.3.4", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.3.4.tgz", + "integrity": "sha512-vux7RWfzxy1lD21CMwZsy9Ej+0+LZdIIj1gEhVmzOQqQZ5N56h8JamrjIVCfDL+Lpj8KwOmFZbPHE8qaYnL2pg==", "cpu": [ "arm64" ], @@ -1059,9 +1059,9 @@ } }, "node_modules/@next/swc-darwin-x64": { - "version": "13.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.3.1.tgz", - "integrity": "sha512-lT36yYxosCfLtplFzJWgo0hrPu6/do8+msgM7oQkPeohDNdhjtjFUgOOwdSnPublLR6Mo2Ym4P/wl5OANuD2bw==", + "version": "13.3.4", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.3.4.tgz", + "integrity": "sha512-1tb+6JT98+t7UIhVQpKL7zegKnCs9RKU6cKNyj+DYKuC/NVl49/JaIlmwCwK8Ibl+RXxJrK7uSXSIO71feXsgw==", "cpu": [ "x64" ], @@ -1074,9 +1074,9 @@ } }, "node_modules/@next/swc-linux-arm64-gnu": { - "version": "13.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.3.1.tgz", - "integrity": "sha512-wRb76nLWJhonH8s3kxC/1tFguEkeOPayIwe9mkaz1G/yeS3OrjeyKMJsb4+Kdg0zbTo53bNCOl59NNtDM7yyyw==", + "version": "13.3.4", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.3.4.tgz", + "integrity": "sha512-UqcKkYTKslf5YAJNtZ5XV1D5MQJIkVtDHL8OehDZERHzqOe7jvy41HFto33IDPPU8gJiP5eJb3V9U26uifqHjw==", "cpu": [ "arm64" ], @@ -1089,9 +1089,9 @@ } }, "node_modules/@next/swc-linux-arm64-musl": { - "version": "13.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.3.1.tgz", - "integrity": "sha512-qz3BzjJRZ16Iq/jrp+pjiYOc0jTjHlfmxQmZk9x/+5uhRP6/eWQSTAPVJ33BMo6oK5O5N4644OgTAbzXzorecg==", + "version": "13.3.4", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.3.4.tgz", + "integrity": "sha512-HE/FmE8VvstAfehyo/XsrhGgz97cEr7uf9IfkgJ/unqSXE0CDshDn/4as6rRid74eDR8/exi7c2tdo49Tuqxrw==", "cpu": [ "arm64" ], @@ -1104,9 +1104,9 @@ } }, "node_modules/@next/swc-linux-x64-gnu": { - "version": "13.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.3.1.tgz", - "integrity": "sha512-6mgkLmwlyWlomQmpl21I3hxgqE5INoW4owTlcLpNsd1V4wP+J46BlI/5zV5KWWbzjfncIqzXoeGs5Eg+1GHODA==", + "version": "13.3.4", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.3.4.tgz", + "integrity": "sha512-xU+ugaupGA4SL5aK1ZYEqVHrW3TPOhxVcpaJLfpANm2443J4GfxCmOacu9XcSgy5c51Mq7C9uZ1LODKHfZosRQ==", "cpu": [ "x64" ], @@ -1119,9 +1119,9 @@ } }, "node_modules/@next/swc-linux-x64-musl": { - "version": "13.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.3.1.tgz", - "integrity": "sha512-uqm5sielhQmKJM+qayIhgZv1KlS5pqTdQ99b+Z7hMWryXS96qE0DftTmMZowBcUL6x7s2vSXyH5wPtO1ON7LBg==", + "version": "13.3.4", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.3.4.tgz", + "integrity": "sha512-cZvmf5KcYeTfIK6bCypfmxGUjme53Ep7hx94JJtGrYgCA1VwEuYdh+KouubJaQCH3aqnNE7+zGnVEupEKfoaaA==", "cpu": [ "x64" ], @@ -1134,9 +1134,9 @@ } }, "node_modules/@next/swc-win32-arm64-msvc": { - "version": "13.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.3.1.tgz", - "integrity": "sha512-WomIiTj/v3LevltlibNQKmvrOymNRYL+a0dp5R73IwPWN5FvXWwSELN/kiNALig/+T3luc4qHNTyvMCp9L6U5Q==", + "version": "13.3.4", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.3.4.tgz", + "integrity": "sha512-7dL+CAUAjmgnVbjXPIpdj7/AQKFqEUL3bKtaOIE1JzJ5UMHHAXCPwzQtibrsvQpf9MwcAmiv8aburD3xH1xf8w==", "cpu": [ "arm64" ], @@ -1149,9 +1149,9 @@ } }, "node_modules/@next/swc-win32-ia32-msvc": { - "version": "13.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.3.1.tgz", - "integrity": "sha512-M+PoH+0+q658wRUbs285RIaSTYnGBSTdweH/0CdzDgA6Q4rBM0sQs4DHmO3BPP0ltCO/vViIoyG7ks66XmCA5g==", + "version": "13.3.4", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.3.4.tgz", + "integrity": "sha512-qplTyzEl1vPkS+/DRK3pKSL0HeXrPHkYsV7U6gboHYpfqoHY+bcLUj3gwVUa9PEHRIoq4vXvPzx/WtzE6q52ng==", "cpu": [ "ia32" ], @@ -1164,9 +1164,9 @@ } }, "node_modules/@next/swc-win32-x64-msvc": { - "version": "13.3.1", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.3.1.tgz", - "integrity": "sha512-Sl1F4Vp5Z1rNXWZYqJwMuWRRol4bqOB6+/d7KqkgQ4AcafKPN1PZmpkCoxv4UFHtFNIB7EotnuIhtXu3zScicQ==", + "version": "13.3.4", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.3.4.tgz", + "integrity": "sha512-usdvZT7JHrTuXC+4OKN5mCzUkviFkCyJJTkEz8jhBpucg+T7s83e7owm3oNFzmj5iKfvxU2St6VkcnSgpFvEYA==", "cpu": [ "x64" ], @@ -1235,9 +1235,9 @@ } }, "node_modules/@swc/helpers": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.0.tgz", - "integrity": "sha512-SjY/p4MmECVVEWspzSRpQEM3sjR17sP8PbGxELWrT+YZMBfiUyt1MRUNjMV23zohwlG2HYtCQOsCwsTHguXkyg==", + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.1.tgz", + "integrity": "sha512-sJ902EfIzn1Fa+qYmjdQqh8tPsoxyBz+8yBKC2HKUxyezKJFwPGOn7pv4WY6QuQW//ySQi5lJjA/ZT9sNWWNTg==", "dependencies": { "tslib": "^2.4.0" } @@ -1295,9 +1295,9 @@ } }, "node_modules/@types/babel__traverse": { - "version": "7.18.4", - "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.18.4.tgz", - "integrity": "sha512-TLG7CsGZZmX9aDF78UuJxnNTfQyRUFU0OYIVyIblr0/wd/HvsIo8wmuB90CszeD2MtLLAE9Tt4cWvk+KVkyGIw==", + "version": "7.18.5", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.18.5.tgz", + "integrity": "sha512-enCvTL8m/EHS/zIvJno9nE+ndYPh1/oNFzRYRmtUqJICG2VnCSBzMLW5VN2KCQU91f23tsNKR8v7VJJQMatl7Q==", "dev": true, "dependencies": { "@babel/types": "^7.3.0" @@ -1399,9 +1399,9 @@ } }, "node_modules/@types/jsonwebtoken": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-9.0.1.tgz", - "integrity": "sha512-c5ltxazpWabia/4UzhIoaDcIza4KViOQhdbjRlfcIGVnsE3c3brkz9Z+F/EeJIECOQP7W7US2hNE930cWWkPiw==", + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz", + "integrity": "sha512-drE6uz7QBKq1fYqqoFKTDRdFCPHd5TCub75BM+D+cMx7NU9hUz7SESLfC2fSCXVFMO5Yj8sOWHuGqPgjc+fz0Q==", "dev": true, "dependencies": { "@types/node": "*" @@ -1414,9 +1414,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "18.16.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.1.tgz", - "integrity": "sha512-DZxSZWXxFfOlx7k7Rv4LAyiMroaxa3Ly/7OOzZO8cBNho0YzAi4qlbrx8W27JGqG57IgR/6J7r+nOJWw6kcvZA==" + "version": "18.16.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.3.tgz", + "integrity": "sha512-OPs5WnnT1xkCBiuQrZA4+YAV4HEJejmHneyraIaxsbev5yCEr6KMwINNFP9wQeFIw8FWcoTqF3vQsa5CDaI+8Q==" }, "node_modules/@types/node-schedule": { "version": "2.1.0", @@ -1866,9 +1866,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001481", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001481.tgz", - "integrity": "sha512-KCqHwRnaa1InZBtqXzP98LPg0ajCVujMKjqKDhZEthIpAsJl/YEIa3YvXjGXPVqzZVguccuu7ga9KOE1J9rKPQ==", + "version": "1.0.30001482", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001482.tgz", + "integrity": "sha512-F1ZInsg53cegyjroxLNW9DmrEQ1SuGRTO1QlpA0o2/6OpQ0gFeDRoq1yFmnr8Sakn9qwwt9DmbxHB6w167OSuQ==", "funding": [ { "type": "opencollective", @@ -2213,9 +2213,9 @@ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" }, "node_modules/electron-to-chromium": { - "version": "1.4.372", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.372.tgz", - "integrity": "sha512-MrlFq/j+TYHOjeWsWGYfzevc25HNeJdsF6qaLFrqBTRWZQtWkb1myq/Q2veLWezVaa5OcSZ99CFwTT4aF4Mung==", + "version": "1.4.382", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.382.tgz", + "integrity": "sha512-czMavlW52VIPgutbVL9JnZIZuFijzsG1ww/1z2Otu1r1q+9Qe2bTsH3My3sZarlvwyqHM6+mnZfEnt2Vr4dsIg==", "dev": true }, "node_modules/emittery": { @@ -3615,7 +3615,7 @@ } }, "node_modules/le-coffre-resources": { - "resolved": "git+ssh://git@github.com/smart-chain-fr/leCoffre-resources.git#0e3dfd0c6e4bfdf2ef78ba13c79ac213c34ab174", + "resolved": "git+ssh://git@github.com/smart-chain-fr/leCoffre-resources.git#cabb4c6c05258d5725cb5747f9cb8335915edf10", "license": "MIT", "dependencies": { "class-transformer": "^0.5.1", @@ -3861,12 +3861,12 @@ } }, "node_modules/next": { - "version": "13.3.1", - "resolved": "https://registry.npmjs.org/next/-/next-13.3.1.tgz", - "integrity": "sha512-eByWRxPzKHs2oQz1yE41LX35umhz86ZSZ+mYyXBqn2IBi2hyUqxBA88avywdr4uyH+hCJczegGsDGWbzQA5Rqw==", + "version": "13.3.4", + "resolved": "https://registry.npmjs.org/next/-/next-13.3.4.tgz", + "integrity": "sha512-sod7HeokBSvH5QV0KB+pXeLfcXUlLrGnVUXxHpmhilQ+nQYT3Im2O8DswD5e4uqbR8Pvdu9pcWgb1CbXZQZlmQ==", "dependencies": { - "@next/env": "13.3.1", - "@swc/helpers": "0.5.0", + "@next/env": "13.3.4", + "@swc/helpers": "0.5.1", "busboy": "1.6.0", "caniuse-lite": "^1.0.30001406", "postcss": "8.4.14", @@ -3876,18 +3876,18 @@ "next": "dist/bin/next" }, "engines": { - "node": ">=14.18.0" + "node": ">=16.8.0" }, "optionalDependencies": { - "@next/swc-darwin-arm64": "13.3.1", - "@next/swc-darwin-x64": "13.3.1", - "@next/swc-linux-arm64-gnu": "13.3.1", - "@next/swc-linux-arm64-musl": "13.3.1", - "@next/swc-linux-x64-gnu": "13.3.1", - "@next/swc-linux-x64-musl": "13.3.1", - "@next/swc-win32-arm64-msvc": "13.3.1", - "@next/swc-win32-ia32-msvc": "13.3.1", - "@next/swc-win32-x64-msvc": "13.3.1" + "@next/swc-darwin-arm64": "13.3.4", + "@next/swc-darwin-x64": "13.3.4", + "@next/swc-linux-arm64-gnu": "13.3.4", + "@next/swc-linux-arm64-musl": "13.3.4", + "@next/swc-linux-x64-gnu": "13.3.4", + "@next/swc-linux-x64-musl": "13.3.4", + "@next/swc-win32-arm64-msvc": "13.3.4", + "@next/swc-win32-ia32-msvc": "13.3.4", + "@next/swc-win32-x64-msvc": "13.3.4" }, "peerDependencies": { "@opentelemetry/api": "^1.1.0", @@ -5291,9 +5291,9 @@ "dev": true }, "node_modules/yargs": { - "version": "17.7.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.1.tgz", - "integrity": "sha512-cwiTb08Xuv5fqF4AovYacTFNxk62th7LKJ6BL9IGUpTJrWoU7/7WdQGTP2SjKf1dUNBGzDd28p/Yfs/GI6JrLw==", + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", "dev": true, "dependencies": { "cliui": "^8.0.1", diff --git a/package.json b/package.json index 322c722b..5efcdb77 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "cors": "^2.8.5", "express": "^4.18.2", "jsonwebtoken": "^9.0.0", - "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.29", + "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.35", "module-alias": "^2.2.2", "next": "^13.1.5", "node-cache": "^5.1.2", diff --git a/src/app/api/super-admin/CustomersController.ts b/src/app/api/super-admin/CustomersController.ts index 0508eb1b..d283cb95 100644 --- a/src/app/api/super-admin/CustomersController.ts +++ b/src/app/api/super-admin/CustomersController.ts @@ -74,8 +74,8 @@ export default class CustomersController extends ApiController { throw new Error("No uid provided"); } //init IUser resource with request body values - const customerEntity = new Customer(); - Customer.hydrate(customerEntity, req.body); + const customerEntity = Customer.hydrate(req.body); + //validate user await validateOrReject(customerEntity, { groups: ["updateCustomer"], forbidUnknownValues: false }); From a9d5a47fd2cc2acc42b19b5f79d46909fbe0eedf Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Thu, 4 May 2023 16:33:28 +0200 Subject: [PATCH 35/72] :sparkles: Fixing nodemon --- nodemon.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nodemon.json b/nodemon.json index 5a4308f5..e1d21322 100644 --- a/nodemon.json +++ b/nodemon.json @@ -1,5 +1,5 @@ { "watch": ["./src/", "./.env", "./package.json", "./tsconfig.json"], - "exec": "npm run start", + "exec": "npm run build && npm run start", "ext": "ts" } \ No newline at end of file From 8ca13569122b5468a4e783111fddd60258185f09 Mon Sep 17 00:00:00 2001 From: Vincent Alamelle Date: Thu, 4 May 2023 17:22:30 +0200 Subject: [PATCH 36/72] new dev script --- src/app/api/super-admin/OfficeFoldersController.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/api/super-admin/OfficeFoldersController.ts b/src/app/api/super-admin/OfficeFoldersController.ts index dc273d35..38b46e47 100644 --- a/src/app/api/super-admin/OfficeFoldersController.ts +++ b/src/app/api/super-admin/OfficeFoldersController.ts @@ -75,7 +75,7 @@ export default class OfficeFoldersController extends ApiController { const officeFolderEntity = OfficeFolder.hydrate(req.body); //validate folder - await validateOrReject(officeFolderEntity, { groups: ["updateFolder"] }); + await validateOrReject(officeFolderEntity, { groups: ["updateFolder"], forbidUnknownValues: false }); //call service to get prisma entity const prismaEntityUpdated = await this.officeFoldersService.update(uid, officeFolderEntity); From 855334dbd8655dfb38b884aadaac4ff16642b438 Mon Sep 17 00:00:00 2001 From: Vincent Alamelle Date: Thu, 4 May 2023 17:48:56 +0200 Subject: [PATCH 37/72] Fixed create Document --- package-lock.json | 4 ++-- package.json | 2 +- src/app/api/super-admin/DocumentsController.ts | 2 ++ src/common/repositories/FilesRepository.ts | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 67d17234..c72c56fe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "cors": "^2.8.5", "express": "^4.18.2", "jsonwebtoken": "^9.0.0", - "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.33", + "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.36", "module-alias": "^2.2.2", "next": "^13.1.5", "node-cache": "^5.1.2", @@ -3615,7 +3615,7 @@ } }, "node_modules/le-coffre-resources": { - "resolved": "git+ssh://git@github.com/smart-chain-fr/leCoffre-resources.git#cabb4c6c05258d5725cb5747f9cb8335915edf10", + "resolved": "git+ssh://git@github.com/smart-chain-fr/leCoffre-resources.git#90ed41d1239cb915defec195cf0e1363ea157d36", "license": "MIT", "dependencies": { "class-transformer": "^0.5.1", diff --git a/package.json b/package.json index 5efcdb77..8a3c77e1 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "cors": "^2.8.5", "express": "^4.18.2", "jsonwebtoken": "^9.0.0", - "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.35", + "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.37", "module-alias": "^2.2.2", "next": "^13.1.5", "node-cache": "^5.1.2", diff --git a/src/app/api/super-admin/DocumentsController.ts b/src/app/api/super-admin/DocumentsController.ts index cfe412ec..6dc9904d 100644 --- a/src/app/api/super-admin/DocumentsController.ts +++ b/src/app/api/super-admin/DocumentsController.ts @@ -47,6 +47,8 @@ export default class DocumentsController extends ApiController { try { //init Document resource with request body values const documentEntity = Document.hydrate(req.body); + console.log(documentEntity); + //validate document await validateOrReject(documentEntity, { groups: ["createDocument"], forbidUnknownValues: false }); diff --git a/src/common/repositories/FilesRepository.ts b/src/common/repositories/FilesRepository.ts index ebc0fb77..7c7d99d8 100644 --- a/src/common/repositories/FilesRepository.ts +++ b/src/common/repositories/FilesRepository.ts @@ -32,7 +32,7 @@ export default class FilesRepository extends BaseRepository { data: { document: { connect: { - uid: file.document.uid, + uid: file.document!.uid, }, }, file_path: file.file_path, From 266501fd79fced2595e81df70b46bc525bd98f65 Mon Sep 17 00:00:00 2001 From: Vincent Alamelle Date: Thu, 4 May 2023 17:57:27 +0200 Subject: [PATCH 38/72] Feature update document --- src/app/api/super-admin/DocumentsController.ts | 4 ++-- src/common/repositories/DocumentsRepository.ts | 7 +------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/app/api/super-admin/DocumentsController.ts b/src/app/api/super-admin/DocumentsController.ts index 6dc9904d..769ef36b 100644 --- a/src/app/api/super-admin/DocumentsController.ts +++ b/src/app/api/super-admin/DocumentsController.ts @@ -78,13 +78,13 @@ export default class DocumentsController extends ApiController { const uid = req.params["uid"]; if (!uid) { throw new Error("No uid provided"); - } + } //init Document resource with request body values const documentEntity = Document.hydrate(req.body); //validate document - await validateOrReject(documentEntity, { groups: ["createDocument"] }); + await validateOrReject(documentEntity, { groups: ["updateDocument"] }); //call service to get prisma entity const prismaEntityUpdated: Documents = await this.documentsService.update(uid, documentEntity); diff --git a/src/common/repositories/DocumentsRepository.ts b/src/common/repositories/DocumentsRepository.ts index f48a0030..1e1aa340 100644 --- a/src/common/repositories/DocumentsRepository.ts +++ b/src/common/repositories/DocumentsRepository.ts @@ -90,12 +90,7 @@ export default class DocumentsRepository extends BaseRepository { document_status: EDocumentStatus[document.document_status as keyof typeof EDocumentStatus], refused_reason: refusedReason, }, - }, - depositor: { - connect: { - uid: document.depositor!.uid, - }, - }, + } }, }); } From fe879584f29e43b77f54dd17e621dc11c3928698 Mon Sep 17 00:00:00 2001 From: OxSaitama Date: Tue, 2 May 2023 15:12:12 +0200 Subject: [PATCH 39/72] add IPFS service --- package.json | 1 + src/app/api/super-admin/FilesController.ts | 150 ++++++++++++++++++ src/app/index.ts | 4 +- src/common/config/variables/Variables.ts | 16 ++ .../20230505075245_v1/migration.sql | 8 + src/common/databases/schema.prisma | 1 + src/common/databases/seeders/seeder.ts | 2 + src/common/helpers/ObjectHydrate.ts | 10 ++ src/common/repositories/FilesRepository.ts | 1 + .../CryptoService/CryptoService.ts | 74 +++++++++ .../FilesService/FilesService.ts | 21 ++- .../IpfsService/IpfsService.ts | 30 ++++ 12 files changed, 314 insertions(+), 4 deletions(-) create mode 100644 src/app/api/super-admin/FilesController.ts create mode 100644 src/common/databases/migrations/20230505075245_v1/migration.sql create mode 100644 src/services/private-services/CryptoService/CryptoService.ts create mode 100644 src/services/private-services/IpfsService/IpfsService.ts diff --git a/package.json b/package.json index 8a3c77e1..22753401 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ }, "homepage": "https://github.com/smart-chain-fr/leCoffre-back#readme", "dependencies": { + "@pinata/sdk": "^2.1.0", "@prisma/client": "^4.11.0", "class-transformer": "^0.5.1", "class-validator": "^0.14.0", diff --git a/src/app/api/super-admin/FilesController.ts b/src/app/api/super-admin/FilesController.ts new file mode 100644 index 00000000..1fdd1696 --- /dev/null +++ b/src/app/api/super-admin/FilesController.ts @@ -0,0 +1,150 @@ +import { Response, Request } from "express"; +import { Controller, Delete, Get, Post, Put } from "@ControllerPattern/index"; +import ApiController from "@Common/system/controller-pattern/ApiController"; +import { Service } from "typedi"; +import FilesService from "@Services/private-services/FilesService/FilesService"; +import { Files } from "@prisma/client"; +import ObjectHydrate from "@Common/helpers/ObjectHydrate"; +import { File } from "le-coffre-resources/dist/SuperAdmin"; +import { validateOrReject } from "class-validator"; + +@Controller() +@Service() +export default class FilesController extends ApiController { + constructor(private filesService: FilesService) { + super(); + } + + /** + * @description Get all Files + * @returns File[] list of Files + */ + @Get("/api/v1/super-admin/files") + protected async get(req: Request, response: Response) { + try { + //get query + const query = JSON.parse(req.query["q"] as string); + + //call service to get prisma entity + const prismaEntity = await this.filesService.get(query); + + //Hydrate ressource with prisma entity + const files = File.map(File, prismaEntity, { strategy: "excludeAll" }); + + //success + this.httpSuccess(response, files); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } + + /** + * @description Create a new File + * @returns File created + */ + @Post("/api/v1/super-admin/files") + protected async post(req: Request, response: Response) { + try { + //init File resource with request body values + const fileEntity = File.hydrate(req.body); + + //validate File + await validateOrReject(fileEntity, { groups: ["createFile"] }); + + //call service to get prisma entity + const prismaEntityCreated = await this.filesService.create(fileEntity); + + //Hydrate ressource with prisma entity + const fileEntityCreated = File.hydrate(prismaEntityCreated, { + strategy: "excludeAll", + }); + + //success + this.httpSuccess(response, fileEntityCreated); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } + + /** + * @description Update a specific file + */ + @Put("/api/v1/super-admin/files/:uid") + protected async update(req: Request, response: Response) { + try { + const uid = req.params["uid"]; + if (!uid) { + throw new Error("No uid provided"); + } + + //init File resource with request body values + const fileEntity = File.hydrate(req.body); + + //validate file + await validateOrReject(fileEntity, { groups: ["create"] }); + + //call service to get prisma entity + const prismaEntityUpdated: Files = await this.filesService.update(uid, fileEntity); + + //Hydrate ressource with prisma entity + const file = File.hydrate(prismaEntityUpdated, { strategy: "excludeAll" }); + + //success + this.httpSuccess(response, file); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } + + /** + * @description Delete a specific File + */ + @Delete("/api/v1/super-admin/files/:uid") + protected async delete(req: Request, response: Response) { + try { + const uid = req.params["uid"]; + if (!uid) { + throw new Error("No uid provided"); + } + + //call service to get prisma entity + const fileEntity: Files = await this.filesService.delete(uid); + + //Hydrate ressource with prisma entity + const file = ObjectHydrate.hydrate(new File(), fileEntity, { strategy: "excludeAll" }); + + //success + this.httpSuccess(response, file); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } + + /** + * @description Get a specific File by uid + */ + @Get("/api/v1/super-admin/Files/:uid") + protected async getOneByUid(req: Request, response: Response) { + try { + const uid = req.params["uid"]; + if (!uid) { + throw new Error("No uid provided"); + } + + const fileEntity = await this.filesService.getByUid(uid); + + //Hydrate ressource with prisma entity + const file = ObjectHydrate.hydrate(new File(), fileEntity, { strategy: "excludeAll" }); + + //success + this.httpSuccess(response, file); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } +} diff --git a/src/app/index.ts b/src/app/index.ts index 01e173ed..e2b0a51f 100644 --- a/src/app/index.ts +++ b/src/app/index.ts @@ -9,8 +9,8 @@ import DeedTypesController from "./api/super-admin/DeedTypesController"; import DocumentsController from "./api/super-admin/DocumentsController"; import DocumentTypesController from "./api/super-admin/DocumentTypesController"; import IdNotUserInfoController from "./api/idnot-user/UserInfoController"; - import DocumentsControllerCustomer from "./api/customer/DocumentsController"; +import FilesController from "./api/super-admin/FilesController"; /** @@ -28,7 +28,7 @@ export default { Container.get(DocumentsController); Container.get(DocumentTypesController); Container.get(IdNotUserInfoController); - + Container.get(FilesController); Container.get(DocumentsControllerCustomer); }, }; diff --git a/src/common/config/variables/Variables.ts b/src/common/config/variables/Variables.ts index 8624a386..43646886 100644 --- a/src/common/config/variables/Variables.ts +++ b/src/common/config/variables/Variables.ts @@ -45,6 +45,18 @@ export class BackendVariables { @IsNotEmpty() public readonly IDNOT_REDIRECT_URL!: string; + @IsNotEmpty() + public readonly PINATA_API_KEY!: string; + + @IsNotEmpty() + public readonly PINATA_API_SECRET!: string; + + @IsNotEmpty() + public readonly PINATA_GATEWAY!: string; + + @IsNotEmpty() + public readonly KEY_DATA!: string; + public constructor() { dotenv.config(); this.DATABASE_PORT = process.env["DATABASE_PORT"]!; @@ -60,6 +72,10 @@ export class BackendVariables { this.IDNOT_CLIENT_ID = process.env["IDNOT_CLIENT_ID"]!; this.IDNOT_CLIENT_SECRET = process.env["IDNOT_CLIENT_SECRET"]!; this.IDNOT_REDIRECT_URL = process.env["IDNOT_REDIRECT_URL"]!; + this.PINATA_API_KEY = process.env["PINATA_API_KEY"]!; + this.PINATA_API_SECRET = process.env["PINATA_API_SECRET"]!; + this.PINATA_GATEWAY = process.env["PINATA_GATEWAY"]!; + this.KEY_DATA = process.env["KEY_DATA"]!; } public async validate() { await validateOrReject(this); diff --git a/src/common/databases/migrations/20230505075245_v1/migration.sql b/src/common/databases/migrations/20230505075245_v1/migration.sql new file mode 100644 index 00000000..c212eab0 --- /dev/null +++ b/src/common/databases/migrations/20230505075245_v1/migration.sql @@ -0,0 +1,8 @@ +/* + Warnings: + + - Added the required column `iv` to the `files` table without a default value. This is not possible if the table is not empty. + +*/ +-- AlterTable +ALTER TABLE "files" ADD COLUMN "iv" VARCHAR(255) NOT NULL; diff --git a/src/common/databases/schema.prisma b/src/common/databases/schema.prisma index 08317b33..9f156af6 100644 --- a/src/common/databases/schema.prisma +++ b/src/common/databases/schema.prisma @@ -203,6 +203,7 @@ model Files { document Documents @relation(fields: [document_uid], references: [uid], onDelete: Cascade) document_uid String @db.VarChar(255) file_path String @unique @db.VarChar(255) + iv String @db.VarChar(255) created_at DateTime? @default(now()) updated_at DateTime? @updatedAt diff --git a/src/common/databases/seeders/seeder.ts b/src/common/databases/seeders/seeder.ts index 35df0bbd..ab450e9f 100644 --- a/src/common/databases/seeders/seeder.ts +++ b/src/common/databases/seeders/seeder.ts @@ -380,6 +380,7 @@ import { uid: uidFiles1, document_uid: uidDocument1, file_path: "https://www.google1.com", + iv: "randomIv1", created_at: new Date(), updated_at: new Date(), }, @@ -387,6 +388,7 @@ import { uid: uidFiles2, document_uid: uidDocument2, file_path: "https://www.google2.com", + iv: "randomIv2", created_at: new Date(), updated_at: new Date(), }, diff --git a/src/common/helpers/ObjectHydrate.ts b/src/common/helpers/ObjectHydrate.ts index 199b8733..92cb3194 100644 --- a/src/common/helpers/ObjectHydrate.ts +++ b/src/common/helpers/ObjectHydrate.ts @@ -10,4 +10,14 @@ export default abstract class ObjectHydrate { return plainToInstance(ClassEntity, from, options); }); } + + // public static fromTypeToRessource(ClassEntity: { new (): T }, from: Record): T { + // const properties = Object.getOwnPropertyNames(ClassEntity); + // const classInstance = new ClassEntity() as T; + // properties.forEach((property) => { + // if (property in from) { + // classInstance[property] = from[property] as T[keyof T]; + // } + // }); + // } } diff --git a/src/common/repositories/FilesRepository.ts b/src/common/repositories/FilesRepository.ts index 7c7d99d8..54bf3bef 100644 --- a/src/common/repositories/FilesRepository.ts +++ b/src/common/repositories/FilesRepository.ts @@ -36,6 +36,7 @@ export default class FilesRepository extends BaseRepository { }, }, file_path: file.file_path, + iv: file.iv }, }); } diff --git a/src/services/private-services/CryptoService/CryptoService.ts b/src/services/private-services/CryptoService/CryptoService.ts new file mode 100644 index 00000000..c0ac9d5e --- /dev/null +++ b/src/services/private-services/CryptoService/CryptoService.ts @@ -0,0 +1,74 @@ +import BaseService from "@Services/BaseService"; +import { Service } from "typedi"; +import { BackendVariables } from "@Common/config/variables/Variables"; +import crypto from "crypto"; + +@Service() +export default class CryptoService extends BaseService { + private key: CryptoKey; + private jwkKey: any; + constructor(protected variables: BackendVariables) { + super(); + this.key = new CryptoKey(); + this.jwkKey = { + kty: "oct", + k: variables.KEY_DATA, + alg: "A256GCM", + ext: true, + }; + } + + private async getKey() { + if (!this.key) this.key = await crypto.subtle.importKey("jwk", this.jwkKey, {name: "AES-GCM"}, false, ["encrypt", "decrypt"]); + return this.key; + } + + public getTextEncoderDecoder() { + return { encoder: new TextEncoder(), decoder: new TextDecoder("utf-8") } + } + + /** + * @description : encrypt data + * @throws {Error} If data cannot be encrypted + */ + public async encrypt(data: any) { + const { encoder, decoder } = this.getTextEncoderDecoder(); + const encodedData = encoder.encode(data); + const iv = crypto.getRandomValues(new Uint8Array(16)); + const key = await this.getKey(); + const cipherData = await crypto.subtle.encrypt( + { + name: "AES-GCM", + iv, + }, + key, + encodedData, + ); + + const cipherText = decoder.decode(cipherData); + const ivStringified = decoder.decode(iv); + + return { cipherText, ivStringified }; + } + + /** + * @description : decrypt data with an initialization vector + * @throws {Error} If data cannot be decrypted + */ + public async decrypt(cipherText: string, ivStringified: string): Promise { + const { encoder, decoder } = this.getTextEncoderDecoder(); + const cipherData = encoder.encode(cipherText); + const iv = encoder.encode(ivStringified); + const key = await this.getKey(); + const decryptedData = await crypto.subtle.decrypt( + { + name: "AES-GCM", + iv, + }, + key, + cipherData, + ); + + return decoder.decode(decryptedData); + } +} diff --git a/src/services/private-services/FilesService/FilesService.ts b/src/services/private-services/FilesService/FilesService.ts index 67656f16..ea97b2fc 100644 --- a/src/services/private-services/FilesService/FilesService.ts +++ b/src/services/private-services/FilesService/FilesService.ts @@ -2,10 +2,14 @@ import FilesRepository from "@Repositories/FilesRepository"; import BaseService from "@Services/BaseService"; import { Service } from "typedi"; import { File } from "le-coffre-resources/dist/SuperAdmin" +import CryptoService from "../CryptoService/CryptoService"; +import IpfsService from "../IpfsService/IpfsService"; +import fs from "fs"; +import { BackendVariables } from "@Common/config/variables/Variables"; @Service() export default class FilesService extends BaseService { - constructor(private filesRepository: FilesRepository) { + constructor(private filesRepository: FilesRepository, private ipfsService: IpfsService, private variables: BackendVariables, private cryptoService: CryptoService) { super(); } @@ -22,6 +26,11 @@ export default class FilesService extends BaseService { * @throws {Error} If file cannot be created */ public async create(file: File) { + const stream = fs.createReadStream('./login.png'); + const upload = await this.ipfsService.pinFile(stream, 'login.png'); + const encryptedPath = await this.cryptoService.encrypt(this.variables.PINATA_GATEWAY.concat(upload.IpfsHash)); + file.file_path = encryptedPath.cipherText; + file.iv = encryptedPath.ivStringified; return this.filesRepository.create(file); } @@ -29,10 +38,18 @@ export default class FilesService extends BaseService { * @description : Modify a new file * @throws {Error} If file cannot be modified */ - public async put(uid: string, file: File) { + public async update(uid: string, file: File) { return this.filesRepository.update(uid, file); } + /** + * @description : Delete a file + * @throws {Error} If file cannot be deleted + */ + public async delete(uid: string) { + return this.filesRepository.delete(uid); + } + /** * @description : Get a file by uid * @throws {Error} If project cannot be created diff --git a/src/services/private-services/IpfsService/IpfsService.ts b/src/services/private-services/IpfsService/IpfsService.ts new file mode 100644 index 00000000..95a1c4d1 --- /dev/null +++ b/src/services/private-services/IpfsService/IpfsService.ts @@ -0,0 +1,30 @@ +import BaseService from "@Services/BaseService"; +import { Service } from "typedi"; +import pinataSDK from "@pinata/sdk"; +import { BackendVariables } from "@Common/config/variables/Variables"; +import fs from "fs"; + +@Service() +export default class FilesService extends BaseService { + private ipfsClient: pinataSDK; + constructor(protected variables: BackendVariables) { + super(); + this.ipfsClient = new pinataSDK({ pinataApiKey: variables.PINATA_API_KEY, pinataSecretApiKey: variables.PINATA_API_SECRET }) + } + + /** + * @description : pin a file + * @throws {Error} If file cannot be pinned + */ + public async pinFile(stream: fs.ReadStream, fileName: string) { + return this.ipfsClient.pinFileToIPFS(stream, {pinataMetadata : {name: fileName}}); + } + + /** + * @description : unpin a file + * @throws {Error} If file cannot be unpinned + */ + public async unpinFile(hashToUnpin: string) { + return this.ipfsClient.unpin(hashToUnpin); + } +} From d893fe69062a6e45f40d759ab445f32b0aaa9668 Mon Sep 17 00:00:00 2001 From: OxSaitama Date: Mon, 8 May 2023 22:26:35 +0200 Subject: [PATCH 40/72] add formdata controller and delete file service --- package.json | 4 ++- src/app/api/super-admin/FilesController.ts | 15 +++++---- src/app/middlewares/FileHandler.ts | 22 +++++++++++++ .../20230505131655_v2/migration.sql | 8 +++++ src/common/databases/schema.prisma | 1 + src/common/databases/seeders/seeder.ts | 2 ++ src/common/repositories/FilesRepository.ts | 2 ++ src/entries/App.ts | 3 +- .../CryptoService/CryptoService.ts | 32 +++++++------------ .../FilesService/FilesService.ts | 13 +++++--- .../IpfsService/IpfsService.ts | 4 +-- 11 files changed, 72 insertions(+), 34 deletions(-) create mode 100644 src/app/middlewares/FileHandler.ts create mode 100644 src/common/databases/migrations/20230505131655_v2/migration.sql diff --git a/package.json b/package.json index 22753401..a286b223 100644 --- a/package.json +++ b/package.json @@ -48,8 +48,9 @@ "cors": "^2.8.5", "express": "^4.18.2", "jsonwebtoken": "^9.0.0", - "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.37", + "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.38", "module-alias": "^2.2.2", + "multer": "^1.4.5-lts.1", "next": "^13.1.5", "node-cache": "^5.1.2", "node-schedule": "^2.1.1", @@ -66,6 +67,7 @@ "@types/express": "^4.17.16", "@types/jest": "^29.5.0", "@types/jsonwebtoken": "^9.0.1", + "@types/multer": "^1.4.7", "@types/node": "^18.11.18", "@types/node-schedule": "^2.1.0", "@types/uuid": "^9.0.0", diff --git a/src/app/api/super-admin/FilesController.ts b/src/app/api/super-admin/FilesController.ts index 1fdd1696..ff0c393c 100644 --- a/src/app/api/super-admin/FilesController.ts +++ b/src/app/api/super-admin/FilesController.ts @@ -4,7 +4,6 @@ import ApiController from "@Common/system/controller-pattern/ApiController"; import { Service } from "typedi"; import FilesService from "@Services/private-services/FilesService/FilesService"; import { Files } from "@prisma/client"; -import ObjectHydrate from "@Common/helpers/ObjectHydrate"; import { File } from "le-coffre-resources/dist/SuperAdmin"; import { validateOrReject } from "class-validator"; @@ -46,14 +45,18 @@ export default class FilesController extends ApiController { @Post("/api/v1/super-admin/files") protected async post(req: Request, response: Response) { try { - //init File resource with request body values - const fileEntity = File.hydrate(req.body); + //get file + if(!req.file) throw new Error('No file provided') + + //init File resource with request body values + const fileEntity = File.hydrate(JSON.parse(req.body["q"])); + //validate File await validateOrReject(fileEntity, { groups: ["createFile"] }); //call service to get prisma entity - const prismaEntityCreated = await this.filesService.create(fileEntity); + const prismaEntityCreated = await this.filesService.create(fileEntity, req.file); //Hydrate ressource with prisma entity const fileEntityCreated = File.hydrate(prismaEntityCreated, { @@ -114,7 +117,7 @@ export default class FilesController extends ApiController { const fileEntity: Files = await this.filesService.delete(uid); //Hydrate ressource with prisma entity - const file = ObjectHydrate.hydrate(new File(), fileEntity, { strategy: "excludeAll" }); + const file = File.hydrate(fileEntity, { strategy: "excludeAll" }); //success this.httpSuccess(response, file); @@ -138,7 +141,7 @@ export default class FilesController extends ApiController { const fileEntity = await this.filesService.getByUid(uid); //Hydrate ressource with prisma entity - const file = ObjectHydrate.hydrate(new File(), fileEntity, { strategy: "excludeAll" }); + const file = File.hydrate(fileEntity, { strategy: "excludeAll" }); //success this.httpSuccess(response, file); diff --git a/src/app/middlewares/FileHandler.ts b/src/app/middlewares/FileHandler.ts new file mode 100644 index 00000000..3a6138ac --- /dev/null +++ b/src/app/middlewares/FileHandler.ts @@ -0,0 +1,22 @@ +import { NextFunction, Request, Response } from "express"; +import multer from "multer"; + +export default function fileHandler(req: Request, response: Response, next: NextFunction) { + const storage = multer.memoryStorage() + const upload = multer({storage:storage}).single('file'); + + // Here call the upload middleware of multer + upload(req, response, function (err) { + if (err instanceof multer.MulterError) { + // A Multer error occurred when uploading. + const err = new Error('Multer error'); + return next(err) + } else if (err) { + // An unknown error occurred when uploading. + const err = new Error('Server Error') + return next(err) + } + next() + }) +} + diff --git a/src/common/databases/migrations/20230505131655_v2/migration.sql b/src/common/databases/migrations/20230505131655_v2/migration.sql new file mode 100644 index 00000000..a7f5aaa6 --- /dev/null +++ b/src/common/databases/migrations/20230505131655_v2/migration.sql @@ -0,0 +1,8 @@ +/* + Warnings: + + - Added the required column `file_name` to the `files` table without a default value. This is not possible if the table is not empty. + +*/ +-- AlterTable +ALTER TABLE "files" ADD COLUMN "file_name" VARCHAR(255) NOT NULL; diff --git a/src/common/databases/schema.prisma b/src/common/databases/schema.prisma index 9f156af6..b1b04496 100644 --- a/src/common/databases/schema.prisma +++ b/src/common/databases/schema.prisma @@ -203,6 +203,7 @@ model Files { document Documents @relation(fields: [document_uid], references: [uid], onDelete: Cascade) document_uid String @db.VarChar(255) file_path String @unique @db.VarChar(255) + file_name String @db.VarChar(255) iv String @db.VarChar(255) created_at DateTime? @default(now()) updated_at DateTime? @updatedAt diff --git a/src/common/databases/seeders/seeder.ts b/src/common/databases/seeders/seeder.ts index ab450e9f..25dba6f3 100644 --- a/src/common/databases/seeders/seeder.ts +++ b/src/common/databases/seeders/seeder.ts @@ -379,6 +379,7 @@ import { { uid: uidFiles1, document_uid: uidDocument1, + file_name: "fileName1", file_path: "https://www.google1.com", iv: "randomIv1", created_at: new Date(), @@ -387,6 +388,7 @@ import { { uid: uidFiles2, document_uid: uidDocument2, + file_name: "fileName2", file_path: "https://www.google2.com", iv: "randomIv2", created_at: new Date(), diff --git a/src/common/repositories/FilesRepository.ts b/src/common/repositories/FilesRepository.ts index 54bf3bef..af5b8044 100644 --- a/src/common/repositories/FilesRepository.ts +++ b/src/common/repositories/FilesRepository.ts @@ -35,9 +35,11 @@ export default class FilesRepository extends BaseRepository { uid: file.document!.uid, }, }, + file_name: file.file_name, file_path: file.file_path, iv: file.iv }, + include: { document: true } }); } diff --git a/src/entries/App.ts b/src/entries/App.ts index b520f7a0..da76f6ae 100644 --- a/src/entries/App.ts +++ b/src/entries/App.ts @@ -8,6 +8,7 @@ import bodyParser from "body-parser"; // import TezosLink from "@Common/databases/TezosLink"; import errorHandler from "@App/middlewares/ErrorHandler"; import { BackendVariables } from "@Common/config/variables/Variables"; +import fileHandler from "@App/middlewares/FileHandler"; (async () => { try { @@ -22,7 +23,7 @@ import { BackendVariables } from "@Common/config/variables/Variables"; label, port: parseInt(port), rootUrl, - middlwares: [cors({ origin: "*" }), bodyParser.urlencoded({ extended: true }), bodyParser.json()], + middlwares: [cors({ origin: "*" }), fileHandler, bodyParser.urlencoded({ extended: true }), bodyParser.json()], errorHandler, }); diff --git a/src/services/private-services/CryptoService/CryptoService.ts b/src/services/private-services/CryptoService/CryptoService.ts index c0ac9d5e..23c7624a 100644 --- a/src/services/private-services/CryptoService/CryptoService.ts +++ b/src/services/private-services/CryptoService/CryptoService.ts @@ -5,11 +5,10 @@ import crypto from "crypto"; @Service() export default class CryptoService extends BaseService { - private key: CryptoKey; - private jwkKey: any; + private jwkKey: JsonWebKey; + private subtle: SubtleCrypto = crypto.webcrypto.subtle constructor(protected variables: BackendVariables) { super(); - this.key = new CryptoKey(); this.jwkKey = { kty: "oct", k: variables.KEY_DATA, @@ -19,24 +18,18 @@ export default class CryptoService extends BaseService { } private async getKey() { - if (!this.key) this.key = await crypto.subtle.importKey("jwk", this.jwkKey, {name: "AES-GCM"}, false, ["encrypt", "decrypt"]); - return this.key; - } - - public getTextEncoderDecoder() { - return { encoder: new TextEncoder(), decoder: new TextDecoder("utf-8") } + return await this.subtle.importKey("jwk", this.jwkKey, {name: "AES-GCM"}, false, ["encrypt", "decrypt"]); } /** * @description : encrypt data * @throws {Error} If data cannot be encrypted */ - public async encrypt(data: any) { - const { encoder, decoder } = this.getTextEncoderDecoder(); - const encodedData = encoder.encode(data); + public async encrypt(data: string) { + const encodedData = Buffer.from(data); const iv = crypto.getRandomValues(new Uint8Array(16)); const key = await this.getKey(); - const cipherData = await crypto.subtle.encrypt( + const cipherData = await this.subtle.encrypt( { name: "AES-GCM", iv, @@ -45,8 +38,8 @@ export default class CryptoService extends BaseService { encodedData, ); - const cipherText = decoder.decode(cipherData); - const ivStringified = decoder.decode(iv); + const cipherText = Buffer.from(cipherData).toString('base64'); + const ivStringified = Buffer.from(iv).toString('base64'); return { cipherText, ivStringified }; } @@ -56,11 +49,10 @@ export default class CryptoService extends BaseService { * @throws {Error} If data cannot be decrypted */ public async decrypt(cipherText: string, ivStringified: string): Promise { - const { encoder, decoder } = this.getTextEncoderDecoder(); - const cipherData = encoder.encode(cipherText); - const iv = encoder.encode(ivStringified); + const cipherData = Buffer.from(cipherText, 'base64'); + const iv = Buffer.from(ivStringified, 'base64'); const key = await this.getKey(); - const decryptedData = await crypto.subtle.decrypt( + const decryptedData = await this.subtle.decrypt( { name: "AES-GCM", iv, @@ -69,6 +61,6 @@ export default class CryptoService extends BaseService { cipherData, ); - return decoder.decode(decryptedData); + return Buffer.from(decryptedData).toString('utf-8'); } } diff --git a/src/services/private-services/FilesService/FilesService.ts b/src/services/private-services/FilesService/FilesService.ts index ea97b2fc..ce6373df 100644 --- a/src/services/private-services/FilesService/FilesService.ts +++ b/src/services/private-services/FilesService/FilesService.ts @@ -4,8 +4,9 @@ import { Service } from "typedi"; import { File } from "le-coffre-resources/dist/SuperAdmin" import CryptoService from "../CryptoService/CryptoService"; import IpfsService from "../IpfsService/IpfsService"; -import fs from "fs"; +//import fs from "fs"; import { BackendVariables } from "@Common/config/variables/Variables"; +import { Readable } from "stream"; @Service() export default class FilesService extends BaseService { @@ -25,10 +26,10 @@ export default class FilesService extends BaseService { * @description : Create a new file * @throws {Error} If file cannot be created */ - public async create(file: File) { - const stream = fs.createReadStream('./login.png'); - const upload = await this.ipfsService.pinFile(stream, 'login.png'); + public async create(file: File, fileData: Express.Multer.File) { + const upload = await this.ipfsService.pinFile(Readable.from(fileData.buffer), fileData.originalname); const encryptedPath = await this.cryptoService.encrypt(this.variables.PINATA_GATEWAY.concat(upload.IpfsHash)); + file.file_name = fileData.originalname; file.file_path = encryptedPath.cipherText; file.iv = encryptedPath.ivStringified; return this.filesRepository.create(file); @@ -47,6 +48,10 @@ export default class FilesService extends BaseService { * @throws {Error} If file cannot be deleted */ public async delete(uid: string) { + const fileToUnpin = await this.filesRepository.findOneByUid(uid); + const decryptedFilePath = await this.cryptoService.decrypt(fileToUnpin.file_path, fileToUnpin.iv); + const fileHash= decryptedFilePath.substring(this.variables.PINATA_GATEWAY.length); + await this.ipfsService.unpinFile(fileHash) return this.filesRepository.delete(uid); } diff --git a/src/services/private-services/IpfsService/IpfsService.ts b/src/services/private-services/IpfsService/IpfsService.ts index 95a1c4d1..cc0f3df7 100644 --- a/src/services/private-services/IpfsService/IpfsService.ts +++ b/src/services/private-services/IpfsService/IpfsService.ts @@ -2,7 +2,7 @@ import BaseService from "@Services/BaseService"; import { Service } from "typedi"; import pinataSDK from "@pinata/sdk"; import { BackendVariables } from "@Common/config/variables/Variables"; -import fs from "fs"; +import { Readable } from "stream"; @Service() export default class FilesService extends BaseService { @@ -16,7 +16,7 @@ export default class FilesService extends BaseService { * @description : pin a file * @throws {Error} If file cannot be pinned */ - public async pinFile(stream: fs.ReadStream, fileName: string) { + public async pinFile(stream: Readable, fileName: string) { return this.ipfsClient.pinFileToIPFS(stream, {pinataMetadata : {name: fileName}}); } From 52ac22fe211c57e0821d2861d793d4e4ceefa872 Mon Sep 17 00:00:00 2001 From: Vincent Alamelle Date: Tue, 9 May 2023 11:01:42 +0200 Subject: [PATCH 41/72] delete folder done --- .../super-admin/OfficeFoldersController.ts | 27 ++++++++++++++++++- .../repositories/OfficeFoldersRepository.ts | 11 ++++++++ .../OfficeFoldersService.ts | 12 +++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/src/app/api/super-admin/OfficeFoldersController.ts b/src/app/api/super-admin/OfficeFoldersController.ts index 38b46e47..989ea9b5 100644 --- a/src/app/api/super-admin/OfficeFoldersController.ts +++ b/src/app/api/super-admin/OfficeFoldersController.ts @@ -1,5 +1,5 @@ import { Response, Request } from "express"; -import { Controller, Get, Post, Put } from "@ControllerPattern/index"; +import { Controller, Delete, Get, Post, Put } from "@ControllerPattern/index"; import ApiController from "@Common/system/controller-pattern/ApiController"; import OfficeFoldersService from "@Services/super-admin/OfficeFoldersService/OfficeFoldersService"; import { Service } from "typedi"; @@ -126,4 +126,29 @@ export default class OfficeFoldersController extends ApiController { } this.httpSuccess(response, await this.officeFoldersService.getByUid("uid")); } + + /** + * @description Delete a specific folder + */ + @Delete("/api/v1/super-admin/folders/:uid") + protected async delete(req: Request, response: Response) { + try { + const uid = req.params["uid"]; + if (!uid) { + throw new Error("No uid provided"); + } + + //call service to get prisma entity + const officeFoldertEntity: OfficeFolders = await this.officeFoldersService.delete(uid); + + //Hydrate ressource with prisma entity + const officeFolder = OfficeFolder.hydrate(officeFoldertEntity, { strategy: "excludeAll" }); + + //success + this.httpSuccess(response, officeFolder); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } } diff --git a/src/common/repositories/OfficeFoldersRepository.ts b/src/common/repositories/OfficeFoldersRepository.ts index 2a752d7f..46205472 100644 --- a/src/common/repositories/OfficeFoldersRepository.ts +++ b/src/common/repositories/OfficeFoldersRepository.ts @@ -143,4 +143,15 @@ export default class OfficeFoldersRepository extends BaseRepository { return officeFolderEntity; } + + /** + * @description : Delete a folder + */ + public async delete(uid: string): Promise { + return this.model.delete({ + where: { + uid: uid, + }, + }); + } } diff --git a/src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts b/src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts index 78e86a84..a2a23e89 100644 --- a/src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts +++ b/src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts @@ -48,4 +48,16 @@ export default class OfficeFoldersService extends BaseService { public async getByUid(uid: string, query?: any) { return this.officeFoldersRepository.findOneByUid(uid, query); } + + /** + * @description : Delete a folder + * @throws {Error} If document cannot be deleted + */ + public async delete(uid: string): Promise { + const officeFolder = await this.officeFoldersRepository.findOneByUid(uid); + if (officeFolder.status !== "ARCHIVED") { + throw new Error("Cannot delete a folder that is not archived"); + } + return this.officeFoldersRepository.delete(uid); + } } From 9d12381ba84b43cabb2ef8d61bce9b94a35aeb69 Mon Sep 17 00:00:00 2001 From: VincentAlamelle <107845815+VincentAlamelle@users.noreply.github.com> Date: Tue, 9 May 2023 11:34:33 +0200 Subject: [PATCH 42/72] Delete folder only when no customers linked (#37) Delete folder only if no customers linked in office_folder_has_customers --- package-lock.json | 638 ++++++++++++++++-- .../OfficeFoldersService.ts | 8 +- 2 files changed, 580 insertions(+), 66 deletions(-) diff --git a/package-lock.json b/package-lock.json index c72c56fe..edba19f7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "1.0.0", "license": "ISC", "dependencies": { + "@pinata/sdk": "^2.1.0", "@prisma/client": "^4.11.0", "class-transformer": "^0.5.1", "class-validator": "^0.14.0", @@ -16,8 +17,9 @@ "cors": "^2.8.5", "express": "^4.18.2", "jsonwebtoken": "^9.0.0", - "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.36", + "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.38", "module-alias": "^2.2.2", + "multer": "^1.4.5-lts.1", "next": "^13.1.5", "node-cache": "^5.1.2", "node-schedule": "^2.1.1", @@ -34,6 +36,7 @@ "@types/express": "^4.17.16", "@types/jest": "^29.5.0", "@types/jsonwebtoken": "^9.0.1", + "@types/multer": "^1.4.7", "@types/node": "^18.11.18", "@types/node-schedule": "^2.1.0", "@types/uuid": "^9.0.0", @@ -1039,14 +1042,14 @@ "dev": true }, "node_modules/@next/env": { - "version": "13.3.4", - "resolved": "https://registry.npmjs.org/@next/env/-/env-13.3.4.tgz", - "integrity": "sha512-oTK/wRV2qga86m/4VdrR1+/56UA6U1Qv3sIgowB+bZjahniZLEG5BmmQjfoGv7ZuLXBZ8Eec6hkL9BqJcrEL2g==" + "version": "13.4.1", + "resolved": "https://registry.npmjs.org/@next/env/-/env-13.4.1.tgz", + "integrity": "sha512-eD6WCBMFjLFooLM19SIhSkWBHtaFrZFfg2Cxnyl3vS3DAdFRfnx5TY2RxlkuKXdIRCC0ySbtK9JXXt8qLCqzZg==" }, "node_modules/@next/swc-darwin-arm64": { - "version": "13.3.4", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.3.4.tgz", - "integrity": "sha512-vux7RWfzxy1lD21CMwZsy9Ej+0+LZdIIj1gEhVmzOQqQZ5N56h8JamrjIVCfDL+Lpj8KwOmFZbPHE8qaYnL2pg==", + "version": "13.4.1", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.4.1.tgz", + "integrity": "sha512-eF8ARHtYfnoYtDa6xFHriUKA/Mfj/cCbmKb3NofeKhMccs65G6/loZ15a6wYCCx4rPAd6x4t1WmVYtri7EdeBg==", "cpu": [ "arm64" ], @@ -1059,9 +1062,9 @@ } }, "node_modules/@next/swc-darwin-x64": { - "version": "13.3.4", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.3.4.tgz", - "integrity": "sha512-1tb+6JT98+t7UIhVQpKL7zegKnCs9RKU6cKNyj+DYKuC/NVl49/JaIlmwCwK8Ibl+RXxJrK7uSXSIO71feXsgw==", + "version": "13.4.1", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.4.1.tgz", + "integrity": "sha512-7cmDgF9tGWTgn5Gw+vP17miJbH4wcraMHDCOHTYWkO/VeKT73dUWG23TNRLfgtCNSPgH4V5B4uLHoZTanx9bAw==", "cpu": [ "x64" ], @@ -1074,9 +1077,9 @@ } }, "node_modules/@next/swc-linux-arm64-gnu": { - "version": "13.3.4", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.3.4.tgz", - "integrity": "sha512-UqcKkYTKslf5YAJNtZ5XV1D5MQJIkVtDHL8OehDZERHzqOe7jvy41HFto33IDPPU8gJiP5eJb3V9U26uifqHjw==", + "version": "13.4.1", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.4.1.tgz", + "integrity": "sha512-qwJqmCri2ie8aTtE5gjTSr8S6O8B67KCYgVZhv9gKH44yvc/zXbAY8u23QGULsYOyh1islWE5sWfQNLOj9iryg==", "cpu": [ "arm64" ], @@ -1089,9 +1092,9 @@ } }, "node_modules/@next/swc-linux-arm64-musl": { - "version": "13.3.4", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.3.4.tgz", - "integrity": "sha512-HE/FmE8VvstAfehyo/XsrhGgz97cEr7uf9IfkgJ/unqSXE0CDshDn/4as6rRid74eDR8/exi7c2tdo49Tuqxrw==", + "version": "13.4.1", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.4.1.tgz", + "integrity": "sha512-qcC54tWNGDv/VVIFkazxhqH1Bnagjfs4enzELVRlUOoJPD2BGJTPI7z08pQPbbgxLtRiu8gl2mXvpB8WlOkMeA==", "cpu": [ "arm64" ], @@ -1104,9 +1107,9 @@ } }, "node_modules/@next/swc-linux-x64-gnu": { - "version": "13.3.4", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.3.4.tgz", - "integrity": "sha512-xU+ugaupGA4SL5aK1ZYEqVHrW3TPOhxVcpaJLfpANm2443J4GfxCmOacu9XcSgy5c51Mq7C9uZ1LODKHfZosRQ==", + "version": "13.4.1", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.4.1.tgz", + "integrity": "sha512-9TeWFlpLsBosZ+tsm/rWBaMwt5It9tPH8m3nawZqFUUrZyGRfGcI67js774vtx0k3rL9qbyY6+3pw9BCVpaYUA==", "cpu": [ "x64" ], @@ -1119,9 +1122,9 @@ } }, "node_modules/@next/swc-linux-x64-musl": { - "version": "13.3.4", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.3.4.tgz", - "integrity": "sha512-cZvmf5KcYeTfIK6bCypfmxGUjme53Ep7hx94JJtGrYgCA1VwEuYdh+KouubJaQCH3aqnNE7+zGnVEupEKfoaaA==", + "version": "13.4.1", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.4.1.tgz", + "integrity": "sha512-sNDGaWmSqTS4QRUzw61wl4mVPeSqNIr1OOjLlQTRuyInxMxtqImRqdvzDvFTlDfdeUMU/DZhWGYoHrXLlZXe6A==", "cpu": [ "x64" ], @@ -1134,9 +1137,9 @@ } }, "node_modules/@next/swc-win32-arm64-msvc": { - "version": "13.3.4", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.3.4.tgz", - "integrity": "sha512-7dL+CAUAjmgnVbjXPIpdj7/AQKFqEUL3bKtaOIE1JzJ5UMHHAXCPwzQtibrsvQpf9MwcAmiv8aburD3xH1xf8w==", + "version": "13.4.1", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.4.1.tgz", + "integrity": "sha512-+CXZC7u1iXdLRudecoUYbhbsXpglYv8KFYsFxKBPn7kg+bk7eJo738wAA4jXIl8grTF2mPdmO93JOQym+BlYGA==", "cpu": [ "arm64" ], @@ -1149,9 +1152,9 @@ } }, "node_modules/@next/swc-win32-ia32-msvc": { - "version": "13.3.4", - "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.3.4.tgz", - "integrity": "sha512-qplTyzEl1vPkS+/DRK3pKSL0HeXrPHkYsV7U6gboHYpfqoHY+bcLUj3gwVUa9PEHRIoq4vXvPzx/WtzE6q52ng==", + "version": "13.4.1", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.4.1.tgz", + "integrity": "sha512-vIoXVVc7UYO68VwVMDKwJC2+HqAZQtCYiVlApyKEeIPIQpz2gpufzGxk1z3/gwrJt/kJ5CDZjlhYDCzd3hdz+g==", "cpu": [ "ia32" ], @@ -1164,9 +1167,9 @@ } }, "node_modules/@next/swc-win32-x64-msvc": { - "version": "13.3.4", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.3.4.tgz", - "integrity": "sha512-usdvZT7JHrTuXC+4OKN5mCzUkviFkCyJJTkEz8jhBpucg+T7s83e7owm3oNFzmj5iKfvxU2St6VkcnSgpFvEYA==", + "version": "13.4.1", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.4.1.tgz", + "integrity": "sha512-n8V5ImLQZibKTu10UUdI3nIeTLkliEXe628qxqW9v8My3BAH2a7H0SaCqkV2OgqFnn8sG1wxKYw9/SNJ632kSA==", "cpu": [ "x64" ], @@ -1178,6 +1181,17 @@ "node": ">= 10" } }, + "node_modules/@pinata/sdk": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@pinata/sdk/-/sdk-2.1.0.tgz", + "integrity": "sha512-hkS0tcKtsjf9xhsEBs2Nbey5s+Db7x5rlOH9TaWHBXkJ7IwwOs2xnEDigNaxAHKjYAwcw+m2hzpO5QgOfeF7Zw==", + "dependencies": { + "axios": "^0.21.1", + "form-data": "^2.3.3", + "is-ipfs": "^0.6.0", + "path": "^0.12.7" + } + }, "node_modules/@prisma/client": { "version": "4.13.0", "resolved": "https://registry.npmjs.org/@prisma/client/-/client-4.13.0.tgz", @@ -1413,10 +1427,19 @@ "integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw==", "dev": true }, + "node_modules/@types/multer": { + "version": "1.4.7", + "resolved": "https://registry.npmjs.org/@types/multer/-/multer-1.4.7.tgz", + "integrity": "sha512-/SNsDidUFCvqqcWDwxv2feww/yqhNeTRL5CVoL3jU4Goc4kKEL10T7Eye65ZqPNi4HRx8sAEX59pV1aEH7drNA==", + "dev": true, + "dependencies": { + "@types/express": "*" + } + }, "node_modules/@types/node": { - "version": "18.16.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.3.tgz", - "integrity": "sha512-OPs5WnnT1xkCBiuQrZA4+YAV4HEJejmHneyraIaxsbev5yCEr6KMwINNFP9wQeFIw8FWcoTqF3vQsa5CDaI+8Q==" + "version": "18.16.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.6.tgz", + "integrity": "sha512-N7KINmeB8IN3vRR8dhgHEp+YpWvGFcpDoh5XZ8jB5a00AdFKCKEyyGTOPTddUf4JqU1ZKTVxkOxakDvchNVI2Q==" }, "node_modules/@types/node-schedule": { "version": "2.1.0", @@ -1478,9 +1501,9 @@ "dev": true }, "node_modules/@types/validator": { - "version": "13.7.15", - "resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.7.15.tgz", - "integrity": "sha512-yeinDVQunb03AEP8luErFcyf/7Lf7AzKCD0NXfgVoGCCQDNpZET8Jgq74oBgqKld3hafLbfzt/3inUdQvaFeXQ==" + "version": "13.7.16", + "resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.7.16.tgz", + "integrity": "sha512-VyKmLktUHYLbrSbsRi241MSUlGYomQgK/tfCNpej3Gt5qDOM10AZ3nU2aR2s5JritClXuOBu4K7MkywVW/Y6Ow==" }, "node_modules/@types/yargs": { "version": "17.0.24", @@ -1586,6 +1609,11 @@ "node": ">= 8" } }, + "node_modules/append-field": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz", + "integrity": "sha512-klpgFSWLW1ZEs8svjfb7g4qWY0YS5imI82dTg+QahUvJ8YqAY0P10Uk8tTyh9ZGuYEZEMaeJYCF5BFuX552hsw==" + }, "node_modules/arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", @@ -1605,6 +1633,19 @@ "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "node_modules/axios": { + "version": "0.21.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", + "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", + "dependencies": { + "follow-redirects": "^1.14.0" + } + }, "node_modules/babel-jest": { "version": "29.5.0", "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.5.0.tgz", @@ -1702,6 +1743,33 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "node_modules/base-x": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", + "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", @@ -1796,6 +1864,14 @@ "node": ">= 6" } }, + "node_modules/bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", + "dependencies": { + "base-x": "^3.0.2" + } + }, "node_modules/bser": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", @@ -1805,6 +1881,29 @@ "node-int64": "^0.4.0" } }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, "node_modules/buffer-equal-constant-time": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", @@ -1813,8 +1912,7 @@ "node_modules/buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", - "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", - "dev": true + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" }, "node_modules/busboy": { "version": "1.6.0", @@ -1866,9 +1964,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001482", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001482.tgz", - "integrity": "sha512-F1ZInsg53cegyjroxLNW9DmrEQ1SuGRTO1QlpA0o2/6OpQ0gFeDRoq1yFmnr8Sakn9qwwt9DmbxHB6w167OSuQ==", + "version": "1.0.30001486", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001486.tgz", + "integrity": "sha512-uv7/gXuHi10Whlj0pp5q/tsK/32J2QSqVRKQhs2j8VsDCjgyruAh/eEXHF822VqO9yT6iZKw3nRwZRSPBE9OQg==", "funding": [ { "type": "opencollective", @@ -1951,12 +2049,34 @@ "node": ">=8" } }, + "node_modules/cids": { + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/cids/-/cids-0.7.5.tgz", + "integrity": "sha512-zT7mPeghoWAu+ppn8+BS1tQ5qGmbMfB4AregnQjA/qHY3GC1m1ptI9GkWNlgeu38r7CuRdXB47uY2XgAYt6QVA==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "buffer": "^5.5.0", + "class-is": "^1.1.0", + "multibase": "~0.6.0", + "multicodec": "^1.0.0", + "multihashes": "~0.4.15" + }, + "engines": { + "node": ">=4.0.0", + "npm": ">=3.0.0" + } + }, "node_modules/cjs-module-lexer": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.2.tgz", "integrity": "sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA==", "dev": true }, + "node_modules/class-is": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/class-is/-/class-is-1.1.0.tgz", + "integrity": "sha512-rhjH9AG1fvabIDoGRVH587413LPjTZgmDF9fOFCbFJQV4yuocX1mHxxvXI4g3cGwbVY9wAYIoKlg1N79frJKQw==" + }, "node_modules/class-transformer": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/class-transformer/-/class-transformer-0.5.1.tgz", @@ -2038,12 +2158,37 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "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==", + "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 }, + "node_modules/concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "engines": [ + "node >= 0.8" + ], + "dependencies": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } + }, "node_modules/content-disposition": { "version": "0.5.4", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", @@ -2082,6 +2227,11 @@ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" + }, "node_modules/cors": { "version": "2.8.5", "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", @@ -2147,6 +2297,14 @@ "node": ">=0.10.0" } }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/depd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", @@ -2213,9 +2371,9 @@ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" }, "node_modules/electron-to-chromium": { - "version": "1.4.382", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.382.tgz", - "integrity": "sha512-czMavlW52VIPgutbVL9JnZIZuFijzsG1ww/1z2Otu1r1q+9Qe2bTsH3My3sZarlvwyqHM6+mnZfEnt2Vr4dsIg==", + "version": "1.4.387", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.387.tgz", + "integrity": "sha512-tutLf+alr1/0YqJwKPdstVvDLmxmLb5xNyDLNS0RZmenHcEYk9qKfpKDCVZEKJ00JVbnayJm1MZAbYhYDFpcOw==", "dev": true }, "node_modules/emittery": { @@ -2443,6 +2601,38 @@ "node": ">=8" } }, + "node_modules/follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/form-data": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", + "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 0.12" + } + }, "node_modules/forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -2655,6 +2845,25 @@ "node": ">=0.10.0" } }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/ignore-by-default": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", @@ -2704,6 +2913,14 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, + "node_modules/ip-regex": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.3.0.tgz", + "integrity": "sha512-B9ZWJxHHOHUhUjCPrMpLD4xEq35bUTClHM1S6CBU5ixQnkZmwipwgc96vAd7AAGM9TGHvJR+Uss+/Ak6UphK+Q==", + "engines": { + "node": ">=8" + } + }, "node_modules/ipaddr.js": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", @@ -2781,6 +2998,30 @@ "node": ">=0.10.0" } }, + "node_modules/is-ip": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-ip/-/is-ip-3.1.0.tgz", + "integrity": "sha512-35vd5necO7IitFPjd/YBeqwWnyDWbuLH9ZXQdMfDA8TEo7pv5X8yfrvVO3xbJbLUlERCMvf6X0hTUamQxCYJ9Q==", + "dependencies": { + "ip-regex": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-ipfs": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/is-ipfs/-/is-ipfs-0.6.3.tgz", + "integrity": "sha512-HyRot1dvLcxImtDqPxAaY1miO6WsiP/z7Yxpg2qpaLWv5UdhAPtLvHJ4kMLM0w8GSl8AFsVF23PHe1LzuWrUlQ==", + "dependencies": { + "bs58": "^4.0.1", + "cids": "~0.7.0", + "mafmt": "^7.0.0", + "multiaddr": "^7.2.1", + "multibase": "~0.6.0", + "multihashes": "~0.4.13" + } + }, "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -2802,6 +3043,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" + }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -3615,7 +3861,7 @@ } }, "node_modules/le-coffre-resources": { - "resolved": "git+ssh://git@github.com/smart-chain-fr/leCoffre-resources.git#90ed41d1239cb915defec195cf0e1363ea157d36", + "resolved": "git+ssh://git@github.com/smart-chain-fr/leCoffre-resources.git#b3d3495c0e65afc0b149d6c07fd5741e144e2aaa", "license": "MIT", "dependencies": { "class-transformer": "^0.5.1", @@ -3632,9 +3878,9 @@ } }, "node_modules/libphonenumber-js": { - "version": "1.10.28", - "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.10.28.tgz", - "integrity": "sha512-1eAgjLrZA0+2Wgw4hs+4Q/kEBycxQo8ZLYnmOvZ3AlM8ImAVAJgDPlZtISLEzD1vunc2q8s2Pn7XwB7I8U3Kzw==" + "version": "1.10.30", + "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.10.30.tgz", + "integrity": "sha512-PLGc+xfrQrkya/YK2/5X+bPpxRmyJBHM+xxz9krUdSgk4Vs2ZwxX5/Ow0lv3r9PDlDtNWb4u+it8MY5rZ0IyGw==" }, "node_modules/lines-and-columns": { "version": "1.2.4", @@ -3699,6 +3945,14 @@ "node": ">=12" } }, + "node_modules/mafmt": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/mafmt/-/mafmt-7.1.0.tgz", + "integrity": "sha512-vpeo9S+hepT3k2h5iFxzEHvvR0GPBx9uKaErmnRzYNcaKb03DgOArjEMlgG4a9LcuZZ89a3I8xbeto487n26eA==", + "dependencies": { + "multiaddr": "^7.3.0" + } + }, "node_modules/make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", @@ -3819,6 +4073,25 @@ "node": "*" } }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, "node_modules/module-alias": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/module-alias/-/module-alias-2.2.2.tgz", @@ -3829,6 +4102,146 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, + "node_modules/multer": { + "version": "1.4.5-lts.1", + "resolved": "https://registry.npmjs.org/multer/-/multer-1.4.5-lts.1.tgz", + "integrity": "sha512-ywPWvcDMeH+z9gQq5qYHCCy+ethsk4goepZ45GLD63fOu0YcNecQxi64nDs3qluZB+murG3/D4dJ7+dGctcCQQ==", + "dependencies": { + "append-field": "^1.0.0", + "busboy": "^1.0.0", + "concat-stream": "^1.5.2", + "mkdirp": "^0.5.4", + "object-assign": "^4.1.1", + "type-is": "^1.6.4", + "xtend": "^4.0.0" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/multiaddr": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/multiaddr/-/multiaddr-7.5.0.tgz", + "integrity": "sha512-GvhHsIGDULh06jyb6ev+VfREH9evJCFIRnh3jUt9iEZ6XDbyoisZRFEI9bMvK/AiR6y66y6P+eoBw9mBYMhMvw==", + "deprecated": "This module is deprecated, please upgrade to @multiformats/multiaddr", + "dependencies": { + "buffer": "^5.5.0", + "cids": "~0.8.0", + "class-is": "^1.1.0", + "is-ip": "^3.1.0", + "multibase": "^0.7.0", + "varint": "^5.0.0" + } + }, + "node_modules/multiaddr/node_modules/cids": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/cids/-/cids-0.8.3.tgz", + "integrity": "sha512-yoXTbV3llpm+EBGWKeL9xKtksPE/s6DPoDSY4fn8I8TEW1zehWXPSB0pwAXVDlLaOlrw+sNynj995uD9abmPhA==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "buffer": "^5.6.0", + "class-is": "^1.1.0", + "multibase": "^1.0.0", + "multicodec": "^1.0.1", + "multihashes": "^1.0.1" + }, + "engines": { + "node": ">=4.0.0", + "npm": ">=3.0.0" + } + }, + "node_modules/multiaddr/node_modules/cids/node_modules/multibase": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-1.0.1.tgz", + "integrity": "sha512-KcCxpBVY8fdVKu4dJMAahq4F/2Z/9xqEjIiR7PiMe7LRGeorFn2NLmicN6nLBCqQvft6MG2Lc9X5P0IdyvnxEw==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "base-x": "^3.0.8", + "buffer": "^5.5.0" + }, + "engines": { + "node": ">=10.0.0", + "npm": ">=6.0.0" + } + }, + "node_modules/multiaddr/node_modules/multibase": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-0.7.0.tgz", + "integrity": "sha512-TW8q03O0f6PNFTQDvh3xxH03c8CjGaaYrjkl9UQPG6rz53TQzzxJVCIWVjzcbN/Q5Y53Zd0IBQBMVktVgNx4Fg==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "base-x": "^3.0.8", + "buffer": "^5.5.0" + } + }, + "node_modules/multiaddr/node_modules/multihashes": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/multihashes/-/multihashes-1.0.1.tgz", + "integrity": "sha512-S27Tepg4i8atNiFaU5ZOm3+gl3KQlUanLs/jWcBxQHFttgq+5x1OgbQmf2d8axJ/48zYGBd/wT9d723USMFduw==", + "dependencies": { + "buffer": "^5.6.0", + "multibase": "^1.0.1", + "varint": "^5.0.0" + }, + "engines": { + "node": ">=10.0.0", + "npm": ">=6.0.0" + } + }, + "node_modules/multiaddr/node_modules/multihashes/node_modules/multibase": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-1.0.1.tgz", + "integrity": "sha512-KcCxpBVY8fdVKu4dJMAahq4F/2Z/9xqEjIiR7PiMe7LRGeorFn2NLmicN6nLBCqQvft6MG2Lc9X5P0IdyvnxEw==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "base-x": "^3.0.8", + "buffer": "^5.5.0" + }, + "engines": { + "node": ">=10.0.0", + "npm": ">=6.0.0" + } + }, + "node_modules/multibase": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-0.6.1.tgz", + "integrity": "sha512-pFfAwyTjbbQgNc3G7D48JkJxWtoJoBMaR4xQUOuB8RnCgRqaYmWNFeJTTvrJ2w51bjLq2zTby6Rqj9TQ9elSUw==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "base-x": "^3.0.8", + "buffer": "^5.5.0" + } + }, + "node_modules/multicodec": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-1.0.4.tgz", + "integrity": "sha512-NDd7FeS3QamVtbgfvu5h7fd1IlbaC4EQ0/pgU4zqE2vdHCmBGsUa0TiM8/TdSeG6BMPC92OOCf8F1ocE/Wkrrg==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "buffer": "^5.6.0", + "varint": "^5.0.0" + } + }, + "node_modules/multihashes": { + "version": "0.4.21", + "resolved": "https://registry.npmjs.org/multihashes/-/multihashes-0.4.21.tgz", + "integrity": "sha512-uVSvmeCWf36pU2nB4/1kzYZjsXD9vofZKpgudqkceYY5g2aZZXJ5r9lxuzoRLl1OAp28XljXsEJ/X/85ZsKmKw==", + "dependencies": { + "buffer": "^5.5.0", + "multibase": "^0.7.0", + "varint": "^5.0.0" + } + }, + "node_modules/multihashes/node_modules/multibase": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-0.7.0.tgz", + "integrity": "sha512-TW8q03O0f6PNFTQDvh3xxH03c8CjGaaYrjkl9UQPG6rz53TQzzxJVCIWVjzcbN/Q5Y53Zd0IBQBMVktVgNx4Fg==", + "deprecated": "This module has been superseded by the multiformats module", + "dependencies": { + "base-x": "^3.0.8", + "buffer": "^5.5.0" + } + }, "node_modules/nanoid": { "version": "3.3.6", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", @@ -3861,16 +4274,17 @@ } }, "node_modules/next": { - "version": "13.3.4", - "resolved": "https://registry.npmjs.org/next/-/next-13.3.4.tgz", - "integrity": "sha512-sod7HeokBSvH5QV0KB+pXeLfcXUlLrGnVUXxHpmhilQ+nQYT3Im2O8DswD5e4uqbR8Pvdu9pcWgb1CbXZQZlmQ==", + "version": "13.4.1", + "resolved": "https://registry.npmjs.org/next/-/next-13.4.1.tgz", + "integrity": "sha512-JBw2kAIyhKDpjhEWvNVoFeIzNp9xNxg8wrthDOtMctfn3EpqGCmW0FSviNyGgOSOSn6zDaX48pmvbdf6X2W9xA==", "dependencies": { - "@next/env": "13.3.4", + "@next/env": "13.4.1", "@swc/helpers": "0.5.1", "busboy": "1.6.0", "caniuse-lite": "^1.0.30001406", "postcss": "8.4.14", - "styled-jsx": "5.1.1" + "styled-jsx": "5.1.1", + "zod": "3.21.4" }, "bin": { "next": "dist/bin/next" @@ -3879,15 +4293,15 @@ "node": ">=16.8.0" }, "optionalDependencies": { - "@next/swc-darwin-arm64": "13.3.4", - "@next/swc-darwin-x64": "13.3.4", - "@next/swc-linux-arm64-gnu": "13.3.4", - "@next/swc-linux-arm64-musl": "13.3.4", - "@next/swc-linux-x64-gnu": "13.3.4", - "@next/swc-linux-x64-musl": "13.3.4", - "@next/swc-win32-arm64-msvc": "13.3.4", - "@next/swc-win32-ia32-msvc": "13.3.4", - "@next/swc-win32-x64-msvc": "13.3.4" + "@next/swc-darwin-arm64": "13.4.1", + "@next/swc-darwin-x64": "13.4.1", + "@next/swc-linux-arm64-gnu": "13.4.1", + "@next/swc-linux-arm64-musl": "13.4.1", + "@next/swc-linux-x64-gnu": "13.4.1", + "@next/swc-linux-x64-musl": "13.4.1", + "@next/swc-win32-arm64-msvc": "13.4.1", + "@next/swc-win32-ia32-msvc": "13.4.1", + "@next/swc-win32-x64-msvc": "13.4.1" }, "peerDependencies": { "@opentelemetry/api": "^1.1.0", @@ -4185,6 +4599,15 @@ "node": ">= 0.8" } }, + "node_modules/path": { + "version": "0.12.7", + "resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz", + "integrity": "sha512-aXXC6s+1w7otVF9UletFkFcDsJeO7lSZBPUQhtb5O0xJe8LtYhj/GxldoL09bBj9+ZmE2hNoHqQSFMN5fikh4Q==", + "dependencies": { + "process": "^0.11.1", + "util": "^0.10.3" + } + }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -4347,6 +4770,19 @@ "resolved": "https://registry.npmjs.org/prisma-query/-/prisma-query-2.0.0.tgz", "integrity": "sha512-+5eneJrgTFxW48j4JaWJ8iBwFSH+YQRtA1N+QEzqsREnTEAbs1Bq85xoZP7ZNEXDsoLOoIo4rYfCYRozuVOB9Q==" }, + "node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + }, "node_modules/prompts": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", @@ -4461,6 +4897,25 @@ "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", "dev": true }, + "node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/readable-stream/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, "node_modules/readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", @@ -4765,6 +5220,19 @@ "node": ">=10.0.0" } }, + "node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/string_decoder/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, "node_modules/string-length": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", @@ -5097,6 +5565,11 @@ "node": ">= 0.6" } }, + "node_modules/typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==" + }, "node_modules/typedi": { "version": "0.10.0", "resolved": "https://registry.npmjs.org/typedi/-/typedi-0.10.0.tgz", @@ -5158,6 +5631,24 @@ "browserslist": ">= 4.21.0" } }, + "node_modules/util": { + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", + "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", + "dependencies": { + "inherits": "2.0.3" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "node_modules/util/node_modules/inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==" + }, "node_modules/utils-merge": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", @@ -5207,6 +5698,11 @@ "node": ">= 0.10" } }, + "node_modules/varint": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz", + "integrity": "sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow==" + }, "node_modules/vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", @@ -5275,6 +5771,14 @@ "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "engines": { + "node": ">=0.4" + } + }, "node_modules/y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", @@ -5336,6 +5840,14 @@ "funding": { "url": "https://github.com/sponsors/sindresorhus" } + }, + "node_modules/zod": { + "version": "3.21.4", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.21.4.tgz", + "integrity": "sha512-m46AKbrzKVzOzs/DZgVnG5H55N1sv1M8qZU3A8RIKbs3mrACDNeIOeilDymVb2HdmP8uwshOCF4uJ8uM9rCqJw==", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } } } } diff --git a/src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts b/src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts index a2a23e89..671b0c3b 100644 --- a/src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts +++ b/src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts @@ -54,9 +54,11 @@ export default class OfficeFoldersService extends BaseService { * @throws {Error} If document cannot be deleted */ public async delete(uid: string): Promise { - const officeFolder = await this.officeFoldersRepository.findOneByUid(uid); - if (officeFolder.status !== "ARCHIVED") { - throw new Error("Cannot delete a folder that is not archived"); + const officeFolderEntity = await this.officeFoldersRepository.findOneByUid(uid, { office_folder_has_customers: true }); + const officeFolder = OfficeFolder.hydrate(officeFolderEntity, { strategy: "excludeAll" }); + + if (officeFolder.office_folder_has_customers && officeFolder.office_folder_has_customers.length !== 0) { + throw new Error("This folder is used by customers"); } return this.officeFoldersRepository.delete(uid); } From 9a261188394f4f226e983a3dfcbde37043b58956 Mon Sep 17 00:00:00 2001 From: Vincent Alamelle Date: Tue, 9 May 2023 12:22:24 +0200 Subject: [PATCH 43/72] Added refused_reason to update document + check if file on delete document --- src/app/api/super-admin/DocumentsController.ts | 4 ++-- .../super-admin/DocumentsService/DocumentsService.ts | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/app/api/super-admin/DocumentsController.ts b/src/app/api/super-admin/DocumentsController.ts index 769ef36b..4cbd9767 100644 --- a/src/app/api/super-admin/DocumentsController.ts +++ b/src/app/api/super-admin/DocumentsController.ts @@ -81,13 +81,13 @@ export default class DocumentsController extends ApiController { } //init Document resource with request body values - const documentEntity = Document.hydrate(req.body); + const documentEntity = Document.hydrate(req.body); //validate document await validateOrReject(documentEntity, { groups: ["updateDocument"] }); //call service to get prisma entity - const prismaEntityUpdated: Documents = await this.documentsService.update(uid, documentEntity); + const prismaEntityUpdated: Documents = await this.documentsService.update(uid, documentEntity, req.body.refused_reason); //Hydrate ressource with prisma entity const document = Document.hydrate(prismaEntityUpdated, { strategy: "excludeAll" }); diff --git a/src/services/super-admin/DocumentsService/DocumentsService.ts b/src/services/super-admin/DocumentsService/DocumentsService.ts index 4e466535..5b6e7217 100644 --- a/src/services/super-admin/DocumentsService/DocumentsService.ts +++ b/src/services/super-admin/DocumentsService/DocumentsService.ts @@ -38,8 +38,8 @@ export default class DocumentsService extends BaseService { * @description : Modify a document * @throws {Error} If document cannot be modified */ - public async update(uid: string, document: Document): Promise { - return this.documentsRepository.update(uid, document); + public async update(uid: string, document: Document, refused_reason?: string): Promise { + return this.documentsRepository.update(uid, document, refused_reason); } /** @@ -55,6 +55,12 @@ export default class DocumentsService extends BaseService { * @throws {Error} If document cannot be get by uid */ public async getByUid(uid: string, query?: any) { + const documentEntity = await this.documentsRepository.findOneByUid(uid, { office_folder_has_customers: true }); + const document = Document.hydrate(documentEntity, { strategy: "excludeAll" }); + + if (document.files && document.files.length !== 0) { + throw new Error("Can't delete a document with file"); + } return this.documentsRepository.findOneByUid(uid, query); } } From 20a5041fd2f0a37281cfb2050781f1fae0b07a95 Mon Sep 17 00:00:00 2001 From: Vincent Alamelle Date: Tue, 9 May 2023 14:43:06 +0200 Subject: [PATCH 44/72] wip --- src/app/api/super-admin/DeedsController.ts | 35 +++++++++++++++++++++- src/app/api/super-admin/FilesController.ts | 2 +- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/app/api/super-admin/DeedsController.ts b/src/app/api/super-admin/DeedsController.ts index 382c9e7d..8dc14408 100644 --- a/src/app/api/super-admin/DeedsController.ts +++ b/src/app/api/super-admin/DeedsController.ts @@ -1,10 +1,11 @@ import { Response, Request } from "express"; -import { Controller, Get } from "@ControllerPattern/index"; +import { Controller, Get, Put } from "@ControllerPattern/index"; import ApiController from "@Common/system/controller-pattern/ApiController"; import DeedsService from "@Services/super-admin/DeedsService/DeedsService"; import { Service } from "typedi"; import { Deeds } from "@prisma/client"; import { Deed } from "le-coffre-resources/dist/SuperAdmin"; +import { validateOrReject } from "class-validator"; @Controller() @Service() @@ -62,4 +63,36 @@ export default class DeedsController extends ApiController { } this.httpSuccess(response, await this.deedsService.getByUid("uid")); } + + /** + * @description Modify a specific deed by uid + */ + @Put("/api/v1/super-admin/deeds/:uid") + protected async put(req: Request, response: Response) { + try { + const uid = req.params["uid"]; + if (!uid) { + throw new Error("No uid provided"); + } + //init OfficeFolder resource with request body values + const deedEntity = Deed.hydrate(req.body); + + //validate folder + await validateOrReject(deedEntity, { groups: ["updateDeed"], forbidUnknownValues: false }); + + //call service to get prisma entity + const prismaEntityUpdated = await this.deedsService.update(uid, deedEntity); + + //Hydrate ressource with prisma entity + const deedEntityUpdated = Deed.hydrate(prismaEntityUpdated, { + strategy: "excludeAll", + }); + + //success + this.httpSuccess(response, deedEntityUpdated); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } } diff --git a/src/app/api/super-admin/FilesController.ts b/src/app/api/super-admin/FilesController.ts index ff0c393c..2ca5f7b1 100644 --- a/src/app/api/super-admin/FilesController.ts +++ b/src/app/api/super-admin/FilesController.ts @@ -86,7 +86,7 @@ export default class FilesController extends ApiController { const fileEntity = File.hydrate(req.body); //validate file - await validateOrReject(fileEntity, { groups: ["create"] }); + await validateOrReject(fileEntity, { groups: ["updateFile"] }); //call service to get prisma entity const prismaEntityUpdated: Files = await this.filesService.update(uid, fileEntity); From da5108bd8f695ad9220964a6d67357ca5021a37f Mon Sep 17 00:00:00 2001 From: Vincent Alamelle Date: Tue, 9 May 2023 14:54:10 +0200 Subject: [PATCH 45/72] wip --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index edba19f7..b8d008e5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "cors": "^2.8.5", "express": "^4.18.2", "jsonwebtoken": "^9.0.0", - "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.38", + "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.39", "module-alias": "^2.2.2", "multer": "^1.4.5-lts.1", "next": "^13.1.5", @@ -3861,7 +3861,7 @@ } }, "node_modules/le-coffre-resources": { - "resolved": "git+ssh://git@github.com/smart-chain-fr/leCoffre-resources.git#b3d3495c0e65afc0b149d6c07fd5741e144e2aaa", + "resolved": "git+ssh://git@github.com/smart-chain-fr/leCoffre-resources.git#d889471c72060fc1ba0d582431c8a4f0c27d441f", "license": "MIT", "dependencies": { "class-transformer": "^0.5.1", diff --git a/package.json b/package.json index a286b223..5ae106cc 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "cors": "^2.8.5", "express": "^4.18.2", "jsonwebtoken": "^9.0.0", - "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.38", + "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.39", "module-alias": "^2.2.2", "multer": "^1.4.5-lts.1", "next": "^13.1.5", From 385d886fb4d7560d13b8047dd6d56a8f05a65da5 Mon Sep 17 00:00:00 2001 From: Vincent Alamelle Date: Tue, 9 May 2023 14:54:56 +0200 Subject: [PATCH 46/72] hotfix delete document --- .../super-admin/DocumentsService/DocumentsService.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/services/super-admin/DocumentsService/DocumentsService.ts b/src/services/super-admin/DocumentsService/DocumentsService.ts index 5b6e7217..a2eefe95 100644 --- a/src/services/super-admin/DocumentsService/DocumentsService.ts +++ b/src/services/super-admin/DocumentsService/DocumentsService.ts @@ -47,6 +47,12 @@ export default class DocumentsService extends BaseService { * @throws {Error} If document cannot be deleted */ public async delete(uid: string): Promise { + const documentEntity = await this.documentsRepository.findOneByUid(uid, { office_folder_has_customers: true }); + const document = Document.hydrate(documentEntity, { strategy: "excludeAll" }); + + if (document.files && document.files.length !== 0) { + throw new Error("Can't delete a document with file"); + } return this.documentsRepository.delete(uid); } @@ -55,12 +61,6 @@ export default class DocumentsService extends BaseService { * @throws {Error} If document cannot be get by uid */ public async getByUid(uid: string, query?: any) { - const documentEntity = await this.documentsRepository.findOneByUid(uid, { office_folder_has_customers: true }); - const document = Document.hydrate(documentEntity, { strategy: "excludeAll" }); - - if (document.files && document.files.length !== 0) { - throw new Error("Can't delete a document with file"); - } return this.documentsRepository.findOneByUid(uid, query); } } From e6654979cd885ee3230b8503218ecf03f173fd85 Mon Sep 17 00:00:00 2001 From: Vincent Alamelle Date: Tue, 9 May 2023 15:37:27 +0200 Subject: [PATCH 47/72] update deed functional --- src/app/api/super-admin/DeedsController.ts | 16 +++++++++++----- src/common/repositories/DeedsRepository.ts | 12 +++++++++--- .../super-admin/DeedsService/DeedsService.ts | 4 ++-- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/app/api/super-admin/DeedsController.ts b/src/app/api/super-admin/DeedsController.ts index 8dc14408..f8ff9da7 100644 --- a/src/app/api/super-admin/DeedsController.ts +++ b/src/app/api/super-admin/DeedsController.ts @@ -49,8 +49,15 @@ export default class DeedsController extends ApiController { throw new Error("No uid provided"); } - //call service to get prisma entity - const deedEntity: Deeds = await this.deedsService.getByUid(uid); + let deedEntity: Deeds; + //get query + if (req.query["q"]) { + const query = JSON.parse(req.query["q"] as string); + deedEntity = await this.deedsService.getByUid(uid, query); + } else { + //call service to get prisma entity + deedEntity = await this.deedsService.getByUid(uid); + } //Hydrate ressource with prisma entity const deed = Deed.hydrate(deedEntity, { strategy: "excludeAll" }); @@ -61,7 +68,6 @@ export default class DeedsController extends ApiController { this.httpBadRequest(response, error); return; } - this.httpSuccess(response, await this.deedsService.getByUid("uid")); } /** @@ -76,9 +82,9 @@ export default class DeedsController extends ApiController { } //init OfficeFolder resource with request body values const deedEntity = Deed.hydrate(req.body); - + //validate folder - await validateOrReject(deedEntity, { groups: ["updateDeed"], forbidUnknownValues: false }); + await validateOrReject(deedEntity, { groups: ["updateDeed"], forbidUnknownValues: false }); //call service to get prisma entity const prismaEntityUpdated = await this.deedsService.update(uid, deedEntity); diff --git a/src/common/repositories/DeedsRepository.ts b/src/common/repositories/DeedsRepository.ts index dcbe3203..79a836a8 100644 --- a/src/common/repositories/DeedsRepository.ts +++ b/src/common/repositories/DeedsRepository.ts @@ -72,6 +72,8 @@ export default class DeedsRepository extends BaseRepository { deed_has_document_types: true, }, }; + console.log(deed.deed_has_document_types); + if (deed.deed_has_document_types) { updateArgs.data.deed_has_document_types = { deleteMany: { deed_uid: uid }, @@ -89,12 +91,16 @@ export default class DeedsRepository extends BaseRepository { /** * @description : Find unique deed */ - public async findOneByUid(uid: string): Promise { - const deedTypeEntity = await this.model.findUnique({ + public async findOneByUid(uid: string, query?: any): Promise { + const findOneArgs: Prisma.DeedsFindUniqueArgs = { where: { uid: uid, }, - }); + }; + if (query) { + findOneArgs.include = query; + } + const deedTypeEntity = await this.model.findUnique(findOneArgs); if (!deedTypeEntity) { throw new Error("deed not found"); diff --git a/src/services/super-admin/DeedsService/DeedsService.ts b/src/services/super-admin/DeedsService/DeedsService.ts index bb133369..93a6c6bd 100644 --- a/src/services/super-admin/DeedsService/DeedsService.ts +++ b/src/services/super-admin/DeedsService/DeedsService.ts @@ -38,7 +38,7 @@ export default class DeedsService extends BaseService { * @description : Get a deed by uid * @throws {Error} If deed-type cannot be get by uid */ - public async getByUid(uid: string) { - return this.deedRepository.findOneByUid(uid); + public async getByUid(uid: string, query?: any) { + return this.deedRepository.findOneByUid(uid, query); } } From 4faa88a80fb84b3bd30ff40043d8d72297f9e2ab Mon Sep 17 00:00:00 2001 From: Vincent Alamelle Date: Tue, 9 May 2023 17:07:58 +0200 Subject: [PATCH 48/72] wip --- package-lock.json | 32 ++++++++++++++++---------------- package.json | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/package-lock.json b/package-lock.json index b8d008e5..edf21b7d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "cors": "^2.8.5", "express": "^4.18.2", "jsonwebtoken": "^9.0.0", - "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.39", + "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.40", "module-alias": "^2.2.2", "multer": "^1.4.5-lts.1", "next": "^13.1.5", @@ -1193,12 +1193,12 @@ } }, "node_modules/@prisma/client": { - "version": "4.13.0", - "resolved": "https://registry.npmjs.org/@prisma/client/-/client-4.13.0.tgz", - "integrity": "sha512-YaiiICcRB2hatxsbnfB66uWXjcRw3jsZdlAVxmx0cFcTc/Ad/sKdHCcWSnqyDX47vAewkjRFwiLwrOUjswVvmA==", + "version": "4.14.0", + "resolved": "https://registry.npmjs.org/@prisma/client/-/client-4.14.0.tgz", + "integrity": "sha512-MK/XaA2sFdfaOa7I9MjNKz6dxeIEdeZlnpNRoF2w3JuRLlFJLkpp6cD3yaqw2nUUhbrn3Iqe3ZpVV+VuGGil7Q==", "hasInstallScript": true, "dependencies": { - "@prisma/engines-version": "4.13.0-50.1e7af066ee9cb95cf3a403c78d9aab3e6b04f37a" + "@prisma/engines-version": "4.14.0-67.d9a4c5988f480fa576d43970d5a23641aa77bc9c" }, "engines": { "node": ">=14.17" @@ -1213,16 +1213,16 @@ } }, "node_modules/@prisma/engines": { - "version": "4.13.0", - "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-4.13.0.tgz", - "integrity": "sha512-HrniowHRZXHuGT9XRgoXEaP2gJLXM5RMoItaY2PkjvuZ+iHc0Zjbm/302MB8YsPdWozAPHHn+jpFEcEn71OgPw==", + "version": "4.14.0", + "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-4.14.0.tgz", + "integrity": "sha512-PDNlhP/1vyTgmNyiucGqGCdXIp7HIkkvKO50si3y3PcceeHvqtiKPaH1iJdz63jCWMVMbj2MElSxXPOeBvEVIQ==", "devOptional": true, "hasInstallScript": true }, "node_modules/@prisma/engines-version": { - "version": "4.13.0-50.1e7af066ee9cb95cf3a403c78d9aab3e6b04f37a", - "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-4.13.0-50.1e7af066ee9cb95cf3a403c78d9aab3e6b04f37a.tgz", - "integrity": "sha512-fsQlbkhPJf08JOzKoyoD9atdUijuGBekwoOPZC3YOygXEml1MTtgXVpnUNchQlRSY82OQ6pSGQ9PxUe4arcSLQ==" + "version": "4.14.0-67.d9a4c5988f480fa576d43970d5a23641aa77bc9c", + "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-4.14.0-67.d9a4c5988f480fa576d43970d5a23641aa77bc9c.tgz", + "integrity": "sha512-3jum8/YSudeSN0zGW5qkpz+wAN2V/NYCQ+BPjvHYDfWatLWlQkqy99toX0GysDeaUoBIJg1vaz2yKqiA3CFcQw==" }, "node_modules/@sinclair/typebox": { "version": "0.25.24", @@ -3861,7 +3861,7 @@ } }, "node_modules/le-coffre-resources": { - "resolved": "git+ssh://git@github.com/smart-chain-fr/leCoffre-resources.git#d889471c72060fc1ba0d582431c8a4f0c27d441f", + "resolved": "git+ssh://git@github.com/smart-chain-fr/leCoffre-resources.git#62639b8bfcd0f779357554a04cd40e8a3ba4e62b", "license": "MIT", "dependencies": { "class-transformer": "^0.5.1", @@ -4749,13 +4749,13 @@ } }, "node_modules/prisma": { - "version": "4.13.0", - "resolved": "https://registry.npmjs.org/prisma/-/prisma-4.13.0.tgz", - "integrity": "sha512-L9mqjnSmvWIRCYJ9mQkwCtj4+JDYYTdhoyo8hlsHNDXaZLh/b4hR0IoKIBbTKxZuyHQzLopb/+0Rvb69uGV7uA==", + "version": "4.14.0", + "resolved": "https://registry.npmjs.org/prisma/-/prisma-4.14.0.tgz", + "integrity": "sha512-+5dMl1uxMQb4RepndY6AwR9xi1cDcaGFICu+ws6/Nmgt93mFPNj8tYxSfTdmfg+rkNrUId9rk/Ac2vTgLe/oXA==", "devOptional": true, "hasInstallScript": true, "dependencies": { - "@prisma/engines": "4.13.0" + "@prisma/engines": "4.14.0" }, "bin": { "prisma": "build/index.js", diff --git a/package.json b/package.json index 5ae106cc..22364cb8 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "cors": "^2.8.5", "express": "^4.18.2", "jsonwebtoken": "^9.0.0", - "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.39", + "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.40", "module-alias": "^2.2.2", "multer": "^1.4.5-lts.1", "next": "^13.1.5", From 6f90174f5fc875a985fd916f21bb4652cfb2edb1 Mon Sep 17 00:00:00 2001 From: Vincent Alamelle Date: Tue, 9 May 2023 17:11:47 +0200 Subject: [PATCH 49/72] hotfix delete document --- src/services/super-admin/DocumentsService/DocumentsService.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/services/super-admin/DocumentsService/DocumentsService.ts b/src/services/super-admin/DocumentsService/DocumentsService.ts index a2eefe95..2a9825c1 100644 --- a/src/services/super-admin/DocumentsService/DocumentsService.ts +++ b/src/services/super-admin/DocumentsService/DocumentsService.ts @@ -47,7 +47,9 @@ export default class DocumentsService extends BaseService { * @throws {Error} If document cannot be deleted */ public async delete(uid: string): Promise { - const documentEntity = await this.documentsRepository.findOneByUid(uid, { office_folder_has_customers: true }); + const documentEntity = await this.documentsRepository.findOneByUid(uid, { files: true }); + console.log(documentEntity); + const document = Document.hydrate(documentEntity, { strategy: "excludeAll" }); if (document.files && document.files.length !== 0) { From 28e5b8a33f8c34cba4e80d66086c21948599ec49 Mon Sep 17 00:00:00 2001 From: Vincent Alamelle Date: Tue, 9 May 2023 17:48:25 +0200 Subject: [PATCH 50/72] Remove useless console log --- src/app/api/super-admin/DocumentsController.ts | 2 -- src/common/repositories/DeedsRepository.ts | 1 - src/services/private-services/AuthService/AuthService.ts | 1 - src/services/super-admin/DocumentsService/DocumentsService.ts | 1 - 4 files changed, 5 deletions(-) diff --git a/src/app/api/super-admin/DocumentsController.ts b/src/app/api/super-admin/DocumentsController.ts index 4cbd9767..ae60a9ab 100644 --- a/src/app/api/super-admin/DocumentsController.ts +++ b/src/app/api/super-admin/DocumentsController.ts @@ -47,8 +47,6 @@ export default class DocumentsController extends ApiController { try { //init Document resource with request body values const documentEntity = Document.hydrate(req.body); - console.log(documentEntity); - //validate document await validateOrReject(documentEntity, { groups: ["createDocument"], forbidUnknownValues: false }); diff --git a/src/common/repositories/DeedsRepository.ts b/src/common/repositories/DeedsRepository.ts index 79a836a8..945a181d 100644 --- a/src/common/repositories/DeedsRepository.ts +++ b/src/common/repositories/DeedsRepository.ts @@ -72,7 +72,6 @@ export default class DeedsRepository extends BaseRepository { deed_has_document_types: true, }, }; - console.log(deed.deed_has_document_types); if (deed.deed_has_document_types) { updateArgs.data.deed_has_document_types = { diff --git a/src/services/private-services/AuthService/AuthService.ts b/src/services/private-services/AuthService/AuthService.ts index 5470dba2..ab528ec4 100644 --- a/src/services/private-services/AuthService/AuthService.ts +++ b/src/services/private-services/AuthService/AuthService.ts @@ -47,7 +47,6 @@ export default class AuthService extends BaseService { const data = await res.json(); return data as IdNotTokens; } catch (error) { - console.log(error); throw new Error(); } } diff --git a/src/services/super-admin/DocumentsService/DocumentsService.ts b/src/services/super-admin/DocumentsService/DocumentsService.ts index 2a9825c1..81a0d8bc 100644 --- a/src/services/super-admin/DocumentsService/DocumentsService.ts +++ b/src/services/super-admin/DocumentsService/DocumentsService.ts @@ -48,7 +48,6 @@ export default class DocumentsService extends BaseService { */ public async delete(uid: string): Promise { const documentEntity = await this.documentsRepository.findOneByUid(uid, { files: true }); - console.log(documentEntity); const document = Document.hydrate(documentEntity, { strategy: "excludeAll" }); From 1f834ab79d8f95013ff39b7e9c53e88b827b3f74 Mon Sep 17 00:00:00 2001 From: Hugo Lextrait Date: Wed, 10 May 2023 11:00:02 +0200 Subject: [PATCH 51/72] add data to seeder --- package-lock.json | 18 ++++++++-------- src/common/databases/seeders/seeder.ts | 30 +++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index edf21b7d..edc5e4e3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1437,9 +1437,9 @@ } }, "node_modules/@types/node": { - "version": "18.16.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.6.tgz", - "integrity": "sha512-N7KINmeB8IN3vRR8dhgHEp+YpWvGFcpDoh5XZ8jB5a00AdFKCKEyyGTOPTddUf4JqU1ZKTVxkOxakDvchNVI2Q==" + "version": "18.16.7", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.7.tgz", + "integrity": "sha512-MFg7ua/bRtnA1hYE3pVyWxGd/r7aMqjNOdHvlSsXV3n8iaeGKkOaPzpJh6/ovf4bEXWcojkeMJpTsq3mzXW4IQ==" }, "node_modules/@types/node-schedule": { "version": "2.1.0", @@ -1501,9 +1501,9 @@ "dev": true }, "node_modules/@types/validator": { - "version": "13.7.16", - "resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.7.16.tgz", - "integrity": "sha512-VyKmLktUHYLbrSbsRi241MSUlGYomQgK/tfCNpej3Gt5qDOM10AZ3nU2aR2s5JritClXuOBu4K7MkywVW/Y6Ow==" + "version": "13.7.17", + "resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.7.17.tgz", + "integrity": "sha512-aqayTNmeWrZcvnG2MG9eGYI6b7S5fl+yKgPs6bAjOTwPS316R5SxBGKvtSExfyoJU7pIeHJfsHI0Ji41RVMkvQ==" }, "node_modules/@types/yargs": { "version": "17.0.24", @@ -2371,9 +2371,9 @@ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" }, "node_modules/electron-to-chromium": { - "version": "1.4.387", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.387.tgz", - "integrity": "sha512-tutLf+alr1/0YqJwKPdstVvDLmxmLb5xNyDLNS0RZmenHcEYk9qKfpKDCVZEKJ00JVbnayJm1MZAbYhYDFpcOw==", + "version": "1.4.388", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.388.tgz", + "integrity": "sha512-xZ0y4zjWZgp65okzwwt00f2rYibkFPHUv9qBz+Vzn8cB9UXIo9Zc6Dw81LJYhhNt0G/vR1OJEfStZ49NKl0YxQ==", "dev": true }, "node_modules/emittery": { diff --git a/src/common/databases/seeders/seeder.ts b/src/common/databases/seeders/seeder.ts index 25dba6f3..f37a2dd0 100644 --- a/src/common/databases/seeders/seeder.ts +++ b/src/common/databases/seeders/seeder.ts @@ -42,6 +42,8 @@ import { const uidContact1: string = randomString(); const uidContact2: string = randomString(); + const uidContact3: string = randomString(); + const uidContact4: string = randomString(); const uidAddress1: string = randomString(); const uidAddress2: string = randomString(); @@ -151,6 +153,32 @@ import { updated_at: new Date(), civility: ECivility.FEMALE, }, + { + uid: uidContact3, + address_uid: uidAddress2, + first_name: "Maitre Marcelino", + last_name: "Jack", + email: "Marcelino.Jack@example.com", + phone_number: randomString(), + cell_phone_number: randomString(), + birthdate: null, + created_at: new Date(), + updated_at: new Date(), + civility: ECivility.MALE, + }, + { + uid: uidContact4, + address_uid: uidAddress2, + first_name: "Maitre Massi", + last_name: "Jack", + email: "Massi.Jack@example.com", + phone_number: randomString(), + cell_phone_number: randomString(), + birthdate: null, + created_at: new Date(), + updated_at: new Date(), + civility: ECivility.FEMALE, + }, ]; const offices: Offices[] = [ @@ -509,4 +537,4 @@ import { } console.log(">MOCK DATA - Seeding completed!"); -})(); +})(); \ No newline at end of file From 3bdeb683da6be7747f06061adfd64428fbeb8f47 Mon Sep 17 00:00:00 2001 From: OxSaitama Date: Wed, 10 May 2023 12:41:48 +0200 Subject: [PATCH 52/72] fix update document status at file creation --- src/app/api/super-admin/FilesController.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/app/api/super-admin/FilesController.ts b/src/app/api/super-admin/FilesController.ts index 2ca5f7b1..ae38660a 100644 --- a/src/app/api/super-admin/FilesController.ts +++ b/src/app/api/super-admin/FilesController.ts @@ -4,13 +4,14 @@ import ApiController from "@Common/system/controller-pattern/ApiController"; import { Service } from "typedi"; import FilesService from "@Services/private-services/FilesService/FilesService"; import { Files } from "@prisma/client"; -import { File } from "le-coffre-resources/dist/SuperAdmin"; +import { File, Document } from "le-coffre-resources/dist/SuperAdmin"; import { validateOrReject } from "class-validator"; +import DocumentsService from "@Services/super-admin/DocumentsService/DocumentsService"; @Controller() @Service() export default class FilesController extends ApiController { - constructor(private filesService: FilesService) { + constructor(private filesService: FilesService, private documentService: DocumentsService) { super(); } @@ -58,6 +59,10 @@ export default class FilesController extends ApiController { //call service to get prisma entity const prismaEntityCreated = await this.filesService.create(fileEntity, req.file); + const document: Document = await this.documentService.getByUid(fileEntity.document!.uid!) + document.document_status = "DEPOSITED"; + await this.documentService.update(document.uid!, document); + //Hydrate ressource with prisma entity const fileEntityCreated = File.hydrate(prismaEntityCreated, { strategy: "excludeAll", From 399f98ea72c207d55f73f517b34719e9388b01af Mon Sep 17 00:00:00 2001 From: Vincent Alamelle Date: Wed, 10 May 2023 14:13:17 +0200 Subject: [PATCH 53/72] Hot fix delete file --- src/services/private-services/FilesService/FilesService.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/services/private-services/FilesService/FilesService.ts b/src/services/private-services/FilesService/FilesService.ts index ce6373df..4f6d83d2 100644 --- a/src/services/private-services/FilesService/FilesService.ts +++ b/src/services/private-services/FilesService/FilesService.ts @@ -49,6 +49,7 @@ export default class FilesService extends BaseService { */ public async delete(uid: string) { const fileToUnpin = await this.filesRepository.findOneByUid(uid); + if(!fileToUnpin) throw new Error("File not found"); const decryptedFilePath = await this.cryptoService.decrypt(fileToUnpin.file_path, fileToUnpin.iv); const fileHash= decryptedFilePath.substring(this.variables.PINATA_GATEWAY.length); await this.ipfsService.unpinFile(fileHash) From 08f2b0ea024406121aa83a54f3f017fa2aa420ad Mon Sep 17 00:00:00 2001 From: Vincent Alamelle Date: Wed, 10 May 2023 14:14:05 +0200 Subject: [PATCH 54/72] Hot fix delete file --- .../private-services/FilesService/FilesService.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/services/private-services/FilesService/FilesService.ts b/src/services/private-services/FilesService/FilesService.ts index 4f6d83d2..15fdfa36 100644 --- a/src/services/private-services/FilesService/FilesService.ts +++ b/src/services/private-services/FilesService/FilesService.ts @@ -49,10 +49,11 @@ export default class FilesService extends BaseService { */ public async delete(uid: string) { const fileToUnpin = await this.filesRepository.findOneByUid(uid); - if(!fileToUnpin) throw new Error("File not found"); - const decryptedFilePath = await this.cryptoService.decrypt(fileToUnpin.file_path, fileToUnpin.iv); - const fileHash= decryptedFilePath.substring(this.variables.PINATA_GATEWAY.length); - await this.ipfsService.unpinFile(fileHash) + if(fileToUnpin){ + const decryptedFilePath = await this.cryptoService.decrypt(fileToUnpin.file_path, fileToUnpin.iv); + const fileHash= decryptedFilePath.substring(this.variables.PINATA_GATEWAY.length); + await this.ipfsService.unpinFile(fileHash) + } return this.filesRepository.delete(uid); } From cf11c386f7860aaaa2302812a4433e9326b64c25 Mon Sep 17 00:00:00 2001 From: Vincent Alamelle Date: Wed, 10 May 2023 14:53:56 +0200 Subject: [PATCH 55/72] Hotfix delete file --- src/services/private-services/FilesService/FilesService.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/services/private-services/FilesService/FilesService.ts b/src/services/private-services/FilesService/FilesService.ts index 15fdfa36..88b1d3b9 100644 --- a/src/services/private-services/FilesService/FilesService.ts +++ b/src/services/private-services/FilesService/FilesService.ts @@ -48,12 +48,15 @@ export default class FilesService extends BaseService { * @throws {Error} If file cannot be deleted */ public async delete(uid: string) { - const fileToUnpin = await this.filesRepository.findOneByUid(uid); - if(fileToUnpin){ + try { + const fileToUnpin = await this.filesRepository.findOneByUid(uid); const decryptedFilePath = await this.cryptoService.decrypt(fileToUnpin.file_path, fileToUnpin.iv); const fileHash= decryptedFilePath.substring(this.variables.PINATA_GATEWAY.length); await this.ipfsService.unpinFile(fileHash) + } catch (error) { + console.log(error); } + return this.filesRepository.delete(uid); } From adea3c3a03a3aade7108bd280cf4f535273bc1b4 Mon Sep 17 00:00:00 2001 From: Hugo Lextrait Date: Wed, 10 May 2023 16:00:11 +0200 Subject: [PATCH 56/72] :art: fix seeder --- src/common/databases/seeders/seeder.ts | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/common/databases/seeders/seeder.ts b/src/common/databases/seeders/seeder.ts index f37a2dd0..8bca08dc 100644 --- a/src/common/databases/seeders/seeder.ts +++ b/src/common/databases/seeders/seeder.ts @@ -47,6 +47,8 @@ import { const uidAddress1: string = randomString(); const uidAddress2: string = randomString(); + const uidAddress3: string = randomString(); + const uidAddress4: string = randomString(); const uidOffice1: string = randomString(); const uidOffice2: string = randomString(); @@ -124,6 +126,22 @@ import { created_at: new Date(), updated_at: new Date(), }, + { + uid: uidAddress3, + address: "Rue Pierre Charles", + city: "Paris", + zip_code: 75003, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidAddress4, + address: "Rue Pierre Pologne", + city: "Paris", + zip_code: 75003, + created_at: new Date(), + updated_at: new Date(), + }, ]; const contacts: Contacts[] = [ @@ -155,7 +173,7 @@ import { }, { uid: uidContact3, - address_uid: uidAddress2, + address_uid: uidAddress3, first_name: "Maitre Marcelino", last_name: "Jack", email: "Marcelino.Jack@example.com", @@ -168,7 +186,7 @@ import { }, { uid: uidContact4, - address_uid: uidAddress2, + address_uid: uidAddress4, first_name: "Maitre Massi", last_name: "Jack", email: "Massi.Jack@example.com", @@ -537,4 +555,4 @@ import { } console.log(">MOCK DATA - Seeding completed!"); -})(); \ No newline at end of file +})(); From 03778759155d5c5eb8ff0c00bd94567ac3c2ff3a Mon Sep 17 00:00:00 2001 From: Vincent Alamelle Date: Wed, 10 May 2023 17:37:12 +0200 Subject: [PATCH 57/72] Fixed getRandomValue --- src/services/private-services/CryptoService/CryptoService.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/private-services/CryptoService/CryptoService.ts b/src/services/private-services/CryptoService/CryptoService.ts index 23c7624a..548ed6b0 100644 --- a/src/services/private-services/CryptoService/CryptoService.ts +++ b/src/services/private-services/CryptoService/CryptoService.ts @@ -27,7 +27,7 @@ export default class CryptoService extends BaseService { */ public async encrypt(data: string) { const encodedData = Buffer.from(data); - const iv = crypto.getRandomValues(new Uint8Array(16)); + const iv = crypto.webcrypto.getRandomValues(new Uint8Array(16)) const key = await this.getKey(); const cipherData = await this.subtle.encrypt( { From 29088493e96af131a10c9a6d80ef1ea6378aeebf Mon Sep 17 00:00:00 2001 From: Vincent Alamelle Date: Wed, 10 May 2023 17:47:04 +0200 Subject: [PATCH 58/72] ressource v2.41 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 22364cb8..6e7439de 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "cors": "^2.8.5", "express": "^4.18.2", "jsonwebtoken": "^9.0.0", - "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.40", + "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.41", "module-alias": "^2.2.2", "multer": "^1.4.5-lts.1", "next": "^13.1.5", From 4b4c92ac54fe88186be58c5ef416d350431d7320 Mon Sep 17 00:00:00 2001 From: Vincent Alamelle Date: Wed, 10 May 2023 18:46:44 +0200 Subject: [PATCH 59/72] v2.44 --- package-lock.json | 13 +++++++------ package.json | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index edc5e4e3..6e8150bc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "cors": "^2.8.5", "express": "^4.18.2", "jsonwebtoken": "^9.0.0", - "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.40", + "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.44", "module-alias": "^2.2.2", "multer": "^1.4.5-lts.1", "next": "^13.1.5", @@ -2371,9 +2371,9 @@ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" }, "node_modules/electron-to-chromium": { - "version": "1.4.388", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.388.tgz", - "integrity": "sha512-xZ0y4zjWZgp65okzwwt00f2rYibkFPHUv9qBz+Vzn8cB9UXIo9Zc6Dw81LJYhhNt0G/vR1OJEfStZ49NKl0YxQ==", + "version": "1.4.389", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.389.tgz", + "integrity": "sha512-WDgWUOK8ROR7sDFyYmxCUOoDc50lPgYAHAHwnnD1iN3SKO/mpqftb9iIPiEkMKmqYdkrR0j3N/O+YB/U7lSxwg==", "dev": true }, "node_modules/emittery": { @@ -3861,11 +3861,12 @@ } }, "node_modules/le-coffre-resources": { - "resolved": "git+ssh://git@github.com/smart-chain-fr/leCoffre-resources.git#62639b8bfcd0f779357554a04cd40e8a3ba4e62b", + "resolved": "git+ssh://git@github.com/smart-chain-fr/leCoffre-resources.git#30c8ee50b872a8bc6bec0f5d8c4626d8f4490177", "license": "MIT", "dependencies": { "class-transformer": "^0.5.1", - "class-validator": "^0.14.0" + "class-validator": "^0.14.0", + "reflect-metadata": "^0.1.13" } }, "node_modules/leven": { diff --git a/package.json b/package.json index 6e7439de..14fa336e 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "cors": "^2.8.5", "express": "^4.18.2", "jsonwebtoken": "^9.0.0", - "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.41", + "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.44", "module-alias": "^2.2.2", "multer": "^1.4.5-lts.1", "next": "^13.1.5", From 4caa6e70c807ca8cad785d30fa157e2ca1332b9f Mon Sep 17 00:00:00 2001 From: Hugo Lextrait Date: Wed, 10 May 2023 18:55:39 +0200 Subject: [PATCH 60/72] :art: fix seeder --- src/common/databases/seeders/seeder.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/databases/seeders/seeder.ts b/src/common/databases/seeders/seeder.ts index 8bca08dc..08b8869a 100644 --- a/src/common/databases/seeders/seeder.ts +++ b/src/common/databases/seeders/seeder.ts @@ -363,7 +363,7 @@ import { uid: uidDocument1, blockchain_anchor_uid: null, depositor_uid: uidCustomer1, - document_status: EDocumentStatus.ASKED, + document_status: EDocumentStatus.DEPOSITED, folder_uid: uidOfficeFolder1, document_type_uid: uidDocumentType1, created_at: new Date(), @@ -433,7 +433,7 @@ import { }, { uid: uidFiles2, - document_uid: uidDocument2, + document_uid: uidDocument1, file_name: "fileName2", file_path: "https://www.google2.com", iv: "randomIv2", @@ -481,7 +481,7 @@ import { uid: uidDocumentHistory1, document_status: EDocumentStatus.ASKED, document_uid: uidDocument1, - refused_reason: "Le document n'est pas conforme", + refused_reason: "", created_at: new Date(), updated_at: new Date(), }, From 4f1c06418996992188c3c12c56bbef0807b5d115 Mon Sep 17 00:00:00 2001 From: OxSaitama Date: Wed, 10 May 2023 23:23:20 +0200 Subject: [PATCH 61/72] fix data encryption --- package.json | 7 +- src/app/api/super-admin/FilesController.ts | 22 ++++++- .../20230510204321_v4/migration.sql | 9 +++ src/common/databases/schema.prisma | 2 +- src/common/databases/seeders/seeder.ts | 17 ++--- src/common/repositories/FilesRepository.ts | 9 ++- .../CryptoService/CryptoService.ts | 66 +++++++------------ .../FilesService/FilesService.ts | 64 +++++++++++------- 8 files changed, 113 insertions(+), 83 deletions(-) create mode 100644 src/common/databases/migrations/20230510204321_v4/migration.sql diff --git a/package.json b/package.json index 14fa336e..7fe55c8c 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "@Test": "./dist/test" }, "scripts": { - "build-db": "npx prisma migrate dev", + "build-db": "npx prisma migrate dev && node ./dist/common/databases/seeders/seeder.js", "build": "tsc", "start": "node ./dist/entries/App.js", "api:start": "npm run migrate && npm run start", @@ -48,7 +48,7 @@ "cors": "^2.8.5", "express": "^4.18.2", "jsonwebtoken": "^9.0.0", - "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.44", + "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.46", "module-alias": "^2.2.2", "multer": "^1.4.5-lts.1", "next": "^13.1.5", @@ -60,7 +60,8 @@ "tslib": "^2.4.1", "typedi": "^0.10.0", "typescript": "^4.9.4", - "uuid": "^9.0.0" + "uuid": "^9.0.0", + "uuidv4": "^6.2.13" }, "devDependencies": { "@types/cors": "^2.8.13", diff --git a/src/app/api/super-admin/FilesController.ts b/src/app/api/super-admin/FilesController.ts index ae38660a..68c2dfd1 100644 --- a/src/app/api/super-admin/FilesController.ts +++ b/src/app/api/super-admin/FilesController.ts @@ -39,6 +39,26 @@ export default class FilesController extends ApiController { } } + /** + * @description Get a specific File by uid + */ + @Get("/api/v1/super-admin/files/upload/:uid") + protected async getFileData(req: Request, response: Response) { + try { + const uid = req.params["uid"]; + if (!uid) { + throw new Error("No uid provided"); + } + + const file = await this.filesService.updload(uid); + + this.httpSuccess(response, file); + } catch (error) { + this.httpBadRequest(response, error); + return; + } + } + /** * @description Create a new File * @returns File created @@ -135,7 +155,7 @@ export default class FilesController extends ApiController { /** * @description Get a specific File by uid */ - @Get("/api/v1/super-admin/Files/:uid") + @Get("/api/v1/super-admin/files/:uid") protected async getOneByUid(req: Request, response: Response) { try { const uid = req.params["uid"]; diff --git a/src/common/databases/migrations/20230510204321_v4/migration.sql b/src/common/databases/migrations/20230510204321_v4/migration.sql new file mode 100644 index 00000000..463c9e19 --- /dev/null +++ b/src/common/databases/migrations/20230510204321_v4/migration.sql @@ -0,0 +1,9 @@ +/* + Warnings: + + - You are about to drop the column `iv` on the `files` table. All the data in the column will be lost. + +*/ +-- AlterTable +ALTER TABLE "files" DROP COLUMN "iv", +ADD COLUMN "key" VARCHAR(255); diff --git a/src/common/databases/schema.prisma b/src/common/databases/schema.prisma index b1b04496..4261b9ea 100644 --- a/src/common/databases/schema.prisma +++ b/src/common/databases/schema.prisma @@ -204,7 +204,7 @@ model Files { document_uid String @db.VarChar(255) file_path String @unique @db.VarChar(255) file_name String @db.VarChar(255) - iv String @db.VarChar(255) + key String? @db.VarChar(255) created_at DateTime? @default(now()) updated_at DateTime? @updatedAt diff --git a/src/common/databases/seeders/seeder.ts b/src/common/databases/seeders/seeder.ts index 08b8869a..999503de 100644 --- a/src/common/databases/seeders/seeder.ts +++ b/src/common/databases/seeders/seeder.ts @@ -25,12 +25,6 @@ import { (async () => { const prisma = new PrismaClient(); - const existingData = await prisma.contacts.findFirst({ where: { email: "john.doe@example.com" } }); - if (existingData) { - console.log("Seed data already exists. Skipping seeding process."); - return; - } - const randomString = () => { const chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; let result = ""; @@ -92,6 +86,13 @@ import { const uidDocumentHistory1: string = randomString(); const uidDocumentHistory2: string = randomString(); + // const existingData = await prisma.contacts.findFirst({ where: { uid: uidContact4 } }); + // if (existingData) { + // console.log("Seed data already exists. Skipping seeding process."); + // return; + // } + + const customers: Customers[] = [ { uid: uidCustomer1, @@ -427,7 +428,7 @@ import { document_uid: uidDocument1, file_name: "fileName1", file_path: "https://www.google1.com", - iv: "randomIv1", + key: '', created_at: new Date(), updated_at: new Date(), }, @@ -436,7 +437,7 @@ import { document_uid: uidDocument1, file_name: "fileName2", file_path: "https://www.google2.com", - iv: "randomIv2", + key: '', created_at: new Date(), updated_at: new Date(), }, diff --git a/src/common/repositories/FilesRepository.ts b/src/common/repositories/FilesRepository.ts index af5b8044..d48fb7d5 100644 --- a/src/common/repositories/FilesRepository.ts +++ b/src/common/repositories/FilesRepository.ts @@ -27,7 +27,7 @@ export default class FilesRepository extends BaseRepository { /** * @description : Create a file linked to a document */ - public async create(file: File): Promise { + public async create(file: File, key: string): Promise { return this.model.create({ data: { document: { @@ -37,7 +37,7 @@ export default class FilesRepository extends BaseRepository { }, file_name: file.file_name, file_path: file.file_path, - iv: file.iv + key: key }, include: { document: true } }); @@ -61,10 +61,13 @@ export default class FilesRepository extends BaseRepository { * @description : Delete a file */ public async delete(uid: string): Promise { - return this.model.delete({ + return this.model.update({ where: { uid: uid, }, + data: { + key: null + } }); } diff --git a/src/services/private-services/CryptoService/CryptoService.ts b/src/services/private-services/CryptoService/CryptoService.ts index 548ed6b0..5ac62af1 100644 --- a/src/services/private-services/CryptoService/CryptoService.ts +++ b/src/services/private-services/CryptoService/CryptoService.ts @@ -5,62 +5,44 @@ import crypto from "crypto"; @Service() export default class CryptoService extends BaseService { - private jwkKey: JsonWebKey; - private subtle: SubtleCrypto = crypto.webcrypto.subtle + + private static readonly CRYPTO_ALGORITHM = "aes-256-ctr"; + constructor(protected variables: BackendVariables) { super(); - this.jwkKey = { - kty: "oct", - k: variables.KEY_DATA, - alg: "A256GCM", - ext: true, - }; } - private async getKey() { - return await this.subtle.importKey("jwk", this.jwkKey, {name: "AES-GCM"}, false, ["encrypt", "decrypt"]); + private getKey(key: string) { + return crypto.createHash('sha256').update(String(key)).digest('base64').slice(0, 32); } /** * @description : encrypt data * @throws {Error} If data cannot be encrypted */ - public async encrypt(data: string) { - const encodedData = Buffer.from(data); - const iv = crypto.webcrypto.getRandomValues(new Uint8Array(16)) - const key = await this.getKey(); - const cipherData = await this.subtle.encrypt( - { - name: "AES-GCM", - iv, - }, - key, - encodedData, - ); - - const cipherText = Buffer.from(cipherData).toString('base64'); - const ivStringified = Buffer.from(iv).toString('base64'); - - return { cipherText, ivStringified }; + public async encrypt(buffer: Buffer, key: string): Promise { + // Create an initialization vector + const iv = crypto.randomBytes(16); + // Create a new cipher using the algorithm, key, and iv + const cipher = crypto.createCipheriv(CryptoService.CRYPTO_ALGORITHM, this.getKey(key), iv); + // Create the new (encrypted) buffer + const result = Buffer.concat([iv, cipher.update(buffer), cipher.final()]); + return result; } - + /** * @description : decrypt data with an initialization vector * @throws {Error} If data cannot be decrypted */ - public async decrypt(cipherText: string, ivStringified: string): Promise { - const cipherData = Buffer.from(cipherText, 'base64'); - const iv = Buffer.from(ivStringified, 'base64'); - const key = await this.getKey(); - const decryptedData = await this.subtle.decrypt( - { - name: "AES-GCM", - iv, - }, - key, - cipherData, - ); - - return Buffer.from(decryptedData).toString('utf-8'); + public async decrypt(encrypted: Buffer, key: string): Promise { + // Get the iv: the first 16 bytes + const iv = encrypted.subarray(0, 16); + // Get the rest + encrypted = encrypted.subarray(16); + // Create a decipher + const decipher = crypto.createDecipheriv(CryptoService.CRYPTO_ALGORITHM, this.getKey(key), iv); + // Actually decrypt it + const result = Buffer.concat([decipher.update(encrypted), decipher.final()]); + return result; } } diff --git a/src/services/private-services/FilesService/FilesService.ts b/src/services/private-services/FilesService/FilesService.ts index 88b1d3b9..8affd988 100644 --- a/src/services/private-services/FilesService/FilesService.ts +++ b/src/services/private-services/FilesService/FilesService.ts @@ -1,16 +1,21 @@ import FilesRepository from "@Repositories/FilesRepository"; import BaseService from "@Services/BaseService"; import { Service } from "typedi"; -import { File } from "le-coffre-resources/dist/SuperAdmin" +import { File } from "le-coffre-resources/dist/SuperAdmin"; import CryptoService from "../CryptoService/CryptoService"; import IpfsService from "../IpfsService/IpfsService"; -//import fs from "fs"; import { BackendVariables } from "@Common/config/variables/Variables"; import { Readable } from "stream"; +import { uuid } from "uuidv4"; @Service() export default class FilesService extends BaseService { - constructor(private filesRepository: FilesRepository, private ipfsService: IpfsService, private variables: BackendVariables, private cryptoService: CryptoService) { + constructor( + private filesRepository: FilesRepository, + private ipfsService: IpfsService, + private variables: BackendVariables, + private cryptoService: CryptoService, + ) { super(); } @@ -22,17 +27,39 @@ export default class FilesService extends BaseService { return this.filesRepository.findMany(query); } + /** + * @description : Get a file by uid + * @throws {Error} If project cannot be created + */ + public async getByUid(uid: string) { + return this.filesRepository.findOneByUid(uid); + } + + /** + * @description : view a file + * @throws {Error} If file cannot be deleted + */ + public async updload(uid: string) { + const file = await this.filesRepository.findOneByUid(uid); + if (!file.key) throw new Error("file deleted"); + const fileResult = await fetch(file.file_path); + const fileContent = await fileResult.arrayBuffer(); + return await this.cryptoService.decrypt(Buffer.from(fileContent), file.key); + } + /** * @description : Create a new file * @throws {Error} If file cannot be created */ public async create(file: File, fileData: Express.Multer.File) { - const upload = await this.ipfsService.pinFile(Readable.from(fileData.buffer), fileData.originalname); - const encryptedPath = await this.cryptoService.encrypt(this.variables.PINATA_GATEWAY.concat(upload.IpfsHash)); - file.file_name = fileData.originalname; - file.file_path = encryptedPath.cipherText; - file.iv = encryptedPath.ivStringified; - return this.filesRepository.create(file); + const key = uuid(); //crypto.getRandomValues(new Uint8Array(16)); + const encryptedFile = await this.cryptoService.encrypt(fileData.buffer, key); + //const encryptedFileName = await this.cryptoService.encrypt(Buffer.from(fileData.originalname, 'utf-8'), key); + const upload = await this.ipfsService.pinFile(Readable.from(encryptedFile), fileData.originalname); + file.file_name = fileData.originalname; //encryptedFileName.toString('utf-8') + file.file_path = this.variables.PINATA_GATEWAY.concat(upload.IpfsHash); + + return this.filesRepository.create(file, key); } /** @@ -48,23 +75,10 @@ export default class FilesService extends BaseService { * @throws {Error} If file cannot be deleted */ public async delete(uid: string) { - try { - const fileToUnpin = await this.filesRepository.findOneByUid(uid); - const decryptedFilePath = await this.cryptoService.decrypt(fileToUnpin.file_path, fileToUnpin.iv); - const fileHash= decryptedFilePath.substring(this.variables.PINATA_GATEWAY.length); - await this.ipfsService.unpinFile(fileHash) - } catch (error) { - console.log(error); - } + const fileToUnpin = await this.filesRepository.findOneByUid(uid); + const fileHash = fileToUnpin.file_path.substring(this.variables.PINATA_GATEWAY.length); + await this.ipfsService.unpinFile(fileHash); return this.filesRepository.delete(uid); } - - /** - * @description : Get a file by uid - * @throws {Error} If project cannot be created - */ - public async getByUid(uid: string) { - return this.filesRepository.findOneByUid(uid); - } } From 6904d1be02ee53aa36371da0ecb5821741f37565 Mon Sep 17 00:00:00 2001 From: OxSaitama Date: Thu, 11 May 2023 08:54:08 +0200 Subject: [PATCH 62/72] remove deprecated method uuid() --- src/services/private-services/FilesService/FilesService.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/private-services/FilesService/FilesService.ts b/src/services/private-services/FilesService/FilesService.ts index 8affd988..8c050c48 100644 --- a/src/services/private-services/FilesService/FilesService.ts +++ b/src/services/private-services/FilesService/FilesService.ts @@ -6,7 +6,7 @@ import CryptoService from "../CryptoService/CryptoService"; import IpfsService from "../IpfsService/IpfsService"; import { BackendVariables } from "@Common/config/variables/Variables"; import { Readable } from "stream"; -import { uuid } from "uuidv4"; +import { v4 } from "uuid"; @Service() export default class FilesService extends BaseService { @@ -52,7 +52,7 @@ export default class FilesService extends BaseService { * @throws {Error} If file cannot be created */ public async create(file: File, fileData: Express.Multer.File) { - const key = uuid(); //crypto.getRandomValues(new Uint8Array(16)); + const key = v4(); const encryptedFile = await this.cryptoService.encrypt(fileData.buffer, key); //const encryptedFileName = await this.cryptoService.encrypt(Buffer.from(fileData.originalname, 'utf-8'), key); const upload = await this.ipfsService.pinFile(Readable.from(encryptedFile), fileData.originalname); From 9c84f995981f54c4dee1c23effc1e57299f6e3c8 Mon Sep 17 00:00:00 2001 From: OxSaitama Date: Thu, 11 May 2023 11:07:59 +0200 Subject: [PATCH 63/72] add archived to files on delete --- package.json | 2 +- .../databases/migrations/20230511085908_v5/migration.sql | 2 ++ src/common/databases/schema.prisma | 3 ++- src/common/databases/seeders/seeder.ts | 2 ++ src/common/repositories/FilesRepository.ts | 3 ++- 5 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 src/common/databases/migrations/20230511085908_v5/migration.sql diff --git a/package.json b/package.json index 7fe55c8c..327677fa 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "cors": "^2.8.5", "express": "^4.18.2", "jsonwebtoken": "^9.0.0", - "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.46", + "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.47", "module-alias": "^2.2.2", "multer": "^1.4.5-lts.1", "next": "^13.1.5", diff --git a/src/common/databases/migrations/20230511085908_v5/migration.sql b/src/common/databases/migrations/20230511085908_v5/migration.sql new file mode 100644 index 00000000..a5b3abcb --- /dev/null +++ b/src/common/databases/migrations/20230511085908_v5/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "files" ADD COLUMN "archived_at" TIMESTAMP(3); diff --git a/src/common/databases/schema.prisma b/src/common/databases/schema.prisma index 4261b9ea..742b331b 100644 --- a/src/common/databases/schema.prisma +++ b/src/common/databases/schema.prisma @@ -39,7 +39,7 @@ model Contacts { cell_phone_number String @unique @db.VarChar(50) civility ECivility @default(MALE) address Addresses? @relation(fields: [address_uid], references: [uid], onDelete: Cascade) - address_uid String? @unique @db.VarChar(255) + address_uid String? @unique @db.VarChar(255) birthdate DateTime? created_at DateTime? @default(now()) updated_at DateTime? @updatedAt @@ -204,6 +204,7 @@ model Files { document_uid String @db.VarChar(255) file_path String @unique @db.VarChar(255) file_name String @db.VarChar(255) + archived_at DateTime? key String? @db.VarChar(255) created_at DateTime? @default(now()) updated_at DateTime? @updatedAt diff --git a/src/common/databases/seeders/seeder.ts b/src/common/databases/seeders/seeder.ts index 999503de..6a3eaf55 100644 --- a/src/common/databases/seeders/seeder.ts +++ b/src/common/databases/seeders/seeder.ts @@ -429,6 +429,7 @@ import { file_name: "fileName1", file_path: "https://www.google1.com", key: '', + archived_at: null, created_at: new Date(), updated_at: new Date(), }, @@ -438,6 +439,7 @@ import { file_name: "fileName2", file_path: "https://www.google2.com", key: '', + archived_at: null, created_at: new Date(), updated_at: new Date(), }, diff --git a/src/common/repositories/FilesRepository.ts b/src/common/repositories/FilesRepository.ts index d48fb7d5..34f2f89c 100644 --- a/src/common/repositories/FilesRepository.ts +++ b/src/common/repositories/FilesRepository.ts @@ -66,7 +66,8 @@ export default class FilesRepository extends BaseRepository { uid: uid, }, data: { - key: null + key: null, + archived_at: new Date(Date.now()) } }); } From d2d2263bd23fe4fc967f8599d37a5febb9621335 Mon Sep 17 00:00:00 2001 From: OxSaitama Date: Thu, 11 May 2023 11:12:58 +0200 Subject: [PATCH 64/72] add error catcher for ipfs --- src/services/private-services/FilesService/FilesService.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/services/private-services/FilesService/FilesService.ts b/src/services/private-services/FilesService/FilesService.ts index 8c050c48..88e5948b 100644 --- a/src/services/private-services/FilesService/FilesService.ts +++ b/src/services/private-services/FilesService/FilesService.ts @@ -75,9 +75,13 @@ export default class FilesService extends BaseService { * @throws {Error} If file cannot be deleted */ public async delete(uid: string) { - const fileToUnpin = await this.filesRepository.findOneByUid(uid); + try { + const fileToUnpin = await this.filesRepository.findOneByUid(uid); const fileHash = fileToUnpin.file_path.substring(this.variables.PINATA_GATEWAY.length); await this.ipfsService.unpinFile(fileHash); + } catch(error) { + console.error(error); + } return this.filesRepository.delete(uid); } From deeddd69446d5537c5779e71566a7c8ffe10950c Mon Sep 17 00:00:00 2001 From: Hugo Lextrait Date: Thu, 11 May 2023 12:35:08 +0200 Subject: [PATCH 65/72] patch seeder 1 --- src/common/databases/seeders/seeder.ts | 46 +++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/src/common/databases/seeders/seeder.ts b/src/common/databases/seeders/seeder.ts index 6a3eaf55..39f8f7cd 100644 --- a/src/common/databases/seeders/seeder.ts +++ b/src/common/databases/seeders/seeder.ts @@ -67,9 +67,13 @@ import { const uidDocument1: string = randomString(); const uidDocument2: string = randomString(); + const uidDocument3: string = randomString(); + const uidDocument4: string = randomString(); + const uidDocument5: string = randomString(); const uidDocumentType1: string = randomString(); const uidDocumentType2: string = randomString(); + const uidDocumentType3: string = randomString(); const uidOfficeFolderHasCustomer1: string = randomString(); const uidOfficeFolderHasCustomer2: string = randomString(); @@ -380,6 +384,36 @@ import { created_at: new Date(), updated_at: new Date(), }, + { + uid: uidDocument3, + blockchain_anchor_uid: null, + depositor_uid: uidCustomer1, + document_status: EDocumentStatus.ASKED, + folder_uid: uidOfficeFolder1, + document_type_uid: uidDocumentType3, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDocument4, + blockchain_anchor_uid: null, + depositor_uid: uidCustomer1, + document_status: EDocumentStatus.ASKED, + folder_uid: uidOfficeFolder1, + document_type_uid: uidDocumentType2, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDocument5, + blockchain_anchor_uid: null, + depositor_uid: uidCustomer1, + document_status: EDocumentStatus.ASKED, + folder_uid: uidOfficeFolder1, + document_type_uid: uidDocumentType1, + created_at: new Date(), + updated_at: new Date(), + }, ]; const documentTypes: DocumentTypes[] = [ @@ -397,7 +431,17 @@ import { uid: uidDocumentType2, archived_at: null, name: "Carte d'identité", - office_uid: uidOffice2, + office_uid: uidOffice1, + private_description: "Ce document est confidentiel, demander un recto-verso au client", + public_description: "Carte d'identité est un document officiel qui atteste de l'identité d'une personne", + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDocumentType3, + archived_at: null, + name: "Autres documents", + office_uid: uidOffice1, private_description: "Ce document est confidentiel, demander un recto-verso au client", public_description: "Carte d'identité est un document officiel qui atteste de l'identité d'une personne", created_at: new Date(), From fea447192306d35ae89002c5a13b514a9859cdb6 Mon Sep 17 00:00:00 2001 From: Vincent Alamelle Date: Thu, 11 May 2023 13:49:44 +0200 Subject: [PATCH 66/72] seeder v2 --- package-lock.json | 35 +- package.json | 2 +- src/common/databases/seeders/seeder2.ts | 1380 +++++++++++++++++++++++ 3 files changed, 1410 insertions(+), 7 deletions(-) create mode 100644 src/common/databases/seeders/seeder2.ts diff --git a/package-lock.json b/package-lock.json index 6e8150bc..2b3ba769 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "cors": "^2.8.5", "express": "^4.18.2", "jsonwebtoken": "^9.0.0", - "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.44", + "le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.47", "module-alias": "^2.2.2", "multer": "^1.4.5-lts.1", "next": "^13.1.5", @@ -29,7 +29,8 @@ "tslib": "^2.4.1", "typedi": "^0.10.0", "typescript": "^4.9.4", - "uuid": "^9.0.0" + "uuid": "^9.0.0", + "uuidv4": "^6.2.13" }, "devDependencies": { "@types/cors": "^2.8.13", @@ -2371,9 +2372,9 @@ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" }, "node_modules/electron-to-chromium": { - "version": "1.4.389", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.389.tgz", - "integrity": "sha512-WDgWUOK8ROR7sDFyYmxCUOoDc50lPgYAHAHwnnD1iN3SKO/mpqftb9iIPiEkMKmqYdkrR0j3N/O+YB/U7lSxwg==", + "version": "1.4.391", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.391.tgz", + "integrity": "sha512-GqydVV1+kUWY5qlEzaw34/hyWTApuQrHiGrcGA2Kk/56nEK44i+YUW45VH43JuZT0Oo7uY8aVtpPhBBZXEWtSA==", "dev": true }, "node_modules/emittery": { @@ -3861,7 +3862,7 @@ } }, "node_modules/le-coffre-resources": { - "resolved": "git+ssh://git@github.com/smart-chain-fr/leCoffre-resources.git#30c8ee50b872a8bc6bec0f5d8c4626d8f4490177", + "resolved": "git+ssh://git@github.com/smart-chain-fr/leCoffre-resources.git#467b34a484adbd6dfa3fd6082bb7677f6178da51", "license": "MIT", "dependencies": { "class-transformer": "^0.5.1", @@ -5666,6 +5667,28 @@ "uuid": "dist/bin/uuid" } }, + "node_modules/uuidv4": { + "version": "6.2.13", + "resolved": "https://registry.npmjs.org/uuidv4/-/uuidv4-6.2.13.tgz", + "integrity": "sha512-AXyzMjazYB3ovL3q051VLH06Ixj//Knx7QnUSi1T//Ie3io6CpsPu9nVMOx5MoLWh6xV0B9J0hIaxungxXUbPQ==", + "dependencies": { + "@types/uuid": "8.3.4", + "uuid": "8.3.2" + } + }, + "node_modules/uuidv4/node_modules/@types/uuid": { + "version": "8.3.4", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.4.tgz", + "integrity": "sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw==" + }, + "node_modules/uuidv4/node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", diff --git a/package.json b/package.json index 327677fa..9442b3d8 100644 --- a/package.json +++ b/package.json @@ -81,6 +81,6 @@ }, "prisma": { "schema": "src/common/databases/schema.prisma", - "seed": "ts-node src/common/databases/seeders/seeder.ts" + "seed": "ts-node src/common/databases/seeders/seeder2.ts" } } diff --git a/src/common/databases/seeders/seeder2.ts b/src/common/databases/seeders/seeder2.ts new file mode 100644 index 00000000..53413da8 --- /dev/null +++ b/src/common/databases/seeders/seeder2.ts @@ -0,0 +1,1380 @@ +import { + Addresses, + Contacts, + Customers, + DeedHasDocumentTypes, + DeedTypeHasDocumentTypes, + DeedTypes, + Deeds, + DocumentHistory, + DocumentTypes, + Documents, + EDocumentStatus, + EFolderStatus, + EOfficeStatus, + Files, + OfficeFolderHasCustomers, + OfficeFolders, + Offices, + Users, + ECivility, + ECustomerStatus, + PrismaClient, +} from "@prisma/client"; + +(async () => { + const prisma = new PrismaClient(); + + const existingData = await prisma.contacts.findFirst({ where: { email: "john.doe@example.com" } }); + if (existingData) { + console.log("Seed data already exists. Skipping seeding process."); + return; + } + + const randomString = () => { + const chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; + let result = ""; + for (let i = 10; i > 0; --i) result += chars[Math.floor(Math.random() * chars.length)]; + return result; + }; + const uidCustomer1: string = randomString(); + const uidCustomer2: string = randomString(); + const uidCustomer3: string = randomString(); + const uidCustomer4: string = randomString(); + const uidCustomer5: string = randomString(); + const uidCustomer6: string = randomString(); + const uidCustomer7: string = randomString(); + const uidCustomer8: string = randomString(); + const uidCustomer9: string = randomString(); + const uidCustomer10: string = randomString(); + const uidCustomer11: string = randomString(); + const uidCustomer12: string = randomString(); + const uidCustomer13: string = randomString(); + const uidCustomer14: string = randomString(); + const uidCustomer15: string = randomString(); + + const uidContact1: string = randomString(); + const uidContact2: string = randomString(); + const uidContact3: string = randomString(); + const uidContact4: string = randomString(); + const uidContact5: string = randomString(); + const uidContact6: string = randomString(); + const uidContact7: string = randomString(); + const uidContact8: string = randomString(); + const uidContact9: string = randomString(); + const uidContact10: string = randomString(); + const uidContact11: string = randomString(); + const uidContact12: string = randomString(); + const uidContact13: string = randomString(); + const uidContact14: string = randomString(); + const uidContact15: string = randomString(); + const uidContact16: string = randomString(); + const uidContact17: string = randomString(); + const uidContact18: string = randomString(); + const uidContact19: string = randomString(); + const uidContact20: string = randomString(); + + const uidAddress1: string = randomString(); + const uidAddress2: string = randomString(); + const uidAddress3: string = randomString(); + const uidAddress4: string = randomString(); + const uidAddress5: string = randomString(); + const uidAddress6: string = randomString(); + const uidAddress7: string = randomString(); + const uidAddress8: string = randomString(); + const uidAddress9: string = randomString(); + const uidAddress10: string = randomString(); + const uidAddress11: string = randomString(); + const uidAddress12: string = randomString(); + const uidAddress13: string = randomString(); + const uidAddress14: string = randomString(); + const uidAddress15: string = randomString(); + const uidAddress16: string = randomString(); + const uidAddress17: string = randomString(); + const uidAddress18: string = randomString(); + const uidAddress19: string = randomString(); + const uidAddress20: string = randomString(); + + const uidOffice1: string = randomString(); + + const uidUser1: string = randomString(); + const uidUser2: string = randomString(); + const uidUser3: string = randomString(); + const uidUser4: string = randomString(); + const uidUser5: string = randomString(); + + const uidOfficeFolder1: string = randomString(); + const uidOfficeFolder2: string = randomString(); + const uidOfficeFolder3: string = randomString(); + const uidOfficeFolder4: string = randomString(); + const uidOfficeFolder5: string = randomString(); + const uidOfficeFolder6: string = randomString(); + const uidOfficeFolder7: string = randomString(); + const uidOfficeFolder8: string = randomString(); + const uidOfficeFolder9: string = randomString(); + const uidOfficeFolder10: string = randomString(); + const uidOfficeFolder11: string = randomString(); + const uidOfficeFolder12: string = randomString(); + const uidOfficeFolder13: string = randomString(); + const uidOfficeFolder14: string = randomString(); + const uidOfficeFolder15: string = randomString(); + const uidOfficeFolder16: string = randomString(); + const uidOfficeFolder17: string = randomString(); + const uidOfficeFolder18: string = randomString(); + const uidOfficeFolder19: string = randomString(); + const uidOfficeFolder20: string = randomString(); + + const uidDeed1: string = randomString(); + const uidDeed2: string = randomString(); + const uidDeed3: string = randomString(); + const uidDeed4: string = randomString(); + const uidDeed5: string = randomString(); + const uidDeed6: string = randomString(); + const uidDeed7: string = randomString(); + const uidDeed8: string = randomString(); + const uidDeed9: string = randomString(); + const uidDeed10: string = randomString(); + const uidDeed11: string = randomString(); + const uidDeed12: string = randomString(); + const uidDeed13: string = randomString(); + const uidDeed14: string = randomString(); + const uidDeed15: string = randomString(); + const uidDeed16: string = randomString(); + const uidDeed17: string = randomString(); + const uidDeed18: string = randomString(); + const uidDeed19: string = randomString(); + const uidDeed20: string = randomString(); + + + const uidDeedType1: string = randomString(); + const uidDeedType2: string = randomString(); + const uidDeedType3: string = randomString(); + const uidDeedType4: string = randomString(); + const uidDeedType5: string = randomString(); + + const uidDocument1: string = randomString(); + const uidDocument2: string = randomString(); + + const uidDocumentType1: string = randomString(); + const uidDocumentType2: string = randomString(); + + const uidOfficeFolderHasCustomer1: string = randomString(); + const uidOfficeFolderHasCustomer2: string = randomString(); + + const uidFiles1: string = randomString(); + const uidFiles2: string = randomString(); + + const uidDeedHasDocumentType1: string = randomString(); + const uidDeedHasDocumentType2: string = randomString(); + + const uidDeedTypeHasDocumentType1: string = randomString(); + const uidDeedTypeHasDocumentType2: string = randomString(); + + const uidDocumentHistory1: string = randomString(); + const uidDocumentHistory2: string = randomString(); + + const customers: Customers[] = [ + { + uid: uidCustomer1, + contact_uid: uidContact1, + created_at: new Date(), + updated_at: new Date(), + status: ECustomerStatus.PENDING, + }, + { + uid: uidCustomer2, + contact_uid: uidContact2, + created_at: new Date(), + updated_at: new Date(), + status: ECustomerStatus.PENDING, + }, + { + uid: uidCustomer3, + contact_uid: uidContact3, + created_at: new Date(), + updated_at: new Date(), + status: ECustomerStatus.PENDING, + }, + { + uid: uidCustomer4, + contact_uid: uidContact4, + created_at: new Date(), + updated_at: new Date(), + status: ECustomerStatus.PENDING, + }, + { + uid: uidCustomer5, + contact_uid: uidContact5, + created_at: new Date(), + updated_at: new Date(), + status: ECustomerStatus.PENDING, + }, + { + uid: uidCustomer6, + contact_uid: uidContact6, + created_at: new Date(), + updated_at: new Date(), + status: ECustomerStatus.PENDING, + }, + { + uid: uidCustomer7, + contact_uid: uidContact7, + created_at: new Date(), + updated_at: new Date(), + status: ECustomerStatus.PENDING, + }, + { + uid: uidCustomer8, + contact_uid: uidContact8, + created_at: new Date(), + updated_at: new Date(), + status: ECustomerStatus.PENDING, + }, + { + uid: uidCustomer9, + contact_uid: uidContact9, + created_at: new Date(), + updated_at: new Date(), + status: ECustomerStatus.PENDING, + }, + { + uid: uidCustomer10, + contact_uid: uidContact10, + created_at: new Date(), + updated_at: new Date(), + status: ECustomerStatus.PENDING, + }, + { + uid: uidCustomer11, + contact_uid: uidContact11, + created_at: new Date(), + updated_at: new Date(), + status: ECustomerStatus.PENDING, + }, + { + uid: uidCustomer12, + contact_uid: uidContact12, + created_at: new Date(), + updated_at: new Date(), + status: ECustomerStatus.PENDING, + }, + { + uid: uidCustomer13, + contact_uid: uidContact13, + created_at: new Date(), + updated_at: new Date(), + status: ECustomerStatus.PENDING, + }, + { + uid: uidCustomer14, + contact_uid: uidContact14, + created_at: new Date(), + updated_at: new Date(), + status: ECustomerStatus.PENDING, + }, + { + uid: uidCustomer15, + contact_uid: uidContact15, + created_at: new Date(), + updated_at: new Date(), + status: ECustomerStatus.PENDING, + }, + ]; + + const addresses: Addresses[] = [ + { + uid: uidAddress1, + address: "123 Main St", + city: "Los Angeles", + zip_code: 35000, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidAddress2, + address: "Rue Pierre Emillion", + city: "Pacé", + zip_code: 35740, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidAddress3, + address: "Rue Pierre Charles", + city: "Rennes", + zip_code: 35000, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidAddress4, + address: "Rue Pierre Pologne", + city: "Rennes", + zip_code: 35000, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidAddress5, + address: "Rue Pierre Marcel", + city: "Rennes", + zip_code: 35000, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidAddress6, + address: "Rue Pierre Jacques", + city: "Rennes", + zip_code: 35000, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidAddress7, + address: "Rue Pierre Pascal", + city: "Rennes", + zip_code: 35000, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidAddress8, + address: "Rue Pierre Pologne", + city: "Rennes", + zip_code: 35000, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidAddress9, + address: "Rue Pierre Pologne", + city: "Rennes", + zip_code: 35000, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidAddress10, + address: "Rue Pierre Pologne", + city: "Rennes", + zip_code: 35000, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidAddress11, + address: "Rue Pierre Pologne", + city: "Rennes", + zip_code: 35000, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidAddress12, + address: "Rue Pierre Pologne", + city: "Rennes", + zip_code: 35000, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidAddress13, + address: "Rue Pierre Pologne", + city: "Rennes", + zip_code: 35000, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidAddress14, + address: "Rue Pierre Pologne", + city: "Rennes", + zip_code: 35000, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidAddress15, + address: "Rue Pierre Pologne", + city: "Rennes", + zip_code: 35000, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidAddress16, + address: "Rue Pierre Pologne", + city: "Rennes", + zip_code: 35000, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidAddress17, + address: "Rue Pierre Pologne", + city: "Rennes", + zip_code: 35000, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidAddress18, + address: "Rue Pierre Pologne", + city: "Rennes", + zip_code: 35000, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidAddress19, + address: "Rue Pierre Pologne", + city: "Rennes", + zip_code: 35000, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidAddress20, + address: "Rue Pierre Pologne", + city: "Rennes", + zip_code: 35000, + created_at: new Date(), + updated_at: new Date(), + }, + + ]; + + const contacts: Contacts[] = [ + { + uid: uidContact1, + address_uid: uidAddress1, + first_name: "John", + last_name: "Doe", + email: "john.doe@example.com", + phone_number: randomString(), + cell_phone_number: randomString(), + birthdate: null, + created_at: new Date(), + updated_at: new Date(), + civility: ECivility.MALE, + }, + { + uid: uidContact2, + address_uid: uidAddress2, + first_name: "Jane", + last_name: "Doe", + email: "jane.doe@example.com", + phone_number: randomString(), + cell_phone_number: randomString(), + birthdate: null, + created_at: new Date(), + updated_at: new Date(), + civility: ECivility.FEMALE, + }, + { + uid: uidContact3, + address_uid: uidAddress3, + first_name: "Maitre Marcelino", + last_name: "Jack", + email: "Marcelino.Jack@example.com", + phone_number: randomString(), + cell_phone_number: randomString(), + birthdate: null, + created_at: new Date(), + updated_at: new Date(), + civility: ECivility.MALE, + }, + { + uid: uidContact4, + address_uid: uidAddress4, + first_name: "Maitre Massi", + last_name: "Jack", + email: "Massi.Jack19@example.com", + phone_number: randomString(), + cell_phone_number: randomString(), + birthdate: null, + created_at: new Date(), + updated_at: new Date(), + civility: ECivility.FEMALE, + }, + { + uid: uidContact5, + address_uid: uidAddress5, + first_name: "Maitre Massi", + last_name: "Jack", + email: "Massi.Jack18@example.com", + phone_number: randomString(), + cell_phone_number: randomString(), + birthdate: null, + created_at: new Date(), + updated_at: new Date(), + civility: ECivility.FEMALE, + }, + { + uid: uidContact6, + address_uid: uidAddress6, + first_name: "Maitre Massi", + last_name: "Jack", + email: "Massi.Jack2@example.com", + phone_number: randomString(), + cell_phone_number: randomString(), + birthdate: null, + created_at: new Date(), + updated_at: new Date(), + civility: ECivility.FEMALE, + }, + { + uid: uidContact7, + address_uid: uidAddress7, + first_name: "Maitre Massi", + last_name: "Jack", + email: "Massi.Jack3@example.com", + phone_number: randomString(), + cell_phone_number: randomString(), + birthdate: null, + created_at: new Date(), + updated_at: new Date(), + civility: ECivility.FEMALE, + }, + { + uid: uidContact8, + address_uid: uidAddress8, + first_name: "Maitre Massi", + last_name: "Jack", + email: "Massi.Jack4@example.com", + phone_number: randomString(), + cell_phone_number: randomString(), + birthdate: null, + created_at: new Date(), + updated_at: new Date(), + civility: ECivility.FEMALE, + }, + { + uid: uidContact9, + address_uid: uidAddress9, + first_name: "Maitre Massi", + last_name: "Jack", + email: "Massi.Jack5@example.com", + phone_number: randomString(), + cell_phone_number: randomString(), + birthdate: null, + created_at: new Date(), + updated_at: new Date(), + civility: ECivility.FEMALE, + }, + { + uid: uidContact10, + address_uid: uidAddress10, + first_name: "Maitre Massi", + last_name: "Jack", + email: "Massi.Jack6@example.com", + phone_number: randomString(), + cell_phone_number: randomString(), + birthdate: null, + created_at: new Date(), + updated_at: new Date(), + civility: ECivility.FEMALE, + }, + { + uid: uidContact11, + address_uid: uidAddress11, + first_name: "Maitre Massi", + last_name: "Jack", + email: "Massi.Jack7@example.com", + phone_number: randomString(), + cell_phone_number: randomString(), + birthdate: null, + created_at: new Date(), + updated_at: new Date(), + civility: ECivility.FEMALE, + }, + { + uid: uidContact12, + address_uid: uidAddress12, + first_name: "Maitre Massi", + last_name: "Jack", + email: "Massi.Jack8@example.com", + phone_number: randomString(), + cell_phone_number: randomString(), + birthdate: null, + created_at: new Date(), + updated_at: new Date(), + civility: ECivility.FEMALE, + }, + { + uid: uidContact13, + address_uid: uidAddress13, + first_name: "Maitre Massi", + last_name: "Jack", + email: "Massi.Jack9@example.com", + phone_number: randomString(), + cell_phone_number: randomString(), + birthdate: null, + created_at: new Date(), + updated_at: new Date(), + civility: ECivility.FEMALE, + }, + { + uid: uidContact14, + address_uid: uidAddress14, + first_name: "Maitre Massi", + last_name: "Jack", + email: "Massi.Jack10@example.com", + phone_number: randomString(), + cell_phone_number: randomString(), + birthdate: null, + created_at: new Date(), + updated_at: new Date(), + civility: ECivility.FEMALE, + }, + { + uid: uidContact15, + address_uid: uidAddress15, + first_name: "Maitre Massi", + last_name: "Jack", + email: "Massi.Jack11@example.com", + phone_number: randomString(), + cell_phone_number: randomString(), + birthdate: null, + created_at: new Date(), + updated_at: new Date(), + civility: ECivility.FEMALE, + }, + { + uid: uidContact16, + address_uid: uidAddress16, + first_name: "Maitre Massi", + last_name: "Jack", + email: "Massi.Jack12@example.com", + phone_number: randomString(), + cell_phone_number: randomString(), + birthdate: null, + created_at: new Date(), + updated_at: new Date(), + civility: ECivility.FEMALE, + }, + { + uid: uidContact17, + address_uid: uidAddress17, + first_name: "Maitre Massi", + last_name: "Jack", + email: "Massi.Jack13@example.com", + phone_number: randomString(), + cell_phone_number: randomString(), + birthdate: null, + created_at: new Date(), + updated_at: new Date(), + civility: ECivility.FEMALE, + }, + { + uid: uidContact18, + address_uid: uidAddress18, + first_name: "Maitre Massi", + last_name: "Jack", + email: "Massi.Jack14@example.com", + phone_number: randomString(), + cell_phone_number: randomString(), + birthdate: null, + created_at: new Date(), + updated_at: new Date(), + civility: ECivility.FEMALE, + }, + { + uid: uidContact19, + address_uid: uidAddress19, + first_name: "Maitre Massi", + last_name: "Jack", + email: "Massi.Jack15@example.com", + phone_number: randomString(), + cell_phone_number: randomString(), + birthdate: null, + created_at: new Date(), + updated_at: new Date(), + civility: ECivility.FEMALE, + }, + { + uid: uidContact20, + address_uid: uidAddress20, + first_name: "Maitre Massi", + last_name: "Jack", + email: "Massi.Jack16@example.com", + phone_number: randomString(), + cell_phone_number: randomString(), + birthdate: null, + created_at: new Date(), + updated_at: new Date(), + civility: ECivility.FEMALE, + }, + ]; + + const offices: Offices[] = [ + { + uid: uidOffice1, + idNot: randomString(), + name: "LA Office", + crpcen: randomString(), + address_uid: uidAddress1, + created_at: new Date(), + updated_at: new Date(), + office_status: EOfficeStatus.ACTIVATED, + } + ]; + + const users: Users[] = [ + { + uid: uidUser1, + created_at: new Date(), + updated_at: new Date(), + idNot: randomString(), + contact_uid: uidContact16, + office_uid: uidOffice1, + }, + { + uid: uidUser2, + created_at: new Date(), + updated_at: new Date(), + idNot: randomString(), + contact_uid: uidContact17, + office_uid: uidOffice1, + }, + { + uid: uidUser3, + created_at: new Date(), + updated_at: new Date(), + idNot: randomString(), + contact_uid: uidContact18, + office_uid: uidOffice1, + }, + { + uid: uidUser4, + created_at: new Date(), + updated_at: new Date(), + idNot: randomString(), + contact_uid: uidContact19, + office_uid: uidOffice1, + }, + { + uid: uidUser5, + created_at: new Date(), + updated_at: new Date(), + idNot: randomString(), + contact_uid: uidContact20, + office_uid: uidOffice1, + }, + ]; + + const officeFolders: OfficeFolders[] = [ + { + uid: uidOfficeFolder1, + folder_number: "0001", + name: "Dossier", + deed_uid: uidDeed1, + status: EFolderStatus.LIVE, + created_at: new Date(), + updated_at: new Date(), + office_uid: uidOffice1, + description: null, + archived_description: null, + }, + { + uid: uidOfficeFolder2, + folder_number: "0002", + name: "Dossier", + deed_uid: uidDeed2, + status: EFolderStatus.LIVE, + created_at: new Date(), + updated_at: new Date(), + office_uid: uidOffice1, + description: null, + archived_description: null, + }, + { + uid: uidOfficeFolder3, + folder_number: "0003", + name: "Dossier", + deed_uid: uidDeed3, + status: EFolderStatus.LIVE, + created_at: new Date(), + updated_at: new Date(), + office_uid: uidOffice1, + description: null, + archived_description: null, + }, + { + uid: uidOfficeFolder4, + folder_number: "0004", + name: "Dossier", + deed_uid: uidDeed4, + status: EFolderStatus.ARCHIVED, + created_at: new Date(), + updated_at: new Date(), + office_uid: uidOffice1, + description: null, + archived_description: null, + }, + { + uid: uidOfficeFolder5, + folder_number: "0005", + name: "Dossier", + deed_uid: uidDeed5, + status: EFolderStatus.ARCHIVED, + created_at: new Date(), + updated_at: new Date(), + office_uid: uidOffice1, + description: null, + archived_description: null, + }, + { + uid: uidOfficeFolder6, + folder_number: "0006", + name: "Dossier", + deed_uid: uidDeed6, + status: EFolderStatus.LIVE, + created_at: new Date(), + updated_at: new Date(), + office_uid: uidOffice1, + description: null, + archived_description: null, + }, + { + uid: uidOfficeFolder7, + folder_number: "0007", + name: "Dossier", + deed_uid: uidDeed7, + status: EFolderStatus.LIVE, + created_at: new Date(), + updated_at: new Date(), + office_uid: uidOffice1, + description: null, + archived_description: null, + }, + { + uid: uidOfficeFolder8, + folder_number: "0008", + name: "Dossier", + deed_uid: uidDeed8, + status: EFolderStatus.LIVE, + created_at: new Date(), + updated_at: new Date(), + office_uid: uidOffice1, + description: null, + archived_description: null, + }, + { + uid: uidOfficeFolder9, + folder_number: "0009", + name: "Dossier", + deed_uid: uidDeed9, + status: EFolderStatus.LIVE, + created_at: new Date(), + updated_at: new Date(), + office_uid: uidOffice1, + description: null, + archived_description: null, + }, + { + uid: uidOfficeFolder10, + folder_number: "00010", + name: "Dossier", + deed_uid: uidDeed10, + status: EFolderStatus.LIVE, + created_at: new Date(), + updated_at: new Date(), + office_uid: uidOffice1, + description: null, + archived_description: null, + }, + { + uid: uidOfficeFolder11, + folder_number: "00011", + name: "Dossier", + deed_uid: uidDeed11, + status: EFolderStatus.LIVE, + created_at: new Date(), + updated_at: new Date(), + office_uid: uidOffice1, + description: null, + archived_description: null, + }, + { + uid: uidOfficeFolder12, + folder_number: "00012", + name: "Dossier", + deed_uid: uidDeed12, + status: EFolderStatus.LIVE, + created_at: new Date(), + updated_at: new Date(), + office_uid: uidOffice1, + description: null, + archived_description: null, + }, + { + uid: uidOfficeFolder13, + folder_number: "00013", + name: "Dossier", + deed_uid: uidDeed13, + status: EFolderStatus.LIVE, + created_at: new Date(), + updated_at: new Date(), + office_uid: uidOffice1, + description: null, + archived_description: null, + }, + { + uid: uidOfficeFolder14, + folder_number: "00014", + name: "Dossier", + deed_uid: uidDeed14, + status: EFolderStatus.LIVE, + created_at: new Date(), + updated_at: new Date(), + office_uid: uidOffice1, + description: null, + archived_description: null, + }, + { + uid: uidOfficeFolder15, + folder_number: "00015", + name: "Dossier", + deed_uid: uidDeed15, + status: EFolderStatus.LIVE, + created_at: new Date(), + updated_at: new Date(), + office_uid: uidOffice1, + description: null, + archived_description: null, + }, + { + uid: uidOfficeFolder16, + folder_number: "00016", + name: "Dossier", + deed_uid: uidDeed16, + status: EFolderStatus.LIVE, + created_at: new Date(), + updated_at: new Date(), + office_uid: uidOffice1, + description: null, + archived_description: null, + }, + { + uid: uidOfficeFolder17, + folder_number: "00017", + name: "Dossier", + deed_uid: uidDeed17, + status: EFolderStatus.LIVE, + created_at: new Date(), + updated_at: new Date(), + office_uid: uidOffice1, + description: null, + archived_description: null, + }, + { + uid: uidOfficeFolder18, + folder_number: "00018", + name: "Dossier", + deed_uid: uidDeed18, + status: EFolderStatus.LIVE, + created_at: new Date(), + updated_at: new Date(), + office_uid: uidOffice1, + description: null, + archived_description: null, + }, + { + uid: uidOfficeFolder19, + folder_number: "00019", + name: "Dossier", + deed_uid: uidDeed19, + status: EFolderStatus.LIVE, + created_at: new Date(), + updated_at: new Date(), + office_uid: uidOffice1, + description: null, + archived_description: null, + }, + { + uid: uidOfficeFolder20, + folder_number: "00020", + name: "Dossier", + deed_uid: uidDeed20, + status: EFolderStatus.LIVE, + created_at: new Date(), + updated_at: new Date(), + office_uid: uidOffice1, + description: null, + archived_description: null, + }, + ]; + + const deeds: Deeds[] = [ + { + uid: uidDeed1, + deed_type_uid: uidDeedType1, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeed2, + deed_type_uid: uidDeedType2, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeed3, + deed_type_uid: uidDeedType2, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeed4, + deed_type_uid: uidDeedType2, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeed5, + deed_type_uid: uidDeedType2, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeed6, + deed_type_uid: uidDeedType2, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeed7, + deed_type_uid: uidDeedType2, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeed8, + deed_type_uid: uidDeedType2, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeed9, + deed_type_uid: uidDeedType2, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeed10, + deed_type_uid: uidDeedType2, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeed11, + deed_type_uid: uidDeedType2, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeed12, + deed_type_uid: uidDeedType2, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeed13, + deed_type_uid: uidDeedType2, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeed14, + deed_type_uid: uidDeedType2, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeed15, + deed_type_uid: uidDeedType2, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeed16, + deed_type_uid: uidDeedType2, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeed17, + deed_type_uid: uidDeedType2, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeed18, + deed_type_uid: uidDeedType2, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeed19, + deed_type_uid: uidDeedType2, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeed20, + deed_type_uid: uidDeedType2, + created_at: new Date(), + updated_at: new Date(), + }, + ]; + + const deedTypes: DeedTypes[] = [ + { + uid: uidDeedType1, + name: "Acte de mariage", + archived_at: null, + description: "Acte regroupant deux personnes en mariage", + office_uid: uidOffice1, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedType2, + name: "Vente d'un bien immobilier", + archived_at: null, + description: "Permet de vendre un bien immobilier à une entité ou une personne physique", + office_uid: uidOffice1, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedType3, + name: "Deed Type 3", + archived_at: null, + description: "Deed type 3", + office_uid: uidOffice1, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedType4, + name: "Deed Type 4", + archived_at: null, + description: "Deed type 4", + office_uid: uidOffice1, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedType5, + name: "Deed Type 5", + archived_at: null, + description: "Deed type 5", + office_uid: uidOffice1, + created_at: new Date(), + updated_at: new Date(), + }, + ]; + + const documents: Documents[] = [ + { + uid: uidDocument1, + blockchain_anchor_uid: null, + depositor_uid: uidCustomer1, + document_status: EDocumentStatus.DEPOSITED, + folder_uid: uidOfficeFolder1, + document_type_uid: uidDocumentType1, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDocument2, + blockchain_anchor_uid: null, + depositor_uid: uidCustomer2, + document_status: EDocumentStatus.ASKED, + folder_uid: uidOfficeFolder2, + document_type_uid: uidDocumentType2, + created_at: new Date(), + updated_at: new Date(), + }, + ]; + + const documentTypes: DocumentTypes[] = [ + { + uid: uidDocumentType1, + archived_at: null, + name: "Acte de naissance", + office_uid: uidOffice1, + private_description: "Ce document est confidentiel, et ne doit pas être divulgué", + public_description: "Acte de naissance est un document officiel qui atteste de la naissance d'une personne", + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDocumentType2, + archived_at: null, + name: "Carte d'identité", + office_uid: uidOffice1, + private_description: "Ce document est confidentiel, demander un recto-verso au client", + public_description: "Carte d'identité est un document officiel qui atteste de l'identité d'une personne", + created_at: new Date(), + updated_at: new Date(), + }, + ]; + + const officeFolderHasCustomers: OfficeFolderHasCustomers[] = [ + { + uid: uidOfficeFolderHasCustomer1, + customer_uid: uidCustomer1, + office_folder_uid: uidOfficeFolder1, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidOfficeFolderHasCustomer2, + customer_uid: uidCustomer2, + office_folder_uid: uidOfficeFolder2, + created_at: new Date(), + updated_at: new Date(), + }, + ]; + + const files: Files[] = [ + { + uid: uidFiles1, + document_uid: uidDocument1, + file_name: "fileName1", + file_path: "https://www.google1.com", + key: '', + archived_at: null, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidFiles2, + document_uid: uidDocument2, + file_name: "fileName1", + file_path: "https://www.google2.com", + key: '', + archived_at: null, + created_at: new Date(), + updated_at: new Date(), + }, + ]; + + const deedHasDocumentTypes: DeedHasDocumentTypes[] = [ + { + uid: uidDeedHasDocumentType1, + deed_uid: uidDeed1, + document_type_uid: uidDocumentType1, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType2, + deed_uid: uidDeed2, + document_type_uid: uidDocumentType2, + created_at: new Date(), + updated_at: new Date(), + }, + ]; + + const deedTypeHasDocumentTypes: DeedTypeHasDocumentTypes[] = [ + { + uid: uidDeedTypeHasDocumentType1, + deed_type_uid: uidDeedType1, + document_type_uid: uidDocumentType1, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedTypeHasDocumentType2, + deed_type_uid: uidDeedType2, + document_type_uid: uidDocumentType2, + created_at: new Date(), + updated_at: new Date(), + }, + ]; + + const documentHistories: DocumentHistory[] = [ + { + uid: uidDocumentHistory1, + document_status: EDocumentStatus.ASKED, + document_uid: uidDocument1, + refused_reason: "", + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDocumentHistory2, + document_status: EDocumentStatus.DEPOSITED, + document_uid: uidDocument1, + refused_reason: "Le document n'est pas conforme", + created_at: new Date(), + updated_at: new Date(), + }, + ]; + + for (const address of addresses) { + await prisma.addresses.create({ data: address }); + } + + for (const contact of contacts) { + await prisma.contacts.create({ data: contact }); + } + + for (const office of offices) { + await prisma.offices.create({ data: office }); + } + + for (const user of users) { + await prisma.users.create({ data: user }); + } + + for (const customer of customers) { + await prisma.customers.create({ data: customer }); + } + + for (const deedType of deedTypes) { + await prisma.deedTypes.create({ data: deedType }); + } + + for (const deed of deeds) { + await prisma.deeds.create({ data: deed }); + } + for (const officeFolder of officeFolders) { + await prisma.officeFolders.create({ data: officeFolder }); + } + + for (const documentType of documentTypes) { + await prisma.documentTypes.create({ data: documentType }); + } + + for (const document of documents) { + await prisma.documents.create({ data: document }); + } + + for (const file of files) { + await prisma.files.create({ data: file }); + } + + for (const documentHistory of documentHistories) { + await prisma.documentHistory.create({ data: documentHistory }); + } + + for (const officeFolderHasCustomer of officeFolderHasCustomers) { + await prisma.officeFolderHasCustomers.create({ data: officeFolderHasCustomer }); + } + + for (const deedHasDocumentType of deedHasDocumentTypes) { + await prisma.deedHasDocumentTypes.create({ data: deedHasDocumentType }); + } + + for (const deedTypeHasDocumentType of deedTypeHasDocumentTypes) { + await prisma.deedTypeHasDocumentTypes.create({ data: deedTypeHasDocumentType }); + } + + console.log(">MOCK DATA - Seeding completed!"); +})(); From 23eb8aecc44a9d40122deb4a82036f541055861d Mon Sep 17 00:00:00 2001 From: Vincent Alamelle Date: Thu, 11 May 2023 14:16:16 +0200 Subject: [PATCH 67/72] Seeder v2 update --- package.json | 2 +- src/common/databases/seeders/seeder2.ts | 266 ++++++++++++------------ 2 files changed, 134 insertions(+), 134 deletions(-) diff --git a/package.json b/package.json index 9442b3d8..8f6c3f38 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "@Test": "./dist/test" }, "scripts": { - "build-db": "npx prisma migrate dev && node ./dist/common/databases/seeders/seeder.js", + "build-db": "npx prisma migrate dev", "build": "tsc", "start": "node ./dist/entries/App.js", "api:start": "npm run migrate && npm run start", diff --git a/src/common/databases/seeders/seeder2.ts b/src/common/databases/seeders/seeder2.ts index 53413da8..3ad9520e 100644 --- a/src/common/databases/seeders/seeder2.ts +++ b/src/common/databases/seeders/seeder2.ts @@ -284,8 +284,8 @@ import { const addresses: Addresses[] = [ { uid: uidAddress1, - address: "123 Main St", - city: "Los Angeles", + address: "148 Avenue du bac", + city: "Rennes", zip_code: 35000, created_at: new Date(), updated_at: new Date(), @@ -340,7 +340,7 @@ import { }, { uid: uidAddress8, - address: "Rue Pierre Pologne", + address: "Rue Maxime Henry", city: "Rennes", zip_code: 35000, created_at: new Date(), @@ -348,7 +348,7 @@ import { }, { uid: uidAddress9, - address: "Rue Pierre Pologne", + address: "Rue Maxime Francis", city: "Rennes", zip_code: 35000, created_at: new Date(), @@ -356,7 +356,7 @@ import { }, { uid: uidAddress10, - address: "Rue Pierre Pologne", + address: "Avenue Paul Roger", city: "Rennes", zip_code: 35000, created_at: new Date(), @@ -364,7 +364,7 @@ import { }, { uid: uidAddress11, - address: "Rue Pierre Pologne", + address: "Avenue Paul Franck", city: "Rennes", zip_code: 35000, created_at: new Date(), @@ -372,7 +372,7 @@ import { }, { uid: uidAddress12, - address: "Rue Pierre Pologne", + address: "Avenue Paul Maréchal", city: "Rennes", zip_code: 35000, created_at: new Date(), @@ -380,7 +380,7 @@ import { }, { uid: uidAddress13, - address: "Rue Pierre Pologne", + address: "Avenue Marcel Denis", city: "Rennes", zip_code: 35000, created_at: new Date(), @@ -388,7 +388,7 @@ import { }, { uid: uidAddress14, - address: "Rue Pierre Pologne", + address: "Place Alexandre", city: "Rennes", zip_code: 35000, created_at: new Date(), @@ -396,7 +396,7 @@ import { }, { uid: uidAddress15, - address: "Rue Pierre Pologne", + address: "Place Alexandre Jacques", city: "Rennes", zip_code: 35000, created_at: new Date(), @@ -404,7 +404,7 @@ import { }, { uid: uidAddress16, - address: "Rue Pierre Pologne", + address: "Place Alexandre 2", city: "Rennes", zip_code: 35000, created_at: new Date(), @@ -412,7 +412,7 @@ import { }, { uid: uidAddress17, - address: "Rue Pierre Pologne", + address: "Rue du livre", city: "Rennes", zip_code: 35000, created_at: new Date(), @@ -420,7 +420,7 @@ import { }, { uid: uidAddress18, - address: "Rue Pierre Pologne", + address: "Place de la joie", city: "Rennes", zip_code: 35000, created_at: new Date(), @@ -428,7 +428,7 @@ import { }, { uid: uidAddress19, - address: "Rue Pierre Pologne", + address: "Rue Paul Henry", city: "Rennes", zip_code: 35000, created_at: new Date(), @@ -436,7 +436,7 @@ import { }, { uid: uidAddress20, - address: "Rue Pierre Pologne", + address: "Rue Marcelin", city: "Rennes", zip_code: 35000, created_at: new Date(), @@ -449,37 +449,37 @@ import { { uid: uidContact1, address_uid: uidAddress1, - first_name: "John", - last_name: "Doe", - email: "john.doe@example.com", - phone_number: randomString(), - cell_phone_number: randomString(), - birthdate: null, - created_at: new Date(), - updated_at: new Date(), - civility: ECivility.MALE, - }, - { - uid: uidContact2, - address_uid: uidAddress2, - first_name: "Jane", - last_name: "Doe", - email: "jane.doe@example.com", - phone_number: randomString(), - cell_phone_number: randomString(), + first_name: "Manon", + last_name: "Simon", + email: "manon.simon@gmail.com", + phone_number: "06 12 34 56 78", + cell_phone_number: "06 12 34 56 78", birthdate: null, created_at: new Date(), updated_at: new Date(), civility: ECivility.FEMALE, }, + { + uid: uidContact2, + address_uid: uidAddress2, + first_name: "Kevin", + last_name: "Hautefaye", + email: "kevin.hautefaye@gmail.com", + phone_number: "06 23 45 67 89", + cell_phone_number: "06 23 45 67 89", + birthdate: null, + created_at: new Date(), + updated_at: new Date(), + civility: ECivility.MALE, + }, { uid: uidContact3, address_uid: uidAddress3, - first_name: "Maitre Marcelino", - last_name: "Jack", - email: "Marcelino.Jack@example.com", - phone_number: randomString(), - cell_phone_number: randomString(), + first_name: "Maxime", + last_name: "Lalo", + email: "maxime.lalo@gmail.com", + phone_number: "06 34 56 78 90", + cell_phone_number: "06 34 56 78 90", birthdate: null, created_at: new Date(), updated_at: new Date(), @@ -488,50 +488,50 @@ import { { uid: uidContact4, address_uid: uidAddress4, - first_name: "Maitre Massi", - last_name: "Jack", - email: "Massi.Jack19@example.com", - phone_number: randomString(), - cell_phone_number: randomString(), + first_name: "Vincent", + last_name: "Brognard", + email: "vincent.brognard@gmail.com", + phone_number: "06 45 67 89 01", + cell_phone_number: "06 45 67 89 01", birthdate: null, created_at: new Date(), updated_at: new Date(), - civility: ECivility.FEMALE, + civility: ECivility.MALE, }, { uid: uidContact5, address_uid: uidAddress5, - first_name: "Maitre Massi", - last_name: "Jack", - email: "Massi.Jack18@example.com", - phone_number: randomString(), - cell_phone_number: randomString(), + first_name: "Maxime", + last_name: "Leroy", + email: "maxime.leroy@hotmail.fr", + phone_number: "06 56 78 90 12", + cell_phone_number: "06 56 78 90 12", birthdate: null, created_at: new Date(), updated_at: new Date(), - civility: ECivility.FEMALE, + civility: ECivility.MALE, }, { uid: uidContact6, address_uid: uidAddress6, - first_name: "Maitre Massi", - last_name: "Jack", - email: "Massi.Jack2@example.com", - phone_number: randomString(), - cell_phone_number: randomString(), + first_name: "Thibault", + last_name: "Dubois", + email: "thibault.dubois@outlook.com", + phone_number: "06 67 89 01 23", + cell_phone_number: "06 67 89 01 23", birthdate: null, created_at: new Date(), updated_at: new Date(), - civility: ECivility.FEMALE, + civility: ECivility.MALE, }, { uid: uidContact7, address_uid: uidAddress7, - first_name: "Maitre Massi", - last_name: "Jack", - email: "Massi.Jack3@example.com", - phone_number: randomString(), - cell_phone_number: randomString(), + first_name: "Léa", + last_name: "Fontaine", + email: "lea.fontaine@gmail.com", + phone_number: "06 78 90 12 34", + cell_phone_number: "06 78 90 12 34", birthdate: null, created_at: new Date(), updated_at: new Date(), @@ -540,24 +540,24 @@ import { { uid: uidContact8, address_uid: uidAddress8, - first_name: "Maitre Massi", - last_name: "Jack", - email: "Massi.Jack4@example.com", - phone_number: randomString(), - cell_phone_number: randomString(), + first_name: "Guillaume", + last_name: "Renaud", + email: "guillaume.renaud@gmail.com", + phone_number: "06 89 01 23 45", + cell_phone_number: "06 89 01 23 45", birthdate: null, created_at: new Date(), updated_at: new Date(), - civility: ECivility.FEMALE, + civility: ECivility.MALE, }, { uid: uidContact9, address_uid: uidAddress9, - first_name: "Maitre Massi", - last_name: "Jack", - email: "Massi.Jack5@example.com", - phone_number: randomString(), - cell_phone_number: randomString(), + first_name: "Lucie", + last_name: "Chevalier", + email: "lucie.chevalier@outlook.com", + phone_number: "07 12 34 56 78", + cell_phone_number: "07 12 34 56 78", birthdate: null, created_at: new Date(), updated_at: new Date(), @@ -566,24 +566,24 @@ import { { uid: uidContact10, address_uid: uidAddress10, - first_name: "Maitre Massi", - last_name: "Jack", - email: "Massi.Jack6@example.com", - phone_number: randomString(), - cell_phone_number: randomString(), + first_name: "Sébastien", + last_name: "Dubois", + email: "sebastien.dubois@gmail.com", + phone_number: "07 23 45 67 89", + cell_phone_number: "07 23 45 67 89", birthdate: null, created_at: new Date(), updated_at: new Date(), - civility: ECivility.FEMALE, + civility: ECivility.MALE, }, { uid: uidContact11, address_uid: uidAddress11, - first_name: "Maitre Massi", - last_name: "Jack", - email: "Massi.Jack7@example.com", - phone_number: randomString(), - cell_phone_number: randomString(), + first_name: "Mathilde", + last_name: "Durand", + email: "mathilde.durand@gmail.com", + phone_number: "07 34 56 78 90", + cell_phone_number: "07 34 56 78 90", birthdate: null, created_at: new Date(), updated_at: new Date(), @@ -592,24 +592,24 @@ import { { uid: uidContact12, address_uid: uidAddress12, - first_name: "Maitre Massi", - last_name: "Jack", - email: "Massi.Jack8@example.com", - phone_number: randomString(), - cell_phone_number: randomString(), + first_name: "Antoine", + last_name: "Bernard", + email: "antoine.bernard@outlook.com", + phone_number: "07 45 67 89 01", + cell_phone_number: "07 45 67 89 01", birthdate: null, created_at: new Date(), updated_at: new Date(), - civility: ECivility.FEMALE, + civility: ECivility.MALE, }, { uid: uidContact13, address_uid: uidAddress13, - first_name: "Maitre Massi", - last_name: "Jack", - email: "Massi.Jack9@example.com", - phone_number: randomString(), - cell_phone_number: randomString(), + first_name: "Camille", + last_name: "Laurent", + email: "camille.laurent@gmail.com", + phone_number: "07 56 78 90 12", + cell_phone_number: "07 56 78 90 12", birthdate: null, created_at: new Date(), updated_at: new Date(), @@ -618,24 +618,24 @@ import { { uid: uidContact14, address_uid: uidAddress14, - first_name: "Maitre Massi", - last_name: "Jack", - email: "Massi.Jack10@example.com", - phone_number: randomString(), - cell_phone_number: randomString(), + first_name: "Julien", + last_name: "Mercier", + email: "julien.mercier@hotmail.fr", + phone_number: "07 67 89 01 23", + cell_phone_number: "07 67 89 01 23", birthdate: null, created_at: new Date(), updated_at: new Date(), - civility: ECivility.FEMALE, + civility: ECivility.MALE, }, { uid: uidContact15, address_uid: uidAddress15, - first_name: "Maitre Massi", - last_name: "Jack", - email: "Massi.Jack11@example.com", - phone_number: randomString(), - cell_phone_number: randomString(), + first_name: "Charlotte", + last_name: "Lefebvre", + email: "charlotte.lefebvre@gmail.com", + phone_number: "07 78 90 12 34", + cell_phone_number: "07 78 90 12 34", birthdate: null, created_at: new Date(), updated_at: new Date(), @@ -644,11 +644,11 @@ import { { uid: uidContact16, address_uid: uidAddress16, - first_name: "Maitre Massi", - last_name: "Jack", - email: "Massi.Jack12@example.com", - phone_number: randomString(), - cell_phone_number: randomString(), + first_name: "Caroline", + last_name: "Pallut", + email: "caroline.pallut@gmail.com", + phone_number: "07 89 01 23 45", + cell_phone_number: "07 89 01 23 45", birthdate: null, created_at: new Date(), updated_at: new Date(), @@ -657,11 +657,11 @@ import { { uid: uidContact17, address_uid: uidAddress17, - first_name: "Maitre Massi", - last_name: "Jack", - email: "Massi.Jack13@example.com", - phone_number: randomString(), - cell_phone_number: randomString(), + first_name: "Nadège", + last_name: "Gauchet", + email: "nedege.gauchet@outlook.com", + phone_number: "06 11 22 33 44", + cell_phone_number: "06 11 22 33 44", birthdate: null, created_at: new Date(), updated_at: new Date(), @@ -670,24 +670,24 @@ import { { uid: uidContact18, address_uid: uidAddress18, - first_name: "Maitre Massi", - last_name: "Jack", - email: "Massi.Jack14@example.com", - phone_number: randomString(), - cell_phone_number: randomString(), + first_name: "Matthieu", + last_name: "Bougeard", + email: "matthieu.bougeard@gmail.com", + phone_number: "07 22 33 44 55", + cell_phone_number: "07 22 33 44 55", birthdate: null, created_at: new Date(), updated_at: new Date(), - civility: ECivility.FEMALE, + civility: ECivility.MALE, }, { uid: uidContact19, address_uid: uidAddress19, - first_name: "Maitre Massi", - last_name: "Jack", - email: "Massi.Jack15@example.com", - phone_number: randomString(), - cell_phone_number: randomString(), + first_name: "Cécile", + last_name: "Celton", + email: "cecile.celton@outlook.com", + phone_number: "06 55 66 77 88", + cell_phone_number: "06 55 66 77 88", birthdate: null, created_at: new Date(), updated_at: new Date(), @@ -696,15 +696,15 @@ import { { uid: uidContact20, address_uid: uidAddress20, - first_name: "Maitre Massi", - last_name: "Jack", - email: "Massi.Jack16@example.com", - phone_number: randomString(), - cell_phone_number: randomString(), + first_name: "Gwendal", + last_name: "Texier", + email: "gwendal.texier@gmail.com", + phone_number: "07 88 99 00 11", + cell_phone_number: "07 88 99 00 11", birthdate: null, created_at: new Date(), updated_at: new Date(), - civility: ECivility.FEMALE, + civility: ECivility.MALE, }, ]; @@ -712,7 +712,7 @@ import { { uid: uidOffice1, idNot: randomString(), - name: "LA Office", + name: "Office Rennes", crpcen: randomString(), address_uid: uidAddress1, created_at: new Date(), From d4c8466f9d6e3454ef06eda78abedad2564ce273 Mon Sep 17 00:00:00 2001 From: Vincent Alamelle Date: Thu, 11 May 2023 14:29:39 +0200 Subject: [PATCH 68/72] Removed key data variables --- src/common/config/variables/Variables.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/common/config/variables/Variables.ts b/src/common/config/variables/Variables.ts index 43646886..bc20851c 100644 --- a/src/common/config/variables/Variables.ts +++ b/src/common/config/variables/Variables.ts @@ -54,9 +54,6 @@ export class BackendVariables { @IsNotEmpty() public readonly PINATA_GATEWAY!: string; - @IsNotEmpty() - public readonly KEY_DATA!: string; - public constructor() { dotenv.config(); this.DATABASE_PORT = process.env["DATABASE_PORT"]!; @@ -75,7 +72,6 @@ export class BackendVariables { this.PINATA_API_KEY = process.env["PINATA_API_KEY"]!; this.PINATA_API_SECRET = process.env["PINATA_API_SECRET"]!; this.PINATA_GATEWAY = process.env["PINATA_GATEWAY"]!; - this.KEY_DATA = process.env["KEY_DATA"]!; } public async validate() { await validateOrReject(this); From 9f752d3d8921e4b5fc4b1174325f7fa1da200031 Mon Sep 17 00:00:00 2001 From: Vincent Alamelle Date: Thu, 11 May 2023 15:28:04 +0200 Subject: [PATCH 69/72] Seeder v2 update --- src/common/databases/seeders/seeder2.ts | 684 ++++++++++++++++++++++-- 1 file changed, 638 insertions(+), 46 deletions(-) diff --git a/src/common/databases/seeders/seeder2.ts b/src/common/databases/seeders/seeder2.ts index 3ad9520e..2090cdab 100644 --- a/src/common/databases/seeders/seeder2.ts +++ b/src/common/databases/seeders/seeder2.ts @@ -123,6 +123,7 @@ import { const uidOfficeFolder18: string = randomString(); const uidOfficeFolder19: string = randomString(); const uidOfficeFolder20: string = randomString(); + const uidOfficeFolder21: string = randomString(); const uidDeed1: string = randomString(); const uidDeed2: string = randomString(); @@ -144,31 +145,100 @@ import { const uidDeed18: string = randomString(); const uidDeed19: string = randomString(); const uidDeed20: string = randomString(); + const uidDeed21: string = randomString(); const uidDeedType1: string = randomString(); const uidDeedType2: string = randomString(); const uidDeedType3: string = randomString(); - const uidDeedType4: string = randomString(); - const uidDeedType5: string = randomString(); const uidDocument1: string = randomString(); const uidDocument2: string = randomString(); const uidDocumentType1: string = randomString(); const uidDocumentType2: string = randomString(); + const uidDocumentType3: string = randomString(); + const uidDocumentType4: string = randomString(); + const uidDocumentType5: string = randomString(); + const uidDocumentType6: string = randomString(); + const uidDocumentType7: string = randomString(); + const uidDocumentType8: string = randomString(); + const uidDocumentType9: string = randomString(); + const uidDocumentType10: string = randomString(); + const uidDocumentType11: string = randomString(); + const uidDocumentType12: string = randomString(); + const uidDocumentType13: string = randomString(); + const uidDocumentType14: string = randomString(); + const uidDocumentType15: string = randomString(); + const uidDocumentType16: string = randomString(); const uidOfficeFolderHasCustomer1: string = randomString(); const uidOfficeFolderHasCustomer2: string = randomString(); + const uidOfficeFolderHasCustomer3: string = randomString(); + const uidFiles1: string = randomString(); const uidFiles2: string = randomString(); const uidDeedHasDocumentType1: string = randomString(); const uidDeedHasDocumentType2: string = randomString(); + const uidDeedHasDocumentType3: string = randomString(); + const uidDeedHasDocumentType4: string = randomString(); + const uidDeedHasDocumentType5: string = randomString(); + const uidDeedHasDocumentType6: string = randomString(); + const uidDeedHasDocumentType7: string = randomString(); + const uidDeedHasDocumentType8: string = randomString(); + const uidDeedHasDocumentType9: string = randomString(); + const uidDeedHasDocumentType10: string = randomString(); + const uidDeedHasDocumentType11: string = randomString(); + const uidDeedHasDocumentType12: string = randomString(); + const uidDeedHasDocumentType13: string = randomString(); + const uidDeedHasDocumentType14: string = randomString(); + const uidDeedHasDocumentType15: string = randomString(); + const uidDeedHasDocumentType16: string = randomString(); + const uidDeedHasDocumentType17: string = randomString(); + const uidDeedHasDocumentType18: string = randomString(); + const uidDeedHasDocumentType19: string = randomString(); + const uidDeedHasDocumentType20: string = randomString(); + const uidDeedHasDocumentType21: string = randomString(); + const uidDeedHasDocumentType22: string = randomString(); + const uidDeedHasDocumentType23: string = randomString(); + const uidDeedHasDocumentType24: string = randomString(); + const uidDeedHasDocumentType25: string = randomString(); + const uidDeedHasDocumentType26: string = randomString(); + const uidDeedHasDocumentType27: string = randomString(); + const uidDeedHasDocumentType28: string = randomString(); + const uidDeedHasDocumentType29: string = randomString(); + const uidDeedHasDocumentType30: string = randomString(); + const uidDeedHasDocumentType31: string = randomString(); + const uidDeedHasDocumentType32: string = randomString(); + const uidDeedHasDocumentType33: string = randomString(); + const uidDeedHasDocumentType34: string = randomString(); + const uidDeedHasDocumentType35: string = randomString(); + const uidDeedHasDocumentType36: string = randomString(); + const uidDeedHasDocumentType37: string = randomString(); + const uidDeedHasDocumentType38: string = randomString(); + const uidDeedHasDocumentType39: string = randomString(); + const uidDeedHasDocumentType40: string = randomString(); + const uidDeedHasDocumentType41: string = randomString(); + const uidDeedHasDocumentType42: string = randomString(); + const uidDeedHasDocumentType43: string = randomString(); + const uidDeedHasDocumentType44: string = randomString(); + const uidDeedHasDocumentType45: string = randomString(); + const uidDeedHasDocumentType46: string = randomString(); + const uidDeedHasDocumentType47: string = randomString(); + const uidDeedHasDocumentType48: string = randomString(); + const uidDeedHasDocumentType49: string = randomString(); + const uidDeedHasDocumentType50: string = randomString(); + const uidDeedHasDocumentType51: string = randomString(); + const uidDeedHasDocumentType52: string = randomString(); + const uidDeedHasDocumentType53: string = randomString(); + + const uidDeedTypeHasDocumentType1: string = randomString(); const uidDeedTypeHasDocumentType2: string = randomString(); + const uidDeedTypeHasDocumentType3: string = randomString(); const uidDocumentHistory1: string = randomString(); const uidDocumentHistory2: string = randomString(); @@ -1005,6 +1075,18 @@ import { description: null, archived_description: null, }, + { + uid: uidOfficeFolder21, + folder_number: "00021", + name: "Dossier", + deed_uid: uidDeed21, + status: EFolderStatus.LIVE, + created_at: new Date(), + updated_at: new Date(), + office_uid: uidOffice1, + description: null, + archived_description: null, + }, ]; const deeds: Deeds[] = [ @@ -1016,37 +1098,37 @@ import { }, { uid: uidDeed2, - deed_type_uid: uidDeedType2, + deed_type_uid: uidDeedType1, created_at: new Date(), updated_at: new Date(), }, { uid: uidDeed3, - deed_type_uid: uidDeedType2, + deed_type_uid: uidDeedType1, created_at: new Date(), updated_at: new Date(), }, { uid: uidDeed4, - deed_type_uid: uidDeedType2, + deed_type_uid: uidDeedType1, created_at: new Date(), updated_at: new Date(), }, { uid: uidDeed5, - deed_type_uid: uidDeedType2, + deed_type_uid: uidDeedType1, created_at: new Date(), updated_at: new Date(), }, { uid: uidDeed6, - deed_type_uid: uidDeedType2, + deed_type_uid: uidDeedType1, created_at: new Date(), updated_at: new Date(), }, { uid: uidDeed7, - deed_type_uid: uidDeedType2, + deed_type_uid: uidDeedType1, created_at: new Date(), updated_at: new Date(), }, @@ -1094,37 +1176,43 @@ import { }, { uid: uidDeed15, - deed_type_uid: uidDeedType2, + deed_type_uid: uidDeedType3, created_at: new Date(), updated_at: new Date(), }, { uid: uidDeed16, - deed_type_uid: uidDeedType2, + deed_type_uid: uidDeedType3, created_at: new Date(), updated_at: new Date(), }, { uid: uidDeed17, - deed_type_uid: uidDeedType2, + deed_type_uid: uidDeedType3, created_at: new Date(), updated_at: new Date(), }, { uid: uidDeed18, - deed_type_uid: uidDeedType2, + deed_type_uid: uidDeedType3, created_at: new Date(), updated_at: new Date(), }, { uid: uidDeed19, - deed_type_uid: uidDeedType2, + deed_type_uid: uidDeedType3, created_at: new Date(), updated_at: new Date(), }, { uid: uidDeed20, - deed_type_uid: uidDeedType2, + deed_type_uid: uidDeedType3, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeed21, + deed_type_uid: uidDeedType3, created_at: new Date(), updated_at: new Date(), }, @@ -1133,45 +1221,27 @@ import { const deedTypes: DeedTypes[] = [ { uid: uidDeedType1, - name: "Acte de mariage", + name: "Acte de donation", archived_at: null, - description: "Acte regroupant deux personnes en mariage", + description: "Acte de donation", office_uid: uidOffice1, created_at: new Date(), updated_at: new Date(), }, { uid: uidDeedType2, - name: "Vente d'un bien immobilier", + name: "Acte de vente", archived_at: null, - description: "Permet de vendre un bien immobilier à une entité ou une personne physique", + description: "Acte de vente", office_uid: uidOffice1, created_at: new Date(), updated_at: new Date(), }, { uid: uidDeedType3, - name: "Deed Type 3", + name: "Acte de succession", archived_at: null, - description: "Deed type 3", - office_uid: uidOffice1, - created_at: new Date(), - updated_at: new Date(), - }, - { - uid: uidDeedType4, - name: "Deed Type 4", - archived_at: null, - description: "Deed type 4", - office_uid: uidOffice1, - created_at: new Date(), - updated_at: new Date(), - }, - { - uid: uidDeedType5, - name: "Deed Type 5", - archived_at: null, - description: "Deed type 5", + description: "Acte de succession", office_uid: uidOffice1, created_at: new Date(), updated_at: new Date(), @@ -1205,20 +1275,160 @@ import { { uid: uidDocumentType1, archived_at: null, - name: "Acte de naissance", + name: "Document d'identité", office_uid: uidOffice1, - private_description: "Ce document est confidentiel, et ne doit pas être divulgué", - public_description: "Acte de naissance est un document officiel qui atteste de la naissance d'une personne", + private_description: "Ce document est confidentiel, demander un recto-verso au client", + public_description: "Document officiel d'identification utilisé par plusieurs personnes pour prouver leur identité et leur nationalité (CNI, passeport)", created_at: new Date(), updated_at: new Date(), }, { uid: uidDocumentType2, archived_at: null, - name: "Carte d'identité", + name: "Taxe Foncière", office_uid: uidOffice1, - private_description: "Ce document est confidentiel, demander un recto-verso au client", - public_description: "Carte d'identité est un document officiel qui atteste de l'identité d'une personne", + private_description: "Ce document est confidentiel, et ne doit pas être divulgué", + public_description: "Impôt annuel imposé sur les propriétés foncières et utilisé pour financer les services publics locaux.", + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDocumentType3, + archived_at: null, + name: "Contrat Mariage", + office_uid: uidOffice1, + private_description: "Ce document est confidentiel, et ne doit pas être divulgué", + public_description: "Accord légal qui établit les droits et les obligations entre deux personnes s'unissant en mariage.", + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDocumentType4, + archived_at: null, + name: "Livret de famille", + office_uid: uidOffice1, + private_description: "Ce document est confidentiel, et ne doit pas être divulgué", + public_description: "Document officiel qui enregistre les détails et les événements familiaux tels que les mariages, les naissances et les décès d'un couple et de leurs enfants.", + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDocumentType16, + archived_at: null, + name: "Bail commercial", + office_uid: uidOffice1, + private_description: "Ce document est confidentiel, et ne doit pas être divulgué", + public_description: "Contrat légal entre un propriétaire et un locataire pour la location d'un bien immobilier utilisé à des fins commerciales ou professionnelles.", + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDocumentType5, + archived_at: null, + name: "Statuts SCI", + office_uid: uidOffice1, + private_description: "Ce document est confidentiel, et ne doit pas être divulgué", + public_description: "Document légal qui définit les règles et les dispositions régissant la Société Civile Immobilière (SCI).", + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDocumentType6, + archived_at: null, + name: "Avis de taxe foncière", + office_uid: uidOffice1, + private_description: "Ce document est confidentiel, et ne doit pas être divulgué", + public_description: "Notification officielle indiquant le montant de l'impôt foncier dû sur une propriété.", + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDocumentType7, + archived_at: null, + name: "Appel de charge de copropriété", + office_uid: uidOffice1, + private_description: "Ce document est confidentiel, et ne doit pas être divulgué", + public_description: "Document envoyé aux copropriétaires pour les informer des dépenses et des charges communes liées à la gestion et à l'entretien de l'immeuble.", + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDocumentType8, + archived_at: null, + name: "PVAG", + office_uid: uidOffice1, + private_description: "Ce document est confidentiel, et ne doit pas être divulgué", + public_description: "Compte rendu écrit des discussions, décisions et résolutions prises lors d'une réunion d'assemblée générale de copropriété.", + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDocumentType9, + archived_at: null, + name: "Règlement de copropriété", + office_uid: uidOffice1, + private_description: "Ce document est confidentiel, et ne doit pas être divulgué", + public_description: "Document juridique qui établit les règles et les droits des copropriétaires d'un immeuble en copropriété.", + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDocumentType10, + archived_at: null, + name: "Titre de propriété", + office_uid: uidOffice1, + private_description: "Ce document est confidentiel, et ne doit pas être divulgué", + public_description: "Document légal qui atteste de la propriété d'un bien immobilier et en identifie le propriétaire.", + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDocumentType11, + archived_at: null, + name: "Plan et loi carrez", + office_uid: uidOffice1, + private_description: "Ce document est confidentiel, et ne doit pas être divulgué", + public_description: "Document officiel qui mesure la superficie d'un lot ou d'un bien immobilier, conformément à la loi Carrez qui encadre les transactions immobilières.", + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDocumentType12, + archived_at: null, + name: "CNI", + office_uid: uidOffice1, + private_description: "Ce document est confidentiel, et ne doit pas être divulgué", + public_description: "Document officiel d'identification délivré par l'État pour prouver l'identité et la nationalité d'une personne.", + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDocumentType13, + archived_at: null, + name: "Modifications règlement copropriété (plusieurs)", + office_uid: uidOffice1, + private_description: "Ce document est confidentiel, et ne doit pas être divulgué", + public_description: "Documents légaux qui apportent des changements ou des ajustements aux règles et dispositions du règlement de copropriété initial.", + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDocumentType14, + archived_at: null, + name: "Avis de décès", + office_uid: uidOffice1, + private_description: "Ce document est confidentiel, et ne doit pas être divulgué", + public_description: "Notification officielle délivrée par les autorités compétentes pour informer du décès d'une personne.", + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDocumentType15, + archived_at: null, + name: "Lettre de mission", + office_uid: uidOffice1, + private_description: "Ce document est confidentiel, et ne doit pas être divulgué", + public_description: "Document contractuel qui définit les termes et les objectifs d'une mission confiée à une personne ou à une entreprise.", created_at: new Date(), updated_at: new Date(), }, @@ -1239,6 +1449,13 @@ import { created_at: new Date(), updated_at: new Date(), }, + { + uid: uidOfficeFolderHasCustomer3, + customer_uid: uidCustomer2, + office_folder_uid: uidOfficeFolder21, + created_at: new Date(), + updated_at: new Date(), + }, ]; const files: Files[] = [ @@ -1272,13 +1489,381 @@ import { created_at: new Date(), updated_at: new Date(), }, - { + { uid: uidDeedHasDocumentType2, - deed_uid: uidDeed2, + deed_uid: uidDeed1, document_type_uid: uidDocumentType2, created_at: new Date(), updated_at: new Date(), }, + { + uid: uidDeedHasDocumentType3, + deed_uid: uidDeed1, + document_type_uid: uidDocumentType3, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType4, + deed_uid: uidDeed1, + document_type_uid: uidDocumentType4, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType5, + deed_uid: uidDeed1, + document_type_uid: uidDocumentType16, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType6, + deed_uid: uidDeed1, + document_type_uid: uidDocumentType5, + created_at: new Date(), + updated_at: new Date(), + }, + + { + uid: uidDeedHasDocumentType7, + deed_uid: uidDeed2, + document_type_uid: uidDocumentType6, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType8, + deed_uid: uidDeed2, + document_type_uid: uidDocumentType7, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType9, + deed_uid: uidDeed2, + document_type_uid: uidDocumentType8, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType10, + deed_uid: uidDeed2, + document_type_uid: uidDocumentType9, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType11, + deed_uid: uidDeed2, + document_type_uid: uidDocumentType10, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType12, + deed_uid: uidDeed2, + document_type_uid: uidDocumentType11, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType13, + deed_uid: uidDeed2, + document_type_uid: uidDocumentType1, + created_at: new Date(), + updated_at: new Date(), + }, + + { + uid: uidDeedHasDocumentType19, + deed_uid: uidDeed3, + document_type_uid: uidDocumentType14, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType20, + deed_uid: uidDeed3, + document_type_uid: uidDocumentType15, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType21, + deed_uid: uidDeed3, + document_type_uid: uidDocumentType4, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType22, + deed_uid: uidDeed3, + document_type_uid: uidDocumentType10, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType23, + deed_uid: uidDeed3, + document_type_uid: uidDocumentType1, + created_at: new Date(), + updated_at: new Date(), + }, + + { + uid: uidDeedHasDocumentType14, + deed_uid: uidDeed4, + document_type_uid: uidDocumentType14, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType15, + deed_uid: uidDeed4, + document_type_uid: uidDocumentType15, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType26, + deed_uid: uidDeed4, + document_type_uid: uidDocumentType4, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType27, + deed_uid: uidDeed4, + document_type_uid: uidDocumentType10, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType28, + deed_uid: uidDeed4, + document_type_uid: uidDocumentType1, + created_at: new Date(), + updated_at: new Date(), + }, + + { + uid: uidDeedHasDocumentType29, + deed_uid: uidDeed5, + document_type_uid: uidDocumentType14, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType30, + deed_uid: uidDeed5, + document_type_uid: uidDocumentType15, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType31, + deed_uid: uidDeed5, + document_type_uid: uidDocumentType4, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType32, + deed_uid: uidDeed5, + document_type_uid: uidDocumentType10, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType33, + deed_uid: uidDeed5, + document_type_uid: uidDocumentType1, + created_at: new Date(), + updated_at: new Date(), + }, + + { + uid: uidDeedHasDocumentType34, + deed_uid: uidDeed6, + document_type_uid: uidDocumentType14, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType35, + deed_uid: uidDeed6, + document_type_uid: uidDocumentType15, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType36, + deed_uid: uidDeed6, + document_type_uid: uidDocumentType4, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType37, + deed_uid: uidDeed6, + document_type_uid: uidDocumentType10, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType38, + deed_uid: uidDeed6, + document_type_uid: uidDocumentType1, + created_at: new Date(), + updated_at: new Date(), + }, + + { + uid: uidDeedHasDocumentType39, + deed_uid: uidDeed7, + document_type_uid: uidDocumentType14, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType40, + deed_uid: uidDeed7, + document_type_uid: uidDocumentType15, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType41, + deed_uid: uidDeed7, + document_type_uid: uidDocumentType4, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType42, + deed_uid: uidDeed7, + document_type_uid: uidDocumentType10, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType43, + deed_uid: uidDeed7, + document_type_uid: uidDocumentType1, + created_at: new Date(), + updated_at: new Date(), + }, + + { + uid: uidDeedHasDocumentType44, + deed_uid: uidDeed8, + document_type_uid: uidDocumentType14, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType45, + deed_uid: uidDeed8, + document_type_uid: uidDocumentType15, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType46, + deed_uid: uidDeed8, + document_type_uid: uidDocumentType4, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType47, + deed_uid: uidDeed8, + document_type_uid: uidDocumentType10, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType48, + deed_uid: uidDeed8, + document_type_uid: uidDocumentType1, + created_at: new Date(), + updated_at: new Date(), + }, + + { + uid: uidDeedHasDocumentType49, + deed_uid: uidDeed9, + document_type_uid: uidDocumentType14, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType50, + deed_uid: uidDeed9, + document_type_uid: uidDocumentType15, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType51, + deed_uid: uidDeed9, + document_type_uid: uidDocumentType4, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType16, + deed_uid: uidDeed9, + document_type_uid: uidDocumentType10, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType17, + deed_uid: uidDeed9, + document_type_uid: uidDocumentType1, + created_at: new Date(), + updated_at: new Date(), + }, + + { + uid: uidDeedHasDocumentType18, + deed_uid: uidDeed10, + document_type_uid: uidDocumentType14, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType24, + deed_uid: uidDeed10, + document_type_uid: uidDocumentType15, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType25, + deed_uid: uidDeed10, + document_type_uid: uidDocumentType4, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType52, + deed_uid: uidDeed10, + document_type_uid: uidDocumentType10, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedHasDocumentType53, + deed_uid: uidDeed10, + document_type_uid: uidDocumentType1, + created_at: new Date(), + updated_at: new Date(), + }, + + ]; const deedTypeHasDocumentTypes: DeedTypeHasDocumentTypes[] = [ @@ -1296,6 +1881,13 @@ import { created_at: new Date(), updated_at: new Date(), }, + { + uid: uidDeedTypeHasDocumentType3, + deed_type_uid: uidDeedType3, + document_type_uid: uidDocumentType3, + created_at: new Date(), + updated_at: new Date(), + }, ]; const documentHistories: DocumentHistory[] = [ From 33313a309818dbc889a54b66cbaf1210d8150d4c Mon Sep 17 00:00:00 2001 From: Vincent Alamelle Date: Thu, 11 May 2023 16:05:02 +0200 Subject: [PATCH 70/72] Update seeder v2 --- src/common/databases/seeders/seeder2.ts | 45 +++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/src/common/databases/seeders/seeder2.ts b/src/common/databases/seeders/seeder2.ts index 2090cdab..c11e30fe 100644 --- a/src/common/databases/seeders/seeder2.ts +++ b/src/common/databases/seeders/seeder2.ts @@ -154,6 +154,8 @@ import { const uidDocument1: string = randomString(); const uidDocument2: string = randomString(); + const uidDocument3: string = randomString(); + const uidDocument4: string = randomString(); const uidDocumentType1: string = randomString(); const uidDocumentType2: string = randomString(); @@ -175,6 +177,8 @@ import { const uidOfficeFolderHasCustomer1: string = randomString(); const uidOfficeFolderHasCustomer2: string = randomString(); const uidOfficeFolderHasCustomer3: string = randomString(); + const uidOfficeFolderHasCustomer4: string = randomString(); + const uidOfficeFolderHasCustomer5: string = randomString(); const uidFiles1: string = randomString(); @@ -876,7 +880,7 @@ import { folder_number: "0004", name: "Dossier", deed_uid: uidDeed4, - status: EFolderStatus.ARCHIVED, + status: EFolderStatus.LIVE, created_at: new Date(), updated_at: new Date(), office_uid: uidOffice1, @@ -888,7 +892,7 @@ import { folder_number: "0005", name: "Dossier", deed_uid: uidDeed5, - status: EFolderStatus.ARCHIVED, + status: EFolderStatus.LIVE, created_at: new Date(), updated_at: new Date(), office_uid: uidOffice1, @@ -1253,7 +1257,7 @@ import { uid: uidDocument1, blockchain_anchor_uid: null, depositor_uid: uidCustomer1, - document_status: EDocumentStatus.DEPOSITED, + document_status: EDocumentStatus.ASKED, folder_uid: uidOfficeFolder1, document_type_uid: uidDocumentType1, created_at: new Date(), @@ -1269,6 +1273,26 @@ import { created_at: new Date(), updated_at: new Date(), }, + { + uid: uidDocument3, + blockchain_anchor_uid: null, + depositor_uid: uidCustomer3, + document_status: EDocumentStatus.ASKED, + folder_uid: uidOfficeFolder3, + document_type_uid: uidDocumentType3, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDocument4, + blockchain_anchor_uid: null, + depositor_uid: uidCustomer4, + document_status: EDocumentStatus.ASKED, + folder_uid: uidOfficeFolder4, + document_type_uid: uidDocumentType4, + created_at: new Date(), + updated_at: new Date(), + }, ]; const documentTypes: DocumentTypes[] = [ @@ -1451,11 +1475,26 @@ import { }, { uid: uidOfficeFolderHasCustomer3, + customer_uid: uidCustomer3, + office_folder_uid: uidOfficeFolder3, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidOfficeFolderHasCustomer4, + customer_uid: uidCustomer4, + office_folder_uid: uidOfficeFolder4, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidOfficeFolderHasCustomer5, customer_uid: uidCustomer2, office_folder_uid: uidOfficeFolder21, created_at: new Date(), updated_at: new Date(), }, + ]; const files: Files[] = [ From 313c7112a3563ff070e0b18c600a5185bcf3214d Mon Sep 17 00:00:00 2001 From: Vincent Alamelle Date: Thu, 11 May 2023 16:47:22 +0200 Subject: [PATCH 71/72] seeder update --- src/common/databases/seeders/seeder2.ts | 77 +++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/src/common/databases/seeders/seeder2.ts b/src/common/databases/seeders/seeder2.ts index c11e30fe..e0e6b892 100644 --- a/src/common/databases/seeders/seeder2.ts +++ b/src/common/databases/seeders/seeder2.ts @@ -151,6 +151,7 @@ import { const uidDeedType1: string = randomString(); const uidDeedType2: string = randomString(); const uidDeedType3: string = randomString(); + const uidDeedType4: string = randomString(); const uidDocument1: string = randomString(); const uidDocument2: string = randomString(); @@ -173,6 +174,8 @@ import { const uidDocumentType14: string = randomString(); const uidDocumentType15: string = randomString(); const uidDocumentType16: string = randomString(); + const uidDocumentType17: string = randomString(); + const uidDocumentType18: string = randomString(); const uidOfficeFolderHasCustomer1: string = randomString(); const uidOfficeFolderHasCustomer2: string = randomString(); @@ -243,6 +246,14 @@ import { const uidDeedTypeHasDocumentType1: string = randomString(); const uidDeedTypeHasDocumentType2: string = randomString(); const uidDeedTypeHasDocumentType3: string = randomString(); + const uidDeedTypeHasDocumentType4: string = randomString(); + const uidDeedTypeHasDocumentType5: string = randomString(); + const uidDeedTypeHasDocumentType6: string = randomString(); + const uidDeedTypeHasDocumentType7: string = randomString(); + const uidDeedTypeHasDocumentType8: string = randomString(); + + + const uidDocumentHistory1: string = randomString(); const uidDocumentHistory2: string = randomString(); @@ -1250,6 +1261,16 @@ import { created_at: new Date(), updated_at: new Date(), }, + { + uid: uidDeedType4, + name: "Acte de vente de maison individuelle", + archived_at: null, + description: "Acte de vente de maison individuelle", + office_uid: uidOffice1, + created_at: new Date(), + updated_at: new Date(), + }, + ]; const documents: Documents[] = [ @@ -1456,6 +1477,26 @@ import { created_at: new Date(), updated_at: new Date(), }, + { + uid: uidDocumentType17, + archived_at: null, + name: "DPE", + office_uid: uidOffice1, + private_description: "Ce document est confidentiel, et ne doit pas être divulgué", + public_description: "Diagnostic de Performance Energétique.", + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDocumentType18, + archived_at: null, + name: "RIB", + office_uid: uidOffice1, + private_description: "Ce document est confidentiel, et ne doit pas être divulgué", + public_description: "RIB.", + created_at: new Date(), + updated_at: new Date(), + }, ]; const officeFolderHasCustomers: OfficeFolderHasCustomers[] = [ @@ -1927,6 +1968,42 @@ import { created_at: new Date(), updated_at: new Date(), }, + + { + uid: uidDeedTypeHasDocumentType4, + deed_type_uid: uidDeedType4, + document_type_uid: uidDocumentType1, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedTypeHasDocumentType5, + deed_type_uid: uidDeedType4, + document_type_uid: uidDocumentType6, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedTypeHasDocumentType6, + deed_type_uid: uidDeedType4, + document_type_uid: uidDocumentType10, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedTypeHasDocumentType7, + deed_type_uid: uidDeedType4, + document_type_uid: uidDocumentType17, + created_at: new Date(), + updated_at: new Date(), + }, + { + uid: uidDeedTypeHasDocumentType8, + deed_type_uid: uidDeedType4, + document_type_uid: uidDocumentType18, + created_at: new Date(), + updated_at: new Date(), + }, ]; const documentHistories: DocumentHistory[] = [ From 5a2106f6a5202d796f718d53914fd9eb3c15bff6 Mon Sep 17 00:00:00 2001 From: OxSaitama Date: Thu, 11 May 2023 17:00:06 +0200 Subject: [PATCH 72/72] fix document type import in deeds --- src/common/repositories/OfficeFoldersRepository.ts | 8 ++------ .../OfficeFoldersService/OfficeFoldersService.ts | 6 +++++- src/test/services/super-admin/OfficeFolderService.test.ts | 3 ++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/common/repositories/OfficeFoldersRepository.ts b/src/common/repositories/OfficeFoldersRepository.ts index 46205472..18f6e894 100644 --- a/src/common/repositories/OfficeFoldersRepository.ts +++ b/src/common/repositories/OfficeFoldersRepository.ts @@ -35,12 +35,8 @@ export default class OfficeFoldersRepository extends BaseRepository { description: officeFolder.description, status: EFolderStatus.LIVE, deed: { - create: { - deed_type: { - connect: { - uid: officeFolder.deed!.deed_type!.uid, - }, - }, + connect: { + uid: officeFolder.deed?.uid }, }, office: { diff --git a/src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts b/src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts index 671b0c3b..128070e4 100644 --- a/src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts +++ b/src/services/super-admin/OfficeFoldersService/OfficeFoldersService.ts @@ -4,13 +4,15 @@ import BaseService from "@Services/BaseService"; import { OfficeFolder } from "le-coffre-resources/dist/SuperAdmin"; import { Service } from "typedi"; import DeedTypesService from "../DeedTypesService/DeedTypesService"; +import DeedsRepository from "@Repositories/DeedsRepository"; @Service() export default class OfficeFoldersService extends BaseService { constructor( private officeFoldersRepository: OfficeFoldersRepository, - private deedTypeService: DeedTypesService + private deedTypeService: DeedTypesService, + private deedRepository: DeedsRepository ) { super(); } @@ -30,6 +32,8 @@ export default class OfficeFoldersService extends BaseService { public async create(officeFolderEntity: OfficeFolder): Promise { const deedType = await this.deedTypeService.getByUid(officeFolderEntity.deed!.deed_type!.uid!); if(deedType.archived_at) throw new Error('deed type is archived'); + const deed = await this.deedRepository.create(officeFolderEntity.deed!); + officeFolderEntity.deed!.uid = deed.uid; return this.officeFoldersRepository.create(officeFolderEntity); } diff --git a/src/test/services/super-admin/OfficeFolderService.test.ts b/src/test/services/super-admin/OfficeFolderService.test.ts index 8c8394a1..c0c52549 100644 --- a/src/test/services/super-admin/OfficeFolderService.test.ts +++ b/src/test/services/super-admin/OfficeFolderService.test.ts @@ -8,10 +8,11 @@ import OfficeFolderService from "@Services/super-admin/OfficeFoldersService/Offi import { initCustomers, initDeedType, initDocumentType, initOffice, initUsers } from "@Test/config/Init"; import { OfficeFolder } from "le-coffre-resources/dist/SuperAdmin"; import DeedTypesService from "@Services/super-admin/DeedTypesService/DeedTypesService"; +import DeedsRepository from "@Repositories/DeedsRepository"; const prisma = new PrismaClient(); -const OfficeFolderServiceTest = new OfficeFolderService(Container.get(OfficeFoldersRepository), Container.get(DeedTypesService)); +const OfficeFolderServiceTest = new OfficeFolderService(Container.get(OfficeFoldersRepository), Container.get(DeedTypesService), Container.get(DeedsRepository)); beforeAll(async () => { office.uid = (await initOffice(office)).uid;