From 4c390669e2ff994d46a73710f96a2a3d043ab8e9 Mon Sep 17 00:00:00 2001 From: Ankit Varshney Date: Tue, 13 Feb 2024 23:44:27 +0530 Subject: [PATCH] Squashed commit of the following: commit e50baf9409a430364faabdaa63a86bacb3ecac5c Merge: 3fd06759 65989b1b Author: ANKIT VARSHNEY <132201033+AVtheking@users.noreply.github.com> Date: Tue Feb 13 23:34:06 2024 +0530 Merge branch 'PalisadoesFoundation:develop' into develop commit 65989b1bbb36af7bdf91b7d6f2c4ff83756373a1 Author: Paras Awasthi <121304240+i-m-Paras@users.noreply.github.com> Date: Tue Feb 13 18:21:56 2024 +0530 removeAdvertisement.ts test updated to 100% coverage (#1835) * removeAdvertisement.ts test updated to 100% coverage * failing tests updated * Update package.json * Update package.json * Update package-lock.json * Update package.json * Update package.json * Update package.json * Update package.json * Update package-lock.json back to normal * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json commit cc21e65688801b35d05009beb6f3a0c277054670 Author: Anvita Mahajan <78889572+Anvita0305@users.noreply.github.com> Date: Tue Feb 13 18:21:20 2024 +0530 Added tests for file src/resolvers/Mutation/createPost.ts (#1833) * Modified tests * some minor changes * Fixed Errors * 100% code covered * Fixed Linting errors commit f95b71f2aaafae0960f32695105dc67d9a8a9ae2 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Feb 12 10:12:01 2024 -0800 chore(deps): bump @types/validator from 13.11.8 to 13.11.9 (#1845) Bumps [@types/validator](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/validator) from 13.11.8 to 13.11.9. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/validator) --- updated-dependencies: - dependency-name: "@types/validator" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit a6a5758f36db4601c05d69f72d6d98d7735a1e3f Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Feb 12 09:51:43 2024 -0800 chore(deps): bump @graphql-codegen/typescript from 4.0.1 to 4.0.4 (#1846) Bumps [@graphql-codegen/typescript](https://github.com/dotansimha/graphql-code-generator/tree/HEAD/packages/plugins/typescript/typescript) from 4.0.1 to 4.0.4. - [Release notes](https://github.com/dotansimha/graphql-code-generator/releases) - [Changelog](https://github.com/dotansimha/graphql-code-generator/blob/master/packages/plugins/typescript/typescript/CHANGELOG.md) - [Commits](https://github.com/dotansimha/graphql-code-generator/commits/@graphql-codegen/typescript@4.0.4/packages/plugins/typescript/typescript) --- updated-dependencies: - dependency-name: "@graphql-codegen/typescript" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit b738582981f1c82bbffcc3e9c705a4489cc812bf Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Feb 12 09:49:35 2024 -0800 chore(deps): bump lint-staged from 15.2.1 to 15.2.2 (#1844) Bumps [lint-staged](https://github.com/okonet/lint-staged) from 15.2.1 to 15.2.2. - [Release notes](https://github.com/okonet/lint-staged/releases) - [Changelog](https://github.com/lint-staged/lint-staged/blob/master/CHANGELOG.md) - [Commits](https://github.com/okonet/lint-staged/compare/v15.2.1...v15.2.2) --- updated-dependencies: - dependency-name: lint-staged dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit 56cb29f634772b81b206f7a7817841bdd2a66360 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Feb 12 09:49:16 2024 -0800 chore(deps): bump nodemailer from 6.9.8 to 6.9.9 (#1843) Bumps [nodemailer](https://github.com/nodemailer/nodemailer) from 6.9.8 to 6.9.9. - [Release notes](https://github.com/nodemailer/nodemailer/releases) - [Changelog](https://github.com/nodemailer/nodemailer/blob/master/CHANGELOG.md) - [Commits](https://github.com/nodemailer/nodemailer/compare/v6.9.8...v6.9.9) --- updated-dependencies: - dependency-name: nodemailer dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit b445770237a0297fca522994d61fd1b2a3b2252e Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Feb 12 09:48:58 2024 -0800 chore(deps): bump @typescript-eslint/eslint-plugin from 6.20.0 to 6.21.0 (#1842) Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 6.20.0 to 6.21.0. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.21.0/packages/eslint-plugin) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit 125853a5d62aa0bc509f2afd80489f5a249b347b Author: TASNEEM KOUSHAR Date: Sun Feb 11 23:20:44 2024 +0530 Update pull_changes.yml commit d069d4055a0c9c3b230584d2c40f08239f3a16b7 Author: TASNEEM KOUSHAR Date: Sun Feb 11 22:57:38 2024 +0530 Update Advertisement.ts commit 5fe0ae8d97f709b61deaa44af62dcc0873c83a16 Author: TASNEEM KOUSHAR Date: Sun Feb 11 22:44:37 2024 +0530 Update pull_changes.yml commit 26e0d1053082c07b4042cb28d258348e14ef3f87 Author: TASNEEM KOUSHAR Date: Sun Feb 11 22:40:11 2024 +0530 Update push.yml commit 60d4b4b80edd6255a7db0a8707b032600af9281b Author: TASNEEM KOUSHAR Date: Sun Feb 11 22:18:30 2024 +0530 Update push.yml commit 07f704255601c002c3d16ee8c1765729dcc96fed Author: TASNEEM KOUSHAR Date: Sun Feb 11 22:01:00 2024 +0530 Update Advertisement.ts commit 12ccdb6f446eab0ded97f353975cfd5ad2fc2d41 Author: TASNEEM KOUSHAR Date: Sun Feb 11 21:29:14 2024 +0530 Update Advertisement.ts commit 4e6113d38ba54ec69c1895f3c9539ab949381c30 Author: TASNEEM KOUSHAR Date: Sun Feb 11 21:26:51 2024 +0530 Update push.yml commit 73b68f055a1a3ad35f18683da25b676ade99348c Author: TASNEEM KOUSHAR Date: Sun Feb 11 20:57:18 2024 +0530 Update Advertisement.ts commit 70701ba4d839482a99790ba19938c524f8c8e76a Author: TASNEEM KOUSHAR Date: Sun Feb 11 20:54:11 2024 +0530 Update push.yml commit 57f4d91b0c8d6f846198f4f3b008a6e03e150ff3 Author: TASNEEM KOUSHAR Date: Sun Feb 11 20:30:17 2024 +0530 Update Advertisement.ts commit e1bbff6edfdad9e4bd017eaeb865d36d706119a8 Author: TASNEEM KOUSHAR Date: Sun Feb 11 20:25:45 2024 +0530 Update pull_changes.yml commit 332c429d19b2370d4f9b8c63c6b7c5ed75f46de2 Author: TASNEEM KOUSHAR Date: Sun Feb 11 20:06:36 2024 +0530 Update pull_changes.yml commit d7450c4897c58b8b208a8ac3137dee8f6cd4a1d1 Author: TASNEEM KOUSHAR Date: Sun Feb 11 20:06:01 2024 +0530 Update push.yml commit 7b9a88f14d5b3bae426c9c6f82b96e801d6cae32 Author: TASNEEM KOUSHAR Date: Sun Feb 11 19:50:17 2024 +0530 Update push.yml commit 94d2d18cb83d16df2481b64c054188101233cc18 Author: TASNEEM KOUSHAR Date: Sun Feb 11 19:39:08 2024 +0530 Create pull_changes.yml commit 031adf9d12d5d19f55c77ccc5db6410602bd3e90 Author: Peter Harrison <16875803+palisadoes@users.noreply.github.com> Date: Sat Feb 10 19:27:48 2024 -0800 Restore the automated-docs if statement commit 3fd06759ba0b75706723a5f22120120ed6cab122 Merge: ad9a412d fa10711d Author: ANKIT VARSHNEY <132201033+AVtheking@users.noreply.github.com> Date: Fri Feb 9 00:59:59 2024 +0530 Merge branch 'PalisadoesFoundation:develop' into develop --- .github/workflows/pull_changes.yml | 23 + .github/workflows/push.yml | 37 +- package-lock.json | 692 ++++++++++++++---- package.json | 10 +- src/models/Advertisement.ts | 2 +- src/resolvers/Mutation/removeAdvertisement.ts | 38 +- tests/resolvers/Mutation/createPost.spec.ts | 98 ++- .../Mutation/removeAdvertisement.spec.ts | 24 +- 8 files changed, 731 insertions(+), 193 deletions(-) create mode 100644 .github/workflows/pull_changes.yml diff --git a/.github/workflows/pull_changes.yml b/.github/workflows/pull_changes.yml new file mode 100644 index 0000000000..006cd1ad25 --- /dev/null +++ b/.github/workflows/pull_changes.yml @@ -0,0 +1,23 @@ +name: Copy Docs to Talawa Docs + +on: + schedule: + - cron: '*/5 * * * *' +jobs: + copy-docs-to-talawa-docs: + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/automated-docs' + # needs: Generate-Documentation + steps: + - uses: actions/checkout@v3 + - uses: dmnemec/copy_file_to_another_repo_action@v1.1.1 + env: + API_TOKEN_GITHUB: ${{secrets.TALAWA_DOCS_SYNC}} + with: + source_file: 'talawa-api-docs/' + destination_repo: 'PalisadoesFoundation/talawa-docs' + destination_branch: 'develop' + destination_folder: 'docs/' + user_email: '${{env.email}}' + user_name: '${{github.actor}}' + commit_message: 'Talawa API docs updated' diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 6eb103c38b..facb5bc15f 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -96,7 +96,7 @@ jobs: Generate-Documentation: name: Generate Documentation runs-on: ubuntu-latest - # if: github.ref == 'refs/heads/automated-docs' + if: github.ref == 'refs/heads/develop' needs: Push-Workflow steps: - name: Checkout repository @@ -150,23 +150,24 @@ jobs: name: documentation-api path: talawa-api-docs - Copy-docs-to-talawa-docs: - runs-on: ubuntu-latest - needs: Generate-Documentation - steps: - - uses: actions/checkout@v3 - - uses: dmnemec/copy_file_to_another_repo_action@v1.1.1 - env: - API_TOKEN_GITHUB: ${{secrets.TALAWA_DOCS_SYNC}} - with: - source_file: 'talawa-api-docs/' - destination_repo: 'PalisadoesFoundation/talawa-docs' - destination_branch: 'develop' - destination_folder: 'docs/' - user_email: '${{env.email}}' - user_name: '${{github.actor}}' - commit_message: 'Talawa API docs updated' - + # Copy-docs-to-talawa-docs: + # runs-on: ubuntu-latest + # if: github.ref == 'refs/heads/automated-docs' + # # needs: Generate-Documentation + # steps: + # - uses: actions/checkout@v3 + # - uses: dmnemec/copy_file_to_another_repo_action@v1.1.1 + # env: + # API_TOKEN_GITHUB: ${{secrets.TALAWA_DOCS_SYNC}} + # with: + # source_file: 'talawa-api-docs/' + # destination_repo: 'PalisadoesFoundation/talawa-docs' + # destination_branch: 'develop' + # destination_folder: 'docs/' + # user_email: '${{env.email}}' + # user_name: '${{github.actor}}' + # commit_message: 'Talawa API docs updated' + # You can find the deployment instructions in the scripts/cloud-api-demo/README.md file Deploy-Workflow: name: Deploying Application to Cloud VPS diff --git a/package-lock.json b/package-lock.json index f7aecf2450..12919106f9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -49,7 +49,7 @@ "mongoose-paginate-v2": "^1.7.0", "morgan": "^1.10.0", "nanoid": "^5.0.5", - "nodemailer": "^6.9.8", + "nodemailer": "^6.9.9", "pm2": "^5.2.0", "redis": "^4.6.12", "shortid": "^2.2.16", @@ -64,7 +64,7 @@ }, "devDependencies": { "@graphql-codegen/cli": "^5.0.0", - "@graphql-codegen/typescript": "^4.0.1", + "@graphql-codegen/typescript": "^4.0.4", "@graphql-codegen/typescript-resolvers": "^4.0.1", "@graphql-eslint/eslint-plugin": "^3.20.1", "@types/bcryptjs": "^2.4.6", @@ -84,8 +84,8 @@ "@types/nodemailer": "^6.4.14", "@types/shortid": "^0.0.32", "@types/uuid": "^9.0.7", - "@types/validator": "^13.11.7", - "@typescript-eslint/eslint-plugin": "^6.20.0", + "@types/validator": "^13.11.9", + "@typescript-eslint/eslint-plugin": "^6.21.0", "@typescript-eslint/parser": "^6.20.0", "@vitest/coverage-c8": "^0.24.3", "concurrently": "^8.2.2", @@ -96,7 +96,7 @@ "get-graphql-schema": "^2.1.2", "graphql-markdown": "^7.0.0", "husky": "^9.0.6", - "lint-staged": "^15.2.1", + "lint-staged": "^15.2.2", "prettier": "^2.7.1", "rimraf": "^5.0.5", "tsx": "^4.7.0", @@ -2640,9 +2640,9 @@ "dev": true }, "node_modules/@graphql-codegen/plugin-helpers": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/@graphql-codegen/plugin-helpers/-/plugin-helpers-5.0.1.tgz", - "integrity": "sha512-6L5sb9D8wptZhnhLLBcheSPU7Tg//DGWgc5tQBWX46KYTOTQHGqDpv50FxAJJOyFVJrveN9otWk9UT9/yfY4ww==", + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/@graphql-codegen/plugin-helpers/-/plugin-helpers-5.0.3.tgz", + "integrity": "sha512-yZ1rpULIWKBZqCDlvGIJRSyj1B2utkEdGmXZTBT/GVayP4hyRYlkd36AJV/LfEsVD8dnsKL5rLz2VTYmRNlJ5Q==", "dev": true, "dependencies": { "@graphql-tools/utils": "^10.0.0", @@ -2650,49 +2650,37 @@ "common-tags": "1.8.2", "import-from": "4.0.0", "lodash": "~4.17.0", - "tslib": "~2.5.0" + "tslib": "~2.6.0" }, "peerDependencies": { "graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0" } }, - "node_modules/@graphql-codegen/plugin-helpers/node_modules/tslib": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.3.tgz", - "integrity": "sha512-mSxlJJwl3BMEQCUNnxXBU9jP4JBktcEGhURcPR6VQVlnP0FdDEsIaz0C35dXNGLyRfrATNofF0F5p2KPxQgB+w==", - "dev": true - }, "node_modules/@graphql-codegen/schema-ast": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@graphql-codegen/schema-ast/-/schema-ast-4.0.0.tgz", - "integrity": "sha512-WIzkJFa9Gz28FITAPILbt+7A8+yzOyd1NxgwFh7ie+EmO9a5zQK6UQ3U/BviirguXCYnn+AR4dXsoDrSrtRA1g==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@graphql-codegen/schema-ast/-/schema-ast-4.0.2.tgz", + "integrity": "sha512-5mVAOQQK3Oz7EtMl/l3vOQdc2aYClUzVDHHkMvZlunc+KlGgl81j8TLa+X7ANIllqU4fUEsQU3lJmk4hXP6K7Q==", "dev": true, "dependencies": { - "@graphql-codegen/plugin-helpers": "^5.0.0", + "@graphql-codegen/plugin-helpers": "^5.0.3", "@graphql-tools/utils": "^10.0.0", - "tslib": "~2.5.0" + "tslib": "~2.6.0" }, "peerDependencies": { "graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0" } }, - "node_modules/@graphql-codegen/schema-ast/node_modules/tslib": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.3.tgz", - "integrity": "sha512-mSxlJJwl3BMEQCUNnxXBU9jP4JBktcEGhURcPR6VQVlnP0FdDEsIaz0C35dXNGLyRfrATNofF0F5p2KPxQgB+w==", - "dev": true - }, "node_modules/@graphql-codegen/typescript": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@graphql-codegen/typescript/-/typescript-4.0.1.tgz", - "integrity": "sha512-3YziQ21dCVdnHb+Us1uDb3pA6eG5Chjv0uTK+bt9dXeMlwYBU8MbtzvQTo4qvzWVC1AxSOKj0rgfNu1xCXqJyA==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@graphql-codegen/typescript/-/typescript-4.0.4.tgz", + "integrity": "sha512-x79CKLfP9UQCX+/I78qxQlMs2Mmq3pF1lKafZo7lAno0f/fvJ+qWUduzdgjRNz+YL+5blGeWcC0pWEDxniO7hw==", "dev": true, "dependencies": { - "@graphql-codegen/plugin-helpers": "^5.0.0", - "@graphql-codegen/schema-ast": "^4.0.0", - "@graphql-codegen/visitor-plugin-common": "4.0.1", + "@graphql-codegen/plugin-helpers": "^5.0.3", + "@graphql-codegen/schema-ast": "^4.0.2", + "@graphql-codegen/visitor-plugin-common": "4.1.2", "auto-bind": "~4.0.0", - "tslib": "~2.5.0" + "tslib": "~2.6.0" }, "peerDependencies": { "graphql": "^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0" @@ -2721,11 +2709,26 @@ "integrity": "sha512-mSxlJJwl3BMEQCUNnxXBU9jP4JBktcEGhURcPR6VQVlnP0FdDEsIaz0C35dXNGLyRfrATNofF0F5p2KPxQgB+w==", "dev": true }, - "node_modules/@graphql-codegen/typescript/node_modules/tslib": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.3.tgz", - "integrity": "sha512-mSxlJJwl3BMEQCUNnxXBU9jP4JBktcEGhURcPR6VQVlnP0FdDEsIaz0C35dXNGLyRfrATNofF0F5p2KPxQgB+w==", - "dev": true + "node_modules/@graphql-codegen/typescript/node_modules/@graphql-codegen/visitor-plugin-common": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/@graphql-codegen/visitor-plugin-common/-/visitor-plugin-common-4.1.2.tgz", + "integrity": "sha512-yk7iEAL1kYZ2Gi/pvVjdsZhul5WsYEM4Zcgh2Ev15VicMdJmPHsMhNUsZWyVJV0CaQCYpNOFlGD/11Ea3pn4GA==", + "dev": true, + "dependencies": { + "@graphql-codegen/plugin-helpers": "^5.0.3", + "@graphql-tools/optimize": "^2.0.0", + "@graphql-tools/relay-operation-optimizer": "^7.0.0", + "@graphql-tools/utils": "^10.0.0", + "auto-bind": "~4.0.0", + "change-case-all": "1.0.15", + "dependency-graph": "^0.11.0", + "graphql-tag": "^2.11.0", + "parse-filepath": "^1.0.2", + "tslib": "~2.6.0" + }, + "peerDependencies": { + "graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0" + } }, "node_modules/@graphql-codegen/visitor-plugin-common": { "version": "4.0.1", @@ -6168,9 +6171,9 @@ "integrity": "sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==" }, "node_modules/@types/semver": { - "version": "7.5.6", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.6.tgz", - "integrity": "sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==", + "version": "7.5.7", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.7.tgz", + "integrity": "sha512-/wdoPq1QqkSj9/QOeKkFquEuPzQbHTWAMPH/PaUMB+JuR31lXhlWXRZ52IpfDYVlDOUBvX09uBrPwxGT1hjNBg==", "dev": true }, "node_modules/@types/send": { @@ -6219,9 +6222,9 @@ "dev": true }, "node_modules/@types/validator": { - "version": "13.11.8", - "resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.11.8.tgz", - "integrity": "sha512-c/hzNDBh7eRF+KbCf+OoZxKbnkpaK/cKp9iLQWqB7muXtM+MtL9SUUH8vCFcLn6dH1Qm05jiexK0ofWY7TfOhQ==", + "version": "13.11.9", + "resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.11.9.tgz", + "integrity": "sha512-FCTsikRozryfayPuiI46QzH3fnrOoctTjvOYZkho9BTFLCOZ2rgZJHMOVgCOfttjPJcgOx52EpkY0CMfy87MIw==", "dev": true }, "node_modules/@types/ws": { @@ -6246,16 +6249,16 @@ "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==" }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "6.20.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.20.0.tgz", - "integrity": "sha512-fTwGQUnjhoYHeSF6m5pWNkzmDDdsKELYrOBxhjMrofPqCkoC2k3B2wvGHFxa1CTIqkEn88nlW1HVMztjo2K8Hg==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.21.0.tgz", + "integrity": "sha512-oy9+hTPCUFpngkEZUSzbf9MxI65wbKFoQYsgPdILTfbUldp5ovUuphZVe4i30emU9M/kP+T64Di0mxl7dSw3MA==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.20.0", - "@typescript-eslint/type-utils": "6.20.0", - "@typescript-eslint/utils": "6.20.0", - "@typescript-eslint/visitor-keys": "6.20.0", + "@typescript-eslint/scope-manager": "6.21.0", + "@typescript-eslint/type-utils": "6.21.0", + "@typescript-eslint/utils": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -6280,6 +6283,53 @@ } } }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz", + "integrity": "sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", + "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", + "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -6353,13 +6403,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "6.20.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.20.0.tgz", - "integrity": "sha512-qnSobiJQb1F5JjN0YDRPHruQTrX7ICsmltXhkV536mp4idGAYrIyr47zF/JmkJtEcAVnIz4gUYJ7gOZa6SmN4g==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.21.0.tgz", + "integrity": "sha512-rZQI7wHfao8qMX3Rd3xqeYSMCL3SoiSQLBATSiVKARdFGCYSRvmViieZjqc58jKgs8Y8i9YvVVhRbHSTA4VBag==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "6.20.0", - "@typescript-eslint/utils": "6.20.0", + "@typescript-eslint/typescript-estree": "6.21.0", + "@typescript-eslint/utils": "6.21.0", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -6379,6 +6429,115 @@ } } }, + "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", + "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz", + "integrity": "sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "9.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/visitor-keys": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", + "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/type-utils/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/@typescript-eslint/type-utils/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/semver": { + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@typescript-eslint/types": { "version": "6.20.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.20.0.tgz", @@ -6472,17 +6631,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "6.20.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.20.0.tgz", - "integrity": "sha512-/EKuw+kRu2vAqCoDwDCBtDRU6CTKbUmwwI7SH7AashZ+W+7o8eiyy6V2cdOqN49KsTcASWsC5QeghYuRDTyOOg==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.21.0.tgz", + "integrity": "sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.20.0", - "@typescript-eslint/types": "6.20.0", - "@typescript-eslint/typescript-estree": "6.20.0", + "@typescript-eslint/scope-manager": "6.21.0", + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/typescript-estree": "6.21.0", "semver": "^7.5.4" }, "engines": { @@ -6496,6 +6655,90 @@ "eslint": "^7.0.0 || ^8.0.0" } }, + "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/scope-manager": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz", + "integrity": "sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", + "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/typescript-estree": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz", + "integrity": "sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "9.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/visitor-keys": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", + "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, "node_modules/@typescript-eslint/utils/node_modules/lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -6508,10 +6751,25 @@ "node": ">=10" } }, + "node_modules/@typescript-eslint/utils/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/@typescript-eslint/utils/node_modules/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" @@ -12158,9 +12416,9 @@ "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==" }, "node_modules/lint-staged": { - "version": "15.2.1", - "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-15.2.1.tgz", - "integrity": "sha512-dhwAPnM85VdshybV9FWI/9ghTvMLoQLEXgVMx+ua2DN7mdfzd/tRfoU2yhMcBac0RHkofoxdnnJUokr8s4zKmQ==", + "version": "15.2.2", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-15.2.2.tgz", + "integrity": "sha512-TiTt93OPh1OZOsb5B7k96A/ATl2AjIZo+vnzFZ6oHK5FuTk63ByDtxGQpHm+kFETjEWqgkF95M8FRXKR/LEBcw==", "dev": true, "dependencies": { "chalk": "5.3.0", @@ -13417,9 +13675,9 @@ "integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==" }, "node_modules/nodemailer": { - "version": "6.9.8", - "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.8.tgz", - "integrity": "sha512-cfrYUk16e67Ks051i4CntM9kshRYei1/o/Gi8K1d+R34OIs21xdFnW7Pt7EucmVKA0LKtqUGNcjMZ7ehjl49mQ==", + "version": "6.9.9", + "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.9.tgz", + "integrity": "sha512-dexTll8zqQoVJEZPwQAKzxxtFn0qTnjdQTchoU6Re9BUUGBJiOy3YMn/0ShTW6J5M0dfQ1NeDeRTTl4oIWgQMA==", "engines": { "node": ">=6.0.0" } @@ -18935,9 +19193,9 @@ } }, "@graphql-codegen/plugin-helpers": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/@graphql-codegen/plugin-helpers/-/plugin-helpers-5.0.1.tgz", - "integrity": "sha512-6L5sb9D8wptZhnhLLBcheSPU7Tg//DGWgc5tQBWX46KYTOTQHGqDpv50FxAJJOyFVJrveN9otWk9UT9/yfY4ww==", + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/@graphql-codegen/plugin-helpers/-/plugin-helpers-5.0.3.tgz", + "integrity": "sha512-yZ1rpULIWKBZqCDlvGIJRSyj1B2utkEdGmXZTBT/GVayP4hyRYlkd36AJV/LfEsVD8dnsKL5rLz2VTYmRNlJ5Q==", "dev": true, "requires": { "@graphql-tools/utils": "^10.0.0", @@ -18945,54 +19203,50 @@ "common-tags": "1.8.2", "import-from": "4.0.0", "lodash": "~4.17.0", - "tslib": "~2.5.0" - }, - "dependencies": { - "tslib": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.3.tgz", - "integrity": "sha512-mSxlJJwl3BMEQCUNnxXBU9jP4JBktcEGhURcPR6VQVlnP0FdDEsIaz0C35dXNGLyRfrATNofF0F5p2KPxQgB+w==", - "dev": true - } + "tslib": "~2.6.0" } }, "@graphql-codegen/schema-ast": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@graphql-codegen/schema-ast/-/schema-ast-4.0.0.tgz", - "integrity": "sha512-WIzkJFa9Gz28FITAPILbt+7A8+yzOyd1NxgwFh7ie+EmO9a5zQK6UQ3U/BviirguXCYnn+AR4dXsoDrSrtRA1g==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@graphql-codegen/schema-ast/-/schema-ast-4.0.2.tgz", + "integrity": "sha512-5mVAOQQK3Oz7EtMl/l3vOQdc2aYClUzVDHHkMvZlunc+KlGgl81j8TLa+X7ANIllqU4fUEsQU3lJmk4hXP6K7Q==", "dev": true, "requires": { - "@graphql-codegen/plugin-helpers": "^5.0.0", + "@graphql-codegen/plugin-helpers": "^5.0.3", "@graphql-tools/utils": "^10.0.0", - "tslib": "~2.5.0" - }, - "dependencies": { - "tslib": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.3.tgz", - "integrity": "sha512-mSxlJJwl3BMEQCUNnxXBU9jP4JBktcEGhURcPR6VQVlnP0FdDEsIaz0C35dXNGLyRfrATNofF0F5p2KPxQgB+w==", - "dev": true - } + "tslib": "~2.6.0" } }, "@graphql-codegen/typescript": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@graphql-codegen/typescript/-/typescript-4.0.1.tgz", - "integrity": "sha512-3YziQ21dCVdnHb+Us1uDb3pA6eG5Chjv0uTK+bt9dXeMlwYBU8MbtzvQTo4qvzWVC1AxSOKj0rgfNu1xCXqJyA==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@graphql-codegen/typescript/-/typescript-4.0.4.tgz", + "integrity": "sha512-x79CKLfP9UQCX+/I78qxQlMs2Mmq3pF1lKafZo7lAno0f/fvJ+qWUduzdgjRNz+YL+5blGeWcC0pWEDxniO7hw==", "dev": true, "requires": { - "@graphql-codegen/plugin-helpers": "^5.0.0", - "@graphql-codegen/schema-ast": "^4.0.0", - "@graphql-codegen/visitor-plugin-common": "4.0.1", + "@graphql-codegen/plugin-helpers": "^5.0.3", + "@graphql-codegen/schema-ast": "^4.0.2", + "@graphql-codegen/visitor-plugin-common": "4.1.2", "auto-bind": "~4.0.0", - "tslib": "~2.5.0" + "tslib": "~2.6.0" }, "dependencies": { - "tslib": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.3.tgz", - "integrity": "sha512-mSxlJJwl3BMEQCUNnxXBU9jP4JBktcEGhURcPR6VQVlnP0FdDEsIaz0C35dXNGLyRfrATNofF0F5p2KPxQgB+w==", - "dev": true + "@graphql-codegen/visitor-plugin-common": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/@graphql-codegen/visitor-plugin-common/-/visitor-plugin-common-4.1.2.tgz", + "integrity": "sha512-yk7iEAL1kYZ2Gi/pvVjdsZhul5WsYEM4Zcgh2Ev15VicMdJmPHsMhNUsZWyVJV0CaQCYpNOFlGD/11Ea3pn4GA==", + "dev": true, + "requires": { + "@graphql-codegen/plugin-helpers": "^5.0.3", + "@graphql-tools/optimize": "^2.0.0", + "@graphql-tools/relay-operation-optimizer": "^7.0.0", + "@graphql-tools/utils": "^10.0.0", + "auto-bind": "~4.0.0", + "change-case-all": "1.0.15", + "dependency-graph": "^0.11.0", + "graphql-tag": "^2.11.0", + "parse-filepath": "^1.0.2", + "tslib": "~2.6.0" + } } } }, @@ -21607,9 +21861,9 @@ "integrity": "sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==" }, "@types/semver": { - "version": "7.5.6", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.6.tgz", - "integrity": "sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==", + "version": "7.5.7", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.7.tgz", + "integrity": "sha512-/wdoPq1QqkSj9/QOeKkFquEuPzQbHTWAMPH/PaUMB+JuR31lXhlWXRZ52IpfDYVlDOUBvX09uBrPwxGT1hjNBg==", "dev": true }, "@types/send": { @@ -21658,9 +21912,9 @@ "dev": true }, "@types/validator": { - "version": "13.11.8", - "resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.11.8.tgz", - "integrity": "sha512-c/hzNDBh7eRF+KbCf+OoZxKbnkpaK/cKp9iLQWqB7muXtM+MtL9SUUH8vCFcLn6dH1Qm05jiexK0ofWY7TfOhQ==", + "version": "13.11.9", + "resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.11.9.tgz", + "integrity": "sha512-FCTsikRozryfayPuiI46QzH3fnrOoctTjvOYZkho9BTFLCOZ2rgZJHMOVgCOfttjPJcgOx52EpkY0CMfy87MIw==", "dev": true }, "@types/ws": { @@ -21685,16 +21939,16 @@ "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==" }, "@typescript-eslint/eslint-plugin": { - "version": "6.20.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.20.0.tgz", - "integrity": "sha512-fTwGQUnjhoYHeSF6m5pWNkzmDDdsKELYrOBxhjMrofPqCkoC2k3B2wvGHFxa1CTIqkEn88nlW1HVMztjo2K8Hg==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.21.0.tgz", + "integrity": "sha512-oy9+hTPCUFpngkEZUSzbf9MxI65wbKFoQYsgPdILTfbUldp5ovUuphZVe4i30emU9M/kP+T64Di0mxl7dSw3MA==", "dev": true, "requires": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.20.0", - "@typescript-eslint/type-utils": "6.20.0", - "@typescript-eslint/utils": "6.20.0", - "@typescript-eslint/visitor-keys": "6.20.0", + "@typescript-eslint/scope-manager": "6.21.0", + "@typescript-eslint/type-utils": "6.21.0", + "@typescript-eslint/utils": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -21703,6 +21957,32 @@ "ts-api-utils": "^1.0.1" }, "dependencies": { + "@typescript-eslint/scope-manager": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz", + "integrity": "sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==", + "dev": true, + "requires": { + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0" + } + }, + "@typescript-eslint/types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", + "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", + "dev": true + }, + "@typescript-eslint/visitor-keys": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", + "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", + "dev": true, + "requires": { + "@typescript-eslint/types": "6.21.0", + "eslint-visitor-keys": "^3.4.1" + } + }, "lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -21747,15 +22027,85 @@ } }, "@typescript-eslint/type-utils": { - "version": "6.20.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.20.0.tgz", - "integrity": "sha512-qnSobiJQb1F5JjN0YDRPHruQTrX7ICsmltXhkV536mp4idGAYrIyr47zF/JmkJtEcAVnIz4gUYJ7gOZa6SmN4g==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.21.0.tgz", + "integrity": "sha512-rZQI7wHfao8qMX3Rd3xqeYSMCL3SoiSQLBATSiVKARdFGCYSRvmViieZjqc58jKgs8Y8i9YvVVhRbHSTA4VBag==", "dev": true, "requires": { - "@typescript-eslint/typescript-estree": "6.20.0", - "@typescript-eslint/utils": "6.20.0", + "@typescript-eslint/typescript-estree": "6.21.0", + "@typescript-eslint/utils": "6.21.0", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" + }, + "dependencies": { + "@typescript-eslint/types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", + "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", + "dev": true + }, + "@typescript-eslint/typescript-estree": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz", + "integrity": "sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==", + "dev": true, + "requires": { + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "9.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + } + }, + "@typescript-eslint/visitor-keys": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", + "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", + "dev": true, + "requires": { + "@typescript-eslint/types": "6.21.0", + "eslint-visitor-keys": "^3.4.1" + } + }, + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0" + } + }, + "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" + } + }, + "minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "requires": { + "brace-expansion": "^2.0.1" + } + }, + "semver": { + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + } } }, "@typescript-eslint/types": { @@ -21819,20 +22169,71 @@ } }, "@typescript-eslint/utils": { - "version": "6.20.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.20.0.tgz", - "integrity": "sha512-/EKuw+kRu2vAqCoDwDCBtDRU6CTKbUmwwI7SH7AashZ+W+7o8eiyy6V2cdOqN49KsTcASWsC5QeghYuRDTyOOg==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.21.0.tgz", + "integrity": "sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ==", "dev": true, "requires": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.20.0", - "@typescript-eslint/types": "6.20.0", - "@typescript-eslint/typescript-estree": "6.20.0", + "@typescript-eslint/scope-manager": "6.21.0", + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/typescript-estree": "6.21.0", "semver": "^7.5.4" }, "dependencies": { + "@typescript-eslint/scope-manager": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz", + "integrity": "sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==", + "dev": true, + "requires": { + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0" + } + }, + "@typescript-eslint/types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", + "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", + "dev": true + }, + "@typescript-eslint/typescript-estree": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz", + "integrity": "sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==", + "dev": true, + "requires": { + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "9.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + } + }, + "@typescript-eslint/visitor-keys": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", + "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", + "dev": true, + "requires": { + "@typescript-eslint/types": "6.21.0", + "eslint-visitor-keys": "^3.4.1" + } + }, + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0" + } + }, "lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -21842,10 +22243,19 @@ "yallist": "^4.0.0" } }, + "minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "requires": { + "brace-expansion": "^2.0.1" + } + }, "semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", "dev": true, "requires": { "lru-cache": "^6.0.0" @@ -25980,9 +26390,9 @@ "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==" }, "lint-staged": { - "version": "15.2.1", - "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-15.2.1.tgz", - "integrity": "sha512-dhwAPnM85VdshybV9FWI/9ghTvMLoQLEXgVMx+ua2DN7mdfzd/tRfoU2yhMcBac0RHkofoxdnnJUokr8s4zKmQ==", + "version": "15.2.2", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-15.2.2.tgz", + "integrity": "sha512-TiTt93OPh1OZOsb5B7k96A/ATl2AjIZo+vnzFZ6oHK5FuTk63ByDtxGQpHm+kFETjEWqgkF95M8FRXKR/LEBcw==", "dev": true, "requires": { "chalk": "5.3.0", @@ -26879,9 +27289,9 @@ "integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==" }, "nodemailer": { - "version": "6.9.8", - "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.8.tgz", - "integrity": "sha512-cfrYUk16e67Ks051i4CntM9kshRYei1/o/Gi8K1d+R34OIs21xdFnW7Pt7EucmVKA0LKtqUGNcjMZ7ehjl49mQ==" + "version": "6.9.9", + "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.9.tgz", + "integrity": "sha512-dexTll8zqQoVJEZPwQAKzxxtFn0qTnjdQTchoU6Re9BUUGBJiOy3YMn/0ShTW6J5M0dfQ1NeDeRTTl4oIWgQMA==" }, "normalize-path": { "version": "3.0.0", diff --git a/package.json b/package.json index 570b502bd9..eabaa960ee 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ "mongoose-paginate-v2": "^1.7.0", "morgan": "^1.10.0", "nanoid": "^5.0.5", - "nodemailer": "^6.9.8", + "nodemailer": "^6.9.9", "pm2": "^5.2.0", "redis": "^4.6.12", "shortid": "^2.2.16", @@ -98,7 +98,7 @@ }, "devDependencies": { "@graphql-codegen/cli": "^5.0.0", - "@graphql-codegen/typescript": "^4.0.1", + "@graphql-codegen/typescript": "^4.0.4", "@graphql-codegen/typescript-resolvers": "^4.0.1", "@graphql-eslint/eslint-plugin": "^3.20.1", "@types/bcryptjs": "^2.4.6", @@ -118,8 +118,8 @@ "@types/nodemailer": "^6.4.14", "@types/shortid": "^0.0.32", "@types/uuid": "^9.0.7", - "@types/validator": "^13.11.7", - "@typescript-eslint/eslint-plugin": "^6.20.0", + "@types/validator": "^13.11.9", + "@typescript-eslint/eslint-plugin": "^6.21.0", "@typescript-eslint/parser": "^6.20.0", "@vitest/coverage-c8": "^0.24.3", "concurrently": "^8.2.2", @@ -130,7 +130,7 @@ "get-graphql-schema": "^2.1.2", "graphql-markdown": "^7.0.0", "husky": "^9.0.6", - "lint-staged": "^15.2.1", + "lint-staged": "^15.2.2", "prettier": "^2.7.1", "rimraf": "^5.0.5", "tsx": "^4.7.0", diff --git a/src/models/Advertisement.ts b/src/models/Advertisement.ts index 2aacecf2e8..ef1a48188b 100644 --- a/src/models/Advertisement.ts +++ b/src/models/Advertisement.ts @@ -2,7 +2,7 @@ import type { Types, Model, PopulatedDoc } from "mongoose"; import { Schema, model, models } from "mongoose"; import type { InterfaceUser } from "./User"; /** - * This is an interface that represents a database(MongoDB) document for Advertisement. + * This is an interface, that represents database - (MongoDB) document for Advertisement. */ export interface InterfaceAdvertisement { _id: Types.ObjectId; diff --git a/src/resolvers/Mutation/removeAdvertisement.ts b/src/resolvers/Mutation/removeAdvertisement.ts index 9c9fa0059c..ff5ec2764e 100644 --- a/src/resolvers/Mutation/removeAdvertisement.ts +++ b/src/resolvers/Mutation/removeAdvertisement.ts @@ -2,27 +2,31 @@ import type { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { Advertisement } from "../../models"; import { ADVERTISEMENT_NOT_FOUND_ERROR } from "../../constants"; +import mongoose from "mongoose"; -// @ts-ignore +// @ts-expect-error : This block intentionally ignores TypeScript checking for incomplete code. export const removeAdvertisement: MutationResolvers["removeAdvertisement"] = // eslint-disable-next-line @typescript-eslint/no-unused-vars async (_parent, args, _context) => { - const currentAd = await Advertisement.findOne({ - _id: args.id ? args.id : "", - }).lean(); + const myId = args.id ? args.id : ""; - if (!currentAd) { - throw new errors.NotFoundError( - requestContext.translate(ADVERTISEMENT_NOT_FOUND_ERROR.MESSAGE), - ADVERTISEMENT_NOT_FOUND_ERROR.CODE, - ADVERTISEMENT_NOT_FOUND_ERROR.PARAM - ); - } + if (mongoose.Types.ObjectId.isValid(myId)) { + const currentAd = await Advertisement.findOne({ + _id: myId, + }).lean(); + if (!currentAd) { + throw new errors.NotFoundError( + requestContext.translate(ADVERTISEMENT_NOT_FOUND_ERROR.MESSAGE), + ADVERTISEMENT_NOT_FOUND_ERROR.CODE, + ADVERTISEMENT_NOT_FOUND_ERROR.PARAM + ); + } - // Deletes the ad. - await Advertisement.deleteOne({ - _id: args.id ? args.id : "", - }); - // Returns deleted ad. - return currentAd; + // Deletes the ad. + await Advertisement.deleteOne({ + _id: myId, + }); + // Returns deleted ad. + return currentAd; + } }; diff --git a/tests/resolvers/Mutation/createPost.spec.ts b/tests/resolvers/Mutation/createPost.spec.ts index 0e2135831c..9f779c1646 100644 --- a/tests/resolvers/Mutation/createPost.spec.ts +++ b/tests/resolvers/Mutation/createPost.spec.ts @@ -21,9 +21,10 @@ import { USER_NOT_AUTHORIZED_TO_PIN, USER_NOT_FOUND_ERROR, } from "../../../src/constants"; -import { AppUserProfile, Organization } from "../../../src/models"; +import { AppUserProfile, Organization, Post } from "../../../src/models"; import { createPost as createPostResolverImage } from "../../../src/resolvers/Mutation/createPost"; import * as uploadEncodedImage from "../../../src/utilities/encodedImageStorage/uploadEncodedImage"; +import * as uploadEncodedVideo from "../../../src/utilities/encodedVideoStorage/uploadEncodedVideo"; import type { TestOrganizationType, TestUserType, @@ -147,6 +148,7 @@ describe("resolvers -> Mutation -> createPost", () => { userId: randomUser?.id, }; + expect(args.data.pinned).toBe(true); const { createPost: createPostResolver } = await import( "../../../src/resolvers/Mutation/createPost" ); @@ -180,16 +182,18 @@ describe("resolvers -> Mutation -> createPost", () => { userId: testUser?.id, }; + expect(args.data.pinned).toBe(true); + const { createPost: createPostResolver } = await import( "../../../src/resolvers/Mutation/createPost" ); const createdPost = await createPostResolver?.({}, args, context); - expect(createdPost).toEqual( expect.objectContaining({ text: "New Post Text", videoUrl: null, // Update the expected value to match the received value title: "New Post Title", + pinned: true, }) ); @@ -204,7 +208,7 @@ describe("resolvers -> Mutation -> createPost", () => { ).toBeTruthy(); }); - it(`creates the post and returns it when image is not provided`, async () => { + it(`creates the post and returns it when image or video is not provided`, async () => { const args: MutationCreatePostArgs = { data: { organizationId: testOrganization?.id, @@ -219,11 +223,14 @@ describe("resolvers -> Mutation -> createPost", () => { userId: testUser?.id, }; + expect(args.data.pinned).toBe(true); + const { createPost: createPostResolver } = await import( "../../../src/resolvers/Mutation/createPost" ); const createPostPayload = await createPostResolver?.({}, args, context); + expect(createPostPayload?.pinned).toBe(true); expect(createPostPayload).toEqual( expect.objectContaining({ @@ -236,6 +243,82 @@ describe("resolvers -> Mutation -> createPost", () => { ); }); + it(`creates the post and and returns it when an image is provided`, async () => { + const args: MutationCreatePostArgs = { + data: { + organizationId: testOrganization?.id, + text: "text", + title: "title", + pinned: true, + }, + file: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAAZSURBVBhXYzxz5sx/BiBgefLkCQMbGxsDAEdkBicg9wbaAAAAAElFTkSuQmCC", // Provide a supported file type + }; + + vi.spyOn(uploadEncodedImage, "uploadEncodedImage").mockImplementation( + async (encodedImageURL: string) => encodedImageURL + ); + + const context = { + userId: testUser?.id, + apiRootUrl: BASE_URL, + }; + + expect(args.data.pinned).toBe(true); + + const createPostPayload = await createPostResolverImage?.( + {}, + args, + context + ); + expect(createPostPayload?.pinned).toBe(true); + + const testCreatePostPayload = await Post.findOne({ + _id: createPostPayload?._id, + imageUrl: { $ne: null }, + }).lean(); + + //Ensures that the post is created and imageUrl is not null + expect(testCreatePostPayload).not.toBeNull(); + }); + + it(`creates the post and and returns it when a video is provided`, async () => { + const args: MutationCreatePostArgs = { + data: { + organizationId: testOrganization?.id, + text: "text", + title: "title", + pinned: true, + }, + file: "data:video/mp4;base64,VIDEO_BASE64_DATA_HERE", // Provide a supported file type + }; + + vi.spyOn(uploadEncodedVideo, "uploadEncodedVideo").mockImplementation( + async (uploadEncodedVideo: string) => uploadEncodedVideo + ); + + const context = { + userId: testUser?.id, + apiRootUrl: BASE_URL, + }; + + expect(args.data.pinned).toBe(true); + + const createPostPayload = await createPostResolverImage?.( + {}, + args, + context + ); + expect(createPostPayload?.pinned).toBe(true); + + const testCreatePostPayload = await Post.findOne({ + _id: createPostPayload?._id, + videoUrl: { $ne: null }, + }).lean(); + + //Ensures that the post is created and videoUrl is not null + expect(testCreatePostPayload).not.toBeNull(); + }); + it(`creates the post and throws an error for unsupported file type`, async () => { const args: MutationCreatePostArgs = { data: { @@ -243,6 +326,7 @@ describe("resolvers -> Mutation -> createPost", () => { text: "text", videoUrl: "videoUrl", title: "title", + pinned: true, }, file: "unsupportedFile.txt", // Provide an unsupported file type }; @@ -252,6 +336,8 @@ describe("resolvers -> Mutation -> createPost", () => { apiRootUrl: BASE_URL, }; + expect(args.data.pinned).toBe(true); + // Mock the uploadEncodedImage function to throw an error for unsupported file types vi.spyOn(uploadEncodedImage, "uploadEncodedImage").mockImplementation( () => { @@ -286,7 +372,7 @@ describe("resolvers -> Mutation -> createPost", () => { const context = { userId: testUser?.id, }; - + expect(args.data.pinned).toBe(true); const { createPost: createPostResolver } = await import( "../../../src/resolvers/Mutation/createPost" ); @@ -319,6 +405,8 @@ describe("resolvers -> Mutation -> createPost", () => { userId: testUser?.id, }; + expect(args.data.pinned).toBe(true); + const { createPost: createPostResolver } = await import( "../../../src/resolvers/Mutation/createPost" ); @@ -350,6 +438,7 @@ describe("resolvers -> Mutation -> createPost", () => { userId: testUser?.id, }; + expect(args.data.pinned).toBe(false); const { createPost: createPostResolver } = await import( "../../../src/resolvers/Mutation/createPost" ); @@ -379,6 +468,7 @@ describe("resolvers -> Mutation -> createPost", () => { const context = { userId: testUser?.id, }; + expect(args.data.pinned).toBe(true); const { createPost: createPostResolver } = await import( "../../../src/resolvers/Mutation/createPost" diff --git a/tests/resolvers/Mutation/removeAdvertisement.spec.ts b/tests/resolvers/Mutation/removeAdvertisement.spec.ts index 79a05d8523..c07e952092 100644 --- a/tests/resolvers/Mutation/removeAdvertisement.spec.ts +++ b/tests/resolvers/Mutation/removeAdvertisement.spec.ts @@ -88,13 +88,21 @@ describe("resolvers -> Mutation -> removeAdvertisement", () => { context ); + const removeAdvertisementPayloadFalsyId = await removeAdvertisement?.( + {}, + { id: "" }, + context + ); expect(removeAdvertisementPayload).toHaveProperty( "_id", createdAdvertisementId ); - + if (removeAdvertisementPayloadFalsyId) { + expect(removeAdvertisementPayloadFalsyId).toHaveProperty("_id", ""); + } else { + console.error("removeAdvertisementPayloadFalsyId is undefined or null"); + } expect(removeAdvertisementPayload).toHaveProperty("name", "myad"); - expect(removeAdvertisementPayload).toHaveProperty( "link", "https://www.example.com" @@ -122,11 +130,13 @@ describe("resolvers -> Mutation -> removeAdvertisement", () => { { id: "64d1f8cb77a4b51004f824b8" }, context ); - } catch (error: any) { - expect(spy).toBeCalledWith(ADVERTISEMENT_NOT_FOUND_ERROR.MESSAGE); - expect(error.message).toEqual( - `Translated ${ADVERTISEMENT_NOT_FOUND_ERROR.MESSAGE}` - ); + } catch (error: unknown) { + if (error instanceof Error) { + expect(spy).toBeCalledWith(ADVERTISEMENT_NOT_FOUND_ERROR.MESSAGE); + expect(error.message).toEqual( + `Translated ${ADVERTISEMENT_NOT_FOUND_ERROR.MESSAGE}` + ); + } } }); });