diff --git a/.eslintignore b/.eslintignore index 7f1734b6c8..4ba8c742cd 100644 --- a/.eslintignore +++ b/.eslintignore @@ -3,4 +3,4 @@ build coverage node_modules -src/generated \ No newline at end of file +src/types \ No newline at end of file diff --git a/.github/workflows/check-jsdocs-comment.py b/.github/workflows/check-jsdocs-comment.py index f76c8ed63f..c21b55ab44 100644 --- a/.github/workflows/check-jsdocs-comment.py +++ b/.github/workflows/check-jsdocs-comment.py @@ -61,9 +61,8 @@ def get_directories(): # list of dir to look in repo for files directories = [ directory, - os.path.expanduser(os.path.join(directory, 'lib')), os.path.expanduser(os.path.join(directory, 'src')), - os.path.expanduser(os.path.join(directory, 'test')) + os.path.expanduser(os.path.join(directory, 'tests')) ] return directories diff --git a/.gitignore b/.gitignore index ec9f442b4a..dd39767721 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ node_modules -nodemon.json .idea .env images @@ -9,12 +8,9 @@ images yarn.lock pnpm-lock.yaml -# We don't want to have code coverage data stored in the repo as it is dynamic +# These files/folders are dynamic and should not be pushed to the repo. +# They should be generated on the fly whenever they're needed. coverage - -# We don't want to push emitted production build of talawa-api to github. -# Since it will only be needed in CI/CD and production environment it -# should be generated on the fly at that time. build serviceAccountKey.json \ No newline at end of file diff --git a/.prettierignore b/.prettierignore index 7f1734b6c8..4ba8c742cd 100644 --- a/.prettierignore +++ b/.prettierignore @@ -3,4 +3,4 @@ build coverage node_modules -src/generated \ No newline at end of file +src/types \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2480ddfd83..dc0a6c8d2a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,22 +1,24 @@ # Contributing to Talawa API -Thank you for your interest in contributing to Talawa API. Regardless of the size of the contribution you make, all contributions are welcome and are appreciated. + +Thank you for your interest in contributing to Talawa API. Regardless of the size of the contribution you make, all contributions are welcome and are appreciated. If you are new to contributing to open source, please read the Open Source Guides on [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/). ## Table of Contents - - [Code of Conduct](#code-of-conduct) - - [Ways to Contribute](#ways-to-contribute) - - [Our Development Process](#our-development-process) - - [Issues](#issues) - - [Pull Requests](#pull-requests) - - [Branching Strategy](#branching-strategy) - - [Contributing Code](#contributing-code) - - Internships - - [GSoC](#gsoc) - - [Community](#community) - +- [Code of Conduct](#code-of-conduct) +- [Ways to Contribute](#ways-to-contribute) +- [Our Development Process](#our-development-process) + - [Issues](#issues) + - [Pull Requests](#pull-requests) + - [Branching Strategy](#branching-strategy) +- [Contributing Code](#contributing-code) +- Internships + - [GSoC](#gsoc) +- [Community](#community) + ## Code of Conduct + A safe environment is required for everyone to contribute. Read our [Code of Conduct Guide](CODE_OF_CONDUCT.md) to understand what this means. Let us know immediately if you have unacceptable experiences in this area. No one should fear voicing their opinion. Respones must be respectful. @@ -38,12 +40,15 @@ If you are ready to start contributing code right away, get ready! Welcome aboard! ### Our Development Process -We utilize GitHub issues and pull requests to keep track of issues and contributions from the community. -#### Issues +We utilize GitHub issues and pull requests to keep track of issues and contributions from the community. + +#### Issues + Make sure you are following [issue report guidelines](issue-guidelines.md) available here before creating any new issues on Talawa API project. #### Pull Requests + [Pull Request guidelines](PR-guidelines.md) is best resource to follow to start working on open issues. #### Branching Strategy @@ -55,17 +60,19 @@ For Talawa API, we had employed the following branching strategy to simplify the - `master`: Where the stable production ready code lies ### Contributing Code + Code contributions to Talawa come in the form of pull requests. These are done by forking the repo and making changes locally. -Make sure you have read the [Documentation for Setting up the Project](INSTALLATION.md) +Make sure you have read the [Documentation for Setting up the Project](./INSTALLATION.md) The process of proposing a change to Talawa API can be summarized as: + 1. Fork the Talawa API repository and branch off `develop`. 1. The repository can be cloned locally using `git clone `. 1. Make the desired changes to the Talawa API source. 1. Run the app and test your changes. -1. If you've added code, then test suites must be added. - 1. **_General_:** +1. If you've added code, then test suites must be added. + 1. **_General_:** 1. We need to get to 100% test coverage for the app. We periodically increase the desired test coverage for our pull requests to meet this goal. 1. Pull requests that don't meet the minimum test coverage levels will not be accepted. This may mean that you will have to create tests for code you did not write. You can decide which part of the code base needs additional tests if this happens to you. 1. **_Testing_:** @@ -73,11 +80,11 @@ The process of proposing a change to Talawa API can be summarized as: ``` npm run test genhtml coverage/lcov.info -o coverage - ``` + ``` 1. Test using these commands (Single test): ``` npm run test -- -t - ``` + ``` 1. Here are some useful testing resources: 1. Documentation: 1. [Jest testing documentation](https://jestjs.io/docs/expect) @@ -87,29 +94,29 @@ The process of proposing a change to Talawa API can be summarized as: 1. [Jest Crash Course](https://www.youtube.com/watch?v=7r4xVDI2vho) 1. [Testing NodeJS applications with JEST](https://www.youtube.com/watch?v=8gHEv5iNRKk) 1. **_Test Code Coverage_:** - 1. _General Information_ - 1. The current code coverage of the repo is: [![codecov](https://codecov.io/gh/PalisadoesFoundation/talawa-api/branch/develop/graph/badge.svg?token=CECBQTAOKM)](https://codecov.io/gh/PalisadoesFoundation/talawa-api) - 1. You can determine the percentage test coverage of your code by running these two commands in sequence: - ``` - npm install - npm run test - genhtml coverage/lcov.info -o coverage - ``` - 1. The coverage rate will be visible on the penultimate line of the `genhtml` command's output. - 1. The `genhtml` command is part of the linux `lcov` package. Similar packages can be found for Windows and MacOS. - 1. The currently acceptable coverage rate can be found in the [GitHub Pull Request file](.github/workflows/pull-request.yml). Search for the value below the line containing `min_coverage`. - 1. _Creating your code coverage account_ - 1. You can also see your code coverage online for your fork of the repo. This is provided by `codecov.io` - 1. Go to this link: `https://app.codecov.io/gh/XXXX/YYYY` where XXXX is your GitHub account username and YYYY is the name of the repository - 1. Login to `codecov.io` using your GitHub account, and add your **repo** and **branches** to the `codecov.io` dashboard. - 1. Remember to add the `Repository Upload Token` for your forked repo. This can be found under `Settings` of your `codecov.io` account. - 1. Use the value of this token to create a secret named CODE_COV for your forked repo. - 1. You will see your code coverage reports with every push to your repo after following these steps + 1. _General Information_ + 1. The current code coverage of the repo is: [![codecov](https://codecov.io/gh/PalisadoesFoundation/talawa-api/branch/develop/graph/badge.svg?token=CECBQTAOKM)](https://codecov.io/gh/PalisadoesFoundation/talawa-api) + 1. You can determine the percentage test coverage of your code by running these two commands in sequence: + ``` + npm install + npm run test + genhtml coverage/lcov.info -o coverage + ``` + 1. The coverage rate will be visible on the penultimate line of the `genhtml` command's output. + 1. The `genhtml` command is part of the linux `lcov` package. Similar packages can be found for Windows and MacOS. + 1. The currently acceptable coverage rate can be found in the [GitHub Pull Request file](.github/workflows/pull-request.yml). Search for the value below the line containing `min_coverage`. + 1. _Creating your code coverage account_ + 1. You can also see your code coverage online for your fork of the repo. This is provided by `codecov.io` + 1. Go to this link: `https://app.codecov.io/gh/XXXX/YYYY` where XXXX is your GitHub account username and YYYY is the name of the repository + 1. Login to `codecov.io` using your GitHub account, and add your **repo** and **branches** to the `codecov.io` dashboard. + 1. Remember to add the `Repository Upload Token` for your forked repo. This can be found under `Settings` of your `codecov.io` account. + 1. Use the value of this token to create a secret named CODE_COV for your forked repo. + 1. You will see your code coverage reports with every push to your repo after following these steps 1. After making changes you can add them to git locally using `git add `(to add changes only in a particular file) or `git add .` (to add all changes). 1. After adding the changes you need to commit them using `git commit -m ''`(look at the commit guidelines below for commit messages). 1. Once you have successfully commited your changes, you need to push the changes to the forked repo on github using: `git push origin `.(Here branch name must be name of the branch you want to push the changes to.) 1. Now create a pull request to the Talawa repository from your forked repo. Open an issue regarding the same and link your PR to it. -1. Ensure the test suite passes, either locally or on CI once a PR has been created. +1. Ensure the test suite passes, either locally or on CI once a PR has been created. 1. Review and address comments on your pull request if requested. ## Internships @@ -117,9 +124,11 @@ The process of proposing a change to Talawa API can be summarized as: We have internship partnerships with a number of organizations. See below for more details. ### GSoC + If you are participating in the Summer of Code, please read more about us and our processes [here](https://docs.talawa.io/docs/internships/gsoc/gsoc-introduction) ## Community + There are many ways to communicate with the community. 1. The Palisadoes Foundation has a Slack channel where members can assist with support and clarification. Visit the [Talawa GitHub repository home page](https://github.com/PalisadoesFoundation/talawa) for the link to join our slack channel. diff --git a/__tests__/resolvers/DirectChat/index.spec.ts b/__tests__/resolvers/DirectChat/index.spec.ts deleted file mode 100644 index 625284e0d6..0000000000 --- a/__tests__/resolvers/DirectChat/index.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { DirectChat } from "../../../src/lib/resolvers/DirectChat/index"; -import { DirectChatResolvers } from "../../../src/generated/graphqlCodegen"; -import { creator } from "../../../src/lib/resolvers/DirectChat/creator"; -import { messages } from "../../../src/lib/resolvers/DirectChat/messages"; -import { organization } from "../../../src/lib/resolvers/DirectChat/organization"; -import { users } from "../../../src/lib/resolvers/DirectChat/users"; -import { describe, it, beforeAll, expect } from "vitest"; - -let testDirectChat: DirectChatResolvers; - -beforeAll(() => { - testDirectChat = { - creator, - messages, - organization, - users, - }; -}); - -describe("resolvers -> DirectChat -> index", () => { - it("creates the DirectChat", () => { - expect(testDirectChat).toStrictEqual(DirectChat); - }); -}); diff --git a/__tests__/resolvers/DirectChatMessage/index.spec.ts b/__tests__/resolvers/DirectChatMessage/index.spec.ts deleted file mode 100644 index 6cb48cf274..0000000000 --- a/__tests__/resolvers/DirectChatMessage/index.spec.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { DirectChatMessage } from "../../../src/lib/resolvers/DirectChatMessage/index"; -import { DirectChatMessageResolvers } from "../../../src/generated/graphqlCodegen"; -import { directChatMessageBelongsTo } from "../../../src/lib/resolvers/DirectChatMessage/directChatMessageBelongsTo"; -import { receiver } from "../../../src/lib/resolvers/DirectChatMessage/receiver"; -import { sender } from "../../../src/lib/resolvers/DirectChatMessage/sender"; -import { describe, it, beforeAll, expect } from "vitest"; - -let testDirectChatMessage: DirectChatMessageResolvers; - -beforeAll(() => { - testDirectChatMessage = { - directChatMessageBelongsTo, - receiver, - sender, - }; -}); - -describe("resolvers -> DirectChatMessage -> index", () => { - it("creates the DirectChatMessage", () => { - expect(testDirectChatMessage).toStrictEqual(DirectChatMessage); - }); -}); diff --git a/__tests__/resolvers/GroupChat/index.spec.ts b/__tests__/resolvers/GroupChat/index.spec.ts deleted file mode 100644 index 94e4b6aec3..0000000000 --- a/__tests__/resolvers/GroupChat/index.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { GroupChat } from "../../../src/lib/resolvers/GroupChat/index"; -import { GroupChatResolvers } from "../../../src/generated/graphqlCodegen"; -import { creator } from "../../../src/lib/resolvers/GroupChat/creator"; -import { messages } from "../../../src/lib/resolvers/GroupChat/messages"; -import { organization } from "../../../src/lib/resolvers/GroupChat/organization"; -import { users } from "../../../src/lib/resolvers/GroupChat/users"; -import { beforeAll, describe, expect, it } from "vitest"; - -let testGroupChat: GroupChatResolvers; - -beforeAll(() => { - testGroupChat = { - creator, - messages, - organization, - users, - }; -}); - -describe("resolvers -> GroupChat -> index", () => { - it("creates the GroupChat", () => { - expect(testGroupChat).toStrictEqual(GroupChat); - }); -}); diff --git a/__tests__/resolvers/Organization/index.spec.ts b/__tests__/resolvers/Organization/index.spec.ts deleted file mode 100644 index e20dd66ba7..0000000000 --- a/__tests__/resolvers/Organization/index.spec.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Organization } from "../../../src/lib/resolvers/Organization/index"; -import { admins } from "../../../src/lib/resolvers/Organization/admins"; -import { blockedUsers } from "../../../src/lib/resolvers/Organization/blockedUsers"; -import { creator } from "../../../src/lib/resolvers/Organization/creator"; -import { members } from "../../../src/lib/resolvers/Organization/members"; -import { membershipRequests } from "../../../src/lib/resolvers/Organization/membershipRequests"; -import { OrganizationResolvers } from "../../../src/generated/graphqlCodegen"; -import { describe, it, expect, beforeAll } from "vitest"; - -let testOrganization: OrganizationResolvers; - -beforeAll(() => { - testOrganization = { - admins, - blockedUsers, - creator, - members, - membershipRequests, - }; -}); - -describe("resolvers -> Organization -> index", () => { - it("creates the Orgainzation", () => { - expect(Organization).toStrictEqual(testOrganization); - }); -}); diff --git a/codegen.ts b/codegen.ts new file mode 100644 index 0000000000..968f455a62 --- /dev/null +++ b/codegen.ts @@ -0,0 +1,80 @@ +import type { CodegenConfig } from "@graphql-codegen/cli"; + +const config: CodegenConfig = { + schema: ["./src/typeDefs/**/*.ts", "scalar Upload"], + + generates: { + "./src/types/generatedGraphQLTypes.ts": { + plugins: ["typescript", "typescript-resolvers"], + + config: { + // Generates graphQL enums as typescript union types. + enumsAsTypes: true, + + // Makes the info argument passed to the resolver functions optional. + optionalInfoArgument: true, + + // Makes the resolver function callable. + makeResolverTypeCallable: true, + + // Adds suffix "Model" to the end of generated database model types. + mapperTypeSuffix: "Model", + + // Mappers lets us provide database model types to be used in generated typescript types instead of graphql types. This + // is because what we retrieve from the database and what we choose to return from a graphql server could be completely + // different fields. This also helps in seperating out resolver logic for nested relation fields into their own resolvers + // instead of resolving them in the root resolver itself. + mappers: { + MessageChat: "../models/MessageChat#Interface_MessageChat", + + Comment: "../models/Comment#Interface_Comment", + + DirectChat: "../models/DirectChat#Interface_DirectChat", + + DirectChatMessage: + "../models/DirectChatMessage#Interface_DirectChatMessage", + + Donation: "../models/Donation#Interface_Donation", + + Event: "../models/Event#Interface_Event", + + // EventProject: '../models/EventProject#Interface_EventProject' + + // File: '../models/File#Interface_File', + + Group: "../models/Group#Interface_Group", + + GroupChat: "../models/GroupChat#Interface_GroupChat", + + GroupChatMessage: + "../models/GroupChatMessage#Interface_GroupChatMessage", + + // ImageHash: '../models/ImageHash#Interface_ImageHash', + + Language: "../models/Language#Interface_Language", + + MembershipRequest: + "../models/MembershipRequest#Interface_MembershipRequest", + + Message: "../models/Message#Interface_Message", + + Organization: "../models/Organization#Interface_Organization", + + Plugin: "../models/Plugin#Interface_Plugin", + + PluginField: "../models/PluginField#Interface_PluginField", + + Post: "../models/Post#Interface_Post", + + Task: "../models/Task#Interface_Task", + + User: "../models/User#Interface_User", + }, + + useTypeImports: true, + }, + }, + }, +}; + +export default config; diff --git a/codegen.yml b/codegen.yml deleted file mode 100644 index 938ea1c89d..0000000000 --- a/codegen.yml +++ /dev/null @@ -1,46 +0,0 @@ -# overwrites the already existing/generated graphql typescript definitions -overwrite: true -# address to the graphql type defintions(schema) -schema: - - "./src/lib/typeDefs/**/*.ts" - # Upload scalar is injected by apollo-server into the schema. Graphql-codegen by default generates it's typescript type as 'any'. - - scalar Upload -generates: - # where to emit the generated graphql typescript defintions - ./src/generated/graphqlCodegen.ts: - plugins: - # Generates base typescript types from graphql types. - - typescript - # Generates resolver types using base typescript types generated above. - - typescript-resolvers - config: - # Makes the info argument passed to the resolver functions optional - optionalInfoArgument: true - # Makes the resolver function callable - makeResolverTypeCallable: true - # Mappers lets us provide database model types to be used in generated typescript types instead of graphql types. This - # is because what we retrieve from the database and what we choose to return from a graphql server could be completely - # different fields. This also helps in seperating out resolver logic for nested relation fields into their own resolvers - # instead of resolving them in the root resolver itself. - mappers: - MessageChat: "../lib/models/MessageChat#Interface_MessageChat" - Comment: "../lib/models/Comment#Interface_Comment" - DirectChat: "../lib/models/DirectChat#Interface_DirectChat" - DirectChatMessage: "../lib/models/DirectChatMessage#Interface_DirectChatMessage" - Donation: "../lib/models/Donation#Interface_Donation" - Event: "../lib/models/Event#Interface_Event" - # EventProject: '../lib/models/EventProject#Interface_EventProject' - # File: '../lib/models/File#Interface_File' - Group: "../lib/models/Group#Interface_Group" - GroupChat: "../lib/models/GroupChat#Interface_GroupChat" - GroupChatMessage: "../lib/models/GroupChatMessage#Interface_GroupChatMessage" - # ImageHash: '../lib/models/ImageHash#Interface_ImageHash' - Language: "../lib/models/Language#Interface_Language" - MembershipRequest: "../lib/models/MembershipRequest#Interface_MembershipRequest" - Message: "../lib/models/Message#Interface_Message" - Organization: "../lib/models/Organization#Interface_Organization" - Plugin: "../lib/models/Plugin#Interface_Plugin" - PluginField: "../lib/models/PluginField#Interface_PluginField" - Post: "../lib/models/Post#Interface_Post" - Task: "../lib/models/Task#Interface_Task" - User: "../lib/models/User#Interface_User" diff --git a/src/locales/en.json b/locales/en.json similarity index 100% rename from src/locales/en.json rename to locales/en.json diff --git a/src/locales/fr.json b/locales/fr.json similarity index 100% rename from src/locales/fr.json rename to locales/fr.json diff --git a/src/locales/hi.json b/locales/hi.json similarity index 100% rename from src/locales/hi.json rename to locales/hi.json diff --git a/src/locales/sp.json b/locales/sp.json similarity index 100% rename from src/locales/sp.json rename to locales/sp.json diff --git a/src/locales/zh.json b/locales/zh.json similarity index 100% rename from src/locales/zh.json rename to locales/zh.json diff --git a/package-lock.json b/package-lock.json index e9cc796a9d..33f28cb6f4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -53,6 +53,7 @@ "@types/bcryptjs": "^2.4.2", "@types/cls-hooked": "^4.3.3", "@types/copy-paste": "^1.1.30", + "@types/cors": "^2.8.13", "@types/express": "^4.17.13", "@types/express-rate-limit": "^5.1.3", "@types/graphql-depth-limit": "^1.1.3", @@ -70,7 +71,6 @@ "@typescript-eslint/parser": "^5.42.0", "@vitest/coverage-c8": "^0.24.3", "concurrently": "^7.5.0", - "copyfiles": "^2.4.1", "eslint": "^8.26.0", "eslint-config-prettier": "^8.5.0", "eslint-plugin-prettier": "^4.2.1", @@ -3265,9 +3265,13 @@ "dev": true }, "node_modules/@types/cors": { - "version": "2.8.10", - "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.10.tgz", - "integrity": "sha512-C7srjHiVG3Ey1nR6d511dtDkCEjxuN9W1HWAEjGq8kpcwmNM6JJkpC0xvabM7BXTG2wDq8Eu33iH9aQKa7IvLQ==" + "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.15", @@ -4395,6 +4399,11 @@ "@types/node": "*" } }, + "node_modules/apollo-server-express/node_modules/@types/cors": { + "version": "2.8.10", + "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.10.tgz", + "integrity": "sha512-C7srjHiVG3Ey1nR6d511dtDkCEjxuN9W1HWAEjGq8kpcwmNM6JJkpC0xvabM7BXTG2wDq8Eu33iH9aQKa7IvLQ==" + }, "node_modules/apollo-server-express/node_modules/@types/node": { "version": "10.17.60", "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.60.tgz", @@ -5856,54 +5865,6 @@ "sync-exec": "~0.6.x" } }, - "node_modules/copyfiles": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/copyfiles/-/copyfiles-2.4.1.tgz", - "integrity": "sha512-fereAvAvxDrQDOXybk3Qu3dPbOoKoysFMWtkY3mv5BsL8//OSZVL5DCLYqgRfY5cWirgRzlC+WSrxp6Bo3eNZg==", - "dev": true, - "dependencies": { - "glob": "^7.0.5", - "minimatch": "^3.0.3", - "mkdirp": "^1.0.4", - "noms": "0.0.0", - "through2": "^2.0.1", - "untildify": "^4.0.0", - "yargs": "^16.1.0" - }, - "bin": { - "copyfiles": "copyfiles", - "copyup": "copyfiles" - } - }, - "node_modules/copyfiles/node_modules/cliui": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", - "dev": true, - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^7.0.0" - } - }, - "node_modules/copyfiles/node_modules/yargs": { - "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", - "dev": true, - "dependencies": { - "cliui": "^7.0.2", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/core-js-pure": { "version": "3.27.1", "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.27.1.tgz", @@ -10585,40 +10546,6 @@ "node": ">=6.0.0" } }, - "node_modules/noms": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/noms/-/noms-0.0.0.tgz", - "integrity": "sha512-lNDU9VJaOPxUmXcLb+HQFeUgQQPtMI24Gt6hgfuMHRJgMRHMF/qZ4HJD3GDru4sSw9IQl2jPjAYnQrdIeLbwow==", - "dev": true, - "dependencies": { - "inherits": "^2.0.1", - "readable-stream": "~1.0.31" - } - }, - "node_modules/noms/node_modules/isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==", - "dev": true - }, - "node_modules/noms/node_modules/readable-stream": { - "version": "1.0.34", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", - "integrity": "sha512-ok1qVCJuRkNmvebYikljxJA/UEsKwLl2nI1OmaqAu4/UE+h0wKCHok4XkL/gvi39OacXvw59RJUOFUkDib2rHg==", - "dev": true, - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "node_modules/noms/node_modules/string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==", - "dev": true - }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -12744,46 +12671,6 @@ "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", "dev": true }, - "node_modules/through2": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", - "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", - "dev": true, - "dependencies": { - "readable-stream": "~2.3.6", - "xtend": "~4.0.1" - } - }, - "node_modules/through2/node_modules/readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dev": true, - "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/through2/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==", - "dev": true - }, - "node_modules/through2/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==", - "dev": true, - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, "node_modules/tinybench": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.3.1.tgz", @@ -13216,15 +13103,6 @@ "node": ">= 0.8" } }, - "node_modules/untildify": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz", - "integrity": "sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/update-browserslist-db": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.10.tgz", @@ -13790,15 +13668,6 @@ "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" }, - "node_modules/xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", - "dev": true, - "engines": { - "node": ">=0.4" - } - }, "node_modules/y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", @@ -16438,9 +16307,13 @@ "dev": true }, "@types/cors": { - "version": "2.8.10", - "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.10.tgz", - "integrity": "sha512-C7srjHiVG3Ey1nR6d511dtDkCEjxuN9W1HWAEjGq8kpcwmNM6JJkpC0xvabM7BXTG2wDq8Eu33iH9aQKa7IvLQ==" + "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.15", @@ -17321,6 +17194,11 @@ "@types/node": "*" } }, + "@types/cors": { + "version": "2.8.10", + "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.10.tgz", + "integrity": "sha512-C7srjHiVG3Ey1nR6d511dtDkCEjxuN9W1HWAEjGq8kpcwmNM6JJkpC0xvabM7BXTG2wDq8Eu33iH9aQKa7IvLQ==" + }, "@types/node": { "version": "10.17.60", "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.60.tgz", @@ -18455,49 +18333,6 @@ "sync-exec": "~0.6.x" } }, - "copyfiles": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/copyfiles/-/copyfiles-2.4.1.tgz", - "integrity": "sha512-fereAvAvxDrQDOXybk3Qu3dPbOoKoysFMWtkY3mv5BsL8//OSZVL5DCLYqgRfY5cWirgRzlC+WSrxp6Bo3eNZg==", - "dev": true, - "requires": { - "glob": "^7.0.5", - "minimatch": "^3.0.3", - "mkdirp": "^1.0.4", - "noms": "0.0.0", - "through2": "^2.0.1", - "untildify": "^4.0.0", - "yargs": "^16.1.0" - }, - "dependencies": { - "cliui": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", - "dev": true, - "requires": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^7.0.0" - } - }, - "yargs": { - "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", - "dev": true, - "requires": { - "cliui": "^7.0.2", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" - } - } - } - }, "core-js-pure": { "version": "3.27.1", "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.27.1.tgz", @@ -21933,42 +21768,6 @@ "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.8.0.tgz", "integrity": "sha512-EjYvSmHzekz6VNkNd12aUqAco+bOkRe3Of5jVhltqKhEsjw/y0PYPJfp83+s9Wzh1dspYAkUW/YNQ350NATbSQ==" }, - "noms": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/noms/-/noms-0.0.0.tgz", - "integrity": "sha512-lNDU9VJaOPxUmXcLb+HQFeUgQQPtMI24Gt6hgfuMHRJgMRHMF/qZ4HJD3GDru4sSw9IQl2jPjAYnQrdIeLbwow==", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "readable-stream": "~1.0.31" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==", - "dev": true - }, - "readable-stream": { - "version": "1.0.34", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", - "integrity": "sha512-ok1qVCJuRkNmvebYikljxJA/UEsKwLl2nI1OmaqAu4/UE+h0wKCHok4XkL/gvi39OacXvw59RJUOFUkDib2rHg==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==", - "dev": true - } - } - }, "normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -23564,48 +23363,6 @@ "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", "dev": true }, - "through2": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", - "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", - "dev": true, - "requires": { - "readable-stream": "~2.3.6", - "xtend": "~4.0.1" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dev": true, - "requires": { - "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" - } - }, - "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==", - "dev": true - }, - "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==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, "tinybench": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.3.1.tgz", @@ -23918,12 +23675,6 @@ "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==" }, - "untildify": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz", - "integrity": "sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==", - "dev": true - }, "update-browserslist-db": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.10.tgz", @@ -24306,12 +24057,6 @@ "resolved": "https://registry.npmjs.org/xss-filters/-/xss-filters-1.2.6.tgz", "integrity": "sha512-uqgwZRpVJCDfHsRX9lDrkPyCitQYzPklmLSbajJncATZKAUd1tF1x9y2VyPNFMv8SsSWed80xorSS5qGpw3WiA==" }, - "xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", - "dev": true - }, "y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", diff --git a/package.json b/package.json index 184704c290..ca855c2e30 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,6 @@ "build": "tsc --pretty --project tsconfig.build.json", "dev": "concurrently \"tsx watch ./src/server.ts\" \"graphql-codegen --watch\"", "lint": "eslint . --fix && echo 'Lint complete.'", - "postbuild": "copyfiles --error --up 1 './src/locales/*' ./build", "prebuild": "graphql-codegen && rimraf ./build", "prod": "cross-env NODE_ENV=production pm2-runtime start ./build/server.js", "start": "cross-env pm2-runtime start ./build/server.js --watch", @@ -75,6 +74,7 @@ "@types/bcryptjs": "^2.4.2", "@types/cls-hooked": "^4.3.3", "@types/copy-paste": "^1.1.30", + "@types/cors": "^2.8.13", "@types/express": "^4.17.13", "@types/express-rate-limit": "^5.1.3", "@types/graphql-depth-limit": "^1.1.3", @@ -92,7 +92,6 @@ "@typescript-eslint/parser": "^5.42.0", "@vitest/coverage-c8": "^0.24.3", "concurrently": "^7.5.0", - "copyfiles": "^2.4.1", "eslint": "^8.26.0", "eslint-config-prettier": "^8.5.0", "eslint-plugin-prettier": "^4.2.1", diff --git a/src/lib/config/appConfig.ts b/src/config/appConfig.ts similarity index 100% rename from src/lib/config/appConfig.ts rename to src/config/appConfig.ts diff --git a/src/lib/config/firebaseConfig.ts b/src/config/firebaseConfig.ts similarity index 100% rename from src/lib/config/firebaseConfig.ts rename to src/config/firebaseConfig.ts diff --git a/src/lib/config/index.ts b/src/config/index.ts similarity index 100% rename from src/lib/config/index.ts rename to src/config/index.ts diff --git a/src/db.ts b/src/db.ts index 9dbf803a82..0a1ebfcf2c 100644 --- a/src/db.ts +++ b/src/db.ts @@ -1,5 +1,5 @@ import mongoose from "mongoose"; -import { logger } from "./lib/libraries"; +import { logger } from "./libraries"; export const connect = async () => { try { diff --git a/src/lib/directives/authDirective.ts b/src/directives/authDirective.ts similarity index 100% rename from src/lib/directives/authDirective.ts rename to src/directives/authDirective.ts diff --git a/src/lib/directives/index.ts b/src/directives/index.ts similarity index 100% rename from src/lib/directives/index.ts rename to src/directives/index.ts diff --git a/src/lib/directives/roleDirective.ts b/src/directives/roleDirective.ts similarity index 98% rename from src/lib/directives/roleDirective.ts rename to src/directives/roleDirective.ts index b83071372d..288f2e7c2d 100644 --- a/src/lib/directives/roleDirective.ts +++ b/src/directives/roleDirective.ts @@ -9,7 +9,7 @@ import { USER_NOT_FOUND_CODE, USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_PARAM, -} from "../../constants"; +} from "../constants"; import { errors, requestContext } from "../libraries"; import { User } from "../models"; diff --git a/src/lib/libraries/errors/applicationError.ts b/src/libraries/errors/applicationError.ts similarity index 100% rename from src/lib/libraries/errors/applicationError.ts rename to src/libraries/errors/applicationError.ts diff --git a/src/lib/libraries/errors/conflictError.ts b/src/libraries/errors/conflictError.ts similarity index 100% rename from src/lib/libraries/errors/conflictError.ts rename to src/libraries/errors/conflictError.ts diff --git a/src/lib/libraries/errors/index.ts b/src/libraries/errors/index.ts similarity index 100% rename from src/lib/libraries/errors/index.ts rename to src/libraries/errors/index.ts diff --git a/src/lib/libraries/errors/internalServerError.ts b/src/libraries/errors/internalServerError.ts similarity index 100% rename from src/lib/libraries/errors/internalServerError.ts rename to src/libraries/errors/internalServerError.ts diff --git a/src/lib/libraries/errors/notFoundError.ts b/src/libraries/errors/notFoundError.ts similarity index 100% rename from src/lib/libraries/errors/notFoundError.ts rename to src/libraries/errors/notFoundError.ts diff --git a/src/lib/libraries/errors/unauthenticatedError.ts b/src/libraries/errors/unauthenticatedError.ts similarity index 100% rename from src/lib/libraries/errors/unauthenticatedError.ts rename to src/libraries/errors/unauthenticatedError.ts diff --git a/src/lib/libraries/errors/unauthorizedError.ts b/src/libraries/errors/unauthorizedError.ts similarity index 100% rename from src/lib/libraries/errors/unauthorizedError.ts rename to src/libraries/errors/unauthorizedError.ts diff --git a/src/lib/libraries/errors/validationError.ts b/src/libraries/errors/validationError.ts similarity index 100% rename from src/lib/libraries/errors/validationError.ts rename to src/libraries/errors/validationError.ts diff --git a/src/lib/libraries/index.ts b/src/libraries/index.ts similarity index 100% rename from src/lib/libraries/index.ts rename to src/libraries/index.ts diff --git a/src/lib/libraries/logger.ts b/src/libraries/logger.ts similarity index 100% rename from src/lib/libraries/logger.ts rename to src/libraries/logger.ts diff --git a/src/lib/libraries/requestContext.ts b/src/libraries/requestContext.ts similarity index 100% rename from src/lib/libraries/requestContext.ts rename to src/libraries/requestContext.ts diff --git a/src/lib/libraries/requestTracing.ts b/src/libraries/requestTracing.ts similarity index 100% rename from src/lib/libraries/requestTracing.ts rename to src/libraries/requestTracing.ts diff --git a/src/lib/middleware/index.ts b/src/middleware/index.ts similarity index 100% rename from src/lib/middleware/index.ts rename to src/middleware/index.ts diff --git a/src/lib/middleware/isAuth.ts b/src/middleware/isAuth.ts similarity index 100% rename from src/lib/middleware/isAuth.ts rename to src/middleware/isAuth.ts diff --git a/src/lib/models/Comment.ts b/src/models/Comment.ts similarity index 100% rename from src/lib/models/Comment.ts rename to src/models/Comment.ts diff --git a/src/lib/models/DirectChat.ts b/src/models/DirectChat.ts similarity index 100% rename from src/lib/models/DirectChat.ts rename to src/models/DirectChat.ts diff --git a/src/lib/models/DirectChatMessage.ts b/src/models/DirectChatMessage.ts similarity index 100% rename from src/lib/models/DirectChatMessage.ts rename to src/models/DirectChatMessage.ts diff --git a/src/lib/models/Donation.ts b/src/models/Donation.ts similarity index 100% rename from src/lib/models/Donation.ts rename to src/models/Donation.ts diff --git a/src/lib/models/Event.ts b/src/models/Event.ts similarity index 95% rename from src/lib/models/Event.ts rename to src/models/Event.ts index 07f6f1e1b8..0612493181 100644 --- a/src/lib/models/Event.ts +++ b/src/models/Event.ts @@ -96,28 +96,28 @@ const eventSchema = new Schema({ }, endDate: { type: String, - required: function (): ()=> boolean { + required: function (): () => boolean { // @ts-ignore return !this.allDay; }, }, startTime: { type: String, - required: function (): ()=> boolean { + required: function (): () => boolean { // @ts-ignore return !this.allDay; }, }, endTime: { type: String, - required: function (): ()=> boolean { + required: function (): () => boolean { // @ts-ignore return !this.allDay; }, }, recurrance: { type: String, - required: function (): ()=> boolean { + required: function (): () => boolean { // @ts-ignore return this.recurring; }, diff --git a/src/lib/models/EventProject.ts b/src/models/EventProject.ts similarity index 100% rename from src/lib/models/EventProject.ts rename to src/models/EventProject.ts diff --git a/src/lib/models/File.ts b/src/models/File.ts similarity index 100% rename from src/lib/models/File.ts rename to src/models/File.ts diff --git a/src/lib/models/Group.ts b/src/models/Group.ts similarity index 100% rename from src/lib/models/Group.ts rename to src/models/Group.ts diff --git a/src/lib/models/GroupChat.ts b/src/models/GroupChat.ts similarity index 100% rename from src/lib/models/GroupChat.ts rename to src/models/GroupChat.ts diff --git a/src/lib/models/GroupChatMessage.ts b/src/models/GroupChatMessage.ts similarity index 100% rename from src/lib/models/GroupChatMessage.ts rename to src/models/GroupChatMessage.ts diff --git a/src/lib/models/ImageHash.ts b/src/models/ImageHash.ts similarity index 100% rename from src/lib/models/ImageHash.ts rename to src/models/ImageHash.ts diff --git a/src/lib/models/Language.ts b/src/models/Language.ts similarity index 100% rename from src/lib/models/Language.ts rename to src/models/Language.ts diff --git a/src/lib/models/MembershipRequest.ts b/src/models/MembershipRequest.ts similarity index 100% rename from src/lib/models/MembershipRequest.ts rename to src/models/MembershipRequest.ts diff --git a/src/lib/models/Message.ts b/src/models/Message.ts similarity index 100% rename from src/lib/models/Message.ts rename to src/models/Message.ts diff --git a/src/lib/models/MessageChat.ts b/src/models/MessageChat.ts similarity index 100% rename from src/lib/models/MessageChat.ts rename to src/models/MessageChat.ts diff --git a/src/lib/models/Organization.ts b/src/models/Organization.ts similarity index 93% rename from src/lib/models/Organization.ts rename to src/models/Organization.ts index beba57088f..f25bc75b03 100644 --- a/src/lib/models/Organization.ts +++ b/src/models/Organization.ts @@ -1,5 +1,5 @@ import { Schema, model, PopulatedDoc, Types, Document, models } from "mongoose"; -import { MembershipRequest } from "../../generated/graphqlCodegen"; +import { Interface_MembershipRequest } from "./MembershipRequest"; import { Interface_Message } from "./Message"; import { Interface_Post } from "./Post"; import { Interface_User } from "./User"; @@ -18,7 +18,9 @@ export interface Interface_Organization { admins: Array>; groupChats: Array>; posts: Array>; - membershipRequests: Array>; + membershipRequests: Array< + PopulatedDoc + >; blockedUsers: Array>; visibleInSearch: boolean | undefined; tags: Array; diff --git a/src/lib/models/Plugin.ts b/src/models/Plugin.ts similarity index 100% rename from src/lib/models/Plugin.ts rename to src/models/Plugin.ts diff --git a/src/lib/models/PluginField.ts b/src/models/PluginField.ts similarity index 100% rename from src/lib/models/PluginField.ts rename to src/models/PluginField.ts diff --git a/src/lib/models/Post.ts b/src/models/Post.ts similarity index 100% rename from src/lib/models/Post.ts rename to src/models/Post.ts diff --git a/src/lib/models/Task.ts b/src/models/Task.ts similarity index 100% rename from src/lib/models/Task.ts rename to src/models/Task.ts diff --git a/src/lib/models/User.ts b/src/models/User.ts similarity index 100% rename from src/lib/models/User.ts rename to src/models/User.ts diff --git a/src/lib/models/index.ts b/src/models/index.ts similarity index 100% rename from src/lib/models/index.ts rename to src/models/index.ts diff --git a/src/lib/resolvers/DirectChat/creator.ts b/src/resolvers/DirectChat/creator.ts similarity index 71% rename from src/lib/resolvers/DirectChat/creator.ts rename to src/resolvers/DirectChat/creator.ts index 7be07df857..193e8a9a68 100644 --- a/src/lib/resolvers/DirectChat/creator.ts +++ b/src/resolvers/DirectChat/creator.ts @@ -1,5 +1,5 @@ import { User } from "../../models"; -import { DirectChatResolvers } from "../../../generated/graphqlCodegen"; +import { DirectChatResolvers } from "../../types/generatedGraphQLTypes"; export const creator: DirectChatResolvers["creator"] = async (parent) => { return await User.findOne({ diff --git a/src/lib/resolvers/DirectChat/index.ts b/src/resolvers/DirectChat/index.ts similarity index 77% rename from src/lib/resolvers/DirectChat/index.ts rename to src/resolvers/DirectChat/index.ts index 45ee5e528a..368c7340ee 100644 --- a/src/lib/resolvers/DirectChat/index.ts +++ b/src/resolvers/DirectChat/index.ts @@ -1,4 +1,4 @@ -import { DirectChatResolvers } from "../../../generated/graphqlCodegen"; +import { DirectChatResolvers } from "../../types/generatedGraphQLTypes"; import { creator } from "./creator"; import { messages } from "./messages"; import { organization } from "./organization"; diff --git a/src/lib/resolvers/DirectChat/messages.ts b/src/resolvers/DirectChat/messages.ts similarity index 75% rename from src/lib/resolvers/DirectChat/messages.ts rename to src/resolvers/DirectChat/messages.ts index 2c64759490..d44423ee92 100644 --- a/src/lib/resolvers/DirectChat/messages.ts +++ b/src/resolvers/DirectChat/messages.ts @@ -1,5 +1,5 @@ import { DirectChatMessage } from "../../models"; -import { DirectChatResolvers } from "../../../generated/graphqlCodegen"; +import { DirectChatResolvers } from "../../types/generatedGraphQLTypes"; export const messages: DirectChatResolvers["messages"] = async (parent) => { return await DirectChatMessage.find({ diff --git a/src/lib/resolvers/DirectChat/organization.ts b/src/resolvers/DirectChat/organization.ts similarity index 75% rename from src/lib/resolvers/DirectChat/organization.ts rename to src/resolvers/DirectChat/organization.ts index d22aec2f49..235a1356c9 100644 --- a/src/lib/resolvers/DirectChat/organization.ts +++ b/src/resolvers/DirectChat/organization.ts @@ -1,5 +1,5 @@ import { Organization } from "../../models"; -import { DirectChatResolvers } from "../../../generated/graphqlCodegen"; +import { DirectChatResolvers } from "../../types/generatedGraphQLTypes"; export const organization: DirectChatResolvers["organization"] = async ( parent diff --git a/src/lib/resolvers/DirectChat/users.ts b/src/resolvers/DirectChat/users.ts similarity index 72% rename from src/lib/resolvers/DirectChat/users.ts rename to src/resolvers/DirectChat/users.ts index 12a3f34551..f7d9cd3471 100644 --- a/src/lib/resolvers/DirectChat/users.ts +++ b/src/resolvers/DirectChat/users.ts @@ -1,5 +1,5 @@ import { User } from "../../models"; -import { DirectChatResolvers } from "../../../generated/graphqlCodegen"; +import { DirectChatResolvers } from "../../types/generatedGraphQLTypes"; export const users: DirectChatResolvers["users"] = async (parent) => { return await User.find({ diff --git a/src/lib/resolvers/DirectChatMessage/directChatMessageBelongsTo.ts b/src/resolvers/DirectChatMessage/directChatMessageBelongsTo.ts similarity index 77% rename from src/lib/resolvers/DirectChatMessage/directChatMessageBelongsTo.ts rename to src/resolvers/DirectChatMessage/directChatMessageBelongsTo.ts index f4da818ab4..fbb44a2a37 100644 --- a/src/lib/resolvers/DirectChatMessage/directChatMessageBelongsTo.ts +++ b/src/resolvers/DirectChatMessage/directChatMessageBelongsTo.ts @@ -1,4 +1,4 @@ -import { DirectChatMessageResolvers } from "../../../generated/graphqlCodegen"; +import { DirectChatMessageResolvers } from "../../types/generatedGraphQLTypes"; import { DirectChat } from "../../models"; export const directChatMessageBelongsTo: DirectChatMessageResolvers["directChatMessageBelongsTo"] = diff --git a/src/lib/resolvers/DirectChatMessage/index.ts b/src/resolvers/DirectChatMessage/index.ts similarity index 77% rename from src/lib/resolvers/DirectChatMessage/index.ts rename to src/resolvers/DirectChatMessage/index.ts index 8afe363d1c..e3472c8b66 100644 --- a/src/lib/resolvers/DirectChatMessage/index.ts +++ b/src/resolvers/DirectChatMessage/index.ts @@ -1,4 +1,4 @@ -import { DirectChatMessageResolvers } from "../../../generated/graphqlCodegen"; +import { DirectChatMessageResolvers } from "../../types/generatedGraphQLTypes"; import { directChatMessageBelongsTo } from "./directChatMessageBelongsTo"; import { receiver } from "./receiver"; import { sender } from "./sender"; diff --git a/src/lib/resolvers/DirectChatMessage/receiver.ts b/src/resolvers/DirectChatMessage/receiver.ts similarity index 71% rename from src/lib/resolvers/DirectChatMessage/receiver.ts rename to src/resolvers/DirectChatMessage/receiver.ts index f178177517..ab14b864b0 100644 --- a/src/lib/resolvers/DirectChatMessage/receiver.ts +++ b/src/resolvers/DirectChatMessage/receiver.ts @@ -1,4 +1,4 @@ -import { DirectChatMessageResolvers } from "../../../generated/graphqlCodegen"; +import { DirectChatMessageResolvers } from "../../types/generatedGraphQLTypes"; import { User } from "../../models"; export const receiver: DirectChatMessageResolvers["receiver"] = async ( diff --git a/src/lib/resolvers/DirectChatMessage/sender.ts b/src/resolvers/DirectChatMessage/sender.ts similarity index 70% rename from src/lib/resolvers/DirectChatMessage/sender.ts rename to src/resolvers/DirectChatMessage/sender.ts index 9b7b2b56c4..2fc6079a4c 100644 --- a/src/lib/resolvers/DirectChatMessage/sender.ts +++ b/src/resolvers/DirectChatMessage/sender.ts @@ -1,4 +1,4 @@ -import { DirectChatMessageResolvers } from "../../../generated/graphqlCodegen"; +import { DirectChatMessageResolvers } from "../../types/generatedGraphQLTypes"; import { User } from "../../models"; export const sender: DirectChatMessageResolvers["sender"] = async (parent) => { diff --git a/src/lib/resolvers/GroupChat/creator.ts b/src/resolvers/GroupChat/creator.ts similarity index 71% rename from src/lib/resolvers/GroupChat/creator.ts rename to src/resolvers/GroupChat/creator.ts index 396067789e..43906eba7b 100644 --- a/src/lib/resolvers/GroupChat/creator.ts +++ b/src/resolvers/GroupChat/creator.ts @@ -1,4 +1,4 @@ -import { GroupChatResolvers } from "../../../generated/graphqlCodegen"; +import { GroupChatResolvers } from "../../types/generatedGraphQLTypes"; import { User } from "../../models"; export const creator: GroupChatResolvers["creator"] = async (parent) => { diff --git a/src/lib/resolvers/GroupChat/index.ts b/src/resolvers/GroupChat/index.ts similarity index 77% rename from src/lib/resolvers/GroupChat/index.ts rename to src/resolvers/GroupChat/index.ts index a6a7768eeb..721e865a9a 100644 --- a/src/lib/resolvers/GroupChat/index.ts +++ b/src/resolvers/GroupChat/index.ts @@ -1,4 +1,4 @@ -import { GroupChatResolvers } from "../../../generated/graphqlCodegen"; +import { GroupChatResolvers } from "../../types/generatedGraphQLTypes"; import { creator } from "./creator"; import { messages } from "./messages"; import { organization } from "./organization"; diff --git a/src/lib/resolvers/GroupChat/messages.ts b/src/resolvers/GroupChat/messages.ts similarity index 75% rename from src/lib/resolvers/GroupChat/messages.ts rename to src/resolvers/GroupChat/messages.ts index 18d851661c..e7403c682a 100644 --- a/src/lib/resolvers/GroupChat/messages.ts +++ b/src/resolvers/GroupChat/messages.ts @@ -1,4 +1,4 @@ -import { GroupChatResolvers } from "../../../generated/graphqlCodegen"; +import { GroupChatResolvers } from "../../types/generatedGraphQLTypes"; import { GroupChatMessage } from "../../models"; export const messages: GroupChatResolvers["messages"] = async (parent) => { diff --git a/src/lib/resolvers/GroupChat/organization.ts b/src/resolvers/GroupChat/organization.ts similarity index 75% rename from src/lib/resolvers/GroupChat/organization.ts rename to src/resolvers/GroupChat/organization.ts index fdf2830046..5954daf328 100644 --- a/src/lib/resolvers/GroupChat/organization.ts +++ b/src/resolvers/GroupChat/organization.ts @@ -1,4 +1,4 @@ -import { GroupChatResolvers } from "../../../generated/graphqlCodegen"; +import { GroupChatResolvers } from "../../types/generatedGraphQLTypes"; import { Organization } from "../../models"; export const organization: GroupChatResolvers["organization"] = async ( diff --git a/src/lib/resolvers/GroupChat/users.ts b/src/resolvers/GroupChat/users.ts similarity index 72% rename from src/lib/resolvers/GroupChat/users.ts rename to src/resolvers/GroupChat/users.ts index a70e7c108e..e3959c7124 100644 --- a/src/lib/resolvers/GroupChat/users.ts +++ b/src/resolvers/GroupChat/users.ts @@ -1,4 +1,4 @@ -import { GroupChatResolvers } from "../../../generated/graphqlCodegen"; +import { GroupChatResolvers } from "../../types/generatedGraphQLTypes"; import { User } from "../../models"; export const users: GroupChatResolvers["users"] = async (parent) => { diff --git a/src/lib/resolvers/GroupChatMessage/groupChatMessageBelongsTo.ts b/src/resolvers/GroupChatMessage/groupChatMessageBelongsTo.ts similarity index 76% rename from src/lib/resolvers/GroupChatMessage/groupChatMessageBelongsTo.ts rename to src/resolvers/GroupChatMessage/groupChatMessageBelongsTo.ts index 7d21135359..c94cc33554 100644 --- a/src/lib/resolvers/GroupChatMessage/groupChatMessageBelongsTo.ts +++ b/src/resolvers/GroupChatMessage/groupChatMessageBelongsTo.ts @@ -1,4 +1,4 @@ -import { GroupChatMessageResolvers } from "../../../generated/graphqlCodegen"; +import { GroupChatMessageResolvers } from "../../types/generatedGraphQLTypes"; import { GroupChat } from "../../models"; export const groupChatMessageBelongsTo: GroupChatMessageResolvers["groupChatMessageBelongsTo"] = diff --git a/src/lib/resolvers/GroupChatMessage/index.ts b/src/resolvers/GroupChatMessage/index.ts similarity index 72% rename from src/lib/resolvers/GroupChatMessage/index.ts rename to src/resolvers/GroupChatMessage/index.ts index 005feac299..b54573c660 100644 --- a/src/lib/resolvers/GroupChatMessage/index.ts +++ b/src/resolvers/GroupChatMessage/index.ts @@ -1,4 +1,4 @@ -import { GroupChatMessageResolvers } from "../../../generated/graphqlCodegen"; +import { GroupChatMessageResolvers } from "../../types/generatedGraphQLTypes"; import { groupChatMessageBelongsTo } from "./groupChatMessageBelongsTo"; import { sender } from "./sender"; diff --git a/src/lib/resolvers/GroupChatMessage/sender.ts b/src/resolvers/GroupChatMessage/sender.ts similarity index 70% rename from src/lib/resolvers/GroupChatMessage/sender.ts rename to src/resolvers/GroupChatMessage/sender.ts index 0ff8e3691a..120b0dc9d7 100644 --- a/src/lib/resolvers/GroupChatMessage/sender.ts +++ b/src/resolvers/GroupChatMessage/sender.ts @@ -1,4 +1,4 @@ -import { GroupChatMessageResolvers } from "../../../generated/graphqlCodegen"; +import { GroupChatMessageResolvers } from "../../types/generatedGraphQLTypes"; import { User } from "../../models"; export const sender: GroupChatMessageResolvers["sender"] = async (parent) => { diff --git a/src/lib/resolvers/MembershipRequest/index.ts b/src/resolvers/MembershipRequest/index.ts similarity index 67% rename from src/lib/resolvers/MembershipRequest/index.ts rename to src/resolvers/MembershipRequest/index.ts index 1d7546b43d..8fad5704e4 100644 --- a/src/lib/resolvers/MembershipRequest/index.ts +++ b/src/resolvers/MembershipRequest/index.ts @@ -1,4 +1,4 @@ -import { MembershipRequestResolvers } from "../../../generated/graphqlCodegen"; +import { MembershipRequestResolvers } from "../../types/generatedGraphQLTypes"; import { organization } from "./organization"; import { user } from "./user"; diff --git a/src/lib/resolvers/MembershipRequest/organization.ts b/src/resolvers/MembershipRequest/organization.ts similarity index 73% rename from src/lib/resolvers/MembershipRequest/organization.ts rename to src/resolvers/MembershipRequest/organization.ts index f74d789577..a142babcb6 100644 --- a/src/lib/resolvers/MembershipRequest/organization.ts +++ b/src/resolvers/MembershipRequest/organization.ts @@ -1,4 +1,4 @@ -import { MembershipRequestResolvers } from "../../../generated/graphqlCodegen"; +import { MembershipRequestResolvers } from "../../types/generatedGraphQLTypes"; import { Organization } from "../../models"; export const organization: MembershipRequestResolvers["organization"] = async ( diff --git a/src/lib/resolvers/MembershipRequest/user.ts b/src/resolvers/MembershipRequest/user.ts similarity index 69% rename from src/lib/resolvers/MembershipRequest/user.ts rename to src/resolvers/MembershipRequest/user.ts index bedb7f65a8..f6f2aec226 100644 --- a/src/lib/resolvers/MembershipRequest/user.ts +++ b/src/resolvers/MembershipRequest/user.ts @@ -1,4 +1,4 @@ -import { MembershipRequestResolvers } from "../../../generated/graphqlCodegen"; +import { MembershipRequestResolvers } from "../../types/generatedGraphQLTypes"; import { User } from "../../models"; export const user: MembershipRequestResolvers["user"] = async (parent) => { diff --git a/src/lib/resolvers/Mutation/acceptAdmin.ts b/src/resolvers/Mutation/acceptAdmin.ts similarity index 92% rename from src/lib/resolvers/Mutation/acceptAdmin.ts rename to src/resolvers/Mutation/acceptAdmin.ts index 350fff79f6..6cf3ce94df 100644 --- a/src/lib/resolvers/Mutation/acceptAdmin.ts +++ b/src/resolvers/Mutation/acceptAdmin.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { IN_PRODUCTION, USER_NOT_AUTHORIZED, @@ -6,7 +6,7 @@ import { USER_NOT_FOUND_CODE, USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; import { User } from "../../models"; import { errors, requestContext } from "../../libraries"; diff --git a/src/lib/resolvers/Mutation/acceptMembershipRequest.ts b/src/resolvers/Mutation/acceptMembershipRequest.ts similarity index 97% rename from src/lib/resolvers/Mutation/acceptMembershipRequest.ts rename to src/resolvers/Mutation/acceptMembershipRequest.ts index 1c04e9a503..992d2de4df 100644 --- a/src/lib/resolvers/Mutation/acceptMembershipRequest.ts +++ b/src/resolvers/Mutation/acceptMembershipRequest.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { adminCheck } from "../../utilities"; import { MembershipRequest, Organization, User } from "../../models"; @@ -20,7 +20,7 @@ import { USER_NOT_FOUND_CODE, USER_NOT_FOUND_PARAM, USER_NOT_FOUND, -} from "../../../constants"; +} from "../../constants"; export const acceptMembershipRequest: MutationResolvers["acceptMembershipRequest"] = async (_parent, args, context) => { diff --git a/src/lib/resolvers/Mutation/addLanguageTranslation.ts b/src/resolvers/Mutation/addLanguageTranslation.ts similarity index 92% rename from src/lib/resolvers/Mutation/addLanguageTranslation.ts rename to src/resolvers/Mutation/addLanguageTranslation.ts index 6df7e7380d..54c79a73f7 100644 --- a/src/lib/resolvers/Mutation/addLanguageTranslation.ts +++ b/src/resolvers/Mutation/addLanguageTranslation.ts @@ -1,5 +1,5 @@ -import { IN_PRODUCTION } from "../../../constants"; -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { IN_PRODUCTION } from "../../constants"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { Language } from "../../models"; diff --git a/src/lib/resolvers/Mutation/addOrganizationImage.ts b/src/resolvers/Mutation/addOrganizationImage.ts similarity index 95% rename from src/lib/resolvers/Mutation/addOrganizationImage.ts rename to src/resolvers/Mutation/addOrganizationImage.ts index a40a982494..71b76b82db 100644 --- a/src/lib/resolvers/Mutation/addOrganizationImage.ts +++ b/src/resolvers/Mutation/addOrganizationImage.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { adminCheck, uploadImage } from "../../utilities"; import { User, Organization } from "../../models"; @@ -12,7 +12,7 @@ import { USER_NOT_FOUND_CODE, USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; export const addOrganizationImage: MutationResolvers["addOrganizationImage"] = async (_parent, args, context) => { diff --git a/src/lib/resolvers/Mutation/addUserImage.ts b/src/resolvers/Mutation/addUserImage.ts similarity index 92% rename from src/lib/resolvers/Mutation/addUserImage.ts rename to src/resolvers/Mutation/addUserImage.ts index de73c41279..171b528b50 100644 --- a/src/lib/resolvers/Mutation/addUserImage.ts +++ b/src/resolvers/Mutation/addUserImage.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { uploadImage } from "../../utilities"; import { User } from "../../models"; @@ -8,7 +8,7 @@ import { USER_NOT_FOUND_CODE, USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; export const addUserImage: MutationResolvers["addUserImage"] = async ( _parent, diff --git a/src/lib/resolvers/Mutation/addUserToGroupChat.ts b/src/resolvers/Mutation/addUserToGroupChat.ts similarity index 96% rename from src/lib/resolvers/Mutation/addUserToGroupChat.ts rename to src/resolvers/Mutation/addUserToGroupChat.ts index 3dee73f102..9e87d8c4d8 100644 --- a/src/lib/resolvers/Mutation/addUserToGroupChat.ts +++ b/src/resolvers/Mutation/addUserToGroupChat.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { adminCheck } from "../../utilities"; import { User, GroupChat, Organization } from "../../models"; @@ -20,7 +20,7 @@ import { USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_CODE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; export const addUserToGroupChat: MutationResolvers["addUserToGroupChat"] = async (_parent, args, context) => { diff --git a/src/lib/resolvers/Mutation/adminRemoveEvent.ts b/src/resolvers/Mutation/adminRemoveEvent.ts similarity index 96% rename from src/lib/resolvers/Mutation/adminRemoveEvent.ts rename to src/resolvers/Mutation/adminRemoveEvent.ts index f4bc87ad62..79f371b856 100644 --- a/src/lib/resolvers/Mutation/adminRemoveEvent.ts +++ b/src/resolvers/Mutation/adminRemoveEvent.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { adminCheck } from "../../utilities"; import { User, Organization, Event } from "../../models"; @@ -16,7 +16,7 @@ import { EVENT_NOT_FOUND_PARAM, EVENT_NOT_FOUND_CODE, EVENT_NOT_FOUND_MESSAGE, -} from "../../../constants"; +} from "../../constants"; export const adminRemoveEvent: MutationResolvers["adminRemoveEvent"] = async ( _parent, diff --git a/src/lib/resolvers/Mutation/adminRemoveGroup.ts b/src/resolvers/Mutation/adminRemoveGroup.ts similarity index 96% rename from src/lib/resolvers/Mutation/adminRemoveGroup.ts rename to src/resolvers/Mutation/adminRemoveGroup.ts index caa96ee7fd..02a677b9e5 100644 --- a/src/lib/resolvers/Mutation/adminRemoveGroup.ts +++ b/src/resolvers/Mutation/adminRemoveGroup.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { adminCheck } from "../../utilities"; import { User, Organization, GroupChat } from "../../models"; @@ -16,7 +16,7 @@ import { CHAT_NOT_FOUND_PARAM, CHAT_NOT_FOUND_CODE, CHAT_NOT_FOUND_MESSAGE, -} from "../../../constants"; +} from "../../constants"; // @ts-ignore export const adminRemoveGroup: MutationResolvers["adminRemoveGroup"] = async ( diff --git a/src/lib/resolvers/Mutation/adminRemovePost.ts b/src/resolvers/Mutation/adminRemovePost.ts similarity index 96% rename from src/lib/resolvers/Mutation/adminRemovePost.ts rename to src/resolvers/Mutation/adminRemovePost.ts index 26d0525e5e..1945e07f93 100644 --- a/src/lib/resolvers/Mutation/adminRemovePost.ts +++ b/src/resolvers/Mutation/adminRemovePost.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { adminCheck } from "../../utilities"; import { User, Organization, Post } from "../../models"; @@ -16,7 +16,7 @@ import { USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_CODE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; export const adminRemovePost: MutationResolvers["adminRemovePost"] = async ( _parent, diff --git a/src/lib/resolvers/Mutation/blockPluginCreationBySuperadmin.ts b/src/resolvers/Mutation/blockPluginCreationBySuperadmin.ts similarity index 95% rename from src/lib/resolvers/Mutation/blockPluginCreationBySuperadmin.ts rename to src/resolvers/Mutation/blockPluginCreationBySuperadmin.ts index 391ae40318..3e36963a6a 100644 --- a/src/lib/resolvers/Mutation/blockPluginCreationBySuperadmin.ts +++ b/src/resolvers/Mutation/blockPluginCreationBySuperadmin.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { User } from "../../models"; import { @@ -11,7 +11,7 @@ import { USER_NOT_AUTHORIZED_MESSAGE, USER_NOT_AUTHORIZED_CODE, USER_NOT_AUTHORIZED_PARAM, -} from "../../../constants"; +} from "../../constants"; export const blockPluginCreationBySuperadmin: MutationResolvers["blockPluginCreationBySuperadmin"] = async (_parent, args, context) => { diff --git a/src/lib/resolvers/Mutation/blockUser.ts b/src/resolvers/Mutation/blockUser.ts similarity index 96% rename from src/lib/resolvers/Mutation/blockUser.ts rename to src/resolvers/Mutation/blockUser.ts index 6e642c9f18..11d8a91148 100644 --- a/src/lib/resolvers/Mutation/blockUser.ts +++ b/src/resolvers/Mutation/blockUser.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { adminCheck } from "../../utilities"; import { @@ -15,7 +15,7 @@ import { USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_CODE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; import { Organization, User } from "../../models"; export const blockUser: MutationResolvers["blockUser"] = async ( diff --git a/src/lib/resolvers/Mutation/cancelMembershipRequest.ts b/src/resolvers/Mutation/cancelMembershipRequest.ts similarity index 97% rename from src/lib/resolvers/Mutation/cancelMembershipRequest.ts rename to src/resolvers/Mutation/cancelMembershipRequest.ts index b872d889f2..51fd47c7fd 100644 --- a/src/lib/resolvers/Mutation/cancelMembershipRequest.ts +++ b/src/resolvers/Mutation/cancelMembershipRequest.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { User, Organization, MembershipRequest } from "../../models"; import { errors, requestContext } from "../../libraries"; import { @@ -19,7 +19,7 @@ import { MEMBERSHIP_REQUEST_NOT_FOUND_CODE, MEMBERSHIP_REQUEST_NOT_FOUND_MESSAGE, MEMBERSHIP_REQUEST_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; export const cancelMembershipRequest: MutationResolvers["cancelMembershipRequest"] = async (_parent, args, context) => { diff --git a/src/lib/resolvers/Mutation/createAdmin.ts b/src/resolvers/Mutation/createAdmin.ts similarity index 97% rename from src/lib/resolvers/Mutation/createAdmin.ts rename to src/resolvers/Mutation/createAdmin.ts index f319628456..5cb545e3e3 100644 --- a/src/lib/resolvers/Mutation/createAdmin.ts +++ b/src/resolvers/Mutation/createAdmin.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { User, Organization } from "../../models"; import { errors, requestContext } from "../../libraries"; import { creatorCheck } from "../../utilities"; @@ -20,7 +20,7 @@ import { USER_NOT_AUTHORIZED_CODE, USER_NOT_AUTHORIZED_MESSAGE, USER_NOT_AUTHORIZED_PARAM, -} from "../../../constants"; +} from "../../constants"; export const createAdmin: MutationResolvers["createAdmin"] = async ( _parent, diff --git a/src/lib/resolvers/Mutation/createComment.ts b/src/resolvers/Mutation/createComment.ts similarity index 92% rename from src/lib/resolvers/Mutation/createComment.ts rename to src/resolvers/Mutation/createComment.ts index 82af19f6c4..c500c364a3 100644 --- a/src/lib/resolvers/Mutation/createComment.ts +++ b/src/resolvers/Mutation/createComment.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { User, Post, Comment } from "../../models"; import { errors, requestContext } from "../../libraries"; import { @@ -7,7 +7,7 @@ import { USER_NOT_FOUND_CODE, USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; export const createComment: MutationResolvers["createComment"] = async ( _parent, diff --git a/src/lib/resolvers/Mutation/createDirectChat.ts b/src/resolvers/Mutation/createDirectChat.ts similarity index 95% rename from src/lib/resolvers/Mutation/createDirectChat.ts rename to src/resolvers/Mutation/createDirectChat.ts index 0e72243905..4115136c67 100644 --- a/src/lib/resolvers/Mutation/createDirectChat.ts +++ b/src/resolvers/Mutation/createDirectChat.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { User, Organization, DirectChat } from "../../models"; import { errors, requestContext } from "../../libraries"; import { @@ -11,7 +11,7 @@ import { ORGANIZATION_NOT_FOUND_MESSAGE, ORGANIZATION_NOT_FOUND_CODE, ORGANIZATION_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; export const createDirectChat: MutationResolvers["createDirectChat"] = async ( _parent, diff --git a/src/lib/resolvers/Mutation/createDonation.ts b/src/resolvers/Mutation/createDonation.ts similarity index 90% rename from src/lib/resolvers/Mutation/createDonation.ts rename to src/resolvers/Mutation/createDonation.ts index c02d105a51..4cf4355092 100644 --- a/src/lib/resolvers/Mutation/createDonation.ts +++ b/src/resolvers/Mutation/createDonation.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { Donation } from "../../models"; /** diff --git a/src/lib/resolvers/Mutation/createEvent.ts b/src/resolvers/Mutation/createEvent.ts similarity index 97% rename from src/lib/resolvers/Mutation/createEvent.ts rename to src/resolvers/Mutation/createEvent.ts index a706825627..f9b91f612d 100644 --- a/src/lib/resolvers/Mutation/createEvent.ts +++ b/src/resolvers/Mutation/createEvent.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { User, Organization, Event } from "../../models"; import { @@ -15,7 +15,7 @@ import { ORGANIZATION_NOT_AUTHORIZED_MESSAGE, ORGANIZATION_NOT_AUTHORIZED_CODE, ORGANIZATION_NOT_AUTHORIZED_PARAM, -} from "../../../constants"; +} from "../../constants"; import admin, { credential } from "firebase-admin"; const applicationDefault = credential.applicationDefault; diff --git a/src/lib/resolvers/Mutation/createEventProject.ts b/src/resolvers/Mutation/createEventProject.ts similarity index 98% rename from src/lib/resolvers/Mutation/createEventProject.ts rename to src/resolvers/Mutation/createEventProject.ts index 0515555066..ab6e4eb474 100644 --- a/src/lib/resolvers/Mutation/createEventProject.ts +++ b/src/resolvers/Mutation/createEventProject.ts @@ -14,7 +14,7 @@ import { EVENT_NOT_FOUND_MESSAGE, EVENT_NOT_FOUND_CODE, EVENT_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; export const createEventProject = async ( _parent: any, diff --git a/src/lib/resolvers/Mutation/createGroupChat.ts b/src/resolvers/Mutation/createGroupChat.ts similarity index 95% rename from src/lib/resolvers/Mutation/createGroupChat.ts rename to src/resolvers/Mutation/createGroupChat.ts index 0b223c0aa8..b9f4170db5 100644 --- a/src/lib/resolvers/Mutation/createGroupChat.ts +++ b/src/resolvers/Mutation/createGroupChat.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { User, GroupChat, Organization } from "../../models"; import { errors, requestContext } from "../../libraries"; import { @@ -11,7 +11,7 @@ import { ORGANIZATION_NOT_FOUND_MESSAGE, ORGANIZATION_NOT_FOUND_CODE, ORGANIZATION_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; export const createGroupChat: MutationResolvers["createGroupChat"] = async ( _parent, diff --git a/src/lib/resolvers/Mutation/createMessageChat.ts b/src/resolvers/Mutation/createMessageChat.ts similarity index 93% rename from src/lib/resolvers/Mutation/createMessageChat.ts rename to src/resolvers/Mutation/createMessageChat.ts index 1b403877e7..da7320b416 100644 --- a/src/lib/resolvers/Mutation/createMessageChat.ts +++ b/src/resolvers/Mutation/createMessageChat.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { User, MessageChat } from "../../models"; import { errors, requestContext } from "../../libraries"; import { @@ -7,7 +7,7 @@ import { USER_NOT_FOUND_CODE, USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; export const createMessageChat: MutationResolvers["createMessageChat"] = async ( _parent, diff --git a/src/lib/resolvers/Mutation/createOrganization.ts b/src/resolvers/Mutation/createOrganization.ts similarity index 94% rename from src/lib/resolvers/Mutation/createOrganization.ts rename to src/resolvers/Mutation/createOrganization.ts index a3730165e2..03f113182b 100644 --- a/src/lib/resolvers/Mutation/createOrganization.ts +++ b/src/resolvers/Mutation/createOrganization.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { User, Organization } from "../../models"; import { uploadImage } from "../../utilities"; import { errors, requestContext } from "../../libraries"; @@ -8,7 +8,7 @@ import { USER_NOT_FOUND_CODE, USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; export const createOrganization: MutationResolvers["createOrganization"] = async (_parent, args, context) => { diff --git a/src/lib/resolvers/Mutation/createPlugin.ts b/src/resolvers/Mutation/createPlugin.ts similarity index 89% rename from src/lib/resolvers/Mutation/createPlugin.ts rename to src/resolvers/Mutation/createPlugin.ts index 7d657cb24c..a1eb31782d 100644 --- a/src/lib/resolvers/Mutation/createPlugin.ts +++ b/src/resolvers/Mutation/createPlugin.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { Plugin } from "../../models"; /** diff --git a/src/lib/resolvers/Mutation/createPost.ts b/src/resolvers/Mutation/createPost.ts similarity index 94% rename from src/lib/resolvers/Mutation/createPost.ts rename to src/resolvers/Mutation/createPost.ts index ae3dde33f4..69b1359819 100644 --- a/src/lib/resolvers/Mutation/createPost.ts +++ b/src/resolvers/Mutation/createPost.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { User, Post, Organization } from "../../models"; import { uploadImage } from "../../utilities"; import { errors, requestContext } from "../../libraries"; @@ -12,7 +12,7 @@ import { USER_NOT_FOUND_CODE, USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; export const createPost: MutationResolvers["createPost"] = async ( _parent, diff --git a/src/lib/resolvers/Mutation/createTask.ts b/src/resolvers/Mutation/createTask.ts similarity index 94% rename from src/lib/resolvers/Mutation/createTask.ts rename to src/resolvers/Mutation/createTask.ts index 20bcd3d9b8..eb79d45ae9 100644 --- a/src/lib/resolvers/Mutation/createTask.ts +++ b/src/resolvers/Mutation/createTask.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { User, Task, Event } from "../../models"; import { errors, requestContext } from "../../libraries"; import { @@ -11,7 +11,7 @@ import { EVENT_NOT_FOUND_MESSAGE, EVENT_NOT_FOUND_CODE, EVENT_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; export const createTask: MutationResolvers["createTask"] = async ( _parent, diff --git a/src/lib/resolvers/Mutation/deleteDonationById.ts b/src/resolvers/Mutation/deleteDonationById.ts similarity index 88% rename from src/lib/resolvers/Mutation/deleteDonationById.ts rename to src/resolvers/Mutation/deleteDonationById.ts index 7e49ad9f76..66630c6e18 100644 --- a/src/lib/resolvers/Mutation/deleteDonationById.ts +++ b/src/resolvers/Mutation/deleteDonationById.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { Donation } from "../../models"; /** diff --git a/src/lib/resolvers/Mutation/forgotPassword.ts b/src/resolvers/Mutation/forgotPassword.ts similarity index 87% rename from src/lib/resolvers/Mutation/forgotPassword.ts rename to src/resolvers/Mutation/forgotPassword.ts index 7f177ce052..828464e4d5 100644 --- a/src/lib/resolvers/Mutation/forgotPassword.ts +++ b/src/resolvers/Mutation/forgotPassword.ts @@ -1,8 +1,8 @@ import bcrypt from "bcryptjs"; import jwtDecode from "jwt-decode"; -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { User } from "../../models"; -import { INVALID_OTP } from "../../../constants"; +import { INVALID_OTP } from "../../constants"; export const forgotPassword: MutationResolvers["forgotPassword"] = async ( _parent, diff --git a/src/lib/resolvers/Mutation/index.ts b/src/resolvers/Mutation/index.ts similarity index 98% rename from src/lib/resolvers/Mutation/index.ts rename to src/resolvers/Mutation/index.ts index bed69188c5..154067b97a 100644 --- a/src/lib/resolvers/Mutation/index.ts +++ b/src/resolvers/Mutation/index.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { acceptAdmin } from "./acceptAdmin"; import { acceptMembershipRequest } from "./acceptMembershipRequest"; import { addLanguageTranslation } from "./addLanguageTranslation"; diff --git a/src/lib/resolvers/Mutation/joinPublicOrganization.ts b/src/resolvers/Mutation/joinPublicOrganization.ts similarity index 96% rename from src/lib/resolvers/Mutation/joinPublicOrganization.ts rename to src/resolvers/Mutation/joinPublicOrganization.ts index 0211dc59e1..c97e2cb7e6 100644 --- a/src/lib/resolvers/Mutation/joinPublicOrganization.ts +++ b/src/resolvers/Mutation/joinPublicOrganization.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { User, Organization } from "../../models"; import { errors, requestContext } from "../../libraries"; import { @@ -19,7 +19,7 @@ import { USER_NOT_FOUND_CODE, USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; export const joinPublicOrganization: MutationResolvers["joinPublicOrganization"] = async (_parent, args, context) => { diff --git a/src/lib/resolvers/Mutation/leaveOrganization.ts b/src/resolvers/Mutation/leaveOrganization.ts similarity index 97% rename from src/lib/resolvers/Mutation/leaveOrganization.ts rename to src/resolvers/Mutation/leaveOrganization.ts index a3ef7f7bac..2fa5b8108d 100644 --- a/src/lib/resolvers/Mutation/leaveOrganization.ts +++ b/src/resolvers/Mutation/leaveOrganization.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { User, Organization } from "../../models"; import { errors, requestContext } from "../../libraries"; import { @@ -19,7 +19,7 @@ import { USER_NOT_FOUND, USER_NOT_AUTHORIZED_MESSAGE, MEMBER_NOT_FOUND, -} from "../../../constants"; +} from "../../constants"; export const leaveOrganization: MutationResolvers["leaveOrganization"] = async ( _parent, diff --git a/src/lib/resolvers/Mutation/likeComment.ts b/src/resolvers/Mutation/likeComment.ts similarity index 95% rename from src/lib/resolvers/Mutation/likeComment.ts rename to src/resolvers/Mutation/likeComment.ts index 9e7d282f7b..f8fc275c52 100644 --- a/src/lib/resolvers/Mutation/likeComment.ts +++ b/src/resolvers/Mutation/likeComment.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { User, Comment } from "../../models"; import { errors, requestContext } from "../../libraries"; import { @@ -11,7 +11,7 @@ import { USER_NOT_FOUND_CODE, USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; export const likeComment: MutationResolvers["likeComment"] = async ( _parent, diff --git a/src/lib/resolvers/Mutation/likePost.ts b/src/resolvers/Mutation/likePost.ts similarity index 94% rename from src/lib/resolvers/Mutation/likePost.ts rename to src/resolvers/Mutation/likePost.ts index a3b852aacf..1018f9d1ba 100644 --- a/src/lib/resolvers/Mutation/likePost.ts +++ b/src/resolvers/Mutation/likePost.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { User, Post } from "../../models"; import { errors, requestContext } from "../../libraries"; import { @@ -11,7 +11,7 @@ import { USER_NOT_FOUND_CODE, USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; export const likePost: MutationResolvers["likePost"] = async ( _parent, diff --git a/src/lib/resolvers/Mutation/login.ts b/src/resolvers/Mutation/login.ts similarity index 95% rename from src/lib/resolvers/Mutation/login.ts rename to src/resolvers/Mutation/login.ts index eee123b158..020b85a3cb 100644 --- a/src/lib/resolvers/Mutation/login.ts +++ b/src/resolvers/Mutation/login.ts @@ -1,5 +1,5 @@ import bcrypt from "bcryptjs"; -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { User } from "../../models"; import { createAccessToken, @@ -14,7 +14,7 @@ import { USER_NOT_FOUND_CODE, USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; export const login: MutationResolvers["login"] = async (_parent, args) => { let user = await User.findOne({ diff --git a/src/lib/resolvers/Mutation/logout.ts b/src/resolvers/Mutation/logout.ts similarity index 90% rename from src/lib/resolvers/Mutation/logout.ts rename to src/resolvers/Mutation/logout.ts index 9c17ccac5b..96250af0f4 100644 --- a/src/lib/resolvers/Mutation/logout.ts +++ b/src/resolvers/Mutation/logout.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { User } from "../../models"; import { errors, requestContext } from "../../libraries"; import { @@ -7,7 +7,7 @@ import { USER_NOT_FOUND_PARAM, USER_NOT_FOUND, IN_PRODUCTION, -} from "../../../constants"; +} from "../../constants"; export const logout: MutationResolvers["logout"] = async ( _parent, diff --git a/src/lib/resolvers/Mutation/otp.ts b/src/resolvers/Mutation/otp.ts similarity index 85% rename from src/lib/resolvers/Mutation/otp.ts rename to src/resolvers/Mutation/otp.ts index fa2cba5535..f66fbce577 100644 --- a/src/lib/resolvers/Mutation/otp.ts +++ b/src/resolvers/Mutation/otp.ts @@ -1,9 +1,10 @@ import bcrypt from "bcryptjs"; import jwt from "jsonwebtoken"; -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { User } from "../../models"; import { mailer } from "../../utilities"; -import { USER_NOT_FOUND } from "../../../constants"; +import { USER_NOT_FOUND } from "../../constants"; +import { logger } from "../../libraries"; export const otp: MutationResolvers["otp"] = async (_parent, args) => { const user = await User.findOne({ @@ -39,7 +40,7 @@ export const otp: MutationResolvers["otp"] = async (_parent, args) => { subject, body, }).then((info) => { - console.log(info); + logger.info(info); return { otpToken }; }); }; diff --git a/src/lib/resolvers/Mutation/recaptcha.ts b/src/resolvers/Mutation/recaptcha.ts similarity index 82% rename from src/lib/resolvers/Mutation/recaptcha.ts rename to src/resolvers/Mutation/recaptcha.ts index 85ccdec3d7..3ce1367947 100644 --- a/src/lib/resolvers/Mutation/recaptcha.ts +++ b/src/resolvers/Mutation/recaptcha.ts @@ -1,5 +1,5 @@ import axios from "axios"; -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; export const recaptcha: MutationResolvers["recaptcha"] = async ( _parent, diff --git a/src/lib/resolvers/Mutation/refreshToken.ts b/src/resolvers/Mutation/refreshToken.ts similarity index 95% rename from src/lib/resolvers/Mutation/refreshToken.ts rename to src/resolvers/Mutation/refreshToken.ts index ec66cdee52..6c443210a9 100644 --- a/src/lib/resolvers/Mutation/refreshToken.ts +++ b/src/resolvers/Mutation/refreshToken.ts @@ -1,5 +1,5 @@ import jwt from "jsonwebtoken"; -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { User } from "../../models"; import { createAccessToken, createRefreshToken } from "../../utilities"; @@ -9,7 +9,7 @@ import { USER_NOT_FOUND_CODE, USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; import { Interface_JwtTokenPayload } from "../../utilities"; export const refreshToken: MutationResolvers["refreshToken"] = async ( diff --git a/src/lib/resolvers/Mutation/registerForEvent.ts b/src/resolvers/Mutation/registerForEvent.ts similarity index 97% rename from src/lib/resolvers/Mutation/registerForEvent.ts rename to src/resolvers/Mutation/registerForEvent.ts index fbb33d8455..242787125a 100644 --- a/src/lib/resolvers/Mutation/registerForEvent.ts +++ b/src/resolvers/Mutation/registerForEvent.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { User, Event } from "../../models"; import { @@ -15,7 +15,7 @@ import { REGISTRANT_ALREADY_EXIST_CODE, REGISTRANT_ALREADY_EXIST_MESSAGE, REGISTRANT_ALREADY_EXIST_PARAM, -} from "../../../constants"; +} from "../../constants"; export const registerForEvent: MutationResolvers["registerForEvent"] = async ( _parent, diff --git a/src/lib/resolvers/Mutation/rejectAdmin.ts b/src/resolvers/Mutation/rejectAdmin.ts similarity index 93% rename from src/lib/resolvers/Mutation/rejectAdmin.ts rename to src/resolvers/Mutation/rejectAdmin.ts index b93a9200ec..4b2710ff75 100644 --- a/src/lib/resolvers/Mutation/rejectAdmin.ts +++ b/src/resolvers/Mutation/rejectAdmin.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { User } from "../../models"; import { IN_PRODUCTION, @@ -7,7 +7,7 @@ import { USER_NOT_FOUND_CODE, USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; import { errors, requestContext } from "../../libraries"; export const rejectAdmin: MutationResolvers["rejectAdmin"] = async ( diff --git a/src/lib/resolvers/Mutation/rejectMembershipRequest.ts b/src/resolvers/Mutation/rejectMembershipRequest.ts similarity index 96% rename from src/lib/resolvers/Mutation/rejectMembershipRequest.ts rename to src/resolvers/Mutation/rejectMembershipRequest.ts index f3dc3a1851..64cb50b402 100644 --- a/src/lib/resolvers/Mutation/rejectMembershipRequest.ts +++ b/src/resolvers/Mutation/rejectMembershipRequest.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { User, Organization, MembershipRequest } from "../../models"; import { adminCheck } from "../../utilities"; @@ -16,7 +16,7 @@ import { ORGANIZATION_NOT_FOUND_MESSAGE, MEMBERSHIP_REQUEST_NOT_FOUND_MESSAGE, USER_NOT_FOUND_MESSAGE, -} from "../../../constants"; +} from "../../constants"; export const rejectMembershipRequest: MutationResolvers["rejectMembershipRequest"] = async (_parent, args, context) => { diff --git a/src/lib/resolvers/Mutation/removeAdmin.ts b/src/resolvers/Mutation/removeAdmin.ts similarity index 95% rename from src/lib/resolvers/Mutation/removeAdmin.ts rename to src/resolvers/Mutation/removeAdmin.ts index 99dc39a109..bb1788a6b0 100644 --- a/src/lib/resolvers/Mutation/removeAdmin.ts +++ b/src/resolvers/Mutation/removeAdmin.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { adminCheck, creatorCheck } from "../../utilities"; import { User, Organization } from "../../models"; import { errors, requestContext } from "../../libraries"; @@ -12,7 +12,7 @@ import { USER_NOT_FOUND_CODE, ORGANIZATION_NOT_FOUND_MESSAGE, ORGANIZATION_NOT_FOUND_CODE, -} from "../../../constants"; +} from "../../constants"; export const removeAdmin: MutationResolvers["removeAdmin"] = async ( _parent, diff --git a/src/lib/resolvers/Mutation/removeComment.ts b/src/resolvers/Mutation/removeComment.ts similarity index 95% rename from src/lib/resolvers/Mutation/removeComment.ts rename to src/resolvers/Mutation/removeComment.ts index 4150de40d6..840a01eef9 100644 --- a/src/lib/resolvers/Mutation/removeComment.ts +++ b/src/resolvers/Mutation/removeComment.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { User, Post, Comment } from "../../models"; import { errors, requestContext } from "../../libraries"; import { @@ -14,7 +14,7 @@ import { USER_NOT_AUTHORIZED, USER_NOT_AUTHORIZED_MESSAGE, USER_NOT_AUTHORIZED_CODE, -} from "../../../constants"; +} from "../../constants"; export const removeComment: MutationResolvers["removeComment"] = async ( _parent, diff --git a/src/lib/resolvers/Mutation/removeDirectChat.ts b/src/resolvers/Mutation/removeDirectChat.ts similarity index 94% rename from src/lib/resolvers/Mutation/removeDirectChat.ts rename to src/resolvers/Mutation/removeDirectChat.ts index c822c5b42a..18a800a427 100644 --- a/src/lib/resolvers/Mutation/removeDirectChat.ts +++ b/src/resolvers/Mutation/removeDirectChat.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { DirectChat, DirectChatMessage, Organization } from "../../models"; import { adminCheck } from "../../utilities"; import { errors, requestContext } from "../../libraries"; @@ -12,7 +12,7 @@ import { ORGANIZATION_NOT_FOUND_CODE, ORGANIZATION_NOT_FOUND_MESSAGE, ORGANIZATION_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; export const removeDirectChat: MutationResolvers["removeDirectChat"] = async ( _parent, diff --git a/src/lib/resolvers/Mutation/removeEvent.ts b/src/resolvers/Mutation/removeEvent.ts similarity index 96% rename from src/lib/resolvers/Mutation/removeEvent.ts rename to src/resolvers/Mutation/removeEvent.ts index 9ff299e08e..bdfb8c2961 100644 --- a/src/lib/resolvers/Mutation/removeEvent.ts +++ b/src/resolvers/Mutation/removeEvent.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { User, Event } from "../../models"; import { @@ -15,7 +15,7 @@ import { USER_NOT_AUTHORIZED_MESSAGE, USER_NOT_AUTHORIZED_CODE, USER_NOT_AUTHORIZED_PARAM, -} from "../../../constants"; +} from "../../constants"; export const removeEvent: MutationResolvers["removeEvent"] = async ( _parent, diff --git a/src/lib/resolvers/Mutation/removeEventProject.ts b/src/resolvers/Mutation/removeEventProject.ts similarity index 98% rename from src/lib/resolvers/Mutation/removeEventProject.ts rename to src/resolvers/Mutation/removeEventProject.ts index b27aff242f..80f34cf9ec 100644 --- a/src/lib/resolvers/Mutation/removeEventProject.ts +++ b/src/resolvers/Mutation/removeEventProject.ts @@ -14,7 +14,7 @@ import { USER_NOT_AUTHORIZED_CODE, USER_NOT_AUTHORIZED_MESSAGE, USER_NOT_AUTHORIZED_PARAM, -} from "../../../constants"; +} from "../../constants"; export const removeEventProject = async ( _parent: any, diff --git a/src/lib/resolvers/Mutation/removeGroupChat.ts b/src/resolvers/Mutation/removeGroupChat.ts similarity index 94% rename from src/lib/resolvers/Mutation/removeGroupChat.ts rename to src/resolvers/Mutation/removeGroupChat.ts index 28739752e7..6d268be635 100644 --- a/src/lib/resolvers/Mutation/removeGroupChat.ts +++ b/src/resolvers/Mutation/removeGroupChat.ts @@ -9,8 +9,8 @@ import { ORGANIZATION_NOT_FOUND_CODE, ORGANIZATION_NOT_FOUND_MESSAGE, ORGANIZATION_NOT_FOUND_PARAM, -} from "../../../constants"; -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +} from "../../constants"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { GroupChat, GroupChatMessage, Organization } from "../../models"; diff --git a/src/lib/resolvers/Mutation/removeMember.ts b/src/resolvers/Mutation/removeMember.ts similarity index 97% rename from src/lib/resolvers/Mutation/removeMember.ts rename to src/resolvers/Mutation/removeMember.ts index be7a36ca34..df6195dc39 100644 --- a/src/lib/resolvers/Mutation/removeMember.ts +++ b/src/resolvers/Mutation/removeMember.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { User, Organization } from "../../models"; import { adminCheck } from "../../utilities"; @@ -10,7 +10,7 @@ import { ORGANIZATION_NOT_FOUND_CODE, ORGANIZATION_NOT_FOUND_MESSAGE, ORGANIZATION_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; export const removeMember: MutationResolvers["removeMember"] = async ( _parent, diff --git a/src/lib/resolvers/Mutation/removeOrganization.ts b/src/resolvers/Mutation/removeOrganization.ts similarity index 98% rename from src/lib/resolvers/Mutation/removeOrganization.ts rename to src/resolvers/Mutation/removeOrganization.ts index 417ebb4622..44a726d29f 100644 --- a/src/lib/resolvers/Mutation/removeOrganization.ts +++ b/src/resolvers/Mutation/removeOrganization.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { User, @@ -18,7 +18,7 @@ import { ORGANIZATION_NOT_FOUND_CODE, ORGANIZATION_NOT_FOUND_MESSAGE, ORGANIZATION_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; export const removeOrganization: MutationResolvers["removeOrganization"] = async (_parent, args, context) => { diff --git a/src/lib/resolvers/Mutation/removeOrganizationImage.ts b/src/resolvers/Mutation/removeOrganizationImage.ts similarity index 95% rename from src/lib/resolvers/Mutation/removeOrganizationImage.ts rename to src/resolvers/Mutation/removeOrganizationImage.ts index c1d90e702e..e6d1d0334a 100644 --- a/src/lib/resolvers/Mutation/removeOrganizationImage.ts +++ b/src/resolvers/Mutation/removeOrganizationImage.ts @@ -8,8 +8,8 @@ import { USER_NOT_FOUND_CODE, USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +} from "../../constants"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { User, Organization } from "../../models"; import { adminCheck, deleteImage } from "../../utilities"; diff --git a/src/lib/resolvers/Mutation/removePost.ts b/src/resolvers/Mutation/removePost.ts similarity index 94% rename from src/lib/resolvers/Mutation/removePost.ts rename to src/resolvers/Mutation/removePost.ts index 6d36424397..34417c2977 100644 --- a/src/lib/resolvers/Mutation/removePost.ts +++ b/src/resolvers/Mutation/removePost.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { User, Post } from "../../models"; import { @@ -15,7 +15,7 @@ import { USER_NOT_AUTHORIZED_CODE, USER_NOT_AUTHORIZED_MESSAGE, USER_NOT_AUTHORIZED_PARAM, -} from "../../../constants"; +} from "../../constants"; export const removePost: MutationResolvers["removePost"] = async ( _parent, diff --git a/src/lib/resolvers/Mutation/removeTask.ts b/src/resolvers/Mutation/removeTask.ts similarity index 94% rename from src/lib/resolvers/Mutation/removeTask.ts rename to src/resolvers/Mutation/removeTask.ts index 193b93932b..6e5cafffb6 100644 --- a/src/lib/resolvers/Mutation/removeTask.ts +++ b/src/resolvers/Mutation/removeTask.ts @@ -8,8 +8,8 @@ import { USER_NOT_AUTHORIZED_CODE, USER_NOT_AUTHORIZED_MESSAGE, USER_NOT_AUTHORIZED_PARAM, -} from "../../../constants"; -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +} from "../../constants"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { User, Task, Event } from "../../models"; diff --git a/src/lib/resolvers/Mutation/removeUserFromGroupChat.ts b/src/resolvers/Mutation/removeUserFromGroupChat.ts similarity index 96% rename from src/lib/resolvers/Mutation/removeUserFromGroupChat.ts rename to src/resolvers/Mutation/removeUserFromGroupChat.ts index 5e9ce4c7e5..b0adaac50b 100644 --- a/src/lib/resolvers/Mutation/removeUserFromGroupChat.ts +++ b/src/resolvers/Mutation/removeUserFromGroupChat.ts @@ -12,8 +12,8 @@ import { USER_NOT_AUTHORIZED_MESSAGE, USER_NOT_AUTHORIZED_CODE, USER_NOT_AUTHORIZED_PARAM, -} from "../../../constants"; -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +} from "../../constants"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { GroupChat, Organization } from "../../models"; import { adminCheck } from "../../utilities"; diff --git a/src/lib/resolvers/Mutation/removeUserImage.ts b/src/resolvers/Mutation/removeUserImage.ts similarity index 93% rename from src/lib/resolvers/Mutation/removeUserImage.ts rename to src/resolvers/Mutation/removeUserImage.ts index 690bbec9f8..e2300dbb05 100644 --- a/src/lib/resolvers/Mutation/removeUserImage.ts +++ b/src/resolvers/Mutation/removeUserImage.ts @@ -4,8 +4,8 @@ import { USER_NOT_FOUND_CODE, USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +} from "../../constants"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { User } from "../../models"; import { deleteImage } from "../../utilities"; diff --git a/src/lib/resolvers/Mutation/revokeRefreshTokenForUser.ts b/src/resolvers/Mutation/revokeRefreshTokenForUser.ts similarity index 82% rename from src/lib/resolvers/Mutation/revokeRefreshTokenForUser.ts rename to src/resolvers/Mutation/revokeRefreshTokenForUser.ts index bf343eb7f3..8cfd07e841 100644 --- a/src/lib/resolvers/Mutation/revokeRefreshTokenForUser.ts +++ b/src/resolvers/Mutation/revokeRefreshTokenForUser.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { User } from "../../models"; export const revokeRefreshTokenForUser: MutationResolvers["revokeRefreshTokenForUser"] = diff --git a/src/lib/resolvers/Mutation/saveFcmToken.ts b/src/resolvers/Mutation/saveFcmToken.ts similarity index 88% rename from src/lib/resolvers/Mutation/saveFcmToken.ts rename to src/resolvers/Mutation/saveFcmToken.ts index c48864dcf7..a4019d3cb5 100644 --- a/src/lib/resolvers/Mutation/saveFcmToken.ts +++ b/src/resolvers/Mutation/saveFcmToken.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { User } from "../../models"; import { @@ -7,7 +7,7 @@ import { USER_NOT_FOUND_CODE, USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; export const saveFcmToken: MutationResolvers["saveFcmToken"] = async ( _parent, diff --git a/src/lib/resolvers/Mutation/sendMembershipRequest.ts b/src/resolvers/Mutation/sendMembershipRequest.ts similarity index 95% rename from src/lib/resolvers/Mutation/sendMembershipRequest.ts rename to src/resolvers/Mutation/sendMembershipRequest.ts index 58d3d9a986..2b7323bb3b 100644 --- a/src/lib/resolvers/Mutation/sendMembershipRequest.ts +++ b/src/resolvers/Mutation/sendMembershipRequest.ts @@ -8,8 +8,8 @@ import { USER_NOT_FOUND_CODE, USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +} from "../../constants"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { User, MembershipRequest, Organization } from "../../models"; diff --git a/src/lib/resolvers/Mutation/sendMessageToDirectChat.ts b/src/resolvers/Mutation/sendMessageToDirectChat.ts similarity index 95% rename from src/lib/resolvers/Mutation/sendMessageToDirectChat.ts rename to src/resolvers/Mutation/sendMessageToDirectChat.ts index d25106f0fe..02ecc3862f 100644 --- a/src/lib/resolvers/Mutation/sendMessageToDirectChat.ts +++ b/src/resolvers/Mutation/sendMessageToDirectChat.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { DirectChat, DirectChatMessage, User } from "../../models"; import { @@ -11,7 +11,7 @@ import { USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_CODE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; export const sendMessageToDirectChat: MutationResolvers["sendMessageToDirectChat"] = async (_parent, args, context) => { diff --git a/src/lib/resolvers/Mutation/sendMessageToGroupChat.ts b/src/resolvers/Mutation/sendMessageToGroupChat.ts similarity index 96% rename from src/lib/resolvers/Mutation/sendMessageToGroupChat.ts rename to src/resolvers/Mutation/sendMessageToGroupChat.ts index 4c8b4c6558..e6bbfc5dbd 100644 --- a/src/lib/resolvers/Mutation/sendMessageToGroupChat.ts +++ b/src/resolvers/Mutation/sendMessageToGroupChat.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { GroupChat, GroupChatMessage, User } from "../../models"; import { @@ -15,7 +15,7 @@ import { USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_CODE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; export const sendMessageToGroupChat: MutationResolvers["sendMessageToGroupChat"] = async (_parent, args, context) => { diff --git a/src/lib/resolvers/Mutation/signUp.ts b/src/resolvers/Mutation/signUp.ts similarity index 96% rename from src/lib/resolvers/Mutation/signUp.ts rename to src/resolvers/Mutation/signUp.ts index ca4aca8e3f..81516ccfe7 100644 --- a/src/lib/resolvers/Mutation/signUp.ts +++ b/src/resolvers/Mutation/signUp.ts @@ -5,8 +5,8 @@ import { ORGANIZATION_NOT_FOUND_CODE, ORGANIZATION_NOT_FOUND_MESSAGE, ORGANIZATION_NOT_FOUND_PARAM, -} from "../../../constants"; -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +} from "../../constants"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { User, Organization } from "../../models"; import { diff --git a/src/lib/resolvers/Mutation/unblockUser.ts b/src/resolvers/Mutation/unblockUser.ts similarity index 96% rename from src/lib/resolvers/Mutation/unblockUser.ts rename to src/resolvers/Mutation/unblockUser.ts index 024be95c8e..d901e2c4e6 100644 --- a/src/lib/resolvers/Mutation/unblockUser.ts +++ b/src/resolvers/Mutation/unblockUser.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { adminCheck } from "../../utilities"; import { @@ -15,7 +15,7 @@ import { USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_CODE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; import { Organization, User } from "../../models"; export const unblockUser: MutationResolvers["unblockUser"] = async ( diff --git a/src/lib/resolvers/Mutation/unlikeComment.ts b/src/resolvers/Mutation/unlikeComment.ts similarity index 93% rename from src/lib/resolvers/Mutation/unlikeComment.ts rename to src/resolvers/Mutation/unlikeComment.ts index 2752c1e235..308d680da7 100644 --- a/src/lib/resolvers/Mutation/unlikeComment.ts +++ b/src/resolvers/Mutation/unlikeComment.ts @@ -8,8 +8,8 @@ import { USER_NOT_FOUND_CODE, USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +} from "../../constants"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { User, Comment } from "../../models"; diff --git a/src/lib/resolvers/Mutation/unlikePost.ts b/src/resolvers/Mutation/unlikePost.ts similarity index 93% rename from src/lib/resolvers/Mutation/unlikePost.ts rename to src/resolvers/Mutation/unlikePost.ts index 45933dc59a..2525df5076 100644 --- a/src/lib/resolvers/Mutation/unlikePost.ts +++ b/src/resolvers/Mutation/unlikePost.ts @@ -8,8 +8,8 @@ import { USER_NOT_FOUND_CODE, USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +} from "../../constants"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { User, Post } from "../../models"; diff --git a/src/lib/resolvers/Mutation/unregisterForEventByUser.ts b/src/resolvers/Mutation/unregisterForEventByUser.ts similarity index 96% rename from src/lib/resolvers/Mutation/unregisterForEventByUser.ts rename to src/resolvers/Mutation/unregisterForEventByUser.ts index b4d6114fdc..387d1cc36c 100644 --- a/src/lib/resolvers/Mutation/unregisterForEventByUser.ts +++ b/src/resolvers/Mutation/unregisterForEventByUser.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { User, Event } from "../../models"; import { @@ -15,7 +15,7 @@ import { USER_ALREADY_UNREGISTERED_MESSAGE, USER_ALREADY_UNREGISTERED_CODE, USER_ALREADY_UNREGISTERED_PARAM, -} from "../../../constants"; +} from "../../constants"; export const unregisterForEventByUser: MutationResolvers["unregisterForEventByUser"] = async (_parent, args, context) => { diff --git a/src/lib/resolvers/Mutation/updateEvent.ts b/src/resolvers/Mutation/updateEvent.ts similarity index 95% rename from src/lib/resolvers/Mutation/updateEvent.ts rename to src/resolvers/Mutation/updateEvent.ts index 0e926a09bc..d8e8fa021f 100644 --- a/src/lib/resolvers/Mutation/updateEvent.ts +++ b/src/resolvers/Mutation/updateEvent.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { User, Event } from "../../models"; import { @@ -15,7 +15,7 @@ import { USER_NOT_AUTHORIZED_MESSAGE, USER_NOT_AUTHORIZED_CODE, USER_NOT_AUTHORIZED_PARAM, -} from "../../../constants"; +} from "../../constants"; export const updateEvent: MutationResolvers["updateEvent"] = async ( _parent, diff --git a/src/lib/resolvers/Mutation/updateEventProject.ts b/src/resolvers/Mutation/updateEventProject.ts similarity index 98% rename from src/lib/resolvers/Mutation/updateEventProject.ts rename to src/resolvers/Mutation/updateEventProject.ts index b8db032e44..964df1534b 100644 --- a/src/lib/resolvers/Mutation/updateEventProject.ts +++ b/src/resolvers/Mutation/updateEventProject.ts @@ -14,7 +14,7 @@ import { USER_NOT_FOUND_CODE, USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; export const updateEventProject = async ( _parent: any, diff --git a/src/lib/resolvers/Mutation/updateLanguage.ts b/src/resolvers/Mutation/updateLanguage.ts similarity index 89% rename from src/lib/resolvers/Mutation/updateLanguage.ts rename to src/resolvers/Mutation/updateLanguage.ts index 6cc2a84fab..0e1c1add52 100644 --- a/src/lib/resolvers/Mutation/updateLanguage.ts +++ b/src/resolvers/Mutation/updateLanguage.ts @@ -4,8 +4,8 @@ import { USER_NOT_FOUND_CODE, USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +} from "../../constants"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { User } from "../../models"; diff --git a/src/lib/resolvers/Mutation/updateOrganization.ts b/src/resolvers/Mutation/updateOrganization.ts similarity index 92% rename from src/lib/resolvers/Mutation/updateOrganization.ts rename to src/resolvers/Mutation/updateOrganization.ts index 9713030d77..c30066e179 100644 --- a/src/lib/resolvers/Mutation/updateOrganization.ts +++ b/src/resolvers/Mutation/updateOrganization.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { Organization } from "../../models"; import { @@ -7,7 +7,7 @@ import { ORGANIZATION_NOT_FOUND_MESSAGE, ORGANIZATION_NOT_FOUND_CODE, ORGANIZATION_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; import { adminCheck } from "../../utilities"; export const updateOrganization: MutationResolvers["updateOrganization"] = diff --git a/src/lib/resolvers/Mutation/updatePluginInstalledOrgs.ts b/src/resolvers/Mutation/updatePluginInstalledOrgs.ts similarity index 95% rename from src/lib/resolvers/Mutation/updatePluginInstalledOrgs.ts rename to src/resolvers/Mutation/updatePluginInstalledOrgs.ts index f42731ad30..ca4bc88808 100644 --- a/src/lib/resolvers/Mutation/updatePluginInstalledOrgs.ts +++ b/src/resolvers/Mutation/updatePluginInstalledOrgs.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { Plugin } from "../../models"; /** diff --git a/src/lib/resolvers/Mutation/updatePluginStatus.ts b/src/resolvers/Mutation/updatePluginStatus.ts similarity index 89% rename from src/lib/resolvers/Mutation/updatePluginStatus.ts rename to src/resolvers/Mutation/updatePluginStatus.ts index 08c1ff574d..9688c2271d 100644 --- a/src/lib/resolvers/Mutation/updatePluginStatus.ts +++ b/src/resolvers/Mutation/updatePluginStatus.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { Plugin } from "../../models"; /** diff --git a/src/lib/resolvers/Mutation/updateTask.ts b/src/resolvers/Mutation/updateTask.ts similarity index 93% rename from src/lib/resolvers/Mutation/updateTask.ts rename to src/resolvers/Mutation/updateTask.ts index abcbb4136c..7ebcb08795 100644 --- a/src/lib/resolvers/Mutation/updateTask.ts +++ b/src/resolvers/Mutation/updateTask.ts @@ -8,8 +8,8 @@ import { USER_NOT_FOUND_CODE, USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +} from "../../constants"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { User, Task } from "../../models"; diff --git a/src/lib/resolvers/Mutation/updateUserProfile.ts b/src/resolvers/Mutation/updateUserProfile.ts similarity index 95% rename from src/lib/resolvers/Mutation/updateUserProfile.ts rename to src/resolvers/Mutation/updateUserProfile.ts index d3ff1d68c5..80d21c6b7d 100644 --- a/src/lib/resolvers/Mutation/updateUserProfile.ts +++ b/src/resolvers/Mutation/updateUserProfile.ts @@ -4,8 +4,8 @@ import { USER_NOT_FOUND_CODE, USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +} from "../../constants"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { User } from "../../models"; import { uploadImage } from "../../utilities"; diff --git a/src/lib/resolvers/Mutation/updateUserType.ts b/src/resolvers/Mutation/updateUserType.ts similarity index 91% rename from src/lib/resolvers/Mutation/updateUserType.ts rename to src/resolvers/Mutation/updateUserType.ts index 172f304942..69ed57270a 100644 --- a/src/lib/resolvers/Mutation/updateUserType.ts +++ b/src/resolvers/Mutation/updateUserType.ts @@ -1,4 +1,4 @@ -import { MutationResolvers } from "../../../generated/graphqlCodegen"; +import { MutationResolvers } from "../../types/generatedGraphQLTypes"; import { User } from "../../models"; import { USER_NOT_AUTHORIZED, @@ -7,7 +7,7 @@ import { USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_CODE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; import { errors, requestContext } from "../../libraries"; export const updateUserType: MutationResolvers["updateUserType"] = async ( diff --git a/src/lib/resolvers/Organization/admins.ts b/src/resolvers/Organization/admins.ts similarity index 72% rename from src/lib/resolvers/Organization/admins.ts rename to src/resolvers/Organization/admins.ts index e090901e74..0d1ebdff1d 100644 --- a/src/lib/resolvers/Organization/admins.ts +++ b/src/resolvers/Organization/admins.ts @@ -1,5 +1,5 @@ import { User } from "../../models"; -import { OrganizationResolvers } from "../../../generated/graphqlCodegen"; +import { OrganizationResolvers } from "../../types/generatedGraphQLTypes"; export const admins: OrganizationResolvers["admins"] = async (parent) => { return await User.find({ diff --git a/src/lib/resolvers/Organization/blockedUsers.ts b/src/resolvers/Organization/blockedUsers.ts similarity index 74% rename from src/lib/resolvers/Organization/blockedUsers.ts rename to src/resolvers/Organization/blockedUsers.ts index b15ddd6a9f..8ef279bd97 100644 --- a/src/lib/resolvers/Organization/blockedUsers.ts +++ b/src/resolvers/Organization/blockedUsers.ts @@ -1,5 +1,5 @@ import { User } from "../../models"; -import { OrganizationResolvers } from "../../../generated/graphqlCodegen"; +import { OrganizationResolvers } from "../../types/generatedGraphQLTypes"; export const blockedUsers: OrganizationResolvers["blockedUsers"] = async ( parent diff --git a/src/lib/resolvers/Organization/creator.ts b/src/resolvers/Organization/creator.ts similarity index 85% rename from src/lib/resolvers/Organization/creator.ts rename to src/resolvers/Organization/creator.ts index e00a8b78c6..efa12f10c6 100644 --- a/src/lib/resolvers/Organization/creator.ts +++ b/src/resolvers/Organization/creator.ts @@ -1,13 +1,13 @@ import { User } from "../../models"; import { errors, requestContext } from "../../libraries"; -import { OrganizationResolvers } from "../../../generated/graphqlCodegen"; +import { OrganizationResolvers } from "../../types/generatedGraphQLTypes"; import { IN_PRODUCTION, USER_NOT_FOUND, USER_NOT_FOUND_CODE, USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; export const creator: OrganizationResolvers["creator"] = async (parent) => { const user = await User.findOne({ diff --git a/src/lib/resolvers/Organization/index.ts b/src/resolvers/Organization/index.ts similarity index 82% rename from src/lib/resolvers/Organization/index.ts rename to src/resolvers/Organization/index.ts index c7a6c1c42d..d088b3e5c6 100644 --- a/src/lib/resolvers/Organization/index.ts +++ b/src/resolvers/Organization/index.ts @@ -1,4 +1,4 @@ -import { OrganizationResolvers } from "../../../generated/graphqlCodegen"; +import { OrganizationResolvers } from "../../types/generatedGraphQLTypes"; import { admins } from "./admins"; import { blockedUsers } from "./blockedUsers"; import { creator } from "./creator"; diff --git a/src/lib/resolvers/Organization/members.ts b/src/resolvers/Organization/members.ts similarity index 73% rename from src/lib/resolvers/Organization/members.ts rename to src/resolvers/Organization/members.ts index 44af794aaf..7db6ceb640 100644 --- a/src/lib/resolvers/Organization/members.ts +++ b/src/resolvers/Organization/members.ts @@ -1,5 +1,5 @@ import { User } from "../../models"; -import { OrganizationResolvers } from "../../../generated/graphqlCodegen"; +import { OrganizationResolvers } from "../../types/generatedGraphQLTypes"; export const members: OrganizationResolvers["members"] = async (parent) => { return await User.find({ diff --git a/src/lib/resolvers/Organization/membershipRequests.ts b/src/resolvers/Organization/membershipRequests.ts similarity index 78% rename from src/lib/resolvers/Organization/membershipRequests.ts rename to src/resolvers/Organization/membershipRequests.ts index 6416be3fbf..cbd81b3c4a 100644 --- a/src/lib/resolvers/Organization/membershipRequests.ts +++ b/src/resolvers/Organization/membershipRequests.ts @@ -1,5 +1,5 @@ import { MembershipRequest } from "../../models"; -import { OrganizationResolvers } from "../../../generated/graphqlCodegen"; +import { OrganizationResolvers } from "../../types/generatedGraphQLTypes"; export const membershipRequests: OrganizationResolvers["membershipRequests"] = async (parent) => { diff --git a/src/lib/resolvers/Query/checkAuth.ts b/src/resolvers/Query/checkAuth.ts similarity index 87% rename from src/lib/resolvers/Query/checkAuth.ts rename to src/resolvers/Query/checkAuth.ts index e38538d28e..99d676682b 100644 --- a/src/lib/resolvers/Query/checkAuth.ts +++ b/src/resolvers/Query/checkAuth.ts @@ -1,11 +1,11 @@ -import { QueryResolvers } from "../../../generated/graphqlCodegen"; +import { QueryResolvers } from "../../types/generatedGraphQLTypes"; import { IN_PRODUCTION, USER_NOT_FOUND, USER_NOT_FOUND_CODE, USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; import { User } from "../../models"; import { errors, requestContext } from "../../libraries"; diff --git a/src/lib/resolvers/Query/comments.ts b/src/resolvers/Query/comments.ts similarity index 77% rename from src/lib/resolvers/Query/comments.ts rename to src/resolvers/Query/comments.ts index d1c6f3008f..d3bd9582e0 100644 --- a/src/lib/resolvers/Query/comments.ts +++ b/src/resolvers/Query/comments.ts @@ -1,4 +1,4 @@ -import { QueryResolvers } from "../../../generated/graphqlCodegen"; +import { QueryResolvers } from "../../types/generatedGraphQLTypes"; import { Comment } from "../../models"; export const comments: QueryResolvers["comments"] = async () => { diff --git a/src/lib/resolvers/Query/commentsByPost.ts b/src/resolvers/Query/commentsByPost.ts similarity index 95% rename from src/lib/resolvers/Query/commentsByPost.ts rename to src/resolvers/Query/commentsByPost.ts index 29d26a7e75..a4106cb46b 100644 --- a/src/lib/resolvers/Query/commentsByPost.ts +++ b/src/resolvers/Query/commentsByPost.ts @@ -1,4 +1,4 @@ -import { QueryResolvers } from "../../../generated/graphqlCodegen"; +import { QueryResolvers } from "../../types/generatedGraphQLTypes"; import { requestContext, errors } from "../../libraries"; import { Comment, Organization } from "../../models"; import { @@ -19,7 +19,7 @@ import { USER_NOT_FOUND_CODE, USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; export const commentsByPost: QueryResolvers["commentsByPost"] = async ( _parent, diff --git a/src/lib/resolvers/Query/directChatMessages.ts b/src/resolvers/Query/directChatMessages.ts similarity index 74% rename from src/lib/resolvers/Query/directChatMessages.ts rename to src/resolvers/Query/directChatMessages.ts index 0a32638e98..d5a6d24b2c 100644 --- a/src/lib/resolvers/Query/directChatMessages.ts +++ b/src/resolvers/Query/directChatMessages.ts @@ -1,4 +1,4 @@ -import { QueryResolvers } from "../../../generated/graphqlCodegen"; +import { QueryResolvers } from "../../types/generatedGraphQLTypes"; import { DirectChatMessage } from "../../models"; export const directChatMessages: QueryResolvers["directChatMessages"] = diff --git a/src/lib/resolvers/Query/directChats.ts b/src/resolvers/Query/directChats.ts similarity index 70% rename from src/lib/resolvers/Query/directChats.ts rename to src/resolvers/Query/directChats.ts index e42515618a..6f8b70051f 100644 --- a/src/lib/resolvers/Query/directChats.ts +++ b/src/resolvers/Query/directChats.ts @@ -1,4 +1,4 @@ -import { QueryResolvers } from "../../../generated/graphqlCodegen"; +import { QueryResolvers } from "../../types/generatedGraphQLTypes"; import { DirectChat } from "../../models"; export const directChats: QueryResolvers["directChats"] = async () => { diff --git a/src/lib/resolvers/Query/directChatsByUserID.ts b/src/resolvers/Query/directChatsByUserID.ts similarity index 83% rename from src/lib/resolvers/Query/directChatsByUserID.ts rename to src/resolvers/Query/directChatsByUserID.ts index bdc4a43cd0..3bdd6787ff 100644 --- a/src/lib/resolvers/Query/directChatsByUserID.ts +++ b/src/resolvers/Query/directChatsByUserID.ts @@ -1,7 +1,7 @@ -import { QueryResolvers } from "../../../generated/graphqlCodegen"; +import { QueryResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { DirectChat } from "../../models"; -import { IN_PRODUCTION } from "../../../constants"; +import { IN_PRODUCTION } from "../../constants"; export const directChatsByUserID: QueryResolvers["directChatsByUserID"] = async (_parent, args) => { diff --git a/src/lib/resolvers/Query/directChatsMessagesByChatID.ts b/src/resolvers/Query/directChatsMessagesByChatID.ts similarity index 88% rename from src/lib/resolvers/Query/directChatsMessagesByChatID.ts rename to src/resolvers/Query/directChatsMessagesByChatID.ts index 364c8de627..1bf8bb8de6 100644 --- a/src/lib/resolvers/Query/directChatsMessagesByChatID.ts +++ b/src/resolvers/Query/directChatsMessagesByChatID.ts @@ -1,4 +1,4 @@ -import { QueryResolvers } from "../../../generated/graphqlCodegen"; +import { QueryResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { DirectChatMessage } from "../../models"; import { @@ -7,7 +7,7 @@ import { CHAT_NOT_FOUND_MESSAGE, CHAT_NOT_FOUND_CODE, CHAT_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; export const directChatsMessagesByChatID: QueryResolvers["directChatsMessagesByChatID"] = async (_parent, args) => { diff --git a/src/lib/resolvers/Query/event.ts b/src/resolvers/Query/event.ts similarity index 88% rename from src/lib/resolvers/Query/event.ts rename to src/resolvers/Query/event.ts index dff9c176ca..042d36aa68 100644 --- a/src/lib/resolvers/Query/event.ts +++ b/src/resolvers/Query/event.ts @@ -1,4 +1,4 @@ -import { QueryResolvers } from "../../../generated/graphqlCodegen"; +import { QueryResolvers } from "../../types/generatedGraphQLTypes"; import { Event } from "../../models"; import { errors, requestContext } from "../../libraries"; import { @@ -7,7 +7,7 @@ import { EVENT_NOT_FOUND_MESSAGE, EVENT_NOT_FOUND_CODE, EVENT_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; export const event: QueryResolvers["event"] = async (_parent, args) => { const event = await Event.findOne({ diff --git a/src/lib/resolvers/Query/events.ts b/src/resolvers/Query/events.ts similarity index 98% rename from src/lib/resolvers/Query/events.ts rename to src/resolvers/Query/events.ts index 2e3e1e2e79..d9ab2da8f2 100644 --- a/src/lib/resolvers/Query/events.ts +++ b/src/resolvers/Query/events.ts @@ -2,7 +2,7 @@ import { EventOrderByInput, InputMaybe, QueryResolvers, -} from "../../../generated/graphqlCodegen"; +} from "../../types/generatedGraphQLTypes"; import { Event } from "../../models"; export const events: QueryResolvers["events"] = async (_parent, args) => { diff --git a/src/lib/resolvers/Query/eventsByOrganization.ts b/src/resolvers/Query/eventsByOrganization.ts similarity index 96% rename from src/lib/resolvers/Query/eventsByOrganization.ts rename to src/resolvers/Query/eventsByOrganization.ts index e899631b55..e75946978c 100644 --- a/src/lib/resolvers/Query/eventsByOrganization.ts +++ b/src/resolvers/Query/eventsByOrganization.ts @@ -2,9 +2,9 @@ import { EventOrderByInput, InputMaybe, QueryResolvers, -} from "../../../generated/graphqlCodegen"; +} from "../../types/generatedGraphQLTypes"; import { Event, Interface_UserAttende } from "../../models"; -import { STATUS_ACTIVE } from "../../../constants"; +import { STATUS_ACTIVE } from "../../constants"; export const eventsByOrganization: QueryResolvers["eventsByOrganization"] = async (_parent, args) => { diff --git a/src/lib/resolvers/Query/getDonationById.ts b/src/resolvers/Query/getDonationById.ts similarity index 85% rename from src/lib/resolvers/Query/getDonationById.ts rename to src/resolvers/Query/getDonationById.ts index 25454cfae5..e098e755fc 100644 --- a/src/lib/resolvers/Query/getDonationById.ts +++ b/src/resolvers/Query/getDonationById.ts @@ -1,4 +1,4 @@ -import { QueryResolvers } from "../../../generated/graphqlCodegen"; +import { QueryResolvers } from "../../types/generatedGraphQLTypes"; import { Donation } from "../../models"; /** diff --git a/src/lib/resolvers/Query/getDonationByOrgId.ts b/src/resolvers/Query/getDonationByOrgId.ts similarity index 84% rename from src/lib/resolvers/Query/getDonationByOrgId.ts rename to src/resolvers/Query/getDonationByOrgId.ts index bc75071941..fe35982acf 100644 --- a/src/lib/resolvers/Query/getDonationByOrgId.ts +++ b/src/resolvers/Query/getDonationByOrgId.ts @@ -1,4 +1,4 @@ -import { QueryResolvers } from "../../../generated/graphqlCodegen"; +import { QueryResolvers } from "../../types/generatedGraphQLTypes"; import { Donation } from "../../models"; /** diff --git a/src/lib/resolvers/Query/getDonations.ts b/src/resolvers/Query/getDonations.ts similarity index 80% rename from src/lib/resolvers/Query/getDonations.ts rename to src/resolvers/Query/getDonations.ts index 3f8fedb9a4..0651bf9306 100644 --- a/src/lib/resolvers/Query/getDonations.ts +++ b/src/resolvers/Query/getDonations.ts @@ -1,4 +1,4 @@ -import { QueryResolvers } from "../../../generated/graphqlCodegen"; +import { QueryResolvers } from "../../types/generatedGraphQLTypes"; import { Donation } from "../../models"; /** diff --git a/src/lib/resolvers/Query/getPlugins.ts b/src/resolvers/Query/getPlugins.ts similarity index 78% rename from src/lib/resolvers/Query/getPlugins.ts rename to src/resolvers/Query/getPlugins.ts index 7883390924..5955ad69a8 100644 --- a/src/lib/resolvers/Query/getPlugins.ts +++ b/src/resolvers/Query/getPlugins.ts @@ -1,4 +1,4 @@ -import { QueryResolvers } from "../../../generated/graphqlCodegen"; +import { QueryResolvers } from "../../types/generatedGraphQLTypes"; import { Plugin } from "../../models"; /** diff --git a/src/lib/resolvers/Query/getlanguage.ts b/src/resolvers/Query/getlanguage.ts similarity index 89% rename from src/lib/resolvers/Query/getlanguage.ts rename to src/resolvers/Query/getlanguage.ts index 355bb29ed5..c9222bde6c 100644 --- a/src/lib/resolvers/Query/getlanguage.ts +++ b/src/resolvers/Query/getlanguage.ts @@ -1,4 +1,4 @@ -import { QueryResolvers, Translation } from "../../../generated/graphqlCodegen"; +import { QueryResolvers, Translation } from "../../types/generatedGraphQLTypes"; import { Language } from "../../models"; export const getlanguage: QueryResolvers["getlanguage"] = async ( diff --git a/src/lib/resolvers/Query/groupChatMessages.ts b/src/resolvers/Query/groupChatMessages.ts similarity index 73% rename from src/lib/resolvers/Query/groupChatMessages.ts rename to src/resolvers/Query/groupChatMessages.ts index d2b213d4e3..d1ea1b6bf3 100644 --- a/src/lib/resolvers/Query/groupChatMessages.ts +++ b/src/resolvers/Query/groupChatMessages.ts @@ -1,4 +1,4 @@ -import { QueryResolvers } from "../../../generated/graphqlCodegen"; +import { QueryResolvers } from "../../types/generatedGraphQLTypes"; import { GroupChatMessage } from "../../models"; export const groupChatMessages: QueryResolvers["groupChatMessages"] = diff --git a/src/lib/resolvers/Query/groupChats.ts b/src/resolvers/Query/groupChats.ts similarity index 69% rename from src/lib/resolvers/Query/groupChats.ts rename to src/resolvers/Query/groupChats.ts index 367d1073cd..c529730bda 100644 --- a/src/lib/resolvers/Query/groupChats.ts +++ b/src/resolvers/Query/groupChats.ts @@ -1,4 +1,4 @@ -import { QueryResolvers } from "../../../generated/graphqlCodegen"; +import { QueryResolvers } from "../../types/generatedGraphQLTypes"; import { GroupChat } from "../../models"; export const groupChats: QueryResolvers["groupChats"] = async () => { diff --git a/src/lib/resolvers/Query/groups.ts b/src/resolvers/Query/groups.ts similarity index 67% rename from src/lib/resolvers/Query/groups.ts rename to src/resolvers/Query/groups.ts index b24933953a..7586750f87 100644 --- a/src/lib/resolvers/Query/groups.ts +++ b/src/resolvers/Query/groups.ts @@ -1,4 +1,4 @@ -import { QueryResolvers } from "../../../generated/graphqlCodegen"; +import { QueryResolvers } from "../../types/generatedGraphQLTypes"; import { Group } from "../../models"; export const groups: QueryResolvers["groups"] = async () => { diff --git a/src/lib/resolvers/Query/index.ts b/src/resolvers/Query/index.ts similarity index 97% rename from src/lib/resolvers/Query/index.ts rename to src/resolvers/Query/index.ts index dd3d9ae19b..8d7ccf8d24 100644 --- a/src/lib/resolvers/Query/index.ts +++ b/src/resolvers/Query/index.ts @@ -1,4 +1,4 @@ -import { QueryResolvers } from "../../../generated/graphqlCodegen"; +import { QueryResolvers } from "../../types/generatedGraphQLTypes"; import { checkAuth } from "./checkAuth"; import { comments } from "./comments"; import { commentsByPost } from "./commentsByPost"; diff --git a/src/lib/resolvers/Query/isUserRegister.ts b/src/resolvers/Query/isUserRegister.ts similarity index 91% rename from src/lib/resolvers/Query/isUserRegister.ts rename to src/resolvers/Query/isUserRegister.ts index bf613582bf..a160d9a683 100644 --- a/src/lib/resolvers/Query/isUserRegister.ts +++ b/src/resolvers/Query/isUserRegister.ts @@ -1,4 +1,4 @@ -import { QueryResolvers } from "../../../generated/graphqlCodegen"; +import { QueryResolvers } from "../../types/generatedGraphQLTypes"; import { Event } from "../../models"; import { errors, requestContext } from "../../libraries"; import { @@ -7,7 +7,7 @@ import { EVENT_NOT_FOUND_CODE, EVENT_NOT_FOUND_MESSAGE, EVENT_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; export const isUserRegister: QueryResolvers["isUserRegister"] = async ( _parent, diff --git a/src/lib/resolvers/Query/me.ts b/src/resolvers/Query/me.ts similarity index 90% rename from src/lib/resolvers/Query/me.ts rename to src/resolvers/Query/me.ts index 3e02a9992e..6f1fddac13 100644 --- a/src/lib/resolvers/Query/me.ts +++ b/src/resolvers/Query/me.ts @@ -1,4 +1,4 @@ -import { QueryResolvers } from "../../../generated/graphqlCodegen"; +import { QueryResolvers } from "../../types/generatedGraphQLTypes"; import { User } from "../../models"; import { errors, requestContext } from "../../libraries"; import { @@ -7,7 +7,7 @@ import { USER_NOT_FOUND_CODE, USER_NOT_FOUND_PARAM, IN_PRODUCTION, -} from "../../../constants"; +} from "../../constants"; // Resolver function for field 'me' of type 'Query' export const me: QueryResolvers["me"] = async (_parent, _args, context) => { diff --git a/src/lib/resolvers/Query/myLanguage.ts b/src/resolvers/Query/myLanguage.ts similarity index 88% rename from src/lib/resolvers/Query/myLanguage.ts rename to src/resolvers/Query/myLanguage.ts index 7c62b56b8a..dfa1da370c 100644 --- a/src/lib/resolvers/Query/myLanguage.ts +++ b/src/resolvers/Query/myLanguage.ts @@ -1,4 +1,4 @@ -import { QueryResolvers } from "../../../generated/graphqlCodegen"; +import { QueryResolvers } from "../../types/generatedGraphQLTypes"; import { User } from "../../models"; import { errors, requestContext } from "../../libraries"; import { @@ -7,7 +7,7 @@ import { USER_NOT_FOUND_CODE, USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; export const myLanguage: QueryResolvers["myLanguage"] = async ( _parent, diff --git a/src/lib/resolvers/Query/organizations.ts b/src/resolvers/Query/organizations.ts similarity index 95% rename from src/lib/resolvers/Query/organizations.ts rename to src/resolvers/Query/organizations.ts index 8e26e5e312..365a480f80 100644 --- a/src/lib/resolvers/Query/organizations.ts +++ b/src/resolvers/Query/organizations.ts @@ -2,7 +2,7 @@ import { InputMaybe, OrganizationOrderByInput, QueryResolvers, -} from "../../../generated/graphqlCodegen"; +} from "../../types/generatedGraphQLTypes"; import { Organization } from "../../models"; import { errors, requestContext } from "../../libraries"; import { @@ -11,7 +11,7 @@ import { ORGANIZATION_NOT_FOUND_CODE, ORGANIZATION_NOT_FOUND_MESSAGE, ORGANIZATION_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; export const organizations: QueryResolvers["organizations"] = async ( _parent, diff --git a/src/lib/resolvers/Query/organizationsConnection.ts b/src/resolvers/Query/organizationsConnection.ts similarity index 99% rename from src/lib/resolvers/Query/organizationsConnection.ts rename to src/resolvers/Query/organizationsConnection.ts index 23ce75b44a..52e214b913 100644 --- a/src/lib/resolvers/Query/organizationsConnection.ts +++ b/src/resolvers/Query/organizationsConnection.ts @@ -3,7 +3,7 @@ import { OrganizationOrderByInput, OrganizationWhereInput, QueryResolvers, -} from "../../../generated/graphqlCodegen"; +} from "../../types/generatedGraphQLTypes"; import { Organization } from "../../models"; export const organizationsConnection: QueryResolvers["organizationsConnection"] = diff --git a/src/lib/resolvers/Query/organizationsMemberConnection.ts b/src/resolvers/Query/organizationsMemberConnection.ts similarity index 99% rename from src/lib/resolvers/Query/organizationsMemberConnection.ts rename to src/resolvers/Query/organizationsMemberConnection.ts index cc32f00ffc..8c3196ffdb 100644 --- a/src/lib/resolvers/Query/organizationsMemberConnection.ts +++ b/src/resolvers/Query/organizationsMemberConnection.ts @@ -3,7 +3,7 @@ import { QueryResolvers, UserOrderByInput, UserWhereInput, -} from "../../../generated/graphqlCodegen"; +} from "../../types/generatedGraphQLTypes"; import { User } from "../../models"; // @ts-ignore diff --git a/src/lib/resolvers/Query/post.ts b/src/resolvers/Query/post.ts similarity index 90% rename from src/lib/resolvers/Query/post.ts rename to src/resolvers/Query/post.ts index 520986e544..5431a10772 100644 --- a/src/lib/resolvers/Query/post.ts +++ b/src/resolvers/Query/post.ts @@ -1,4 +1,4 @@ -import { QueryResolvers } from "../../../generated/graphqlCodegen"; +import { QueryResolvers } from "../../types/generatedGraphQLTypes"; import { Post } from "../../models"; import { errors, requestContext } from "../../libraries"; import { @@ -7,7 +7,7 @@ import { POST_NOT_FOUND_CODE, POST_NOT_FOUND_MESSAGE, POST_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; export const post: QueryResolvers["post"] = async (_parent, args) => { const post = await Post.findOne({ _id: args.id }) diff --git a/src/lib/resolvers/Query/posts.ts b/src/resolvers/Query/posts.ts similarity index 97% rename from src/lib/resolvers/Query/posts.ts rename to src/resolvers/Query/posts.ts index 65705e1cc6..3b0f50d009 100644 --- a/src/lib/resolvers/Query/posts.ts +++ b/src/resolvers/Query/posts.ts @@ -2,7 +2,7 @@ import { InputMaybe, PostOrderByInput, QueryResolvers, -} from "../../../generated/graphqlCodegen"; +} from "../../types/generatedGraphQLTypes"; import { Post } from "../../models"; export const posts: QueryResolvers["posts"] = async (_parent, args) => { diff --git a/src/lib/resolvers/Query/postsByOrganization.ts b/src/resolvers/Query/postsByOrganization.ts similarity index 97% rename from src/lib/resolvers/Query/postsByOrganization.ts rename to src/resolvers/Query/postsByOrganization.ts index cbb37ed421..97e6f1046e 100644 --- a/src/lib/resolvers/Query/postsByOrganization.ts +++ b/src/resolvers/Query/postsByOrganization.ts @@ -2,7 +2,7 @@ import { InputMaybe, PostOrderByInput, QueryResolvers, -} from "../../../generated/graphqlCodegen"; +} from "../../types/generatedGraphQLTypes"; import { Post } from "../../models"; export const postsByOrganization: QueryResolvers["postsByOrganization"] = diff --git a/src/lib/resolvers/Query/postsByOrganizationConnection.ts b/src/resolvers/Query/postsByOrganizationConnection.ts similarity index 98% rename from src/lib/resolvers/Query/postsByOrganizationConnection.ts rename to src/resolvers/Query/postsByOrganizationConnection.ts index 5e12921625..552184650d 100644 --- a/src/lib/resolvers/Query/postsByOrganizationConnection.ts +++ b/src/resolvers/Query/postsByOrganizationConnection.ts @@ -3,10 +3,10 @@ import { PostOrderByInput, PostWhereInput, QueryResolvers, -} from "../../../generated/graphqlCodegen"; +} from "../../types/generatedGraphQLTypes"; import { Post } from "../../models"; import { errors, requestContext } from "../../libraries"; -import { IN_PRODUCTION } from "../../../constants"; +import { IN_PRODUCTION } from "../../constants"; export const postsByOrganizationConnection: QueryResolvers["postsByOrganizationConnection"] = async (_parent, args) => { diff --git a/src/lib/resolvers/Query/registeredEventsByUser.ts b/src/resolvers/Query/registeredEventsByUser.ts similarity index 98% rename from src/lib/resolvers/Query/registeredEventsByUser.ts rename to src/resolvers/Query/registeredEventsByUser.ts index 3da81b1b77..6ea2470f73 100644 --- a/src/lib/resolvers/Query/registeredEventsByUser.ts +++ b/src/resolvers/Query/registeredEventsByUser.ts @@ -2,7 +2,7 @@ import { EventOrderByInput, InputMaybe, QueryResolvers, -} from "../../../generated/graphqlCodegen"; +} from "../../types/generatedGraphQLTypes"; import { Event } from "../../models"; export const registeredEventsByUser: QueryResolvers["registeredEventsByUser"] = diff --git a/src/lib/resolvers/Query/registrantsByEvent.ts b/src/resolvers/Query/registrantsByEvent.ts similarity index 91% rename from src/lib/resolvers/Query/registrantsByEvent.ts rename to src/resolvers/Query/registrantsByEvent.ts index 0a06996d6f..7dc344b5a7 100644 --- a/src/lib/resolvers/Query/registrantsByEvent.ts +++ b/src/resolvers/Query/registrantsByEvent.ts @@ -1,4 +1,4 @@ -import { QueryResolvers } from "../../../generated/graphqlCodegen"; +import { QueryResolvers } from "../../types/generatedGraphQLTypes"; import { Event, Interface_User, Interface_UserAttende } from "../../models"; import { errors, requestContext } from "../../libraries"; import { @@ -7,7 +7,7 @@ import { EVENT_NOT_FOUND_CODE, EVENT_NOT_FOUND_MESSAGE, EVENT_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; export const registrantsByEvent: QueryResolvers["registrantsByEvent"] = async ( _parent, diff --git a/src/lib/resolvers/Query/tasksByEvent.ts b/src/resolvers/Query/tasksByEvent.ts similarity index 96% rename from src/lib/resolvers/Query/tasksByEvent.ts rename to src/resolvers/Query/tasksByEvent.ts index 4ea28d7b55..c85d8f7fdf 100644 --- a/src/lib/resolvers/Query/tasksByEvent.ts +++ b/src/resolvers/Query/tasksByEvent.ts @@ -2,7 +2,7 @@ import { InputMaybe, QueryResolvers, TaskOrderByInput, -} from "../../../generated/graphqlCodegen"; +} from "../../types/generatedGraphQLTypes"; import { Task } from "../../models"; export const tasksByEvent: QueryResolvers["tasksByEvent"] = async ( diff --git a/src/lib/resolvers/Query/tasksByUser.ts b/src/resolvers/Query/tasksByUser.ts similarity index 96% rename from src/lib/resolvers/Query/tasksByUser.ts rename to src/resolvers/Query/tasksByUser.ts index ddbe209736..a7c4f3c2bf 100644 --- a/src/lib/resolvers/Query/tasksByUser.ts +++ b/src/resolvers/Query/tasksByUser.ts @@ -2,7 +2,7 @@ import { InputMaybe, QueryResolvers, TaskOrderByInput, -} from "../../../generated/graphqlCodegen"; +} from "../../types/generatedGraphQLTypes"; import { Task } from "../../models"; export const tasksByUser: QueryResolvers["tasksByUser"] = async ( diff --git a/src/lib/resolvers/Query/user.ts b/src/resolvers/Query/user.ts similarity index 90% rename from src/lib/resolvers/Query/user.ts rename to src/resolvers/Query/user.ts index 52d583f83a..8dd88acead 100644 --- a/src/lib/resolvers/Query/user.ts +++ b/src/resolvers/Query/user.ts @@ -4,8 +4,8 @@ import { USER_NOT_FOUND_CODE, USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; -import { QueryResolvers } from "../../../generated/graphqlCodegen"; +} from "../../constants"; +import { QueryResolvers } from "../../types/generatedGraphQLTypes"; import { errors, requestContext } from "../../libraries"; import { User } from "../../models"; diff --git a/src/lib/resolvers/Query/userLanguage.ts b/src/resolvers/Query/userLanguage.ts similarity index 87% rename from src/lib/resolvers/Query/userLanguage.ts rename to src/resolvers/Query/userLanguage.ts index e29f4e46bc..149c709e14 100644 --- a/src/lib/resolvers/Query/userLanguage.ts +++ b/src/resolvers/Query/userLanguage.ts @@ -1,4 +1,4 @@ -import { QueryResolvers } from "../../../generated/graphqlCodegen"; +import { QueryResolvers } from "../../types/generatedGraphQLTypes"; import { User } from "../../models"; import { errors, requestContext } from "../../libraries"; import { @@ -7,7 +7,7 @@ import { USER_NOT_FOUND_CODE, USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; export const userLanguage: QueryResolvers["userLanguage"] = async ( _parent, diff --git a/src/lib/resolvers/Query/users.ts b/src/resolvers/Query/users.ts similarity index 99% rename from src/lib/resolvers/Query/users.ts rename to src/resolvers/Query/users.ts index 463fb69086..6dbc030f81 100644 --- a/src/lib/resolvers/Query/users.ts +++ b/src/resolvers/Query/users.ts @@ -3,7 +3,7 @@ import { QueryResolvers, UserOrderByInput, UserWhereInput, -} from "../../../generated/graphqlCodegen"; +} from "../../types/generatedGraphQLTypes"; import { User } from "../../models"; import { errors, requestContext } from "../../libraries"; import { @@ -12,7 +12,7 @@ import { USER_NOT_FOUND_CODE, USER_NOT_FOUND_MESSAGE, USER_NOT_FOUND_PARAM, -} from "../../../constants"; +} from "../../constants"; export const users: QueryResolvers["users"] = async (_parent, args) => { const inputArg = getInputArg(args.where); diff --git a/src/lib/resolvers/Query/usersConnection.ts b/src/resolvers/Query/usersConnection.ts similarity index 99% rename from src/lib/resolvers/Query/usersConnection.ts rename to src/resolvers/Query/usersConnection.ts index c309c61469..f567492cea 100644 --- a/src/lib/resolvers/Query/usersConnection.ts +++ b/src/resolvers/Query/usersConnection.ts @@ -3,7 +3,7 @@ import { QueryResolvers, UserOrderByInput, UserWhereInput, -} from "../../../generated/graphqlCodegen"; +} from "../../types/generatedGraphQLTypes"; import { User } from "../../models"; export const usersConnection: QueryResolvers["usersConnection"] = async ( diff --git a/src/lib/resolvers/Subscription/directMessageChat.ts b/src/resolvers/Subscription/directMessageChat.ts similarity index 82% rename from src/lib/resolvers/Subscription/directMessageChat.ts rename to src/resolvers/Subscription/directMessageChat.ts index b325e71e36..3a1027db02 100644 --- a/src/lib/resolvers/Subscription/directMessageChat.ts +++ b/src/resolvers/Subscription/directMessageChat.ts @@ -1,5 +1,5 @@ import { withFilter } from "apollo-server-express"; -import { SubscriptionResolvers } from "../../../generated/graphqlCodegen"; +import { SubscriptionResolvers } from "../../types/generatedGraphQLTypes"; const CHAT_CHANNEL = "CHAT_CHANNEL"; diff --git a/src/lib/resolvers/Subscription/index.ts b/src/resolvers/Subscription/index.ts similarity index 81% rename from src/lib/resolvers/Subscription/index.ts rename to src/resolvers/Subscription/index.ts index d0dc24c0d2..e633d1463f 100644 --- a/src/lib/resolvers/Subscription/index.ts +++ b/src/resolvers/Subscription/index.ts @@ -1,4 +1,4 @@ -import { SubscriptionResolvers } from "../../../generated/graphqlCodegen"; +import { SubscriptionResolvers } from "../../types/generatedGraphQLTypes"; import { directMessageChat } from "./directMessageChat"; import { messageSentToDirectChat } from "./messageSentToDirectChat"; import { messageSentToGroupChat } from "./messageSentToGroupChat"; diff --git a/src/lib/resolvers/Subscription/messageSentToDirectChat.ts b/src/resolvers/Subscription/messageSentToDirectChat.ts similarity index 89% rename from src/lib/resolvers/Subscription/messageSentToDirectChat.ts rename to src/resolvers/Subscription/messageSentToDirectChat.ts index 48c9ed0429..647d60f305 100644 --- a/src/lib/resolvers/Subscription/messageSentToDirectChat.ts +++ b/src/resolvers/Subscription/messageSentToDirectChat.ts @@ -1,5 +1,5 @@ import { withFilter } from "apollo-server-express"; -import { SubscriptionResolvers } from "../../../generated/graphqlCodegen"; +import { SubscriptionResolvers } from "../../types/generatedGraphQLTypes"; const MESSAGE_SENT_TO_DIRECT_CHAT = "MESSAGE_SENT_TO_DIRECT_CHAT"; diff --git a/src/lib/resolvers/Subscription/messageSentToGroupChat.ts b/src/resolvers/Subscription/messageSentToGroupChat.ts similarity index 92% rename from src/lib/resolvers/Subscription/messageSentToGroupChat.ts rename to src/resolvers/Subscription/messageSentToGroupChat.ts index 64882f4eae..d2a87182db 100644 --- a/src/lib/resolvers/Subscription/messageSentToGroupChat.ts +++ b/src/resolvers/Subscription/messageSentToGroupChat.ts @@ -1,5 +1,5 @@ import { withFilter } from "apollo-server-express"; -import { SubscriptionResolvers } from "../../../generated/graphqlCodegen"; +import { SubscriptionResolvers } from "../../types/generatedGraphQLTypes"; import { GroupChat } from "../../models"; const MESSAGE_SENT_TO_GROUP_CHAT = "MESSAGE_SENT_TO_GROUP_CHAT"; diff --git a/src/lib/resolvers/index.ts b/src/resolvers/index.ts similarity index 90% rename from src/lib/resolvers/index.ts rename to src/resolvers/index.ts index 2cb5f766c8..4ce2bb12c6 100644 --- a/src/lib/resolvers/index.ts +++ b/src/resolvers/index.ts @@ -1,4 +1,4 @@ -import { Resolvers } from "../../generated/graphqlCodegen"; +import { Resolvers } from "../types/generatedGraphQLTypes"; import { DirectChat } from "./DirectChat"; import { DirectChatMessage } from "./DirectChatMessage"; import { GroupChat } from "./GroupChat"; diff --git a/src/server.ts b/src/server.ts index fe88fe6a75..91ebd4c36e 100644 --- a/src/server.ts +++ b/src/server.ts @@ -15,16 +15,16 @@ import cors from "cors"; import requestLogger from "morgan"; import i18n from "i18n"; import * as database from "./db"; -import { logger, requestContext, requestTracing } from "./lib/libraries"; -import { appConfig } from "./lib/config"; -import { isAuth } from "./lib/middleware"; +import { logger, requestContext, requestTracing } from "./libraries"; +import { appConfig } from "./config"; +import { isAuth } from "./middleware"; import { AuthenticationDirective, RoleAuthorizationDirective, -} from "./lib/directives"; -import { typeDefs } from "./lib/typeDefs"; -import { resolvers } from "./lib/resolvers"; -import { Interface_JwtTokenPayload } from "./lib/utilities"; +} from "./directives"; +import { typeDefs } from "./typeDefs"; +import { resolvers } from "./resolvers"; +import { Interface_JwtTokenPayload } from "./utilities"; const app = express(); @@ -39,13 +39,13 @@ const apiLimiter = rateLimit({ }); i18n.configure({ - directory: `${__dirname}/locales`, + directory: `${__dirname}/../locales`, staticCatalog: { - en: require("./locales/en.json"), - hi: require("./locales/hi.json"), - zh: require("./locales/zh.json"), - sp: require("./locales/sp.json"), - fr: require("./locales/fr.json"), + en: require("../locales/en.json"), + hi: require("../locales/hi.json"), + zh: require("../locales/zh.json"), + sp: require("../locales/sp.json"), + fr: require("../locales/fr.json"), }, queryParameter: "lang", defaultLocale: appConfig.defaultLocale, diff --git a/src/lib/typeDefs/chats/chat.ts b/src/typeDefs/chats/chat.ts similarity index 100% rename from src/lib/typeDefs/chats/chat.ts rename to src/typeDefs/chats/chat.ts diff --git a/src/lib/typeDefs/chats/index.ts b/src/typeDefs/chats/index.ts similarity index 100% rename from src/lib/typeDefs/chats/index.ts rename to src/typeDefs/chats/index.ts diff --git a/src/lib/typeDefs/chats/message.ts b/src/typeDefs/chats/message.ts similarity index 100% rename from src/lib/typeDefs/chats/message.ts rename to src/typeDefs/chats/message.ts diff --git a/src/lib/typeDefs/donation.ts b/src/typeDefs/donation.ts similarity index 100% rename from src/lib/typeDefs/donation.ts rename to src/typeDefs/donation.ts diff --git a/src/lib/typeDefs/event.ts b/src/typeDefs/event.ts similarity index 100% rename from src/lib/typeDefs/event.ts rename to src/typeDefs/event.ts diff --git a/src/lib/typeDefs/index.ts b/src/typeDefs/index.ts similarity index 97% rename from src/lib/typeDefs/index.ts rename to src/typeDefs/index.ts index d0a8e27e60..4f25f52bf2 100644 --- a/src/lib/typeDefs/index.ts +++ b/src/typeDefs/index.ts @@ -1,4 +1,4 @@ -import { gql } from "apollo-server-express"; +import { gql } from "apollo-server-core"; import { chat, message } from "./chats"; import { donation } from "./donation"; import { event } from "./event"; diff --git a/src/lib/typeDefs/language.ts b/src/typeDefs/language.ts similarity index 100% rename from src/lib/typeDefs/language.ts rename to src/typeDefs/language.ts diff --git a/src/lib/typeDefs/mutation.ts b/src/typeDefs/mutation.ts similarity index 100% rename from src/lib/typeDefs/mutation.ts rename to src/typeDefs/mutation.ts diff --git a/src/lib/typeDefs/newsfeed.ts b/src/typeDefs/newsfeed.ts similarity index 100% rename from src/lib/typeDefs/newsfeed.ts rename to src/typeDefs/newsfeed.ts diff --git a/src/lib/typeDefs/organization.ts b/src/typeDefs/organization.ts similarity index 100% rename from src/lib/typeDefs/organization.ts rename to src/typeDefs/organization.ts diff --git a/src/lib/typeDefs/plugin/index.ts b/src/typeDefs/plugin/index.ts similarity index 100% rename from src/lib/typeDefs/plugin/index.ts rename to src/typeDefs/plugin/index.ts diff --git a/src/lib/typeDefs/plugin/plugin.ts b/src/typeDefs/plugin/plugin.ts similarity index 100% rename from src/lib/typeDefs/plugin/plugin.ts rename to src/typeDefs/plugin/plugin.ts diff --git a/src/lib/typeDefs/plugin/pluginField.ts b/src/typeDefs/plugin/pluginField.ts similarity index 100% rename from src/lib/typeDefs/plugin/pluginField.ts rename to src/typeDefs/plugin/pluginField.ts diff --git a/src/lib/typeDefs/query.ts b/src/typeDefs/query.ts similarity index 100% rename from src/lib/typeDefs/query.ts rename to src/typeDefs/query.ts diff --git a/src/lib/typeDefs/user/auth.ts b/src/typeDefs/user/auth.ts similarity index 100% rename from src/lib/typeDefs/user/auth.ts rename to src/typeDefs/user/auth.ts diff --git a/src/lib/typeDefs/user/index.ts b/src/typeDefs/user/index.ts similarity index 100% rename from src/lib/typeDefs/user/index.ts rename to src/typeDefs/user/index.ts diff --git a/src/lib/typeDefs/user/user.ts b/src/typeDefs/user/user.ts similarity index 100% rename from src/lib/typeDefs/user/user.ts rename to src/typeDefs/user/user.ts diff --git a/src/lib/typeDefs/utils.ts b/src/typeDefs/utils.ts similarity index 100% rename from src/lib/typeDefs/utils.ts rename to src/typeDefs/utils.ts diff --git a/src/generated/graphqlCodegen.ts b/src/types/generatedGraphQLTypes.ts similarity index 93% rename from src/generated/graphqlCodegen.ts rename to src/types/generatedGraphQLTypes.ts index 1b1e4883c5..1b88ddf141 100644 --- a/src/generated/graphqlCodegen.ts +++ b/src/types/generatedGraphQLTypes.ts @@ -1,22 +1,22 @@ -import { GraphQLResolveInfo, GraphQLScalarType, GraphQLScalarTypeConfig } from 'graphql'; -import { Interface_MessageChat } from '../lib/models/MessageChat'; -import { Interface_Comment } from '../lib/models/Comment'; -import { Interface_DirectChat } from '../lib/models/DirectChat'; -import { Interface_DirectChatMessage } from '../lib/models/DirectChatMessage'; -import { Interface_Donation } from '../lib/models/Donation'; -import { Interface_Event } from '../lib/models/Event'; -import { Interface_Group } from '../lib/models/Group'; -import { Interface_GroupChat } from '../lib/models/GroupChat'; -import { Interface_GroupChatMessage } from '../lib/models/GroupChatMessage'; -import { Interface_Language } from '../lib/models/Language'; -import { Interface_MembershipRequest } from '../lib/models/MembershipRequest'; -import { Interface_Message } from '../lib/models/Message'; -import { Interface_Organization } from '../lib/models/Organization'; -import { Interface_Plugin } from '../lib/models/Plugin'; -import { Interface_PluginField } from '../lib/models/PluginField'; -import { Interface_Post } from '../lib/models/Post'; -import { Interface_Task } from '../lib/models/Task'; -import { Interface_User } from '../lib/models/User'; +import type { GraphQLResolveInfo, GraphQLScalarType, GraphQLScalarTypeConfig } from 'graphql'; +import type { Interface_MessageChat as Interface_MessageChatModel } from '../models/MessageChat'; +import type { Interface_Comment as Interface_CommentModel } from '../models/Comment'; +import type { Interface_DirectChat as Interface_DirectChatModel } from '../models/DirectChat'; +import type { Interface_DirectChatMessage as Interface_DirectChatMessageModel } from '../models/DirectChatMessage'; +import type { Interface_Donation as Interface_DonationModel } from '../models/Donation'; +import type { Interface_Event as Interface_EventModel } from '../models/Event'; +import type { Interface_Group as Interface_GroupModel } from '../models/Group'; +import type { Interface_GroupChat as Interface_GroupChatModel } from '../models/GroupChat'; +import type { Interface_GroupChatMessage as Interface_GroupChatMessageModel } from '../models/GroupChatMessage'; +import type { Interface_Language as Interface_LanguageModel } from '../models/Language'; +import type { Interface_MembershipRequest as Interface_MembershipRequestModel } from '../models/MembershipRequest'; +import type { Interface_Message as Interface_MessageModel } from '../models/Message'; +import type { Interface_Organization as Interface_OrganizationModel } from '../models/Organization'; +import type { Interface_Plugin as Interface_PluginModel } from '../models/Plugin'; +import type { Interface_PluginField as Interface_PluginFieldModel } from '../models/PluginField'; +import type { Interface_Post as Interface_PostModel } from '../models/Post'; +import type { Interface_Task as Interface_TaskModel } from '../models/Task'; +import type { Interface_User as Interface_UserModel } from '../models/User'; export type Maybe = T | null; export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; @@ -160,28 +160,27 @@ export type EventInput = { title: Scalars['String']; }; -export enum EventOrderByInput { - AllDayAsc = 'allDay_ASC', - AllDayDesc = 'allDay_DESC', - DescriptionAsc = 'description_ASC', - DescriptionDesc = 'description_DESC', - EndDateAsc = 'endDate_ASC', - EndDateDesc = 'endDate_DESC', - EndTimeAsc = 'endTime_ASC', - EndTimeDesc = 'endTime_DESC', - IdAsc = 'id_ASC', - IdDesc = 'id_DESC', - LocationAsc = 'location_ASC', - LocationDesc = 'location_DESC', - RecurranceAsc = 'recurrance_ASC', - RecurranceDesc = 'recurrance_DESC', - StartDateAsc = 'startDate_ASC', - StartDateDesc = 'startDate_DESC', - StartTimeAsc = 'startTime_ASC', - StartTimeDesc = 'startTime_DESC', - TitleAsc = 'title_ASC', - TitleDesc = 'title_DESC' -} +export type EventOrderByInput = + | 'allDay_ASC' + | 'allDay_DESC' + | 'description_ASC' + | 'description_DESC' + | 'endDate_ASC' + | 'endDate_DESC' + | 'endTime_ASC' + | 'endTime_DESC' + | 'id_ASC' + | 'id_DESC' + | 'location_ASC' + | 'location_DESC' + | 'recurrance_ASC' + | 'recurrance_DESC' + | 'startDate_ASC' + | 'startDate_DESC' + | 'startTime_ASC' + | 'startTime_DESC' + | 'title_ASC' + | 'title_DESC'; export type EventRegistrants = { __typename?: 'EventRegistrants'; @@ -794,16 +793,15 @@ export type OrganizationInput = { visibleInSearch: Scalars['Boolean']; }; -export enum OrganizationOrderByInput { - ApiUrlAsc = 'apiUrl_ASC', - ApiUrlDesc = 'apiUrl_DESC', - DescriptionAsc = 'description_ASC', - DescriptionDesc = 'description_DESC', - IdAsc = 'id_ASC', - IdDesc = 'id_DESC', - NameAsc = 'name_ASC', - NameDesc = 'name_DESC' -} +export type OrganizationOrderByInput = + | 'apiUrl_ASC' + | 'apiUrl_DESC' + | 'description_ASC' + | 'description_DESC' + | 'id_ASC' + | 'id_DESC' + | 'name_ASC' + | 'name_DESC'; export type OrganizationWhereInput = { apiUrl?: InputMaybe; @@ -918,24 +916,23 @@ export type PostInput = { videoUrl?: InputMaybe; }; -export enum PostOrderByInput { - CommentCountAsc = 'commentCount_ASC', - CommentCountDesc = 'commentCount_DESC', - CreatedAtAsc = 'createdAt_ASC', - CreatedAtDesc = 'createdAt_DESC', - IdAsc = 'id_ASC', - IdDesc = 'id_DESC', - ImageUrlAsc = 'imageUrl_ASC', - ImageUrlDesc = 'imageUrl_DESC', - LikeCountAsc = 'likeCount_ASC', - LikeCountDesc = 'likeCount_DESC', - TextAsc = 'text_ASC', - TextDesc = 'text_DESC', - TitleAsc = 'title_ASC', - TitleDesc = 'title_DESC', - VideoUrlAsc = 'videoUrl_ASC', - VideoUrlDesc = 'videoUrl_DESC' -} +export type PostOrderByInput = + | 'commentCount_ASC' + | 'commentCount_DESC' + | 'createdAt_ASC' + | 'createdAt_DESC' + | 'id_ASC' + | 'id_DESC' + | 'imageUrl_ASC' + | 'imageUrl_DESC' + | 'likeCount_ASC' + | 'likeCount_DESC' + | 'text_ASC' + | 'text_DESC' + | 'title_ASC' + | 'title_DESC' + | 'videoUrl_ASC' + | 'videoUrl_DESC'; export type PostWhereInput = { id?: InputMaybe; @@ -1161,19 +1158,17 @@ export type RecaptchaVerification = { recaptchaToken: Scalars['String']; }; -export enum Recurrance { - Daily = 'DAILY', - Monthly = 'MONTHLY', - Once = 'ONCE', - Weekly = 'WEEKLY', - Yearly = 'YEARLY' -} +export type Recurrance = + | 'DAILY' + | 'MONTHLY' + | 'ONCE' + | 'WEEKLY' + | 'YEARLY'; -export enum Status { - Active = 'ACTIVE', - Blocked = 'BLOCKED', - Deleted = 'DELETED' -} +export type Status = + | 'ACTIVE' + | 'BLOCKED' + | 'DELETED'; export type Subscription = { __typename?: 'Subscription'; @@ -1199,18 +1194,17 @@ export type TaskInput = { title: Scalars['String']; }; -export enum TaskOrderByInput { - CreatedAtAsc = 'createdAt_ASC', - CreatedAtDesc = 'createdAt_DESC', - DeadlineAsc = 'deadline_ASC', - DeadlineDesc = 'deadline_DESC', - DescriptionAsc = 'description_ASC', - DescriptionDesc = 'description_DESC', - IdAsc = 'id_ASC', - IdDesc = 'id_DESC', - TitleAsc = 'title_ASC', - TitleDesc = 'title_DESC' -} +export type TaskOrderByInput = + | 'createdAt_ASC' + | 'createdAt_DESC' + | 'deadline_ASC' + | 'deadline_DESC' + | 'description_ASC' + | 'description_DESC' + | 'id_ASC' + | 'id_DESC' + | 'title_ASC' + | 'title_DESC'; export type Translation = { __typename?: 'Translation'; @@ -1220,10 +1214,9 @@ export type Translation = { verified?: Maybe; }; -export enum Type { - Private = 'PRIVATE', - Universal = 'UNIVERSAL' -} +export type Type = + | 'PRIVATE' + | 'UNIVERSAL'; export type UpdateEventInput = { allDay?: InputMaybe; @@ -1321,24 +1314,22 @@ export type UserInput = { userType?: InputMaybe; }; -export enum UserOrderByInput { - AppLanguageCodeAsc = 'appLanguageCode_ASC', - AppLanguageCodeDesc = 'appLanguageCode_DESC', - EmailAsc = 'email_ASC', - EmailDesc = 'email_DESC', - FirstNameAsc = 'firstName_ASC', - FirstNameDesc = 'firstName_DESC', - IdAsc = 'id_ASC', - IdDesc = 'id_DESC', - LastNameAsc = 'lastName_ASC', - LastNameDesc = 'lastName_DESC' -} +export type UserOrderByInput = + | 'appLanguageCode_ASC' + | 'appLanguageCode_DESC' + | 'email_ASC' + | 'email_DESC' + | 'firstName_ASC' + | 'firstName_DESC' + | 'id_ASC' + | 'id_DESC' + | 'lastName_ASC' + | 'lastName_DESC'; -export enum UserType { - Admin = 'ADMIN', - Superadmin = 'SUPERADMIN', - User = 'USER' -} +export type UserType = + | 'ADMIN' + | 'SUPERADMIN' + | 'USER'; export type UserWhereInput = { appLanguageCode?: InputMaybe; @@ -1454,49 +1445,49 @@ export type ResolversTypes = { AndroidFirebaseOptions: ResolverTypeWrapper; AuthData: ResolverTypeWrapper & { user: ResolversTypes['User'] }>; Boolean: ResolverTypeWrapper; - Comment: ResolverTypeWrapper; + Comment: ResolverTypeWrapper; CommentInput: CommentInput; DeletePayload: ResolverTypeWrapper; - DirectChat: ResolverTypeWrapper; - DirectChatMessage: ResolverTypeWrapper; - Donation: ResolverTypeWrapper; - Event: ResolverTypeWrapper; + DirectChat: ResolverTypeWrapper; + DirectChatMessage: ResolverTypeWrapper; + Donation: ResolverTypeWrapper; + Event: ResolverTypeWrapper; EventInput: EventInput; EventOrderByInput: EventOrderByInput; EventRegistrants: ResolverTypeWrapper & { event: ResolversTypes['Event'] }>; ExtendSession: ResolverTypeWrapper; Float: ResolverTypeWrapper; ForgotPasswordData: ForgotPasswordData; - Group: ResolverTypeWrapper; - GroupChat: ResolverTypeWrapper; - GroupChatMessage: ResolverTypeWrapper; + Group: ResolverTypeWrapper; + GroupChat: ResolverTypeWrapper; + GroupChatMessage: ResolverTypeWrapper; GroupInput: GroupInput; ID: ResolverTypeWrapper; IOSFirebaseOptions: ResolverTypeWrapper; Int: ResolverTypeWrapper; - Language: ResolverTypeWrapper; + Language: ResolverTypeWrapper; LanguageInput: LanguageInput; LanguageModel: ResolverTypeWrapper; LoginInput: LoginInput; - MembershipRequest: ResolverTypeWrapper; - Message: ResolverTypeWrapper; - MessageChat: ResolverTypeWrapper; + MembershipRequest: ResolverTypeWrapper; + Message: ResolverTypeWrapper; + MessageChat: ResolverTypeWrapper; MessageChatInput: MessageChatInput; MultipleUsersAndOrganizationInput: MultipleUsersAndOrganizationInput; Mutation: ResolverTypeWrapper<{}>; OTPInput: OtpInput; - Organization: ResolverTypeWrapper; + Organization: ResolverTypeWrapper; OrganizationInfoNode: ResolverTypeWrapper & { creator: ResolversTypes['User'] }>; OrganizationInput: OrganizationInput; OrganizationOrderByInput: OrganizationOrderByInput; OrganizationWhereInput: OrganizationWhereInput; OtpData: ResolverTypeWrapper; PageInfo: ResolverTypeWrapper; - Plugin: ResolverTypeWrapper; - PluginField: ResolverTypeWrapper; + Plugin: ResolverTypeWrapper; + PluginField: ResolverTypeWrapper; PluginFieldInput: PluginFieldInput; PluginInput: PluginInput; - Post: ResolverTypeWrapper; + Post: ResolverTypeWrapper; PostConnection: ResolverTypeWrapper & { edges: Array> }>; PostInput: PostInput; PostOrderByInput: PostOrderByInput; @@ -1507,7 +1498,7 @@ export type ResolversTypes = { Status: Status; String: ResolverTypeWrapper; Subscription: ResolverTypeWrapper<{}>; - Task: ResolverTypeWrapper; + Task: ResolverTypeWrapper; TaskInput: TaskInput; TaskOrderByInput: TaskOrderByInput; Translation: ResolverTypeWrapper; @@ -1518,7 +1509,7 @@ export type ResolversTypes = { UpdateUserInput: UpdateUserInput; UpdateUserTypeInput: UpdateUserTypeInput; Upload: ResolverTypeWrapper; - User: ResolverTypeWrapper; + User: ResolverTypeWrapper; UserAndOrganizationInput: UserAndOrganizationInput; UserAttende: ResolverTypeWrapper & { user: ResolversTypes['User'] }>; UserConnection: ResolverTypeWrapper & { edges: Array> }>; @@ -1537,47 +1528,47 @@ export type ResolversParentTypes = { AndroidFirebaseOptions: AndroidFirebaseOptions; AuthData: Omit & { user: ResolversParentTypes['User'] }; Boolean: Scalars['Boolean']; - Comment: Interface_Comment; + Comment: Interface_CommentModel; CommentInput: CommentInput; DeletePayload: DeletePayload; - DirectChat: Interface_DirectChat; - DirectChatMessage: Interface_DirectChatMessage; - Donation: Interface_Donation; - Event: Interface_Event; + DirectChat: Interface_DirectChatModel; + DirectChatMessage: Interface_DirectChatMessageModel; + Donation: Interface_DonationModel; + Event: Interface_EventModel; EventInput: EventInput; EventRegistrants: Omit & { event: ResolversParentTypes['Event'] }; ExtendSession: ExtendSession; Float: Scalars['Float']; ForgotPasswordData: ForgotPasswordData; - Group: Interface_Group; - GroupChat: Interface_GroupChat; - GroupChatMessage: Interface_GroupChatMessage; + Group: Interface_GroupModel; + GroupChat: Interface_GroupChatModel; + GroupChatMessage: Interface_GroupChatMessageModel; GroupInput: GroupInput; ID: Scalars['ID']; IOSFirebaseOptions: IosFirebaseOptions; Int: Scalars['Int']; - Language: Interface_Language; + Language: Interface_LanguageModel; LanguageInput: LanguageInput; LanguageModel: LanguageModel; LoginInput: LoginInput; - MembershipRequest: Interface_MembershipRequest; - Message: Interface_Message; - MessageChat: Interface_MessageChat; + MembershipRequest: Interface_MembershipRequestModel; + Message: Interface_MessageModel; + MessageChat: Interface_MessageChatModel; MessageChatInput: MessageChatInput; MultipleUsersAndOrganizationInput: MultipleUsersAndOrganizationInput; Mutation: {}; OTPInput: OtpInput; - Organization: Interface_Organization; + Organization: Interface_OrganizationModel; OrganizationInfoNode: Omit & { creator: ResolversParentTypes['User'] }; OrganizationInput: OrganizationInput; OrganizationWhereInput: OrganizationWhereInput; OtpData: OtpData; PageInfo: PageInfo; - Plugin: Interface_Plugin; - PluginField: Interface_PluginField; + Plugin: Interface_PluginModel; + PluginField: Interface_PluginFieldModel; PluginFieldInput: PluginFieldInput; PluginInput: PluginInput; - Post: Interface_Post; + Post: Interface_PostModel; PostConnection: Omit & { edges: Array> }; PostInput: PostInput; PostWhereInput: PostWhereInput; @@ -1585,7 +1576,7 @@ export type ResolversParentTypes = { RecaptchaVerification: RecaptchaVerification; String: Scalars['String']; Subscription: {}; - Task: Interface_Task; + Task: Interface_TaskModel; TaskInput: TaskInput; Translation: Translation; UpdateEventInput: UpdateEventInput; @@ -1594,7 +1585,7 @@ export type ResolversParentTypes = { UpdateUserInput: UpdateUserInput; UpdateUserTypeInput: UpdateUserTypeInput; Upload: Scalars['Upload']; - User: Interface_User; + User: Interface_UserModel; UserAndOrganizationInput: UserAndOrganizationInput; UserAttende: Omit & { user: ResolversParentTypes['User'] }; UserConnection: Omit & { edges: Array> }; diff --git a/src/lib/utilities/adminCheck.ts b/src/utilities/adminCheck.ts similarity index 96% rename from src/lib/utilities/adminCheck.ts rename to src/utilities/adminCheck.ts index 73f291c59f..764dafa0f2 100644 --- a/src/lib/utilities/adminCheck.ts +++ b/src/utilities/adminCheck.ts @@ -6,7 +6,7 @@ import { USER_NOT_AUTHORIZED_MESSAGE, USER_NOT_AUTHORIZED_CODE, USER_NOT_AUTHORIZED_PARAM, -} from "../../constants"; +} from "../constants"; import { Interface_Organization } from "../models"; export const adminCheck = ( diff --git a/src/lib/utilities/auth.ts b/src/utilities/auth.ts similarity index 100% rename from src/lib/utilities/auth.ts rename to src/utilities/auth.ts diff --git a/src/lib/utilities/copyToClipboard.ts b/src/utilities/copyToClipboard.ts similarity index 79% rename from src/lib/utilities/copyToClipboard.ts rename to src/utilities/copyToClipboard.ts index cdbb8cc21b..9980ba0618 100644 --- a/src/lib/utilities/copyToClipboard.ts +++ b/src/utilities/copyToClipboard.ts @@ -1,5 +1,5 @@ import ncp from "copy-paste"; -import { IN_PRODUCTION } from "../../constants"; +import { IN_PRODUCTION } from "../constants"; export const copyToClipboard = (text: string) => { // Only copies in development or test mode diff --git a/src/lib/utilities/creatorCheck.ts b/src/utilities/creatorCheck.ts similarity index 96% rename from src/lib/utilities/creatorCheck.ts rename to src/utilities/creatorCheck.ts index c9f0676cfa..31ba174086 100644 --- a/src/lib/utilities/creatorCheck.ts +++ b/src/utilities/creatorCheck.ts @@ -5,7 +5,7 @@ import { USER_NOT_AUTHORIZED_CODE, USER_NOT_AUTHORIZED_PARAM, IN_PRODUCTION, -} from "../../constants"; +} from "../constants"; import { Types } from "mongoose"; import { Interface_Organization } from "../models"; diff --git a/src/lib/utilities/deleteDuplicatedImage.ts b/src/utilities/deleteDuplicatedImage.ts similarity index 100% rename from src/lib/utilities/deleteDuplicatedImage.ts rename to src/utilities/deleteDuplicatedImage.ts diff --git a/src/lib/utilities/deleteImage.ts b/src/utilities/deleteImage.ts similarity index 100% rename from src/lib/utilities/deleteImage.ts rename to src/utilities/deleteImage.ts diff --git a/src/lib/utilities/imageAlreadyInDbCheck.ts b/src/utilities/imageAlreadyInDbCheck.ts similarity index 100% rename from src/lib/utilities/imageAlreadyInDbCheck.ts rename to src/utilities/imageAlreadyInDbCheck.ts diff --git a/src/lib/utilities/imageExtensionCheck.ts b/src/utilities/imageExtensionCheck.ts similarity index 100% rename from src/lib/utilities/imageExtensionCheck.ts rename to src/utilities/imageExtensionCheck.ts diff --git a/src/lib/utilities/index.ts b/src/utilities/index.ts similarity index 100% rename from src/lib/utilities/index.ts rename to src/utilities/index.ts diff --git a/src/lib/utilities/mailer.ts b/src/utilities/mailer.ts similarity index 93% rename from src/lib/utilities/mailer.ts rename to src/utilities/mailer.ts index 1009da1aa5..8f43cde8f8 100644 --- a/src/lib/utilities/mailer.ts +++ b/src/utilities/mailer.ts @@ -1,5 +1,5 @@ import nodemailer from "nodemailer"; -import { ERROR_IN_SENDING_MAIL } from "../../constants"; +import { ERROR_IN_SENDING_MAIL } from "../constants"; export interface Interface_MailFields { emailTo: string; diff --git a/src/lib/utilities/reuploadDuplicateCheck.ts b/src/utilities/reuploadDuplicateCheck.ts similarity index 93% rename from src/lib/utilities/reuploadDuplicateCheck.ts rename to src/utilities/reuploadDuplicateCheck.ts index 5fbb255a4c..7c92f8d5ae 100644 --- a/src/lib/utilities/reuploadDuplicateCheck.ts +++ b/src/utilities/reuploadDuplicateCheck.ts @@ -1,5 +1,5 @@ import { imageHash } from "image-hash"; -import { requestContext, errors } from "../libraries"; +import { requestContext, errors, logger } from "../libraries"; interface UrlRequestObject { encoding?: string | null; @@ -45,7 +45,7 @@ export const reuploadDuplicateCheck = async ( return false; } catch (error) { - console.error(error); + logger.error(error); throw new errors.ValidationError( [ diff --git a/src/lib/utilities/uploadImage.ts b/src/utilities/uploadImage.ts similarity index 100% rename from src/lib/utilities/uploadImage.ts rename to src/utilities/uploadImage.ts diff --git a/__tests__/middleware/isAuth.spec.ts b/tests/middleware/isAuth.spec.ts similarity index 89% rename from __tests__/middleware/isAuth.spec.ts rename to tests/middleware/isAuth.spec.ts index 346e06d7b5..49abdf7b9b 100644 --- a/__tests__/middleware/isAuth.spec.ts +++ b/tests/middleware/isAuth.spec.ts @@ -1,8 +1,8 @@ import { Request } from "express"; -import { isAuth } from "../../src/lib/middleware/isAuth"; +import { isAuth } from "../../src/middleware/isAuth"; import { beforeEach, afterEach, describe, expect, it, vi } from "vitest"; import jwt from "jsonwebtoken"; -import { logger } from "../../src/lib/libraries/logger"; +import { logger } from "../../src/libraries/logger"; interface Test_Interface_AuthData { isAuth: boolean; @@ -36,7 +36,9 @@ describe("middleware -> isAuth", () => { }); it("returns authData if token === undefined", () => { - const testAuthorizationHeader = (Math.random() + 1).toString(36).substring(2, 5); + const testAuthorizationHeader = (Math.random() + 1) + .toString(36) + .substring(2, 5); const mockRequest = { headers: { @@ -170,17 +172,17 @@ describe("middleware -> isAuth", () => { return callBackFn(null, decoded); }); - const testToken = (Math.random() + 1).toString(36).substring(2, 5); - const testAuthorizationHeader = (Math.random() + 1) - .toString(36) - .substring(2, 5) - .concat(" ", testToken); - - const mockRequest = { - headers: { - authorization: testAuthorizationHeader, - }, - } as Request; + const testToken = (Math.random() + 1).toString(36).substring(2, 5); + const testAuthorizationHeader = (Math.random() + 1) + .toString(36) + .substring(2, 5) + .concat(" ", testToken); + + const mockRequest = { + headers: { + authorization: testAuthorizationHeader, + }, + } as Request; const authData: Test_Interface_AuthData = isAuth(mockRequest); diff --git a/__tests__/resolvers/DirectChat/creator.spec.ts b/tests/resolvers/DirectChat/creator.spec.ts similarity index 92% rename from __tests__/resolvers/DirectChat/creator.spec.ts rename to tests/resolvers/DirectChat/creator.spec.ts index b50f523e8d..24af9776c7 100644 --- a/__tests__/resolvers/DirectChat/creator.spec.ts +++ b/tests/resolvers/DirectChat/creator.spec.ts @@ -1,12 +1,12 @@ import "dotenv/config"; -import { creator as creatorResolver } from "../../../src/lib/resolvers/DirectChat/creator"; +import { creator as creatorResolver } from "../../../src/resolvers/DirectChat/creator"; import { connect, disconnect } from "../../../src/db"; import { User, Organization, Interface_DirectChat, DirectChat, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { Document } from "mongoose"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/tests/resolvers/DirectChat/index.spec.ts b/tests/resolvers/DirectChat/index.spec.ts new file mode 100644 index 0000000000..998ea460f9 --- /dev/null +++ b/tests/resolvers/DirectChat/index.spec.ts @@ -0,0 +1,24 @@ +import { DirectChat } from "../../../src/resolvers/DirectChat/index"; +import { DirectChatResolvers } from "../../../src/types/generatedGraphQLTypes"; +import { creator } from "../../../src/resolvers/DirectChat/creator"; +import { messages } from "../../../src/resolvers/DirectChat/messages"; +import { organization } from "../../../src/resolvers/DirectChat/organization"; +import { users } from "../../../src/resolvers/DirectChat/users"; +import { describe, it, beforeAll, expect } from "vitest"; + +let testDirectChat: DirectChatResolvers; + +beforeAll(() => { + testDirectChat = { + creator, + messages, + organization, + users, + }; +}); + +describe("resolvers -> DirectChat -> index", () => { + it("creates the DirectChat", () => { + expect(testDirectChat).toStrictEqual(DirectChat); + }); +}); diff --git a/__tests__/resolvers/DirectChat/messages.spec.ts b/tests/resolvers/DirectChat/messages.spec.ts similarity index 93% rename from __tests__/resolvers/DirectChat/messages.spec.ts rename to tests/resolvers/DirectChat/messages.spec.ts index a83ace2acc..7f7d95cede 100644 --- a/__tests__/resolvers/DirectChat/messages.spec.ts +++ b/tests/resolvers/DirectChat/messages.spec.ts @@ -1,5 +1,5 @@ import "dotenv/config"; -import { messages as messagesResolver } from "../../../src/lib/resolvers/DirectChat/messages"; +import { messages as messagesResolver } from "../../../src/resolvers/DirectChat/messages"; import { connect, disconnect } from "../../../src/db"; import { User, @@ -7,7 +7,7 @@ import { Interface_DirectChat, DirectChat, DirectChatMessage, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { Document } from "mongoose"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/DirectChat/organization.spec.ts b/tests/resolvers/DirectChat/organization.spec.ts similarity index 95% rename from __tests__/resolvers/DirectChat/organization.spec.ts rename to tests/resolvers/DirectChat/organization.spec.ts index 90fc21b28d..4350d043f2 100644 --- a/__tests__/resolvers/DirectChat/organization.spec.ts +++ b/tests/resolvers/DirectChat/organization.spec.ts @@ -1,12 +1,12 @@ import "dotenv/config"; -import { organization as organizationResolver } from "../../../src/lib/resolvers/DirectChat/organization"; +import { organization as organizationResolver } from "../../../src/resolvers/DirectChat/organization"; import { connect, disconnect } from "../../../src/db"; import { User, Organization, Interface_DirectChat, DirectChat, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { Document } from "mongoose"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/DirectChat/users.spec.ts b/tests/resolvers/DirectChat/users.spec.ts similarity index 94% rename from __tests__/resolvers/DirectChat/users.spec.ts rename to tests/resolvers/DirectChat/users.spec.ts index 03a83db40e..f13da17b68 100644 --- a/__tests__/resolvers/DirectChat/users.spec.ts +++ b/tests/resolvers/DirectChat/users.spec.ts @@ -1,5 +1,5 @@ import "dotenv/config"; -import { users as usersResolver } from "../../../src/lib/resolvers/DirectChat/users"; +import { users as usersResolver } from "../../../src/resolvers/DirectChat/users"; import { connect, disconnect } from "../../../src/db"; import { User, @@ -7,7 +7,7 @@ import { Interface_DirectChat, DirectChat, DirectChatMessage, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { Document } from "mongoose"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/DirectChatMessage/directChatMessageBelongsTo.spec.ts b/tests/resolvers/DirectChatMessage/directChatMessageBelongsTo.spec.ts similarity index 94% rename from __tests__/resolvers/DirectChatMessage/directChatMessageBelongsTo.spec.ts rename to tests/resolvers/DirectChatMessage/directChatMessageBelongsTo.spec.ts index 02f09aec42..0d25774852 100644 --- a/__tests__/resolvers/DirectChatMessage/directChatMessageBelongsTo.spec.ts +++ b/tests/resolvers/DirectChatMessage/directChatMessageBelongsTo.spec.ts @@ -1,5 +1,5 @@ import "dotenv/config"; -import { directChatMessageBelongsTo as directChatMessageBelongsToResolver } from "../../../src/lib/resolvers/DirectChatMessage/directChatMessageBelongsTo"; +import { directChatMessageBelongsTo as directChatMessageBelongsToResolver } from "../../../src/resolvers/DirectChatMessage/directChatMessageBelongsTo"; import { connect, disconnect } from "../../../src/db"; import { User, @@ -7,7 +7,7 @@ import { Interface_DirectChatMessage, DirectChat, DirectChatMessage, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { Document } from "mongoose"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/tests/resolvers/DirectChatMessage/index.spec.ts b/tests/resolvers/DirectChatMessage/index.spec.ts new file mode 100644 index 0000000000..4be41fa335 --- /dev/null +++ b/tests/resolvers/DirectChatMessage/index.spec.ts @@ -0,0 +1,22 @@ +import { DirectChatMessage } from "../../../src/resolvers/DirectChatMessage/index"; +import { DirectChatMessageResolvers } from "../../../src/types/generatedGraphQLTypes"; +import { directChatMessageBelongsTo } from "../../../src/resolvers/DirectChatMessage/directChatMessageBelongsTo"; +import { receiver } from "../../../src/resolvers/DirectChatMessage/receiver"; +import { sender } from "../../../src/resolvers/DirectChatMessage/sender"; +import { describe, it, beforeAll, expect } from "vitest"; + +let testDirectChatMessage: DirectChatMessageResolvers; + +beforeAll(() => { + testDirectChatMessage = { + directChatMessageBelongsTo, + receiver, + sender, + }; +}); + +describe("resolvers -> DirectChatMessage -> index", () => { + it("creates the DirectChatMessage", () => { + expect(testDirectChatMessage).toStrictEqual(DirectChatMessage); + }); +}); diff --git a/__tests__/resolvers/DirectChatMessage/receiver.spec.ts b/tests/resolvers/DirectChatMessage/receiver.spec.ts similarity index 93% rename from __tests__/resolvers/DirectChatMessage/receiver.spec.ts rename to tests/resolvers/DirectChatMessage/receiver.spec.ts index c5a9611f0a..a626ed99e3 100644 --- a/__tests__/resolvers/DirectChatMessage/receiver.spec.ts +++ b/tests/resolvers/DirectChatMessage/receiver.spec.ts @@ -1,5 +1,5 @@ import "dotenv/config"; -import { receiver as receiverResolver } from "../../../src/lib/resolvers/DirectChatMessage/receiver"; +import { receiver as receiverResolver } from "../../../src/resolvers/DirectChatMessage/receiver"; import { connect, disconnect } from "../../../src/db"; import { User, @@ -7,7 +7,7 @@ import { Interface_DirectChatMessage, DirectChat, DirectChatMessage, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { Document } from "mongoose"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/DirectChatMessage/sender.spec.ts b/tests/resolvers/DirectChatMessage/sender.spec.ts similarity index 93% rename from __tests__/resolvers/DirectChatMessage/sender.spec.ts rename to tests/resolvers/DirectChatMessage/sender.spec.ts index e10436c719..33ae0a4335 100644 --- a/__tests__/resolvers/DirectChatMessage/sender.spec.ts +++ b/tests/resolvers/DirectChatMessage/sender.spec.ts @@ -1,5 +1,5 @@ import "dotenv/config"; -import { sender as senderResolver } from "../../../src/lib/resolvers/DirectChatMessage/sender"; +import { sender as senderResolver } from "../../../src/resolvers/DirectChatMessage/sender"; import { connect, disconnect } from "../../../src/db"; import { User, @@ -7,7 +7,7 @@ import { Interface_DirectChatMessage, DirectChat, DirectChatMessage, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { Document } from "mongoose"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/GroupChat/creator.spec.ts b/tests/resolvers/GroupChat/creator.spec.ts similarity index 93% rename from __tests__/resolvers/GroupChat/creator.spec.ts rename to tests/resolvers/GroupChat/creator.spec.ts index a0ae29d921..e2c17482b4 100644 --- a/__tests__/resolvers/GroupChat/creator.spec.ts +++ b/tests/resolvers/GroupChat/creator.spec.ts @@ -1,12 +1,12 @@ import "dotenv/config"; -import { creator as creatorResolver } from "../../../src/lib/resolvers/GroupChat/creator"; +import { creator as creatorResolver } from "../../../src/resolvers/GroupChat/creator"; import { connect, disconnect } from "../../../src/db"; import { User, Organization, Interface_GroupChat, GroupChat, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { Document } from "mongoose"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/tests/resolvers/GroupChat/index.spec.ts b/tests/resolvers/GroupChat/index.spec.ts new file mode 100644 index 0000000000..6e541419e8 --- /dev/null +++ b/tests/resolvers/GroupChat/index.spec.ts @@ -0,0 +1,24 @@ +import { GroupChat } from "../../../src/resolvers/GroupChat/index"; +import { GroupChatResolvers } from "../../../src/types/generatedGraphQLTypes"; +import { creator } from "../../../src/resolvers/GroupChat/creator"; +import { messages } from "../../../src/resolvers/GroupChat/messages"; +import { organization } from "../../../src/resolvers/GroupChat/organization"; +import { users } from "../../../src/resolvers/GroupChat/users"; +import { beforeAll, describe, expect, it } from "vitest"; + +let testGroupChat: GroupChatResolvers; + +beforeAll(() => { + testGroupChat = { + creator, + messages, + organization, + users, + }; +}); + +describe("resolvers -> GroupChat -> index", () => { + it("creates the GroupChat", () => { + expect(testGroupChat).toStrictEqual(GroupChat); + }); +}); diff --git a/__tests__/resolvers/GroupChat/messages.spec.ts b/tests/resolvers/GroupChat/messages.spec.ts similarity index 93% rename from __tests__/resolvers/GroupChat/messages.spec.ts rename to tests/resolvers/GroupChat/messages.spec.ts index dc2fd8240f..d9212eb9f6 100644 --- a/__tests__/resolvers/GroupChat/messages.spec.ts +++ b/tests/resolvers/GroupChat/messages.spec.ts @@ -1,5 +1,5 @@ import "dotenv/config"; -import { messages as messagesResolver } from "../../../src/lib/resolvers/GroupChat/messages"; +import { messages as messagesResolver } from "../../../src/resolvers/GroupChat/messages"; import { connect, disconnect } from "../../../src/db"; import { User, @@ -7,7 +7,7 @@ import { Interface_GroupChat, GroupChat, GroupChatMessage, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { Document } from "mongoose"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/GroupChat/organization.spec.ts b/tests/resolvers/GroupChat/organization.spec.ts similarity index 95% rename from __tests__/resolvers/GroupChat/organization.spec.ts rename to tests/resolvers/GroupChat/organization.spec.ts index f9032f66c3..b96618c6aa 100644 --- a/__tests__/resolvers/GroupChat/organization.spec.ts +++ b/tests/resolvers/GroupChat/organization.spec.ts @@ -1,12 +1,12 @@ import "dotenv/config"; -import { organization as organizationResolver } from "../../../src/lib/resolvers/GroupChat/organization"; +import { organization as organizationResolver } from "../../../src/resolvers/GroupChat/organization"; import { connect, disconnect } from "../../../src/db"; import { User, Organization, Interface_GroupChat, GroupChat, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { Document } from "mongoose"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/GroupChat/users.spec.ts b/tests/resolvers/GroupChat/users.spec.ts similarity index 93% rename from __tests__/resolvers/GroupChat/users.spec.ts rename to tests/resolvers/GroupChat/users.spec.ts index 57466d1d21..e767344abc 100644 --- a/__tests__/resolvers/GroupChat/users.spec.ts +++ b/tests/resolvers/GroupChat/users.spec.ts @@ -1,12 +1,12 @@ import "dotenv/config"; -import { users as usersResolver } from "../../../src/lib/resolvers/GroupChat/users"; +import { users as usersResolver } from "../../../src/resolvers/GroupChat/users"; import { connect, disconnect } from "../../../src/db"; import { User, Organization, Interface_GroupChat, GroupChat, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { Document } from "mongoose"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/GroupChatMessage/groupChatMessageBelongsTo.spec.ts b/tests/resolvers/GroupChatMessage/groupChatMessageBelongsTo.spec.ts similarity index 94% rename from __tests__/resolvers/GroupChatMessage/groupChatMessageBelongsTo.spec.ts rename to tests/resolvers/GroupChatMessage/groupChatMessageBelongsTo.spec.ts index a1f1ae38b1..d2d089c49f 100644 --- a/__tests__/resolvers/GroupChatMessage/groupChatMessageBelongsTo.spec.ts +++ b/tests/resolvers/GroupChatMessage/groupChatMessageBelongsTo.spec.ts @@ -1,5 +1,5 @@ import "dotenv/config"; -import { groupChatMessageBelongsTo as groupChatMessageBelongsToResolver } from "../../../src/lib/resolvers/GroupChatMessage/groupChatMessageBelongsTo"; +import { groupChatMessageBelongsTo as groupChatMessageBelongsToResolver } from "../../../src/resolvers/GroupChatMessage/groupChatMessageBelongsTo"; import { connect, disconnect } from "../../../src/db"; import { User, @@ -7,7 +7,7 @@ import { Interface_GroupChatMessage, GroupChat, GroupChatMessage, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { Document } from "mongoose"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/GroupChatMessage/index.spec.ts b/tests/resolvers/GroupChatMessage/index.spec.ts similarity index 52% rename from __tests__/resolvers/GroupChatMessage/index.spec.ts rename to tests/resolvers/GroupChatMessage/index.spec.ts index 1c38fdf61e..c0fd60a75a 100644 --- a/__tests__/resolvers/GroupChatMessage/index.spec.ts +++ b/tests/resolvers/GroupChatMessage/index.spec.ts @@ -1,7 +1,7 @@ -import { GroupChatMessage } from "../../../src/lib/resolvers/GroupChatMessage/index"; -import { GroupChatMessageResolvers } from "../../../src/generated/graphqlCodegen"; -import { groupChatMessageBelongsTo } from "../../../src/lib/resolvers/GroupChatMessage/groupChatMessageBelongsTo"; -import { sender } from "../../../src/lib/resolvers/GroupChatMessage/sender"; +import { GroupChatMessage } from "../../../src/resolvers/GroupChatMessage/index"; +import { GroupChatMessageResolvers } from "../../../src/types/generatedGraphQLTypes"; +import { groupChatMessageBelongsTo } from "../../../src/resolvers/GroupChatMessage/groupChatMessageBelongsTo"; +import { sender } from "../../../src/resolvers/GroupChatMessage/sender"; import { describe, it, beforeAll, expect } from "vitest"; let testGroupChatMessage: GroupChatMessageResolvers; diff --git a/__tests__/resolvers/GroupChatMessage/sender.spec.ts b/tests/resolvers/GroupChatMessage/sender.spec.ts similarity index 93% rename from __tests__/resolvers/GroupChatMessage/sender.spec.ts rename to tests/resolvers/GroupChatMessage/sender.spec.ts index 04cb8a269d..0663294291 100644 --- a/__tests__/resolvers/GroupChatMessage/sender.spec.ts +++ b/tests/resolvers/GroupChatMessage/sender.spec.ts @@ -1,5 +1,5 @@ import "dotenv/config"; -import { sender as senderResolver } from "../../../src/lib/resolvers/GroupChatMessage/sender"; +import { sender as senderResolver } from "../../../src/resolvers/GroupChatMessage/sender"; import { connect, disconnect } from "../../../src/db"; import { User, @@ -7,7 +7,7 @@ import { Interface_GroupChatMessage, GroupChat, GroupChatMessage, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { Document } from "mongoose"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/MembershipRequest/index.spec.ts b/tests/resolvers/MembershipRequest/index.spec.ts similarity index 53% rename from __tests__/resolvers/MembershipRequest/index.spec.ts rename to tests/resolvers/MembershipRequest/index.spec.ts index fb027025ed..b19e28faec 100644 --- a/__tests__/resolvers/MembershipRequest/index.spec.ts +++ b/tests/resolvers/MembershipRequest/index.spec.ts @@ -1,7 +1,7 @@ -import { MembershipRequest } from "../../../src/lib/resolvers/MembershipRequest/index"; -import { MembershipRequestResolvers } from "../../../src/generated/graphqlCodegen"; -import { organization } from "../../../src/lib/resolvers/MembershipRequest/organization"; -import { user } from "../../../src/lib/resolvers/MembershipRequest/user"; +import { MembershipRequest } from "../../../src/resolvers/MembershipRequest/index"; +import { MembershipRequestResolvers } from "../../../src/types/generatedGraphQLTypes"; +import { organization } from "../../../src/resolvers/MembershipRequest/organization"; +import { user } from "../../../src/resolvers/MembershipRequest/user"; import { describe, it, beforeAll, expect } from "vitest"; let testMembershipRequest: MembershipRequestResolvers; diff --git a/__tests__/resolvers/MembershipRequest/organization.spec.ts b/tests/resolvers/MembershipRequest/organization.spec.ts similarity index 95% rename from __tests__/resolvers/MembershipRequest/organization.spec.ts rename to tests/resolvers/MembershipRequest/organization.spec.ts index 96de0f4ff1..fbfe7fc6c3 100644 --- a/__tests__/resolvers/MembershipRequest/organization.spec.ts +++ b/tests/resolvers/MembershipRequest/organization.spec.ts @@ -1,12 +1,12 @@ import "dotenv/config"; -import { organization as organizationResolver } from "../../../src/lib/resolvers/MembershipRequest/organization"; +import { organization as organizationResolver } from "../../../src/resolvers/MembershipRequest/organization"; import { connect, disconnect } from "../../../src/db"; import { User, Organization, MembershipRequest, Interface_MembershipRequest, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { Document } from "mongoose"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/MembershipRequest/user.spec.ts b/tests/resolvers/MembershipRequest/user.spec.ts similarity index 93% rename from __tests__/resolvers/MembershipRequest/user.spec.ts rename to tests/resolvers/MembershipRequest/user.spec.ts index 180717d881..142698fe27 100644 --- a/__tests__/resolvers/MembershipRequest/user.spec.ts +++ b/tests/resolvers/MembershipRequest/user.spec.ts @@ -1,12 +1,12 @@ import "dotenv/config"; -import { user as userResolver } from "../../../src/lib/resolvers/MembershipRequest/user"; +import { user as userResolver } from "../../../src/resolvers/MembershipRequest/user"; import { connect, disconnect } from "../../../src/db"; import { User, Organization, MembershipRequest, Interface_MembershipRequest, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { Document } from "mongoose"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Mutation/acceptAdmin.spec.ts b/tests/resolvers/Mutation/acceptAdmin.spec.ts similarity index 93% rename from __tests__/resolvers/Mutation/acceptAdmin.spec.ts rename to tests/resolvers/Mutation/acceptAdmin.spec.ts index 29c4507432..45c91f5bf6 100644 --- a/__tests__/resolvers/Mutation/acceptAdmin.spec.ts +++ b/tests/resolvers/Mutation/acceptAdmin.spec.ts @@ -1,9 +1,9 @@ import "dotenv/config"; import { Document, Types } from "mongoose"; -import { Interface_User, User } from "../../../src/lib/models"; -import { MutationAcceptAdminArgs } from "../../../src/generated/graphqlCodegen"; +import { Interface_User, User } from "../../../src/models"; +import { MutationAcceptAdminArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { acceptAdmin as acceptAdminResolver } from "../../../src/lib/resolvers/Mutation/acceptAdmin"; +import { acceptAdmin as acceptAdminResolver } from "../../../src/resolvers/Mutation/acceptAdmin"; import { USER_NOT_AUTHORIZED, USER_NOT_FOUND } from "../../../src/constants"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Mutation/acceptMembershipRequest.spec.ts b/tests/resolvers/Mutation/acceptMembershipRequest.spec.ts similarity index 98% rename from __tests__/resolvers/Mutation/acceptMembershipRequest.spec.ts rename to tests/resolvers/Mutation/acceptMembershipRequest.spec.ts index a21d86fc3e..4008619877 100644 --- a/__tests__/resolvers/Mutation/acceptMembershipRequest.spec.ts +++ b/tests/resolvers/Mutation/acceptMembershipRequest.spec.ts @@ -7,10 +7,10 @@ import { Interface_Organization, MembershipRequest, Interface_MembershipRequest, -} from "../../../src/lib/models"; -import { MutationAcceptMembershipRequestArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationAcceptMembershipRequestArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { acceptMembershipRequest as acceptMembershipRequestResolver } from "../../../src/lib/resolvers/Mutation/acceptMembershipRequest"; +import { acceptMembershipRequest as acceptMembershipRequestResolver } from "../../../src/resolvers/Mutation/acceptMembershipRequest"; import { MEMBERSHIP_REQUEST_NOT_FOUND, ORGANIZATION_NOT_FOUND, diff --git a/__tests__/resolvers/Mutation/addLanguageTranslation.spec.ts b/tests/resolvers/Mutation/addLanguageTranslation.spec.ts similarity index 94% rename from __tests__/resolvers/Mutation/addLanguageTranslation.spec.ts rename to tests/resolvers/Mutation/addLanguageTranslation.spec.ts index fcc9986eb3..293ea625cb 100644 --- a/__tests__/resolvers/Mutation/addLanguageTranslation.spec.ts +++ b/tests/resolvers/Mutation/addLanguageTranslation.spec.ts @@ -1,8 +1,8 @@ import "dotenv/config"; -import { addLanguageTranslation as addLanguageTranslationResolver } from "../../../src/lib/resolvers/Mutation/addLanguageTranslation"; +import { addLanguageTranslation as addLanguageTranslationResolver } from "../../../src/resolvers/Mutation/addLanguageTranslation"; import { connect, disconnect } from "../../../src/db"; -import { MutationAddLanguageTranslationArgs } from "../../../src/generated/graphqlCodegen"; -import { Language } from "../../../src/lib/models"; +import { MutationAddLanguageTranslationArgs } from "../../../src/types/generatedGraphQLTypes"; +import { Language } from "../../../src/models"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Mutation/addOrganizationImage.spec.ts b/tests/resolvers/Mutation/addOrganizationImage.spec.ts similarity index 95% rename from __tests__/resolvers/Mutation/addOrganizationImage.spec.ts rename to tests/resolvers/Mutation/addOrganizationImage.spec.ts index c47719dcfb..13fb601211 100644 --- a/__tests__/resolvers/Mutation/addOrganizationImage.spec.ts +++ b/tests/resolvers/Mutation/addOrganizationImage.spec.ts @@ -5,10 +5,10 @@ import { User, Organization, Interface_Organization, -} from "../../../src/lib/models"; -import { MutationAddOrganizationImageArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationAddOrganizationImageArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { addOrganizationImage as addOrganizationImageResolver } from "../../../src/lib/resolvers/Mutation/addOrganizationImage"; +import { addOrganizationImage as addOrganizationImageResolver } from "../../../src/resolvers/Mutation/addOrganizationImage"; import { ORGANIZATION_NOT_FOUND, USER_NOT_AUTHORIZED, diff --git a/__tests__/resolvers/Mutation/addUserImage.spec.ts b/tests/resolvers/Mutation/addUserImage.spec.ts similarity index 91% rename from __tests__/resolvers/Mutation/addUserImage.spec.ts rename to tests/resolvers/Mutation/addUserImage.spec.ts index 3d6f885e71..fd5e5d169d 100644 --- a/__tests__/resolvers/Mutation/addUserImage.spec.ts +++ b/tests/resolvers/Mutation/addUserImage.spec.ts @@ -3,10 +3,10 @@ import { // Document, Types, } from "mongoose"; -// import { Interface_User, User } from "../../../src/lib/models"; +// import { Interface_User, User } from "../../../src/models"; import { connect, disconnect } from "../../../src/db"; -import { MutationAddUserImageArgs } from "../../../src/generated/graphqlCodegen"; -import { addUserImage as addUserImageResolver } from "../../../src/lib/resolvers/Mutation/addUserImage"; +import { MutationAddUserImageArgs } from "../../../src/types/generatedGraphQLTypes"; +import { addUserImage as addUserImageResolver } from "../../../src/resolvers/Mutation/addUserImage"; import { USER_NOT_FOUND } from "../../../src/constants"; // import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Mutation/addUserToGroupChat.spec.ts b/tests/resolvers/Mutation/addUserToGroupChat.spec.ts similarity index 97% rename from __tests__/resolvers/Mutation/addUserToGroupChat.spec.ts rename to tests/resolvers/Mutation/addUserToGroupChat.spec.ts index 11aa3c0cce..0415992db3 100644 --- a/__tests__/resolvers/Mutation/addUserToGroupChat.spec.ts +++ b/tests/resolvers/Mutation/addUserToGroupChat.spec.ts @@ -8,10 +8,10 @@ import { GroupChat, Interface_GroupChat, GroupChatMessage, -} from "../../../src/lib/models"; -import { MutationAddUserToGroupChatArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationAddUserToGroupChatArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { addUserToGroupChat as addUserToGroupChatResolver } from "../../../src/lib/resolvers/Mutation/addUserToGroupChat"; +import { addUserToGroupChat as addUserToGroupChatResolver } from "../../../src/resolvers/Mutation/addUserToGroupChat"; import { CHAT_NOT_FOUND, ORGANIZATION_NOT_FOUND, diff --git a/__tests__/resolvers/Mutation/adminRemoveEvent.spec.ts b/tests/resolvers/Mutation/adminRemoveEvent.spec.ts similarity index 96% rename from __tests__/resolvers/Mutation/adminRemoveEvent.spec.ts rename to tests/resolvers/Mutation/adminRemoveEvent.spec.ts index c5b8cd2de4..7f0d472cad 100644 --- a/__tests__/resolvers/Mutation/adminRemoveEvent.spec.ts +++ b/tests/resolvers/Mutation/adminRemoveEvent.spec.ts @@ -7,10 +7,10 @@ import { Interface_Organization, Interface_Event, Event, -} from "../../../src/lib/models"; -import { MutationAdminRemoveEventArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationAdminRemoveEventArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { adminRemoveEvent as adminRemoveEventResolver } from "../../../src/lib/resolvers/Mutation/adminRemoveEvent"; +import { adminRemoveEvent as adminRemoveEventResolver } from "../../../src/resolvers/Mutation/adminRemoveEvent"; import { EVENT_NOT_FOUND, ORGANIZATION_NOT_FOUND, diff --git a/__tests__/resolvers/Mutation/adminRemoveGroup.spec.ts b/tests/resolvers/Mutation/adminRemoveGroup.spec.ts similarity index 96% rename from __tests__/resolvers/Mutation/adminRemoveGroup.spec.ts rename to tests/resolvers/Mutation/adminRemoveGroup.spec.ts index 43e062f74f..0e4cabec99 100644 --- a/__tests__/resolvers/Mutation/adminRemoveGroup.spec.ts +++ b/tests/resolvers/Mutation/adminRemoveGroup.spec.ts @@ -7,10 +7,10 @@ import { Interface_Organization, GroupChat, Interface_GroupChat, -} from "../../../src/lib/models"; -import { MutationAdminRemoveGroupArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationAdminRemoveGroupArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { adminRemoveGroup as adminRemoveGroupResolver } from "../../../src/lib/resolvers/Mutation/adminRemoveGroup"; +import { adminRemoveGroup as adminRemoveGroupResolver } from "../../../src/resolvers/Mutation/adminRemoveGroup"; import { CHAT_NOT_FOUND, ORGANIZATION_NOT_FOUND, diff --git a/__tests__/resolvers/Mutation/adminRemovePost.spec.ts b/tests/resolvers/Mutation/adminRemovePost.spec.ts similarity index 96% rename from __tests__/resolvers/Mutation/adminRemovePost.spec.ts rename to tests/resolvers/Mutation/adminRemovePost.spec.ts index 9c4f28e413..fbb80aa1b6 100644 --- a/__tests__/resolvers/Mutation/adminRemovePost.spec.ts +++ b/tests/resolvers/Mutation/adminRemovePost.spec.ts @@ -7,10 +7,10 @@ import { Interface_Post, Post, Interface_Organization, -} from "../../../src/lib/models"; -import { MutationAdminRemovePostArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationAdminRemovePostArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { adminRemovePost as adminRemovePostResolver } from "../../../src/lib/resolvers/Mutation/adminRemovePost"; +import { adminRemovePost as adminRemovePostResolver } from "../../../src/resolvers/Mutation/adminRemovePost"; import { ORGANIZATION_NOT_FOUND, POST_NOT_FOUND, diff --git a/__tests__/resolvers/Mutation/blockPluginCreationBySuperadmin.spec.ts b/tests/resolvers/Mutation/blockPluginCreationBySuperadmin.spec.ts similarity index 93% rename from __tests__/resolvers/Mutation/blockPluginCreationBySuperadmin.spec.ts rename to tests/resolvers/Mutation/blockPluginCreationBySuperadmin.spec.ts index b7e41ab0ee..08a065f36b 100644 --- a/__tests__/resolvers/Mutation/blockPluginCreationBySuperadmin.spec.ts +++ b/tests/resolvers/Mutation/blockPluginCreationBySuperadmin.spec.ts @@ -1,9 +1,9 @@ import "dotenv/config"; import { Document, Types } from "mongoose"; -import { Interface_User, User } from "../../../src/lib/models"; -import { MutationBlockPluginCreationBySuperadminArgs } from "../../../src/generated/graphqlCodegen"; +import { Interface_User, User } from "../../../src/models"; +import { MutationBlockPluginCreationBySuperadminArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { blockPluginCreationBySuperadmin as blockPluginCreationBySuperadminResolver } from "../../../src/lib/resolvers/Mutation/blockPluginCreationBySuperadmin"; +import { blockPluginCreationBySuperadmin as blockPluginCreationBySuperadminResolver } from "../../../src/resolvers/Mutation/blockPluginCreationBySuperadmin"; import { USER_NOT_AUTHORIZED, USER_NOT_FOUND } from "../../../src/constants"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Mutation/blockUser.spec.ts b/tests/resolvers/Mutation/blockUser.spec.ts similarity index 95% rename from __tests__/resolvers/Mutation/blockUser.spec.ts rename to tests/resolvers/Mutation/blockUser.spec.ts index 4a549f4c12..e509d62b6d 100644 --- a/__tests__/resolvers/Mutation/blockUser.spec.ts +++ b/tests/resolvers/Mutation/blockUser.spec.ts @@ -5,10 +5,10 @@ import { User, Organization, Interface_Organization, -} from "../../../src/lib/models"; -import { MutationBlockUserArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationBlockUserArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { blockUser as blockUserResolver } from "../../../src/lib/resolvers/Mutation/blockUser"; +import { blockUser as blockUserResolver } from "../../../src/resolvers/Mutation/blockUser"; import { ORGANIZATION_NOT_FOUND, USER_NOT_AUTHORIZED, diff --git a/__tests__/resolvers/Mutation/cancelMembershipRequest.spec.ts b/tests/resolvers/Mutation/cancelMembershipRequest.spec.ts similarity index 97% rename from __tests__/resolvers/Mutation/cancelMembershipRequest.spec.ts rename to tests/resolvers/Mutation/cancelMembershipRequest.spec.ts index 6e1ceaffcf..dfc1c71e5a 100644 --- a/__tests__/resolvers/Mutation/cancelMembershipRequest.spec.ts +++ b/tests/resolvers/Mutation/cancelMembershipRequest.spec.ts @@ -7,10 +7,10 @@ import { Interface_Organization, MembershipRequest, Interface_MembershipRequest, -} from "../../../src/lib/models"; -import { MutationCancelMembershipRequestArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationCancelMembershipRequestArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { cancelMembershipRequest as cancelMembershipRequestResolver } from "../../../src/lib/resolvers/Mutation/cancelMembershipRequest"; +import { cancelMembershipRequest as cancelMembershipRequestResolver } from "../../../src/resolvers/Mutation/cancelMembershipRequest"; import { MEMBERSHIP_REQUEST_NOT_FOUND, ORGANIZATION_NOT_FOUND, diff --git a/__tests__/resolvers/Mutation/createAdmin.spec.ts b/tests/resolvers/Mutation/createAdmin.spec.ts similarity index 97% rename from __tests__/resolvers/Mutation/createAdmin.spec.ts rename to tests/resolvers/Mutation/createAdmin.spec.ts index c53b4d863d..adc752e197 100644 --- a/__tests__/resolvers/Mutation/createAdmin.spec.ts +++ b/tests/resolvers/Mutation/createAdmin.spec.ts @@ -5,10 +5,10 @@ import { User, Organization, Interface_Organization, -} from "../../../src/lib/models"; -import { MutationCreateAdminArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationCreateAdminArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { createAdmin as createAdminResolver } from "../../../src/lib/resolvers/Mutation/createAdmin"; +import { createAdmin as createAdminResolver } from "../../../src/resolvers/Mutation/createAdmin"; import { ORGANIZATION_MEMBER_NOT_FOUND, ORGANIZATION_NOT_FOUND, diff --git a/__tests__/resolvers/Mutation/createComment.spec.ts b/tests/resolvers/Mutation/createComment.spec.ts similarity index 94% rename from __tests__/resolvers/Mutation/createComment.spec.ts rename to tests/resolvers/Mutation/createComment.spec.ts index ca2e0b9b1d..cba4d7a09a 100644 --- a/__tests__/resolvers/Mutation/createComment.spec.ts +++ b/tests/resolvers/Mutation/createComment.spec.ts @@ -7,10 +7,10 @@ import { Interface_Organization, Interface_Post, Post, -} from "../../../src/lib/models"; -import { MutationCreateCommentArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationCreateCommentArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { createComment as createCommentResolver } from "../../../src/lib/resolvers/Mutation/createComment"; +import { createComment as createCommentResolver } from "../../../src/resolvers/Mutation/createComment"; import { USER_NOT_FOUND } from "../../../src/constants"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Mutation/createDirectChat.spec.ts b/tests/resolvers/Mutation/createDirectChat.spec.ts similarity index 95% rename from __tests__/resolvers/Mutation/createDirectChat.spec.ts rename to tests/resolvers/Mutation/createDirectChat.spec.ts index c216f44128..7729535f7c 100644 --- a/__tests__/resolvers/Mutation/createDirectChat.spec.ts +++ b/tests/resolvers/Mutation/createDirectChat.spec.ts @@ -5,10 +5,10 @@ import { User, Organization, Interface_Organization, -} from "../../../src/lib/models"; -import { MutationCreateDirectChatArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationCreateDirectChatArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { createDirectChat as createDirectChatResolver } from "../../../src/lib/resolvers/Mutation/createDirectChat"; +import { createDirectChat as createDirectChatResolver } from "../../../src/resolvers/Mutation/createDirectChat"; import { ORGANIZATION_NOT_FOUND, USER_NOT_FOUND } from "../../../src/constants"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Mutation/createDonation.spec.ts b/tests/resolvers/Mutation/createDonation.spec.ts similarity index 92% rename from __tests__/resolvers/Mutation/createDonation.spec.ts rename to tests/resolvers/Mutation/createDonation.spec.ts index ae19f42731..3c5a4176db 100644 --- a/__tests__/resolvers/Mutation/createDonation.spec.ts +++ b/tests/resolvers/Mutation/createDonation.spec.ts @@ -5,10 +5,10 @@ import { User, Organization, Interface_Organization, -} from "../../../src/lib/models"; -import { MutationCreateDonationArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationCreateDonationArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { createDonation as createDonationResolver } from "../../../src/lib/resolvers/Mutation/createDonation"; +import { createDonation as createDonationResolver } from "../../../src/resolvers/Mutation/createDonation"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Mutation/createEvent.spec.ts b/tests/resolvers/Mutation/createEvent.spec.ts similarity index 94% rename from __tests__/resolvers/Mutation/createEvent.spec.ts rename to tests/resolvers/Mutation/createEvent.spec.ts index 789580e5eb..e3b2617b27 100644 --- a/__tests__/resolvers/Mutation/createEvent.spec.ts +++ b/tests/resolvers/Mutation/createEvent.spec.ts @@ -5,13 +5,10 @@ import { User, Organization, Interface_Organization, -} from "../../../src/lib/models"; -import { - MutationCreateEventArgs, - Recurrance, -} from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationCreateEventArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { createEvent as createEventResolver } from "../../../src/lib/resolvers/Mutation/createEvent"; +import { createEvent as createEventResolver } from "../../../src/resolvers/Mutation/createEvent"; import { ORGANIZATION_NOT_AUTHORIZED, ORGANIZATION_NOT_FOUND, @@ -93,7 +90,7 @@ describe("resolvers -> Mutation -> createEvent", () => { startDate: "", startTime: "", title: "", - recurrance: Recurrance.Daily, + recurrance: "DAILY", }, }; @@ -126,7 +123,7 @@ describe("resolvers -> Mutation -> createEvent", () => { startDate: "", startTime: "", title: "", - recurrance: Recurrance.Daily, + recurrance: "DAILY", }, }; @@ -169,7 +166,7 @@ describe("resolvers -> Mutation -> createEvent", () => { startDate: new Date().toUTCString(), startTime: new Date().toUTCString(), title: "newTitle", - recurrance: Recurrance.Daily, + recurrance: "DAILY", }, }; @@ -190,7 +187,7 @@ describe("resolvers -> Mutation -> createEvent", () => { location: "newLocation", recurring: false, title: "newTitle", - recurrance: Recurrance.Daily, + recurrance: "DAILY", creator: testUser._id, registrants: expect.arrayContaining([ expect.objectContaining({ diff --git a/__tests__/resolvers/Mutation/createGroupChat.spec.ts b/tests/resolvers/Mutation/createGroupChat.spec.ts similarity index 95% rename from __tests__/resolvers/Mutation/createGroupChat.spec.ts rename to tests/resolvers/Mutation/createGroupChat.spec.ts index 758623dfce..7202399180 100644 --- a/__tests__/resolvers/Mutation/createGroupChat.spec.ts +++ b/tests/resolvers/Mutation/createGroupChat.spec.ts @@ -5,10 +5,10 @@ import { User, Organization, Interface_Organization, -} from "../../../src/lib/models"; -import { MutationCreateGroupChatArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationCreateGroupChatArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { createGroupChat as createGroupChatResolver } from "../../../src/lib/resolvers/Mutation/createGroupChat"; +import { createGroupChat as createGroupChatResolver } from "../../../src/resolvers/Mutation/createGroupChat"; import { ORGANIZATION_NOT_FOUND, USER_NOT_FOUND } from "../../../src/constants"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Mutation/createMessageChat.spec.ts b/tests/resolvers/Mutation/createMessageChat.spec.ts similarity index 91% rename from __tests__/resolvers/Mutation/createMessageChat.spec.ts rename to tests/resolvers/Mutation/createMessageChat.spec.ts index 4b63466d54..36541f89d8 100644 --- a/__tests__/resolvers/Mutation/createMessageChat.spec.ts +++ b/tests/resolvers/Mutation/createMessageChat.spec.ts @@ -4,8 +4,8 @@ import { Interface_User, User, Interface_MessageChat, -} from "../../../src/lib/models"; -import { MutationCreateMessageChatArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationCreateMessageChatArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; import { USER_NOT_FOUND, USER_NOT_FOUND_MESSAGE } from "../../../src/constants"; import { nanoid } from "nanoid"; @@ -76,7 +76,7 @@ describe("resolvers -> Mutation -> createMessageChat", () => { }); const { createMessageChat: createMessageChatResolver } = await import( - "../../../src/lib/resolvers/Mutation/createMessageChat" + "../../../src/resolvers/Mutation/createMessageChat" ); await createMessageChatResolver?.({}, args, context); } catch (error: any) { @@ -85,7 +85,7 @@ describe("resolvers -> Mutation -> createMessageChat", () => { }); it(`throws NotFoundError if no user exists with _id === args.data.receiver and IN_PRODUCTION === true`, async () => { - const { requestContext } = await import("../../../src/lib/libraries"); + const { requestContext } = await import("../../../src/libraries"); const spy = vi .spyOn(requestContext, "translate") .mockImplementationOnce((message) => `Translated ${message}`); @@ -113,7 +113,7 @@ describe("resolvers -> Mutation -> createMessageChat", () => { }); const { createMessageChat: createMessageChatResolver } = await import( - "../../../src/lib/resolvers/Mutation/createMessageChat" + "../../../src/resolvers/Mutation/createMessageChat" ); await createMessageChatResolver?.({}, args, context); } catch (error: any) { @@ -147,7 +147,7 @@ describe("resolvers -> Mutation -> createMessageChat", () => { }; const { createMessageChat: createMessageChatResolver } = await import( - "../../../src/lib/resolvers/Mutation/createMessageChat" + "../../../src/resolvers/Mutation/createMessageChat" ); const createMessageChatPayload = await createMessageChatResolver?.( {}, diff --git a/__tests__/resolvers/Mutation/createOrganization.spec.ts b/tests/resolvers/Mutation/createOrganization.spec.ts similarity index 92% rename from __tests__/resolvers/Mutation/createOrganization.spec.ts rename to tests/resolvers/Mutation/createOrganization.spec.ts index 6054db8d53..5326ac0fc6 100644 --- a/__tests__/resolvers/Mutation/createOrganization.spec.ts +++ b/tests/resolvers/Mutation/createOrganization.spec.ts @@ -1,9 +1,9 @@ import "dotenv/config"; import { Document, Types } from "mongoose"; -import { Interface_User, User } from "../../../src/lib/models"; -import { MutationCreateOrganizationArgs } from "../../../src/generated/graphqlCodegen"; +import { Interface_User, User } from "../../../src/models"; +import { MutationCreateOrganizationArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { createOrganization as createOrganizationResolver } from "../../../src/lib/resolvers/Mutation/createOrganization"; +import { createOrganization as createOrganizationResolver } from "../../../src/resolvers/Mutation/createOrganization"; import { USER_NOT_FOUND } from "../../../src/constants"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Mutation/createPlugin.spec.ts b/tests/resolvers/Mutation/createPlugin.spec.ts similarity index 88% rename from __tests__/resolvers/Mutation/createPlugin.spec.ts rename to tests/resolvers/Mutation/createPlugin.spec.ts index 2fbf1eecef..909963c7cd 100644 --- a/__tests__/resolvers/Mutation/createPlugin.spec.ts +++ b/tests/resolvers/Mutation/createPlugin.spec.ts @@ -1,9 +1,9 @@ import "dotenv/config"; import { Document } from "mongoose"; -import { Interface_User, User } from "../../../src/lib/models"; -import { MutationCreatePluginArgs } from "../../../src/generated/graphqlCodegen"; +import { Interface_User, User } from "../../../src/models"; +import { MutationCreatePluginArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { createPlugin as createPluginResolver } from "../../../src/lib/resolvers/Mutation/createPlugin"; +import { createPlugin as createPluginResolver } from "../../../src/resolvers/Mutation/createPlugin"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Mutation/createPost.spec.ts b/tests/resolvers/Mutation/createPost.spec.ts similarity index 93% rename from __tests__/resolvers/Mutation/createPost.spec.ts rename to tests/resolvers/Mutation/createPost.spec.ts index 2a18782e20..e9d48abd1e 100644 --- a/__tests__/resolvers/Mutation/createPost.spec.ts +++ b/tests/resolvers/Mutation/createPost.spec.ts @@ -5,10 +5,10 @@ import { User, Organization, Interface_Organization, -} from "../../../src/lib/models"; -import { MutationCreatePostArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationCreatePostArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { createPost as createPostResolver } from "../../../src/lib/resolvers/Mutation/createPost"; +import { createPost as createPostResolver } from "../../../src/resolvers/Mutation/createPost"; import { ORGANIZATION_NOT_FOUND, USER_NOT_FOUND } from "../../../src/constants"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Mutation/createTask.spec.ts b/tests/resolvers/Mutation/createTask.spec.ts similarity index 94% rename from __tests__/resolvers/Mutation/createTask.spec.ts rename to tests/resolvers/Mutation/createTask.spec.ts index 7e31da1ac4..6f676b2395 100644 --- a/__tests__/resolvers/Mutation/createTask.spec.ts +++ b/tests/resolvers/Mutation/createTask.spec.ts @@ -6,10 +6,10 @@ import { Organization, Event, Interface_Event, -} from "../../../src/lib/models"; -import { MutationCreateTaskArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationCreateTaskArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { createTask as createTaskResolver } from "../../../src/lib/resolvers/Mutation/createTask"; +import { createTask as createTaskResolver } from "../../../src/resolvers/Mutation/createTask"; import { EVENT_NOT_FOUND, USER_NOT_FOUND } from "../../../src/constants"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Mutation/deleteDonationById.spec.ts b/tests/resolvers/Mutation/deleteDonationById.spec.ts similarity index 92% rename from __tests__/resolvers/Mutation/deleteDonationById.spec.ts rename to tests/resolvers/Mutation/deleteDonationById.spec.ts index e34b910807..5889ebd284 100644 --- a/__tests__/resolvers/Mutation/deleteDonationById.spec.ts +++ b/tests/resolvers/Mutation/deleteDonationById.spec.ts @@ -5,10 +5,10 @@ import { Organization, Interface_Donation, Donation, -} from "../../../src/lib/models"; -import { MutationDeleteDonationByIdArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationDeleteDonationByIdArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { deleteDonationById as deleteDonationByIdResolver } from "../../../src/lib/resolvers/Mutation/deleteDonationById"; +import { deleteDonationById as deleteDonationByIdResolver } from "../../../src/resolvers/Mutation/deleteDonationById"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Mutation/forgotPassword.spec.ts b/tests/resolvers/Mutation/forgotPassword.spec.ts similarity index 91% rename from __tests__/resolvers/Mutation/forgotPassword.spec.ts rename to tests/resolvers/Mutation/forgotPassword.spec.ts index 5d530590cb..3452f16159 100644 --- a/__tests__/resolvers/Mutation/forgotPassword.spec.ts +++ b/tests/resolvers/Mutation/forgotPassword.spec.ts @@ -1,9 +1,9 @@ import "dotenv/config"; import { Document } from "mongoose"; -import { Interface_User, User } from "../../../src/lib/models"; -import { MutationForgotPasswordArgs } from "../../../src/generated/graphqlCodegen"; +import { Interface_User, User } from "../../../src/models"; +import { MutationForgotPasswordArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { forgotPassword as forgotPasswordResolver } from "../../../src/lib/resolvers/Mutation/forgotPassword"; +import { forgotPassword as forgotPasswordResolver } from "../../../src/resolvers/Mutation/forgotPassword"; import { INVALID_OTP } from "../../../src/constants"; import jwt from "jsonwebtoken"; import { nanoid } from "nanoid"; diff --git a/__tests__/resolvers/Mutation/joinPublicOrganization.spec.ts b/tests/resolvers/Mutation/joinPublicOrganization.spec.ts similarity index 97% rename from __tests__/resolvers/Mutation/joinPublicOrganization.spec.ts rename to tests/resolvers/Mutation/joinPublicOrganization.spec.ts index 8172be2d61..6889b3f9c6 100644 --- a/__tests__/resolvers/Mutation/joinPublicOrganization.spec.ts +++ b/tests/resolvers/Mutation/joinPublicOrganization.spec.ts @@ -5,10 +5,10 @@ import { User, Organization, Interface_Organization, -} from "../../../src/lib/models"; -import { MutationJoinPublicOrganizationArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationJoinPublicOrganizationArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { joinPublicOrganization as joinPublicOrganizationResolver } from "../../../src/lib/resolvers/Mutation/joinPublicOrganization"; +import { joinPublicOrganization as joinPublicOrganizationResolver } from "../../../src/resolvers/Mutation/joinPublicOrganization"; import { ORGANIZATION_NOT_FOUND, USER_ALREADY_MEMBER, diff --git a/__tests__/resolvers/Mutation/leaveOrganization.spec.ts b/tests/resolvers/Mutation/leaveOrganization.spec.ts similarity index 96% rename from __tests__/resolvers/Mutation/leaveOrganization.spec.ts rename to tests/resolvers/Mutation/leaveOrganization.spec.ts index 4f36a44b73..d030abfb8e 100644 --- a/__tests__/resolvers/Mutation/leaveOrganization.spec.ts +++ b/tests/resolvers/Mutation/leaveOrganization.spec.ts @@ -5,10 +5,10 @@ import { User, Organization, Interface_Organization, -} from "../../../src/lib/models"; -import { MutationLeaveOrganizationArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationLeaveOrganizationArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { leaveOrganization as leaveOrganizationResolver } from "../../../src/lib/resolvers/Mutation/leaveOrganization"; +import { leaveOrganization as leaveOrganizationResolver } from "../../../src/resolvers/Mutation/leaveOrganization"; import { MEMBER_NOT_FOUND, ORGANIZATION_NOT_FOUND, diff --git a/__tests__/resolvers/Mutation/likeComment.spec.ts b/tests/resolvers/Mutation/likeComment.spec.ts similarity index 95% rename from __tests__/resolvers/Mutation/likeComment.spec.ts rename to tests/resolvers/Mutation/likeComment.spec.ts index bf619ccfdf..eabbb9cc3a 100644 --- a/__tests__/resolvers/Mutation/likeComment.spec.ts +++ b/tests/resolvers/Mutation/likeComment.spec.ts @@ -7,10 +7,10 @@ import { Post, Comment, Interface_Comment, -} from "../../../src/lib/models"; -import { MutationLikeCommentArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationLikeCommentArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { likeComment as likeCommentResolver } from "../../../src/lib/resolvers/Mutation/likeComment"; +import { likeComment as likeCommentResolver } from "../../../src/resolvers/Mutation/likeComment"; import { COMMENT_NOT_FOUND, USER_NOT_FOUND } from "../../../src/constants"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Mutation/likePost.spec.ts b/tests/resolvers/Mutation/likePost.spec.ts similarity index 93% rename from __tests__/resolvers/Mutation/likePost.spec.ts rename to tests/resolvers/Mutation/likePost.spec.ts index bbeab0ac78..a89a174073 100644 --- a/__tests__/resolvers/Mutation/likePost.spec.ts +++ b/tests/resolvers/Mutation/likePost.spec.ts @@ -6,10 +6,10 @@ import { Organization, Post, Interface_Post, -} from "../../../src/lib/models"; -import { MutationLikePostArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationLikePostArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { likePost as likePostResolver } from "../../../src/lib/resolvers/Mutation/likePost"; +import { likePost as likePostResolver } from "../../../src/resolvers/Mutation/likePost"; import { POST_NOT_FOUND, USER_NOT_FOUND } from "../../../src/constants"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Mutation/login.spec.ts b/tests/resolvers/Mutation/login.spec.ts similarity index 95% rename from __tests__/resolvers/Mutation/login.spec.ts rename to tests/resolvers/Mutation/login.spec.ts index 7d49306df4..8d232c7da9 100644 --- a/__tests__/resolvers/Mutation/login.spec.ts +++ b/tests/resolvers/Mutation/login.spec.ts @@ -6,14 +6,14 @@ import { Organization, Event, MembershipRequest, -} from "../../../src/lib/models"; -import { MutationLoginArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationLoginArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { login as loginResolver } from "../../../src/lib/resolvers/Mutation/login"; +import { login as loginResolver } from "../../../src/resolvers/Mutation/login"; import { androidFirebaseOptions, iosFirebaseOptions, -} from "../../../src/lib/config"; +} from "../../../src/config"; import { USER_NOT_FOUND } from "../../../src/constants"; import bcrypt from "bcryptjs"; import { nanoid } from "nanoid"; diff --git a/__tests__/resolvers/Mutation/logout.spec.ts b/tests/resolvers/Mutation/logout.spec.ts similarity index 94% rename from __tests__/resolvers/Mutation/logout.spec.ts rename to tests/resolvers/Mutation/logout.spec.ts index 8cee8dc1bc..fd95a90d41 100644 --- a/__tests__/resolvers/Mutation/logout.spec.ts +++ b/tests/resolvers/Mutation/logout.spec.ts @@ -5,9 +5,9 @@ import { User, Organization, Interface_Organization, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { connect, disconnect } from "../../../src/db"; -import { logout as logoutResolver } from "../../../src/lib/resolvers/Mutation/logout"; +import { logout as logoutResolver } from "../../../src/resolvers/Mutation/logout"; import { USER_NOT_FOUND } from "../../../src/constants"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Mutation/otp.spec.ts b/tests/resolvers/Mutation/otp.spec.ts similarity index 87% rename from __tests__/resolvers/Mutation/otp.spec.ts rename to tests/resolvers/Mutation/otp.spec.ts index fab8b6e0d7..ae2deb7eb8 100644 --- a/__tests__/resolvers/Mutation/otp.spec.ts +++ b/tests/resolvers/Mutation/otp.spec.ts @@ -1,9 +1,9 @@ import "dotenv/config"; -import { MutationOtpArgs } from "../../../src/generated/graphqlCodegen"; +import { MutationOtpArgs } from "../../../src/types/generatedGraphQLTypes"; // import { Document } from "mongoose"; -// import { Interface_User, User } from "../../../src/lib/models"; +// import { Interface_User, User } from "../../../src/models"; import { connect, disconnect } from "../../../src/db"; -import { otp as otpResolver } from "../../../src/lib/resolvers/Mutation/otp"; +import { otp as otpResolver } from "../../../src/resolvers/Mutation/otp"; import { USER_NOT_FOUND } from "../../../src/constants"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; @@ -28,7 +28,6 @@ afterAll(async () => { // describe('Testing otp resolver', () => { // test('otp', async () => { -// console.log(token); // const args = { // data: { diff --git a/__tests__/resolvers/Mutation/recaptcha.spec.ts b/tests/resolvers/Mutation/recaptcha.spec.ts similarity index 67% rename from __tests__/resolvers/Mutation/recaptcha.spec.ts rename to tests/resolvers/Mutation/recaptcha.spec.ts index a5e15148f1..35b958133b 100644 --- a/__tests__/resolvers/Mutation/recaptcha.spec.ts +++ b/tests/resolvers/Mutation/recaptcha.spec.ts @@ -1,5 +1,5 @@ -import { MutationRecaptchaArgs } from "../../../src/generated/graphqlCodegen"; -import { recaptcha as recaptchaResolver } from "../../../src/lib/resolvers/Mutation/recaptcha"; +import { MutationRecaptchaArgs } from "../../../src/types/generatedGraphQLTypes"; +import { recaptcha as recaptchaResolver } from "../../../src/resolvers/Mutation/recaptcha"; import { describe, it, expect } from "vitest"; describe("resolvers -> Mutation -> recaptcha", () => { diff --git a/__tests__/resolvers/Mutation/refreshToken.spec.ts b/tests/resolvers/Mutation/refreshToken.spec.ts similarity index 92% rename from __tests__/resolvers/Mutation/refreshToken.spec.ts rename to tests/resolvers/Mutation/refreshToken.spec.ts index 2141fb26cf..3eb04633b2 100644 --- a/__tests__/resolvers/Mutation/refreshToken.spec.ts +++ b/tests/resolvers/Mutation/refreshToken.spec.ts @@ -1,11 +1,11 @@ import "dotenv/config"; import { Document, Types } from "mongoose"; -import { Interface_User, User } from "../../../src/lib/models"; -import { MutationRefreshTokenArgs } from "../../../src/generated/graphqlCodegen"; +import { Interface_User, User } from "../../../src/models"; +import { MutationRefreshTokenArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { refreshToken as refreshTokenResolver } from "../../../src/lib/resolvers/Mutation/refreshToken"; +import { refreshToken as refreshTokenResolver } from "../../../src/resolvers/Mutation/refreshToken"; import { USER_NOT_FOUND } from "../../../src/constants"; -import { createRefreshToken } from "../../../src/lib/utilities"; +import { createRefreshToken } from "../../../src/utilities"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Mutation/registerForEvent.spec.ts b/tests/resolvers/Mutation/registerForEvent.spec.ts similarity index 96% rename from __tests__/resolvers/Mutation/registerForEvent.spec.ts rename to tests/resolvers/Mutation/registerForEvent.spec.ts index 019a4b84ea..5e8dc9cea9 100644 --- a/__tests__/resolvers/Mutation/registerForEvent.spec.ts +++ b/tests/resolvers/Mutation/registerForEvent.spec.ts @@ -6,10 +6,10 @@ import { Organization, Event, Interface_Event, -} from "../../../src/lib/models"; -import { MutationRegisterForEventArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationRegisterForEventArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { registerForEvent as registerForEventResolver } from "../../../src/lib/resolvers/Mutation/registerForEvent"; +import { registerForEvent as registerForEventResolver } from "../../../src/resolvers/Mutation/registerForEvent"; import { EVENT_NOT_FOUND, REGISTRANT_ALREADY_EXIST, diff --git a/__tests__/resolvers/Mutation/rejectAdmin.spec.ts b/tests/resolvers/Mutation/rejectAdmin.spec.ts similarity index 93% rename from __tests__/resolvers/Mutation/rejectAdmin.spec.ts rename to tests/resolvers/Mutation/rejectAdmin.spec.ts index 8a61a8fc14..74564ef88a 100644 --- a/__tests__/resolvers/Mutation/rejectAdmin.spec.ts +++ b/tests/resolvers/Mutation/rejectAdmin.spec.ts @@ -1,9 +1,9 @@ import "dotenv/config"; import { Document, Types } from "mongoose"; -import { Interface_User, User } from "../../../src/lib/models"; -import { MutationRejectAdminArgs } from "../../../src/generated/graphqlCodegen"; +import { Interface_User, User } from "../../../src/models"; +import { MutationRejectAdminArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { rejectAdmin as rejectAdminResolver } from "../../../src/lib/resolvers/Mutation/rejectAdmin"; +import { rejectAdmin as rejectAdminResolver } from "../../../src/resolvers/Mutation/rejectAdmin"; import { USER_NOT_AUTHORIZED, USER_NOT_FOUND } from "../../../src/constants"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Mutation/rejectMembershipRequest.spec.ts b/tests/resolvers/Mutation/rejectMembershipRequest.spec.ts similarity index 97% rename from __tests__/resolvers/Mutation/rejectMembershipRequest.spec.ts rename to tests/resolvers/Mutation/rejectMembershipRequest.spec.ts index d2ed28056c..d36e381639 100644 --- a/__tests__/resolvers/Mutation/rejectMembershipRequest.spec.ts +++ b/tests/resolvers/Mutation/rejectMembershipRequest.spec.ts @@ -7,10 +7,10 @@ import { Interface_Organization, MembershipRequest, Interface_MembershipRequest, -} from "../../../src/lib/models"; -import { MutationRejectMembershipRequestArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationRejectMembershipRequestArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { rejectMembershipRequest as rejectMembershipRequestResolver } from "../../../src/lib/resolvers/Mutation/rejectMembershipRequest"; +import { rejectMembershipRequest as rejectMembershipRequestResolver } from "../../../src/resolvers/Mutation/rejectMembershipRequest"; import { MEMBERSHIP_REQUEST_NOT_FOUND, ORGANIZATION_NOT_FOUND, diff --git a/__tests__/resolvers/Mutation/removeAdmin.spec.ts b/tests/resolvers/Mutation/removeAdmin.spec.ts similarity index 96% rename from __tests__/resolvers/Mutation/removeAdmin.spec.ts rename to tests/resolvers/Mutation/removeAdmin.spec.ts index 0d698dfa8f..f4ab2996e3 100644 --- a/__tests__/resolvers/Mutation/removeAdmin.spec.ts +++ b/tests/resolvers/Mutation/removeAdmin.spec.ts @@ -5,10 +5,10 @@ import { User, Organization, Interface_Organization, -} from "../../../src/lib/models"; -import { MutationRemoveAdminArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationRemoveAdminArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { removeAdmin as removeAdminResolver } from "../../../src/lib/resolvers/Mutation/removeAdmin"; +import { removeAdmin as removeAdminResolver } from "../../../src/resolvers/Mutation/removeAdmin"; import { ORGANIZATION_NOT_FOUND, USER_NOT_AUTHORIZED, diff --git a/__tests__/resolvers/Mutation/removeComment.spec.ts b/tests/resolvers/Mutation/removeComment.spec.ts similarity index 96% rename from __tests__/resolvers/Mutation/removeComment.spec.ts rename to tests/resolvers/Mutation/removeComment.spec.ts index fea6057117..c59d163ae1 100644 --- a/__tests__/resolvers/Mutation/removeComment.spec.ts +++ b/tests/resolvers/Mutation/removeComment.spec.ts @@ -9,10 +9,10 @@ import { Interface_Post, Interface_Comment, Post, -} from "../../../src/lib/models"; -import { MutationRemoveCommentArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationRemoveCommentArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { removeComment as removeCommentResolver } from "../../../src/lib/resolvers/Mutation/removeComment"; +import { removeComment as removeCommentResolver } from "../../../src/resolvers/Mutation/removeComment"; import { COMMENT_NOT_FOUND, USER_NOT_AUTHORIZED, diff --git a/__tests__/resolvers/Mutation/removeDirectChat.spec.ts b/tests/resolvers/Mutation/removeDirectChat.spec.ts similarity index 92% rename from __tests__/resolvers/Mutation/removeDirectChat.spec.ts rename to tests/resolvers/Mutation/removeDirectChat.spec.ts index b898f08ff8..4ce625ba42 100644 --- a/__tests__/resolvers/Mutation/removeDirectChat.spec.ts +++ b/tests/resolvers/Mutation/removeDirectChat.spec.ts @@ -8,8 +8,8 @@ import { Interface_DirectChat, DirectChat, DirectChatMessage, -} from "../../../src/lib/models"; -import { MutationRemoveDirectChatArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationRemoveDirectChatArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; import { CHAT_NOT_FOUND, @@ -130,7 +130,7 @@ describe("resolvers -> Mutation -> removeDirectChat", () => { }); const { removeDirectChat: removeDirectChatResolver } = await import( - "../../../src/lib/resolvers/Mutation/removeDirectChat" + "../../../src/resolvers/Mutation/removeDirectChat" ); await removeDirectChatResolver?.({}, args, context); } catch (error: any) { @@ -139,7 +139,7 @@ describe("resolvers -> Mutation -> removeDirectChat", () => { }); it(`throws NotFoundError if no organization exists with _id === args.organizationId and IN_PRODUCTION === true`, async () => { - const { requestContext } = await import("../../../src/lib/libraries"); + const { requestContext } = await import("../../../src/libraries"); const spy = vi .spyOn(requestContext, "translate") .mockImplementation((message) => `Translated ${message}`); @@ -165,7 +165,7 @@ describe("resolvers -> Mutation -> removeDirectChat", () => { }); const { removeDirectChat: removeDirectChatResolver } = await import( - "../../../src/lib/resolvers/Mutation/removeDirectChat" + "../../../src/resolvers/Mutation/removeDirectChat" ); await removeDirectChatResolver?.({}, args, context); } catch (error: any) { @@ -198,7 +198,7 @@ describe("resolvers -> Mutation -> removeDirectChat", () => { }); const { removeDirectChat: removeDirectChatResolver } = await import( - "../../../src/lib/resolvers/Mutation/removeDirectChat" + "../../../src/resolvers/Mutation/removeDirectChat" ); await removeDirectChatResolver?.({}, args, context); } catch (error: any) { @@ -207,7 +207,7 @@ describe("resolvers -> Mutation -> removeDirectChat", () => { }); it(`throws NotFoundError if no directChat exists with _id === args.chatId and IN_PRODUCTION === true`, async () => { - const { requestContext } = await import("../../../src/lib/libraries"); + const { requestContext } = await import("../../../src/libraries"); const spy = vi .spyOn(requestContext, "translate") .mockImplementation((message) => `Translated ${message}`); @@ -233,7 +233,7 @@ describe("resolvers -> Mutation -> removeDirectChat", () => { }); const { removeDirectChat: removeDirectChatResolver } = await import( - "../../../src/lib/resolvers/Mutation/removeDirectChat" + "../../../src/resolvers/Mutation/removeDirectChat" ); await removeDirectChatResolver?.({}, args, context); } catch (error: any) { @@ -266,7 +266,7 @@ describe("resolvers -> Mutation -> removeDirectChat", () => { }; const { removeDirectChat: removeDirectChatResolver } = await import( - "../../../src/lib/resolvers/Mutation/removeDirectChat" + "../../../src/resolvers/Mutation/removeDirectChat" ); await removeDirectChatResolver?.({}, args, context); } catch (error: any) { @@ -296,7 +296,7 @@ describe("resolvers -> Mutation -> removeDirectChat", () => { }; const { removeDirectChat: removeDirectChatResolver } = await import( - "../../../src/lib/resolvers/Mutation/removeDirectChat" + "../../../src/resolvers/Mutation/removeDirectChat" ); const removeDirectChatPayload = await removeDirectChatResolver?.( {}, diff --git a/__tests__/resolvers/Mutation/removeEvent.spec.ts b/tests/resolvers/Mutation/removeEvent.spec.ts similarity index 96% rename from __tests__/resolvers/Mutation/removeEvent.spec.ts rename to tests/resolvers/Mutation/removeEvent.spec.ts index 93dfb98038..6da0f42911 100644 --- a/__tests__/resolvers/Mutation/removeEvent.spec.ts +++ b/tests/resolvers/Mutation/removeEvent.spec.ts @@ -7,10 +7,10 @@ import { Interface_Organization, Interface_Event, Event, -} from "../../../src/lib/models"; -import { MutationRemoveEventArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationRemoveEventArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { removeEvent as removeEventResolver } from "../../../src/lib/resolvers/Mutation/removeEvent"; +import { removeEvent as removeEventResolver } from "../../../src/resolvers/Mutation/removeEvent"; import { EVENT_NOT_FOUND, USER_NOT_AUTHORIZED, diff --git a/__tests__/resolvers/Mutation/removeGroupChat.spec.ts b/tests/resolvers/Mutation/removeGroupChat.spec.ts similarity index 96% rename from __tests__/resolvers/Mutation/removeGroupChat.spec.ts rename to tests/resolvers/Mutation/removeGroupChat.spec.ts index ccfe4b2519..9366c49ebf 100644 --- a/__tests__/resolvers/Mutation/removeGroupChat.spec.ts +++ b/tests/resolvers/Mutation/removeGroupChat.spec.ts @@ -8,10 +8,10 @@ import { GroupChat, Interface_GroupChat, GroupChatMessage, -} from "../../../src/lib/models"; -import { MutationRemoveGroupChatArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationRemoveGroupChatArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { removeGroupChat as removeGroupChatResolver } from "../../../src/lib/resolvers/Mutation/removeGroupChat"; +import { removeGroupChat as removeGroupChatResolver } from "../../../src/resolvers/Mutation/removeGroupChat"; import { CHAT_NOT_FOUND, ORGANIZATION_NOT_FOUND, diff --git a/__tests__/resolvers/Mutation/removeMember.spec.ts b/tests/resolvers/Mutation/removeMember.spec.ts similarity index 97% rename from __tests__/resolvers/Mutation/removeMember.spec.ts rename to tests/resolvers/Mutation/removeMember.spec.ts index c8e7c8cd4d..56985b072e 100644 --- a/__tests__/resolvers/Mutation/removeMember.spec.ts +++ b/tests/resolvers/Mutation/removeMember.spec.ts @@ -5,10 +5,10 @@ import { User, Organization, Interface_Organization, -} from "../../../src/lib/models"; -import { MutationRemoveMemberArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationRemoveMemberArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { removeMember as removeMemberResolver } from "../../../src/lib/resolvers/Mutation/removeMember"; +import { removeMember as removeMemberResolver } from "../../../src/resolvers/Mutation/removeMember"; import { MEMBER_NOT_FOUND, ORGANIZATION_NOT_FOUND, diff --git a/__tests__/resolvers/Mutation/removeOrganization.spec.ts b/tests/resolvers/Mutation/removeOrganization.spec.ts similarity index 97% rename from __tests__/resolvers/Mutation/removeOrganization.spec.ts rename to tests/resolvers/Mutation/removeOrganization.spec.ts index 428f61f842..23a433e5ca 100644 --- a/__tests__/resolvers/Mutation/removeOrganization.spec.ts +++ b/tests/resolvers/Mutation/removeOrganization.spec.ts @@ -10,10 +10,10 @@ import { MembershipRequest, Interface_Comment, Interface_Post, -} from "../../../src/lib/models"; -import { MutationRemoveOrganizationArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationRemoveOrganizationArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { removeOrganization as removeOrganizationResolver } from "../../../src/lib/resolvers/Mutation/removeOrganization"; +import { removeOrganization as removeOrganizationResolver } from "../../../src/resolvers/Mutation/removeOrganization"; import { ORGANIZATION_NOT_FOUND, USER_NOT_AUTHORIZED, diff --git a/__tests__/resolvers/Mutation/removeOrganizationImage.spec.ts b/tests/resolvers/Mutation/removeOrganizationImage.spec.ts similarity index 97% rename from __tests__/resolvers/Mutation/removeOrganizationImage.spec.ts rename to tests/resolvers/Mutation/removeOrganizationImage.spec.ts index fee164e8dc..d33393d36c 100644 --- a/__tests__/resolvers/Mutation/removeOrganizationImage.spec.ts +++ b/tests/resolvers/Mutation/removeOrganizationImage.spec.ts @@ -5,10 +5,10 @@ import { User, Organization, Interface_Organization, -} from "../../../src/lib/models"; -import { MutationRemoveOrganizationImageArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationRemoveOrganizationImageArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { removeOrganizationImage as removeOrganizationImageResolver } from "../../../src/lib/resolvers/Mutation/removeOrganizationImage"; +import { removeOrganizationImage as removeOrganizationImageResolver } from "../../../src/resolvers/Mutation/removeOrganizationImage"; import { ORGANIZATION_NOT_FOUND, USER_NOT_AUTHORIZED, diff --git a/__tests__/resolvers/Mutation/removePost.spec.ts b/tests/resolvers/Mutation/removePost.spec.ts similarity index 94% rename from __tests__/resolvers/Mutation/removePost.spec.ts rename to tests/resolvers/Mutation/removePost.spec.ts index eabafe3887..2a107b54cc 100644 --- a/__tests__/resolvers/Mutation/removePost.spec.ts +++ b/tests/resolvers/Mutation/removePost.spec.ts @@ -6,10 +6,10 @@ import { Organization, Interface_Post, Post, -} from "../../../src/lib/models"; -import { MutationRemovePostArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationRemovePostArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { removePost as removePostResolver } from "../../../src/lib/resolvers/Mutation/removePost"; +import { removePost as removePostResolver } from "../../../src/resolvers/Mutation/removePost"; import { POST_NOT_FOUND, USER_NOT_AUTHORIZED, diff --git a/__tests__/resolvers/Mutation/removeTask.spec.ts b/tests/resolvers/Mutation/removeTask.spec.ts similarity index 95% rename from __tests__/resolvers/Mutation/removeTask.spec.ts rename to tests/resolvers/Mutation/removeTask.spec.ts index 2fd79fc544..581f9e2ef4 100644 --- a/__tests__/resolvers/Mutation/removeTask.spec.ts +++ b/tests/resolvers/Mutation/removeTask.spec.ts @@ -7,10 +7,10 @@ import { Event, Task, Interface_Task, -} from "../../../src/lib/models"; -import { MutationRemoveTaskArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationRemoveTaskArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { removeTask as removeTaskResolver } from "../../../src/lib/resolvers/Mutation/removeTask"; +import { removeTask as removeTaskResolver } from "../../../src/resolvers/Mutation/removeTask"; import { USER_NOT_AUTHORIZED, USER_NOT_FOUND } from "../../../src/constants"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Mutation/removeUserFromGroupChat.spec.ts b/tests/resolvers/Mutation/removeUserFromGroupChat.spec.ts similarity index 97% rename from __tests__/resolvers/Mutation/removeUserFromGroupChat.spec.ts rename to tests/resolvers/Mutation/removeUserFromGroupChat.spec.ts index b52e22ae05..dc2f212f4c 100644 --- a/__tests__/resolvers/Mutation/removeUserFromGroupChat.spec.ts +++ b/tests/resolvers/Mutation/removeUserFromGroupChat.spec.ts @@ -7,10 +7,10 @@ import { GroupChat, Interface_GroupChat, Interface_Organization, -} from "../../../src/lib/models"; -import { MutationRemoveUserFromGroupChatArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationRemoveUserFromGroupChatArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { removeUserFromGroupChat as removeUserFromGroupChatResolver } from "../../../src/lib/resolvers/Mutation/removeUserFromGroupChat"; +import { removeUserFromGroupChat as removeUserFromGroupChatResolver } from "../../../src/resolvers/Mutation/removeUserFromGroupChat"; import { CHAT_NOT_FOUND, ORGANIZATION_NOT_FOUND, diff --git a/__tests__/resolvers/Mutation/removeUserImage.spec.ts b/tests/resolvers/Mutation/removeUserImage.spec.ts similarity index 89% rename from __tests__/resolvers/Mutation/removeUserImage.spec.ts rename to tests/resolvers/Mutation/removeUserImage.spec.ts index a8839a08ee..b964e4d7fb 100644 --- a/__tests__/resolvers/Mutation/removeUserImage.spec.ts +++ b/tests/resolvers/Mutation/removeUserImage.spec.ts @@ -1,6 +1,6 @@ import "dotenv/config"; import { Document, Types } from "mongoose"; -import { Interface_User, User } from "../../../src/lib/models"; +import { Interface_User, User } from "../../../src/models"; import { connect, disconnect } from "../../../src/db"; import { USER_NOT_FOUND, USER_NOT_FOUND_MESSAGE } from "../../../src/constants"; import { nanoid } from "nanoid"; @@ -15,7 +15,7 @@ import { } from "vitest"; let testUser: Interface_User & Document; -let testImage: string = "testImage"; +const testImage: string = "testImage"; beforeAll(async () => { await connect(); @@ -56,7 +56,7 @@ describe("resolvers -> Mutation -> removeUserImage", () => { }); const { removeUserImage: removeUserImageResolver } = await import( - "../../../src/lib/resolvers/Mutation/removeUserImage" + "../../../src/resolvers/Mutation/removeUserImage" ); await removeUserImageResolver?.({}, {}, context); @@ -66,7 +66,7 @@ describe("resolvers -> Mutation -> removeUserImage", () => { }); it(`throws NotFoundError if no user exists with _id === context.userId and IN_PRODUCTION === true`, async () => { - const { requestContext } = await import("../../../src/lib/libraries"); + const { requestContext } = await import("../../../src/libraries"); const spy = vi .spyOn(requestContext, "translate") .mockImplementationOnce((message) => `Translated ${message}`); @@ -87,7 +87,7 @@ describe("resolvers -> Mutation -> removeUserImage", () => { }); const { removeUserImage: removeUserImageResolver } = await import( - "../../../src/lib/resolvers/Mutation/removeUserImage" + "../../../src/resolvers/Mutation/removeUserImage" ); await removeUserImageResolver?.({}, {}, context); @@ -115,7 +115,7 @@ describe("resolvers -> Mutation -> removeUserImage", () => { }); const { removeUserImage: removeUserImageResolver } = await import( - "../../../src/lib/resolvers/Mutation/removeUserImage" + "../../../src/resolvers/Mutation/removeUserImage" ); await removeUserImageResolver?.({}, {}, context); @@ -126,7 +126,7 @@ describe("resolvers -> Mutation -> removeUserImage", () => { it(`throws NotFoundError if no user.image exists for currentUser with _id === context.userId and IN_PRODUCTION === true`, async () => { - const { requestContext } = await import("../../../src/lib/libraries"); + const { requestContext } = await import("../../../src/libraries"); const spy = vi .spyOn(requestContext, "translate") .mockImplementationOnce((message) => `Translated ${message}`); @@ -147,7 +147,7 @@ describe("resolvers -> Mutation -> removeUserImage", () => { }); const { removeUserImage: removeUserImageResolver } = await import( - "../../../src/lib/resolvers/Mutation/removeUserImage" + "../../../src/resolvers/Mutation/removeUserImage" ); await removeUserImageResolver?.({}, {}, context); @@ -159,7 +159,7 @@ describe("resolvers -> Mutation -> removeUserImage", () => { it(`sets image field to null for organization with _id === args.organizationId and returns the updated user`, async () => { - const utilities = await import("../../../src/lib/utilities"); + const utilities = await import("../../../src/utilities"); const deleteImageSpy = vi .spyOn(utilities, "deleteImage") @@ -183,7 +183,7 @@ describe("resolvers -> Mutation -> removeUserImage", () => { }; const { removeUserImage: removeUserImageResolver } = await import( - "../../../src/lib/resolvers/Mutation/removeUserImage" + "../../../src/resolvers/Mutation/removeUserImage" ); const removeUserImagePayload = await removeUserImageResolver?.( diff --git a/__tests__/resolvers/Mutation/revokeRefreshTokenForUser.spec.ts b/tests/resolvers/Mutation/revokeRefreshTokenForUser.spec.ts similarity index 89% rename from __tests__/resolvers/Mutation/revokeRefreshTokenForUser.spec.ts rename to tests/resolvers/Mutation/revokeRefreshTokenForUser.spec.ts index adc61a2dd4..dd86e86c9b 100644 --- a/__tests__/resolvers/Mutation/revokeRefreshTokenForUser.spec.ts +++ b/tests/resolvers/Mutation/revokeRefreshTokenForUser.spec.ts @@ -1,9 +1,9 @@ import "dotenv/config"; import { Document } from "mongoose"; -import { Interface_User, User } from "../../../src/lib/models"; -import { MutationRevokeRefreshTokenForUserArgs } from "../../../src/generated/graphqlCodegen"; +import { Interface_User, User } from "../../../src/models"; +import { MutationRevokeRefreshTokenForUserArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { revokeRefreshTokenForUser as revokeRefreshTokenForUserResolver } from "../../../src/lib/resolvers/Mutation/revokeRefreshTokenForUser"; +import { revokeRefreshTokenForUser as revokeRefreshTokenForUserResolver } from "../../../src/resolvers/Mutation/revokeRefreshTokenForUser"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Mutation/saveFcmToken.spec.ts b/tests/resolvers/Mutation/saveFcmToken.spec.ts similarity index 90% rename from __tests__/resolvers/Mutation/saveFcmToken.spec.ts rename to tests/resolvers/Mutation/saveFcmToken.spec.ts index cc3ca56b59..e1566fe9ff 100644 --- a/__tests__/resolvers/Mutation/saveFcmToken.spec.ts +++ b/tests/resolvers/Mutation/saveFcmToken.spec.ts @@ -1,9 +1,9 @@ import "dotenv/config"; import { Document, Types } from "mongoose"; -import { Interface_User, User } from "../../../src/lib/models"; -import { MutationSaveFcmTokenArgs } from "../../../src/generated/graphqlCodegen"; +import { Interface_User, User } from "../../../src/models"; +import { MutationSaveFcmTokenArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { saveFcmToken as saveFcmTokenResolver } from "../../../src/lib/resolvers/Mutation/saveFcmToken"; +import { saveFcmToken as saveFcmTokenResolver } from "../../../src/resolvers/Mutation/saveFcmToken"; import { USER_NOT_FOUND } from "../../../src/constants"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Mutation/sendMembershipRequest.spec.ts b/tests/resolvers/Mutation/sendMembershipRequest.spec.ts similarity index 97% rename from __tests__/resolvers/Mutation/sendMembershipRequest.spec.ts rename to tests/resolvers/Mutation/sendMembershipRequest.spec.ts index fda0a7d0cd..0b10377e34 100644 --- a/__tests__/resolvers/Mutation/sendMembershipRequest.spec.ts +++ b/tests/resolvers/Mutation/sendMembershipRequest.spec.ts @@ -7,10 +7,10 @@ import { Interface_Organization, MembershipRequest, Interface_MembershipRequest, -} from "../../../src/lib/models"; -import { MutationSendMembershipRequestArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationSendMembershipRequestArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { sendMembershipRequest as sendMembershipRequestResolver } from "../../../src/lib/resolvers/Mutation/sendMembershipRequest"; +import { sendMembershipRequest as sendMembershipRequestResolver } from "../../../src/resolvers/Mutation/sendMembershipRequest"; import { ORGANIZATION_NOT_FOUND, USER_NOT_FOUND } from "../../../src/constants"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Mutation/sendMessageToDirectChat.spec.ts b/tests/resolvers/Mutation/sendMessageToDirectChat.spec.ts similarity index 96% rename from __tests__/resolvers/Mutation/sendMessageToDirectChat.spec.ts rename to tests/resolvers/Mutation/sendMessageToDirectChat.spec.ts index 07c54c8796..9deb931544 100644 --- a/__tests__/resolvers/Mutation/sendMessageToDirectChat.spec.ts +++ b/tests/resolvers/Mutation/sendMessageToDirectChat.spec.ts @@ -7,10 +7,10 @@ import { DirectChat, Interface_DirectChat, Interface_DirectChatMessage, -} from "../../../src/lib/models"; -import { MutationSendMessageToDirectChatArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationSendMessageToDirectChatArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { sendMessageToDirectChat as sendMessageToDirectChatResolver } from "../../../src/lib/resolvers/Mutation/sendMessageToDirectChat"; +import { sendMessageToDirectChat as sendMessageToDirectChatResolver } from "../../../src/resolvers/Mutation/sendMessageToDirectChat"; import { CHAT_NOT_FOUND, USER_NOT_FOUND } from "../../../src/constants"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Mutation/sendMessageToGroupChat.spec.ts b/tests/resolvers/Mutation/sendMessageToGroupChat.spec.ts similarity index 96% rename from __tests__/resolvers/Mutation/sendMessageToGroupChat.spec.ts rename to tests/resolvers/Mutation/sendMessageToGroupChat.spec.ts index 042879370b..b55f555799 100644 --- a/__tests__/resolvers/Mutation/sendMessageToGroupChat.spec.ts +++ b/tests/resolvers/Mutation/sendMessageToGroupChat.spec.ts @@ -7,10 +7,10 @@ import { GroupChat, Interface_GroupChat, Interface_GroupChatMessage, -} from "../../../src/lib/models"; -import { MutationSendMessageToGroupChatArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationSendMessageToGroupChatArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { sendMessageToGroupChat as sendMessageToGroupChatResolver } from "../../../src/lib/resolvers/Mutation/sendMessageToGroupChat"; +import { sendMessageToGroupChat as sendMessageToGroupChatResolver } from "../../../src/resolvers/Mutation/sendMessageToGroupChat"; import { CHAT_NOT_FOUND, USER_NOT_AUTHORIZED, diff --git a/__tests__/resolvers/Mutation/signUp.spec.ts b/tests/resolvers/Mutation/signUp.spec.ts similarity index 92% rename from __tests__/resolvers/Mutation/signUp.spec.ts rename to tests/resolvers/Mutation/signUp.spec.ts index 8f1e5f9931..ae64d10137 100644 --- a/__tests__/resolvers/Mutation/signUp.spec.ts +++ b/tests/resolvers/Mutation/signUp.spec.ts @@ -5,17 +5,14 @@ import { User, Organization, Interface_Organization, -} from "../../../src/lib/models"; -import { - MutationSignUpArgs, - UserType, -} from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationSignUpArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { signUp as signUpResolver } from "../../../src/lib/resolvers/Mutation/signUp"; +import { signUp as signUpResolver } from "../../../src/resolvers/Mutation/signUp"; import { androidFirebaseOptions, iosFirebaseOptions, -} from "../../../src/lib/config"; +} from "../../../src/config"; import { ORGANIZATION_NOT_FOUND } from "../../../src/constants"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; @@ -74,7 +71,7 @@ describe("resolvers -> Mutation -> signUp", () => { password: "password", appLanguageCode: "en", organizationUserBelongsToId: undefined, - userType: UserType.User, + userType: "USER", }, }; @@ -96,7 +93,7 @@ describe("resolvers -> Mutation -> signUp", () => { password: "password", appLanguageCode: "en", organizationUserBelongsToId: undefined, - userType: UserType.User, + userType: "USER", }, }; @@ -137,7 +134,7 @@ describe("resolvers -> Mutation -> signUp", () => { password: "password", appLanguageCode: "en", organizationUserBelongsToId: Types.ObjectId().toString(), - userType: UserType.User, + userType: "USER", }, }; @@ -160,7 +157,7 @@ describe("resolvers -> Mutation -> signUp", () => { password: "password", appLanguageCode: "en", organizationUserBelongsToId: testOrganization.id, - userType: UserType.User, + userType: "USER", }, }; diff --git a/__tests__/resolvers/Mutation/unblockUser.spec.ts b/tests/resolvers/Mutation/unblockUser.spec.ts similarity index 96% rename from __tests__/resolvers/Mutation/unblockUser.spec.ts rename to tests/resolvers/Mutation/unblockUser.spec.ts index cdbd974650..80644abe40 100644 --- a/__tests__/resolvers/Mutation/unblockUser.spec.ts +++ b/tests/resolvers/Mutation/unblockUser.spec.ts @@ -5,10 +5,10 @@ import { User, Organization, Interface_Organization, -} from "../../../src/lib/models"; -import { MutationUnblockUserArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationUnblockUserArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { unblockUser as unblockUserResolver } from "../../../src/lib/resolvers/Mutation/unblockUser"; +import { unblockUser as unblockUserResolver } from "../../../src/resolvers/Mutation/unblockUser"; import { ORGANIZATION_NOT_FOUND, USER_NOT_AUTHORIZED, diff --git a/__tests__/resolvers/Mutation/unlikeComment.spec.ts b/tests/resolvers/Mutation/unlikeComment.spec.ts similarity index 96% rename from __tests__/resolvers/Mutation/unlikeComment.spec.ts rename to tests/resolvers/Mutation/unlikeComment.spec.ts index de66c90a22..1cc035a063 100644 --- a/__tests__/resolvers/Mutation/unlikeComment.spec.ts +++ b/tests/resolvers/Mutation/unlikeComment.spec.ts @@ -7,10 +7,10 @@ import { Post, Comment, Interface_Comment, -} from "../../../src/lib/models"; -import { MutationUnlikeCommentArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationUnlikeCommentArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { unlikeComment as unlikeCommentResolver } from "../../../src/lib/resolvers/Mutation/unlikeComment"; +import { unlikeComment as unlikeCommentResolver } from "../../../src/resolvers/Mutation/unlikeComment"; import { COMMENT_NOT_FOUND, USER_NOT_FOUND } from "../../../src/constants"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Mutation/unlikePost.spec.ts b/tests/resolvers/Mutation/unlikePost.spec.ts similarity index 94% rename from __tests__/resolvers/Mutation/unlikePost.spec.ts rename to tests/resolvers/Mutation/unlikePost.spec.ts index 409f979c7b..0e82c6afd2 100644 --- a/__tests__/resolvers/Mutation/unlikePost.spec.ts +++ b/tests/resolvers/Mutation/unlikePost.spec.ts @@ -6,10 +6,10 @@ import { Organization, Interface_Post, Post, -} from "../../../src/lib/models"; -import { MutationUnlikePostArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationUnlikePostArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { unlikePost as unlikePostResolver } from "../../../src/lib/resolvers/Mutation/unlikePost"; +import { unlikePost as unlikePostResolver } from "../../../src/resolvers/Mutation/unlikePost"; import { POST_NOT_FOUND, USER_NOT_FOUND } from "../../../src/constants"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Mutation/unregisterForEventByUser.spec.ts b/tests/resolvers/Mutation/unregisterForEventByUser.spec.ts similarity index 97% rename from __tests__/resolvers/Mutation/unregisterForEventByUser.spec.ts rename to tests/resolvers/Mutation/unregisterForEventByUser.spec.ts index a6b27abc90..d9da054a41 100644 --- a/__tests__/resolvers/Mutation/unregisterForEventByUser.spec.ts +++ b/tests/resolvers/Mutation/unregisterForEventByUser.spec.ts @@ -6,10 +6,10 @@ import { Organization, Event, Interface_Event, -} from "../../../src/lib/models"; -import { MutationUnregisterForEventByUserArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationUnregisterForEventByUserArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { unregisterForEventByUser as unregisterForEventByUserResolver } from "../../../src/lib/resolvers/Mutation/unregisterForEventByUser"; +import { unregisterForEventByUser as unregisterForEventByUserResolver } from "../../../src/resolvers/Mutation/unregisterForEventByUser"; import { EVENT_NOT_FOUND, USER_ALREADY_UNREGISTERED, diff --git a/__tests__/resolvers/Mutation/updateEvent.spec.ts b/tests/resolvers/Mutation/updateEvent.spec.ts similarity index 95% rename from __tests__/resolvers/Mutation/updateEvent.spec.ts rename to tests/resolvers/Mutation/updateEvent.spec.ts index 82346f417e..9821f8600a 100644 --- a/__tests__/resolvers/Mutation/updateEvent.spec.ts +++ b/tests/resolvers/Mutation/updateEvent.spec.ts @@ -6,13 +6,10 @@ import { Organization, Event, Interface_Event, -} from "../../../src/lib/models"; -import { - MutationUpdateEventArgs, - Recurrance, -} from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationUpdateEventArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { updateEvent as updateEventResolver } from "../../../src/lib/resolvers/Mutation/updateEvent"; +import { updateEvent as updateEventResolver } from "../../../src/resolvers/Mutation/updateEvent"; import { EVENT_NOT_FOUND, USER_NOT_AUTHORIZED, @@ -174,7 +171,7 @@ describe("resolvers -> Mutation -> updateEvent", () => { startDate: new Date().toUTCString(), startTime: new Date().toUTCString(), title: "newTitle", - recurrance: Recurrance.Daily, + recurrance: "DAILY", }, }; diff --git a/__tests__/resolvers/Mutation/updateLanguage.spec.ts b/tests/resolvers/Mutation/updateLanguage.spec.ts similarity index 93% rename from __tests__/resolvers/Mutation/updateLanguage.spec.ts rename to tests/resolvers/Mutation/updateLanguage.spec.ts index 83f1f4c4b8..33a87b85c7 100644 --- a/__tests__/resolvers/Mutation/updateLanguage.spec.ts +++ b/tests/resolvers/Mutation/updateLanguage.spec.ts @@ -1,9 +1,9 @@ import "dotenv/config"; import { Document, Types } from "mongoose"; -import { Interface_User, User, Organization } from "../../../src/lib/models"; -import { MutationUpdateLanguageArgs } from "../../../src/generated/graphqlCodegen"; +import { Interface_User, User, Organization } from "../../../src/models"; +import { MutationUpdateLanguageArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { updateLanguage as updateLanguageResolver } from "../../../src/lib/resolvers/Mutation/updateLanguage"; +import { updateLanguage as updateLanguageResolver } from "../../../src/resolvers/Mutation/updateLanguage"; import { USER_NOT_FOUND } from "../../../src/constants"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Mutation/updateOrganization.spec.ts b/tests/resolvers/Mutation/updateOrganization.spec.ts similarity index 94% rename from __tests__/resolvers/Mutation/updateOrganization.spec.ts rename to tests/resolvers/Mutation/updateOrganization.spec.ts index 9780eedab8..2ee5172ac2 100644 --- a/__tests__/resolvers/Mutation/updateOrganization.spec.ts +++ b/tests/resolvers/Mutation/updateOrganization.spec.ts @@ -5,10 +5,10 @@ import { User, Organization, Interface_Organization, -} from "../../../src/lib/models"; -import { MutationUpdateOrganizationArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationUpdateOrganizationArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { updateOrganization as updateOrganizationResolver } from "../../../src/lib/resolvers/Mutation/updateOrganization"; +import { updateOrganization as updateOrganizationResolver } from "../../../src/resolvers/Mutation/updateOrganization"; import { ORGANIZATION_NOT_FOUND, USER_NOT_AUTHORIZED, diff --git a/__tests__/resolvers/Mutation/updatePluginInstalledOrgs.spec.ts b/tests/resolvers/Mutation/updatePluginInstalledOrgs.spec.ts similarity index 95% rename from __tests__/resolvers/Mutation/updatePluginInstalledOrgs.spec.ts rename to tests/resolvers/Mutation/updatePluginInstalledOrgs.spec.ts index fcda372801..68b6fe30de 100644 --- a/__tests__/resolvers/Mutation/updatePluginInstalledOrgs.spec.ts +++ b/tests/resolvers/Mutation/updatePluginInstalledOrgs.spec.ts @@ -7,10 +7,10 @@ import { Plugin, Interface_Plugin, Interface_Organization, -} from "../../../src/lib/models"; -import { MutationUpdatePluginInstalledOrgsArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationUpdatePluginInstalledOrgsArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { updatePluginInstalledOrgs as updatePluginInstalledOrgsResolver } from "../../../src/lib/resolvers/Mutation/updatePluginInstalledOrgs"; +import { updatePluginInstalledOrgs as updatePluginInstalledOrgsResolver } from "../../../src/resolvers/Mutation/updatePluginInstalledOrgs"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Mutation/updatePluginStatus.spec.ts b/tests/resolvers/Mutation/updatePluginStatus.spec.ts similarity index 92% rename from __tests__/resolvers/Mutation/updatePluginStatus.spec.ts rename to tests/resolvers/Mutation/updatePluginStatus.spec.ts index ba40808c8d..378adab469 100644 --- a/__tests__/resolvers/Mutation/updatePluginStatus.spec.ts +++ b/tests/resolvers/Mutation/updatePluginStatus.spec.ts @@ -6,10 +6,10 @@ import { Organization, Plugin, Interface_Plugin, -} from "../../../src/lib/models"; -import { MutationUpdatePluginStatusArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationUpdatePluginStatusArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { updatePluginStatus as updatePluginStatusResolver } from "../../../src/lib/resolvers/Mutation/updatePluginStatus"; +import { updatePluginStatus as updatePluginStatusResolver } from "../../../src/resolvers/Mutation/updatePluginStatus"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Mutation/updateTask.spec.ts b/tests/resolvers/Mutation/updateTask.spec.ts similarity index 95% rename from __tests__/resolvers/Mutation/updateTask.spec.ts rename to tests/resolvers/Mutation/updateTask.spec.ts index 7eb41eb21b..757b5706ed 100644 --- a/__tests__/resolvers/Mutation/updateTask.spec.ts +++ b/tests/resolvers/Mutation/updateTask.spec.ts @@ -7,10 +7,10 @@ import { Event, Task, Interface_Task, -} from "../../../src/lib/models"; -import { MutationUpdateTaskArgs } from "../../../src/generated/graphqlCodegen"; +} from "../../../src/models"; +import { MutationUpdateTaskArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { updateTask as updateTaskResolver } from "../../../src/lib/resolvers/Mutation/updateTask"; +import { updateTask as updateTaskResolver } from "../../../src/resolvers/Mutation/updateTask"; import { USER_NOT_AUTHORIZED, USER_NOT_FOUND } from "../../../src/constants"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Mutation/updateUserProfile.spec.ts b/tests/resolvers/Mutation/updateUserProfile.spec.ts similarity index 91% rename from __tests__/resolvers/Mutation/updateUserProfile.spec.ts rename to tests/resolvers/Mutation/updateUserProfile.spec.ts index 5f88f9d4c0..34b0104c26 100644 --- a/__tests__/resolvers/Mutation/updateUserProfile.spec.ts +++ b/tests/resolvers/Mutation/updateUserProfile.spec.ts @@ -1,9 +1,9 @@ import "dotenv/config"; import { Document, Types } from "mongoose"; -import { Interface_User, User } from "../../../src/lib/models"; -import { MutationUpdateUserProfileArgs } from "../../../src/generated/graphqlCodegen"; +import { Interface_User, User } from "../../../src/models"; +import { MutationUpdateUserProfileArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { updateUserProfile as updateUserProfileResolver } from "../../../src/lib/resolvers/Mutation/updateUserProfile"; +import { updateUserProfile as updateUserProfileResolver } from "../../../src/resolvers/Mutation/updateUserProfile"; import { USER_NOT_FOUND } from "../../../src/constants"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Mutation/updateUserType.spec.ts b/tests/resolvers/Mutation/updateUserType.spec.ts similarity index 93% rename from __tests__/resolvers/Mutation/updateUserType.spec.ts rename to tests/resolvers/Mutation/updateUserType.spec.ts index 0d4cf41cbf..9431c29d15 100644 --- a/__tests__/resolvers/Mutation/updateUserType.spec.ts +++ b/tests/resolvers/Mutation/updateUserType.spec.ts @@ -1,10 +1,10 @@ import "dotenv/config"; import { Document, Types } from "mongoose"; import { nanoid } from "nanoid"; -import { Interface_User, User } from "../../../src/lib/models"; -import { MutationUpdateUserTypeArgs } from "../../../src/generated/graphqlCodegen"; +import { Interface_User, User } from "../../../src/models"; +import { MutationUpdateUserTypeArgs } from "../../../src/types/generatedGraphQLTypes"; import { connect, disconnect } from "../../../src/db"; -import { updateUserType as updateUserTypeResolver } from "../../../src/lib/resolvers/Mutation/updateUserType"; +import { updateUserType as updateUserTypeResolver } from "../../../src/resolvers/Mutation/updateUserType"; import { USER_NOT_AUTHORIZED, USER_NOT_FOUND } from "../../../src/constants"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Organization/admins.spec.ts b/tests/resolvers/Organization/admins.spec.ts similarity index 92% rename from __tests__/resolvers/Organization/admins.spec.ts rename to tests/resolvers/Organization/admins.spec.ts index 3dc9961160..9f6db9ea59 100644 --- a/__tests__/resolvers/Organization/admins.spec.ts +++ b/tests/resolvers/Organization/admins.spec.ts @@ -1,11 +1,11 @@ import "dotenv/config"; -import { admins as adminsResolver } from "../../../src/lib/resolvers/Organization/admins"; +import { admins as adminsResolver } from "../../../src/resolvers/Organization/admins"; import { connect, disconnect } from "../../../src/db"; import { User, Organization, Interface_Organization, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { Document } from "mongoose"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Organization/blockedUsers.spec.ts b/tests/resolvers/Organization/blockedUsers.spec.ts similarity index 95% rename from __tests__/resolvers/Organization/blockedUsers.spec.ts rename to tests/resolvers/Organization/blockedUsers.spec.ts index 739792e1ef..f48070730d 100644 --- a/__tests__/resolvers/Organization/blockedUsers.spec.ts +++ b/tests/resolvers/Organization/blockedUsers.spec.ts @@ -1,11 +1,11 @@ import "dotenv/config"; -import { blockedUsers as blockedUsersResolver } from "../../../src/lib/resolvers/Organization/blockedUsers"; +import { blockedUsers as blockedUsersResolver } from "../../../src/resolvers/Organization/blockedUsers"; import { connect, disconnect } from "../../../src/db"; import { User, Organization, Interface_Organization, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { Document } from "mongoose"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Organization/creator.spec.ts b/tests/resolvers/Organization/creator.spec.ts similarity index 93% rename from __tests__/resolvers/Organization/creator.spec.ts rename to tests/resolvers/Organization/creator.spec.ts index a2cbe8a237..f11479660d 100644 --- a/__tests__/resolvers/Organization/creator.spec.ts +++ b/tests/resolvers/Organization/creator.spec.ts @@ -5,7 +5,7 @@ import { Organization, Interface_Organization, Interface_User, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { Document, Types } from "mongoose"; import { USER_NOT_FOUND, USER_NOT_FOUND_MESSAGE } from "../../../src/constants"; import { nanoid } from "nanoid"; @@ -98,7 +98,7 @@ describe("resolvers -> Organization -> creator", () => { }); const { creator: creatorResolver } = await import( - "../../../src/lib/resolvers/Organization/creator" + "../../../src/resolvers/Organization/creator" ); await creatorResolver?.(parent, {}, {}); } catch (error: any) { @@ -107,7 +107,7 @@ describe("resolvers -> Organization -> creator", () => { }); it(`throws NotFoundError if no user exists with _id === parent.creator and IN_PRODUCTION === true`, async () => { - const { requestContext } = await import("../../../src/lib/libraries"); + const { requestContext } = await import("../../../src/libraries"); const spy = vi .spyOn(requestContext, "translate") .mockImplementation((message) => `Translated ${message}`); @@ -140,7 +140,7 @@ describe("resolvers -> Organization -> creator", () => { }); const { creator: creatorResolver } = await import( - "../../../src/lib/resolvers/Organization/creator" + "../../../src/resolvers/Organization/creator" ); await creatorResolver?.(parent, {}, {}); } catch (error: any) { @@ -167,7 +167,7 @@ describe("resolvers -> Organization -> creator", () => { const parent = testOrganization!.toObject(); const { creator: creatorResolver } = await import( - "../../../src/lib/resolvers/Organization/creator" + "../../../src/resolvers/Organization/creator" ); const creatorPayload = await creatorResolver?.(parent, {}, {}); diff --git a/tests/resolvers/Organization/index.spec.ts b/tests/resolvers/Organization/index.spec.ts new file mode 100644 index 0000000000..16a2759703 --- /dev/null +++ b/tests/resolvers/Organization/index.spec.ts @@ -0,0 +1,26 @@ +import { Organization } from "../../../src/resolvers/Organization/index"; +import { admins } from "../../../src/resolvers/Organization/admins"; +import { blockedUsers } from "../../../src/resolvers/Organization/blockedUsers"; +import { creator } from "../../../src/resolvers/Organization/creator"; +import { members } from "../../../src/resolvers/Organization/members"; +import { membershipRequests } from "../../../src/resolvers/Organization/membershipRequests"; +import { OrganizationResolvers } from "../../../src/types/generatedGraphQLTypes"; +import { describe, it, expect, beforeAll } from "vitest"; + +let testOrganization: OrganizationResolvers; + +beforeAll(() => { + testOrganization = { + admins, + blockedUsers, + creator, + members, + membershipRequests, + }; +}); + +describe("resolvers -> Organization -> index", () => { + it("creates the Orgainzation", () => { + expect(Organization).toStrictEqual(testOrganization); + }); +}); diff --git a/__tests__/resolvers/Organization/members.spec.ts b/tests/resolvers/Organization/members.spec.ts similarity index 92% rename from __tests__/resolvers/Organization/members.spec.ts rename to tests/resolvers/Organization/members.spec.ts index c3aa927e27..8b2b55db04 100644 --- a/__tests__/resolvers/Organization/members.spec.ts +++ b/tests/resolvers/Organization/members.spec.ts @@ -1,11 +1,11 @@ import "dotenv/config"; -import { members as membersResolver } from "../../../src/lib/resolvers/Organization/members"; +import { members as membersResolver } from "../../../src/resolvers/Organization/members"; import { connect, disconnect } from "../../../src/db"; import { User, Organization, Interface_Organization, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { Document } from "mongoose"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Organization/membershipRequests.spec.ts b/tests/resolvers/Organization/membershipRequests.spec.ts similarity index 96% rename from __tests__/resolvers/Organization/membershipRequests.spec.ts rename to tests/resolvers/Organization/membershipRequests.spec.ts index e594cf5b0a..c03b0225e2 100644 --- a/__tests__/resolvers/Organization/membershipRequests.spec.ts +++ b/tests/resolvers/Organization/membershipRequests.spec.ts @@ -1,12 +1,12 @@ import "dotenv/config"; -import { membershipRequests as membershipRequestsResolver } from "../../../src/lib/resolvers/Organization/membershipRequests"; +import { membershipRequests as membershipRequestsResolver } from "../../../src/resolvers/Organization/membershipRequests"; import { connect, disconnect } from "../../../src/db"; import { User, Organization, MembershipRequest, Interface_Organization, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { Document } from "mongoose"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Query/checkAuth.spec.ts b/tests/resolvers/Query/checkAuth.spec.ts similarity index 89% rename from __tests__/resolvers/Query/checkAuth.spec.ts rename to tests/resolvers/Query/checkAuth.spec.ts index 1fb3e21da6..0ae08d93e7 100644 --- a/__tests__/resolvers/Query/checkAuth.spec.ts +++ b/tests/resolvers/Query/checkAuth.spec.ts @@ -1,8 +1,8 @@ import "dotenv/config"; import { connect, disconnect } from "../../../src/db"; -import { checkAuth as checkAuthResolver } from "../../../src/lib/resolvers/Query/checkAuth"; +import { checkAuth as checkAuthResolver } from "../../../src/resolvers/Query/checkAuth"; import { Types } from "mongoose"; -import { User } from "../../../src/lib/models"; +import { User } from "../../../src/models"; import { USER_NOT_FOUND } from "../../../src/constants"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Query/comments.spec.ts b/tests/resolvers/Query/comments.spec.ts similarity index 95% rename from __tests__/resolvers/Query/comments.spec.ts rename to tests/resolvers/Query/comments.spec.ts index 32e70f0bd3..2e5579d71e 100644 --- a/__tests__/resolvers/Query/comments.spec.ts +++ b/tests/resolvers/Query/comments.spec.ts @@ -1,7 +1,7 @@ import "dotenv/config"; -import { comments as commentsResolver } from "../../../src/lib/resolvers/Query/comments"; +import { comments as commentsResolver } from "../../../src/resolvers/Query/comments"; import { connect, disconnect } from "../../../src/db"; -import { Comment, Post, User, Organization } from "../../../src/lib/models"; +import { Comment, Post, User, Organization } from "../../../src/models"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Query/commentsByPost.spec.ts b/tests/resolvers/Query/commentsByPost.spec.ts similarity index 96% rename from __tests__/resolvers/Query/commentsByPost.spec.ts rename to tests/resolvers/Query/commentsByPost.spec.ts index d82d86fbc6..2985b2bca1 100644 --- a/__tests__/resolvers/Query/commentsByPost.spec.ts +++ b/tests/resolvers/Query/commentsByPost.spec.ts @@ -1,6 +1,6 @@ import "dotenv/config"; import { connect, disconnect } from "../../../src/db"; -import { commentsByPost as commentsByPostResolver } from "../../../src/lib/resolvers/Query/commentsByPost"; +import { commentsByPost as commentsByPostResolver } from "../../../src/resolvers/Query/commentsByPost"; import { Comment, User, @@ -9,7 +9,7 @@ import { Interface_Post, Interface_Organization, Interface_User, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { nanoid } from "nanoid"; import { Document, Types } from "mongoose"; import { @@ -18,7 +18,7 @@ import { POST_NOT_FOUND, USER_NOT_FOUND, } from "../../../src/constants"; -import { QueryCommentsByPostArgs } from "../../../src/generated/graphqlCodegen"; +import { QueryCommentsByPostArgs } from "../../../src/types/generatedGraphQLTypes"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; let testUser: Interface_User & Document; diff --git a/__tests__/resolvers/Query/directChatMessages.spec.ts b/tests/resolvers/Query/directChatMessages.spec.ts similarity index 95% rename from __tests__/resolvers/Query/directChatMessages.spec.ts rename to tests/resolvers/Query/directChatMessages.spec.ts index 319f4a84f8..4189fa9b5e 100644 --- a/__tests__/resolvers/Query/directChatMessages.spec.ts +++ b/tests/resolvers/Query/directChatMessages.spec.ts @@ -1,12 +1,12 @@ import "dotenv/config"; -import { directChatMessages as directChatMessagesResolver } from "../../../src/lib/resolvers/Query/directChatMessages"; +import { directChatMessages as directChatMessagesResolver } from "../../../src/resolvers/Query/directChatMessages"; import { connect, disconnect } from "../../../src/db"; import { DirectChat, DirectChatMessage, Organization, User, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Query/directChats.spec.ts b/tests/resolvers/Query/directChats.spec.ts similarity index 96% rename from __tests__/resolvers/Query/directChats.spec.ts rename to tests/resolvers/Query/directChats.spec.ts index 19e44b96b2..446664a8ca 100644 --- a/__tests__/resolvers/Query/directChats.spec.ts +++ b/tests/resolvers/Query/directChats.spec.ts @@ -1,12 +1,12 @@ import "dotenv/config"; -import { directChats as directChatsResolver } from "../../../src/lib/resolvers/Query/directChats"; +import { directChats as directChatsResolver } from "../../../src/resolvers/Query/directChats"; import { connect, disconnect } from "../../../src/db"; import { User, Organization, DirectChat, DirectChatMessage, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Query/directChatsByUserID.spec.ts b/tests/resolvers/Query/directChatsByUserID.spec.ts similarity index 92% rename from __tests__/resolvers/Query/directChatsByUserID.spec.ts rename to tests/resolvers/Query/directChatsByUserID.spec.ts index d9403813d1..c17eba07b7 100644 --- a/__tests__/resolvers/Query/directChatsByUserID.spec.ts +++ b/tests/resolvers/Query/directChatsByUserID.spec.ts @@ -1,15 +1,15 @@ import "dotenv/config"; import { Document, Types } from "mongoose"; import { connect, disconnect } from "../../../src/db"; -import { directChatsByUserID as directChatsByUserIDResolver } from "../../../src/lib/resolvers/Query/directChatsByUserID"; +import { directChatsByUserID as directChatsByUserIDResolver } from "../../../src/resolvers/Query/directChatsByUserID"; import { User, Organization, DirectChat, Interface_User, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { nanoid } from "nanoid"; -import { QueryDirectChatsByUserIdArgs } from "../../../src/generated/graphqlCodegen"; +import { QueryDirectChatsByUserIdArgs } from "../../../src/types/generatedGraphQLTypes"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; let testUser: Interface_User & Document; diff --git a/__tests__/resolvers/Query/directChatsMessagesByChatID.spec.ts b/tests/resolvers/Query/directChatsMessagesByChatID.spec.ts similarity index 96% rename from __tests__/resolvers/Query/directChatsMessagesByChatID.spec.ts rename to tests/resolvers/Query/directChatsMessagesByChatID.spec.ts index e8d6827446..22461a6d46 100644 --- a/__tests__/resolvers/Query/directChatsMessagesByChatID.spec.ts +++ b/tests/resolvers/Query/directChatsMessagesByChatID.spec.ts @@ -1,6 +1,6 @@ import "dotenv/config"; import { CHAT_NOT_FOUND } from "../../../src/constants"; -import { directChatsMessagesByChatID as directChatsMessagesByChatIDResolver } from "../../../src/lib/resolvers/Query/directChatsMessagesByChatID"; +import { directChatsMessagesByChatID as directChatsMessagesByChatIDResolver } from "../../../src/resolvers/Query/directChatsMessagesByChatID"; import { connect, disconnect } from "../../../src/db"; import { Document, Types } from "mongoose"; import { @@ -9,9 +9,9 @@ import { DirectChat, Interface_DirectChat, DirectChatMessage, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { nanoid } from "nanoid"; -import { QueryDirectChatsMessagesByChatIdArgs } from "../../../src/generated/graphqlCodegen"; +import { QueryDirectChatsMessagesByChatIdArgs } from "../../../src/types/generatedGraphQLTypes"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; let testDirectChats: (Interface_DirectChat & diff --git a/__tests__/resolvers/Query/event.spec.ts b/tests/resolvers/Query/event.spec.ts similarity index 93% rename from __tests__/resolvers/Query/event.spec.ts rename to tests/resolvers/Query/event.spec.ts index 70ef334a79..227a68f82b 100644 --- a/__tests__/resolvers/Query/event.spec.ts +++ b/tests/resolvers/Query/event.spec.ts @@ -1,5 +1,5 @@ import "dotenv/config"; -import { event as eventResolver } from "../../../src/lib/resolvers/Query/event"; +import { event as eventResolver } from "../../../src/resolvers/Query/event"; import { connect, disconnect } from "../../../src/db"; import { EVENT_NOT_FOUND } from "../../../src/constants"; import { @@ -8,10 +8,10 @@ import { Event, Task, Interface_Event, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { nanoid } from "nanoid"; import { Document, Types } from "mongoose"; -import { QueryEventArgs } from "../../../src/generated/graphqlCodegen"; +import { QueryEventArgs } from "../../../src/types/generatedGraphQLTypes"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; let testEvent: Interface_Event & Document; diff --git a/__tests__/resolvers/Query/events.spec.ts b/tests/resolvers/Query/events.spec.ts similarity index 92% rename from __tests__/resolvers/Query/events.spec.ts rename to tests/resolvers/Query/events.spec.ts index 26dcd5b02b..8ccd1f9313 100644 --- a/__tests__/resolvers/Query/events.spec.ts +++ b/tests/resolvers/Query/events.spec.ts @@ -1,12 +1,9 @@ import "dotenv/config"; -import { events as eventsResolver } from "../../../src/lib/resolvers/Query/events"; -import { Event, User, Organization, Task } from "../../../src/lib/models"; +import { events as eventsResolver } from "../../../src/resolvers/Query/events"; +import { Event, User, Organization, Task } from "../../../src/models"; import { connect, disconnect } from "../../../src/db"; import { nanoid } from "nanoid"; -import { - QueryEventsArgs, - EventOrderByInput, -} from "../../../src/generated/graphqlCodegen"; +import { QueryEventsArgs } from "../../../src/types/generatedGraphQLTypes"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; beforeAll(async () => { @@ -122,7 +119,7 @@ describe("resolvers -> Query -> events", () => { }; const args: QueryEventsArgs = { - orderBy: EventOrderByInput.IdAsc, + orderBy: "id_ASC", }; const eventsPayload = await eventsResolver?.({}, args, {}); @@ -146,7 +143,7 @@ describe("resolvers -> Query -> events", () => { }; const args: QueryEventsArgs = { - orderBy: EventOrderByInput.IdDesc, + orderBy: "id_DESC", }; const eventsPayload = await eventsResolver?.({}, args, {}); @@ -170,7 +167,7 @@ describe("resolvers -> Query -> events", () => { }; const args: QueryEventsArgs = { - orderBy: EventOrderByInput.TitleAsc, + orderBy: "title_ASC", }; const eventsPayload = await eventsResolver?.({}, args, {}); @@ -194,7 +191,7 @@ describe("resolvers -> Query -> events", () => { }; const args: QueryEventsArgs = { - orderBy: EventOrderByInput.TitleDesc, + orderBy: "title_DESC", }; const eventsPayload = await eventsResolver?.({}, args, {}); @@ -218,7 +215,7 @@ describe("resolvers -> Query -> events", () => { }; const args: QueryEventsArgs = { - orderBy: EventOrderByInput.DescriptionAsc, + orderBy: "description_ASC", }; const eventsPayload = await eventsResolver?.({}, args, {}); @@ -242,7 +239,7 @@ describe("resolvers -> Query -> events", () => { }; const args: QueryEventsArgs = { - orderBy: EventOrderByInput.DescriptionDesc, + orderBy: "description_DESC", }; const eventsPayload = await eventsResolver?.({}, args, {}); @@ -266,7 +263,7 @@ describe("resolvers -> Query -> events", () => { }; const args: QueryEventsArgs = { - orderBy: EventOrderByInput.StartDateAsc, + orderBy: "startDate_ASC", }; const eventsPayload = await eventsResolver?.({}, args, {}); @@ -290,7 +287,7 @@ describe("resolvers -> Query -> events", () => { }; const args: QueryEventsArgs = { - orderBy: EventOrderByInput.StartDateDesc, + orderBy: "startDate_DESC", }; const eventsPayload = await eventsResolver?.({}, args, {}); @@ -314,7 +311,7 @@ describe("resolvers -> Query -> events", () => { }; const args: QueryEventsArgs = { - orderBy: EventOrderByInput.EndDateAsc, + orderBy: "endDate_ASC", }; const eventsPayload = await eventsResolver?.({}, args, {}); @@ -338,7 +335,7 @@ describe("resolvers -> Query -> events", () => { }; const args: QueryEventsArgs = { - orderBy: EventOrderByInput.EndDateDesc, + orderBy: "endDate_DESC", }; const eventsPayload = await eventsResolver?.({}, args, {}); @@ -362,7 +359,7 @@ describe("resolvers -> Query -> events", () => { }; const args: QueryEventsArgs = { - orderBy: EventOrderByInput.AllDayAsc, + orderBy: "allDay_ASC", }; const eventsPayload = await eventsResolver?.({}, args, {}); @@ -386,7 +383,7 @@ describe("resolvers -> Query -> events", () => { }; const args: QueryEventsArgs = { - orderBy: EventOrderByInput.AllDayDesc, + orderBy: "allDay_DESC", }; const eventsPayload = await eventsResolver?.({}, args, {}); @@ -410,7 +407,7 @@ describe("resolvers -> Query -> events", () => { }; const args: QueryEventsArgs = { - orderBy: EventOrderByInput.StartTimeAsc, + orderBy: "startTime_ASC", }; const eventsPayload = await eventsResolver?.({}, args, {}); @@ -434,7 +431,7 @@ describe("resolvers -> Query -> events", () => { }; const args: QueryEventsArgs = { - orderBy: EventOrderByInput.StartTimeDesc, + orderBy: "startTime_DESC", }; const eventsPayload = await eventsResolver?.({}, args, {}); @@ -458,7 +455,7 @@ describe("resolvers -> Query -> events", () => { }; const args: QueryEventsArgs = { - orderBy: EventOrderByInput.EndTimeAsc, + orderBy: "endTime_ASC", }; const eventsPayload = await eventsResolver?.({}, args, {}); @@ -482,7 +479,7 @@ describe("resolvers -> Query -> events", () => { }; const args: QueryEventsArgs = { - orderBy: EventOrderByInput.EndTimeDesc, + orderBy: "endTime_DESC", }; const eventsPayload = await eventsResolver?.({}, args, {}); @@ -506,7 +503,7 @@ describe("resolvers -> Query -> events", () => { }; const args: QueryEventsArgs = { - orderBy: EventOrderByInput.RecurranceAsc, + orderBy: "recurrance_ASC", }; const eventsPayload = await eventsResolver?.({}, args, {}); @@ -530,7 +527,7 @@ describe("resolvers -> Query -> events", () => { }; const args: QueryEventsArgs = { - orderBy: EventOrderByInput.RecurranceDesc, + orderBy: "recurrance_DESC", }; const eventsPayload = await eventsResolver?.({}, args, {}); @@ -554,7 +551,7 @@ describe("resolvers -> Query -> events", () => { }; const args: QueryEventsArgs = { - orderBy: EventOrderByInput.LocationAsc, + orderBy: "location_ASC", }; const eventsPayload = await eventsResolver?.({}, args, {}); @@ -578,7 +575,7 @@ describe("resolvers -> Query -> events", () => { }; const args: QueryEventsArgs = { - orderBy: EventOrderByInput.LocationDesc, + orderBy: "location_DESC", }; const eventsPayload = await eventsResolver?.({}, args, {}); diff --git a/__tests__/resolvers/Query/eventsByOrganization.spec.ts b/tests/resolvers/Query/eventsByOrganization.spec.ts similarity index 94% rename from __tests__/resolvers/Query/eventsByOrganization.spec.ts rename to tests/resolvers/Query/eventsByOrganization.spec.ts index 8b9269a00d..51ee97c591 100644 --- a/__tests__/resolvers/Query/eventsByOrganization.spec.ts +++ b/tests/resolvers/Query/eventsByOrganization.spec.ts @@ -1,18 +1,15 @@ import "dotenv/config"; -import { eventsByOrganization as eventsByOrganizationResolver } from "../../../src/lib/resolvers/Query/eventsByOrganization"; +import { eventsByOrganization as eventsByOrganizationResolver } from "../../../src/resolvers/Query/eventsByOrganization"; import { Event, User, Organization, Task, Interface_Organization, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { connect, disconnect } from "../../../src/db"; import { nanoid } from "nanoid"; -import { - QueryEventsByOrganizationArgs, - EventOrderByInput, -} from "../../../src/generated/graphqlCodegen"; +import { QueryEventsByOrganizationArgs } from "../../../src/types/generatedGraphQLTypes"; import { Document } from "mongoose"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; @@ -133,7 +130,7 @@ describe("resolvers -> Query -> eventsByOrganization", () => { const args: QueryEventsByOrganizationArgs = { id: testOrganization._id, - orderBy: EventOrderByInput.IdAsc, + orderBy: "id_ASC", }; const eventsByOrganizationPayload = await eventsByOrganizationResolver?.( @@ -163,7 +160,7 @@ describe("resolvers -> Query -> eventsByOrganization", () => { const args: QueryEventsByOrganizationArgs = { id: testOrganization._id, - orderBy: EventOrderByInput.IdDesc, + orderBy: "id_DESC", }; const eventsByOrganizationPayload = await eventsByOrganizationResolver?.( @@ -193,7 +190,7 @@ describe("resolvers -> Query -> eventsByOrganization", () => { const args: QueryEventsByOrganizationArgs = { id: testOrganization._id, - orderBy: EventOrderByInput.TitleAsc, + orderBy: "title_ASC", }; const eventsByOrganizationPayload = await eventsByOrganizationResolver?.( @@ -223,7 +220,7 @@ describe("resolvers -> Query -> eventsByOrganization", () => { const args: QueryEventsByOrganizationArgs = { id: testOrganization._id, - orderBy: EventOrderByInput.TitleDesc, + orderBy: "title_DESC", }; const eventsByOrganizationPayload = await eventsByOrganizationResolver?.( @@ -253,7 +250,7 @@ describe("resolvers -> Query -> eventsByOrganization", () => { const args: QueryEventsByOrganizationArgs = { id: testOrganization._id, - orderBy: EventOrderByInput.DescriptionAsc, + orderBy: "description_ASC", }; const eventsByOrganizationPayload = await eventsByOrganizationResolver?.( @@ -283,7 +280,7 @@ describe("resolvers -> Query -> eventsByOrganization", () => { const args: QueryEventsByOrganizationArgs = { id: testOrganization._id, - orderBy: EventOrderByInput.DescriptionDesc, + orderBy: "description_DESC", }; const eventsByOrganizationPayload = await eventsByOrganizationResolver?.( @@ -313,7 +310,7 @@ describe("resolvers -> Query -> eventsByOrganization", () => { const args: QueryEventsByOrganizationArgs = { id: testOrganization._id, - orderBy: EventOrderByInput.StartDateAsc, + orderBy: "startDate_ASC", }; const eventsByOrganizationPayload = await eventsByOrganizationResolver?.( @@ -343,7 +340,7 @@ describe("resolvers -> Query -> eventsByOrganization", () => { const args: QueryEventsByOrganizationArgs = { id: testOrganization._id, - orderBy: EventOrderByInput.StartDateDesc, + orderBy: "startDate_DESC", }; const eventsByOrganizationPayload = await eventsByOrganizationResolver?.( @@ -373,7 +370,7 @@ describe("resolvers -> Query -> eventsByOrganization", () => { const args: QueryEventsByOrganizationArgs = { id: testOrganization._id, - orderBy: EventOrderByInput.EndDateAsc, + orderBy: "endDate_ASC", }; const eventsByOrganizationPayload = await eventsByOrganizationResolver?.( @@ -403,7 +400,7 @@ describe("resolvers -> Query -> eventsByOrganization", () => { const args: QueryEventsByOrganizationArgs = { id: testOrganization._id, - orderBy: EventOrderByInput.EndDateDesc, + orderBy: "endDate_DESC", }; const eventsByOrganizationPayload = await eventsByOrganizationResolver?.( @@ -433,7 +430,7 @@ describe("resolvers -> Query -> eventsByOrganization", () => { const args: QueryEventsByOrganizationArgs = { id: testOrganization._id, - orderBy: EventOrderByInput.AllDayAsc, + orderBy: "allDay_ASC", }; const eventsByOrganizationPayload = await eventsByOrganizationResolver?.( @@ -463,7 +460,7 @@ describe("resolvers -> Query -> eventsByOrganization", () => { const args: QueryEventsByOrganizationArgs = { id: testOrganization._id, - orderBy: EventOrderByInput.AllDayDesc, + orderBy: "allDay_DESC", }; const eventsByOrganizationPayload = await eventsByOrganizationResolver?.( @@ -493,7 +490,7 @@ describe("resolvers -> Query -> eventsByOrganization", () => { const args: QueryEventsByOrganizationArgs = { id: testOrganization._id, - orderBy: EventOrderByInput.StartTimeAsc, + orderBy: "startTime_ASC", }; const eventsByOrganizationPayload = await eventsByOrganizationResolver?.( @@ -523,7 +520,7 @@ describe("resolvers -> Query -> eventsByOrganization", () => { const args: QueryEventsByOrganizationArgs = { id: testOrganization._id, - orderBy: EventOrderByInput.StartTimeDesc, + orderBy: "startTime_DESC", }; const eventsByOrganizationPayload = await eventsByOrganizationResolver?.( @@ -553,7 +550,7 @@ describe("resolvers -> Query -> eventsByOrganization", () => { const args: QueryEventsByOrganizationArgs = { id: testOrganization._id, - orderBy: EventOrderByInput.EndTimeAsc, + orderBy: "endTime_ASC", }; const eventsByOrganizationPayload = await eventsByOrganizationResolver?.( @@ -583,7 +580,7 @@ describe("resolvers -> Query -> eventsByOrganization", () => { const args: QueryEventsByOrganizationArgs = { id: testOrganization._id, - orderBy: EventOrderByInput.EndTimeDesc, + orderBy: "endTime_DESC", }; const eventsByOrganizationPayload = await eventsByOrganizationResolver?.( @@ -613,7 +610,7 @@ describe("resolvers -> Query -> eventsByOrganization", () => { const args: QueryEventsByOrganizationArgs = { id: testOrganization._id, - orderBy: EventOrderByInput.RecurranceAsc, + orderBy: "recurrance_ASC", }; const eventsByOrganizationPayload = await eventsByOrganizationResolver?.( @@ -643,7 +640,7 @@ describe("resolvers -> Query -> eventsByOrganization", () => { const args: QueryEventsByOrganizationArgs = { id: testOrganization._id, - orderBy: EventOrderByInput.RecurranceDesc, + orderBy: "recurrance_DESC", }; const eventsByOrganizationPayload = await eventsByOrganizationResolver?.( @@ -673,7 +670,7 @@ describe("resolvers -> Query -> eventsByOrganization", () => { const args: QueryEventsByOrganizationArgs = { id: testOrganization._id, - orderBy: EventOrderByInput.LocationAsc, + orderBy: "location_ASC", }; const eventsByOrganizationPayload = await eventsByOrganizationResolver?.( @@ -703,7 +700,7 @@ describe("resolvers -> Query -> eventsByOrganization", () => { const args: QueryEventsByOrganizationArgs = { id: testOrganization._id, - orderBy: EventOrderByInput.LocationDesc, + orderBy: "location_DESC", }; const eventsByOrganizationPayload = await eventsByOrganizationResolver?.( diff --git a/__tests__/resolvers/Query/getDonationById.spec.ts b/tests/resolvers/Query/getDonationById.spec.ts similarity index 91% rename from __tests__/resolvers/Query/getDonationById.spec.ts rename to tests/resolvers/Query/getDonationById.spec.ts index 37d8a7c423..bb94813222 100644 --- a/__tests__/resolvers/Query/getDonationById.spec.ts +++ b/tests/resolvers/Query/getDonationById.spec.ts @@ -4,12 +4,12 @@ import { Organization, Donation, Interface_Donation, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { connect, disconnect } from "../../../src/db"; -import { getDonationById as getDonationByIdResolver } from "../../../src/lib/resolvers/Query/getDonationById"; +import { getDonationById as getDonationByIdResolver } from "../../../src/resolvers/Query/getDonationById"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; -import { QueryGetDonationByIdArgs } from "../../../src/generated/graphqlCodegen"; +import { QueryGetDonationByIdArgs } from "../../../src/types/generatedGraphQLTypes"; import { Document } from "mongoose"; let testDonation: Interface_Donation & Document; diff --git a/__tests__/resolvers/Query/getDonationByOrgId.spec.ts b/tests/resolvers/Query/getDonationByOrgId.spec.ts similarity index 91% rename from __tests__/resolvers/Query/getDonationByOrgId.spec.ts rename to tests/resolvers/Query/getDonationByOrgId.spec.ts index e425b68df7..cb1eb8f65d 100644 --- a/__tests__/resolvers/Query/getDonationByOrgId.spec.ts +++ b/tests/resolvers/Query/getDonationByOrgId.spec.ts @@ -4,12 +4,12 @@ import { Organization, Donation, Interface_Organization, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { connect, disconnect } from "../../../src/db"; -import { getDonationByOrgId as getDonationByOrgIdResolver } from "../../../src/lib/resolvers/Query/getDonationByOrgId"; +import { getDonationByOrgId as getDonationByOrgIdResolver } from "../../../src/resolvers/Query/getDonationByOrgId"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; -import { QueryGetDonationByOrgIdArgs } from "../../../src/generated/graphqlCodegen"; +import { QueryGetDonationByOrgIdArgs } from "../../../src/types/generatedGraphQLTypes"; import { Document } from "mongoose"; let testOrganization: Interface_Organization & diff --git a/__tests__/resolvers/Query/getDonations.spec.ts b/tests/resolvers/Query/getDonations.spec.ts similarity index 93% rename from __tests__/resolvers/Query/getDonations.spec.ts rename to tests/resolvers/Query/getDonations.spec.ts index 934df3bf6b..b2ce9157ed 100644 --- a/__tests__/resolvers/Query/getDonations.spec.ts +++ b/tests/resolvers/Query/getDonations.spec.ts @@ -1,7 +1,7 @@ import "dotenv/config"; -import { User, Organization, Donation } from "../../../src/lib/models"; +import { User, Organization, Donation } from "../../../src/models"; import { connect, disconnect } from "../../../src/db"; -import { getDonations as getDonationsResolver } from "../../../src/lib/resolvers/Query/getDonations"; +import { getDonations as getDonationsResolver } from "../../../src/resolvers/Query/getDonations"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Query/getPlugins.spec.ts b/tests/resolvers/Query/getPlugins.spec.ts similarity index 88% rename from __tests__/resolvers/Query/getPlugins.spec.ts rename to tests/resolvers/Query/getPlugins.spec.ts index 86a74be665..872538ea85 100644 --- a/__tests__/resolvers/Query/getPlugins.spec.ts +++ b/tests/resolvers/Query/getPlugins.spec.ts @@ -1,7 +1,7 @@ import "dotenv/config"; -import { getPlugins as getPluginsResolver } from "../../../src/lib/resolvers/Query/getPlugins"; +import { getPlugins as getPluginsResolver } from "../../../src/resolvers/Query/getPlugins"; import { connect, disconnect } from "../../../src/db"; -import { Organization, Plugin, User } from "../../../src/lib/models"; +import { Organization, Plugin, User } from "../../../src/models"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Query/getlanguage.spec.ts b/tests/resolvers/Query/getlanguage.spec.ts similarity index 91% rename from __tests__/resolvers/Query/getlanguage.spec.ts rename to tests/resolvers/Query/getlanguage.spec.ts index d484ebe962..5fd0fc9537 100644 --- a/__tests__/resolvers/Query/getlanguage.spec.ts +++ b/tests/resolvers/Query/getlanguage.spec.ts @@ -1,9 +1,9 @@ import "dotenv/config"; -import { getlanguage as getLanguageResolver } from "../../../src/lib/resolvers/Query/getlanguage"; +import { getlanguage as getLanguageResolver } from "../../../src/resolvers/Query/getlanguage"; import { connect, disconnect } from "../../../src/db"; -import { Interface_Language, Language } from "../../../src/lib/models"; +import { Interface_Language, Language } from "../../../src/models"; import { Document } from "mongoose"; -import { QueryGetlanguageArgs } from "../../../src/generated/graphqlCodegen"; +import { QueryGetlanguageArgs } from "../../../src/types/generatedGraphQLTypes"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Query/groupChatMessages.spec.ts b/tests/resolvers/Query/groupChatMessages.spec.ts similarity index 95% rename from __tests__/resolvers/Query/groupChatMessages.spec.ts rename to tests/resolvers/Query/groupChatMessages.spec.ts index 01e234ec6b..837ce057a1 100644 --- a/__tests__/resolvers/Query/groupChatMessages.spec.ts +++ b/tests/resolvers/Query/groupChatMessages.spec.ts @@ -1,12 +1,12 @@ import "dotenv/config"; -import { groupChatMessages as groupChatMessagesResolver } from "../../../src/lib/resolvers/Query/groupChatMessages"; +import { groupChatMessages as groupChatMessagesResolver } from "../../../src/resolvers/Query/groupChatMessages"; import { connect, disconnect } from "../../../src/db"; import { GroupChat, GroupChatMessage, Organization, User, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Query/groupChats.spec.ts b/tests/resolvers/Query/groupChats.spec.ts similarity index 89% rename from __tests__/resolvers/Query/groupChats.spec.ts rename to tests/resolvers/Query/groupChats.spec.ts index 8aaab9271a..2c1fa56372 100644 --- a/__tests__/resolvers/Query/groupChats.spec.ts +++ b/tests/resolvers/Query/groupChats.spec.ts @@ -1,7 +1,7 @@ import "dotenv/config"; -import { groupChats as groupChatsResolver } from "../../../src/lib/resolvers/Query/groupChats"; +import { groupChats as groupChatsResolver } from "../../../src/resolvers/Query/groupChats"; import { connect, disconnect } from "../../../src/db"; -import { GroupChat, Organization, User } from "../../../src/lib/models"; +import { GroupChat, Organization, User } from "../../../src/models"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Query/groups.spec.ts b/tests/resolvers/Query/groups.spec.ts similarity index 89% rename from __tests__/resolvers/Query/groups.spec.ts rename to tests/resolvers/Query/groups.spec.ts index 95ec21367a..e379d95232 100644 --- a/__tests__/resolvers/Query/groups.spec.ts +++ b/tests/resolvers/Query/groups.spec.ts @@ -1,7 +1,7 @@ import "dotenv/config"; -import { groups as groupsResolver } from "../../../src/lib/resolvers/Query/groups"; +import { groups as groupsResolver } from "../../../src/resolvers/Query/groups"; import { connect, disconnect } from "../../../src/db"; -import { User, Organization, Group } from "../../../src/lib/models"; +import { User, Organization, Group } from "../../../src/models"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Query/isUserRegister.spec.ts b/tests/resolvers/Query/isUserRegister.spec.ts similarity index 97% rename from __tests__/resolvers/Query/isUserRegister.spec.ts rename to tests/resolvers/Query/isUserRegister.spec.ts index 8cc20a66d8..0d3bc76e74 100644 --- a/__tests__/resolvers/Query/isUserRegister.spec.ts +++ b/tests/resolvers/Query/isUserRegister.spec.ts @@ -1,5 +1,5 @@ import "dotenv/config"; -import { isUserRegister as isUserRegisterResolver } from "../../../src/lib/resolvers/Query/isUserRegister"; +import { isUserRegister as isUserRegisterResolver } from "../../../src/resolvers/Query/isUserRegister"; import { User, Organization, @@ -7,11 +7,11 @@ import { Interface_Event, Task, Interface_User, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { connect, disconnect } from "../../../src/db"; import { nanoid } from "nanoid"; import { Document, Types } from "mongoose"; -import { QueryIsUserRegisterArgs } from "../../../src/generated/graphqlCodegen"; +import { QueryIsUserRegisterArgs } from "../../../src/types/generatedGraphQLTypes"; import { EVENT_NOT_FOUND } from "../../../src/constants"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Query/me.spec.ts b/tests/resolvers/Query/me.spec.ts similarity index 94% rename from __tests__/resolvers/Query/me.spec.ts rename to tests/resolvers/Query/me.spec.ts index 3042144b75..40a8e0c9d6 100644 --- a/__tests__/resolvers/Query/me.spec.ts +++ b/tests/resolvers/Query/me.spec.ts @@ -1,13 +1,8 @@ import "dotenv/config"; -import { me as meResolver } from "../../../src/lib/resolvers/Query/me"; +import { me as meResolver } from "../../../src/resolvers/Query/me"; import { connect, disconnect } from "../../../src/db"; import { USER_NOT_FOUND } from "../../../src/constants"; -import { - Interface_User, - User, - Organization, - Event, -} from "../../../src/lib/models"; +import { Interface_User, User, Organization, Event } from "../../../src/models"; import { nanoid } from "nanoid"; import { Document, Types } from "mongoose"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Query/myLanguage.spec.ts b/tests/resolvers/Query/myLanguage.spec.ts similarity index 89% rename from __tests__/resolvers/Query/myLanguage.spec.ts rename to tests/resolvers/Query/myLanguage.spec.ts index 8196d13c83..fe74dd361b 100644 --- a/__tests__/resolvers/Query/myLanguage.spec.ts +++ b/tests/resolvers/Query/myLanguage.spec.ts @@ -1,8 +1,8 @@ import "dotenv/config"; -import { myLanguage as myLanguageResolver } from "../../../src/lib/resolvers/Query/myLanguage"; +import { myLanguage as myLanguageResolver } from "../../../src/resolvers/Query/myLanguage"; import { connect, disconnect } from "../../../src/db"; import { USER_NOT_FOUND } from "../../../src/constants"; -import { User } from "../../../src/lib/models"; +import { User } from "../../../src/models"; import { nanoid } from "nanoid"; import { Types } from "mongoose"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Query/organizations.spec.ts b/tests/resolvers/Query/organizations.spec.ts similarity index 92% rename from __tests__/resolvers/Query/organizations.spec.ts rename to tests/resolvers/Query/organizations.spec.ts index e65e0cad0e..d6a8980c61 100644 --- a/__tests__/resolvers/Query/organizations.spec.ts +++ b/tests/resolvers/Query/organizations.spec.ts @@ -1,16 +1,13 @@ import "dotenv/config"; -import { organizations as organizationsResolver } from "../../../src/lib/resolvers/Query/organizations"; +import { organizations as organizationsResolver } from "../../../src/resolvers/Query/organizations"; import { ORGANIZATION_NOT_FOUND } from "../../../src/constants"; import { Interface_Organization, Organization, User, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { connect, disconnect } from "../../../src/db"; -import { - QueryOrganizationsArgs, - OrganizationOrderByInput, -} from "../../../src/generated/graphqlCodegen"; +import { QueryOrganizationsArgs } from "../../../src/types/generatedGraphQLTypes"; import { Document, Types } from "mongoose"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; @@ -106,7 +103,7 @@ describe("resolvers -> Query -> organizations", () => { }; const args: QueryOrganizationsArgs = { - orderBy: OrganizationOrderByInput.IdAsc, + orderBy: "id_ASC", }; const organizationsPayload = await organizationsResolver?.({}, args, {}); @@ -126,7 +123,7 @@ describe("resolvers -> Query -> organizations", () => { }; const args: QueryOrganizationsArgs = { - orderBy: OrganizationOrderByInput.IdDesc, + orderBy: "id_DESC", }; const organizationsPayload = await organizationsResolver?.({}, args, {}); @@ -146,7 +143,7 @@ describe("resolvers -> Query -> organizations", () => { }; const args: QueryOrganizationsArgs = { - orderBy: OrganizationOrderByInput.NameAsc, + orderBy: "name_ASC", }; const organizationsPayload = await organizationsResolver?.({}, args, {}); @@ -166,7 +163,7 @@ describe("resolvers -> Query -> organizations", () => { }; const args: QueryOrganizationsArgs = { - orderBy: OrganizationOrderByInput.NameDesc, + orderBy: "name_DESC", }; const organizationsPayload = await organizationsResolver?.({}, args, {}); @@ -186,7 +183,7 @@ describe("resolvers -> Query -> organizations", () => { }; const args: QueryOrganizationsArgs = { - orderBy: OrganizationOrderByInput.DescriptionAsc, + orderBy: "description_ASC", }; const organizationsPayload = await organizationsResolver?.({}, args, {}); @@ -206,7 +203,7 @@ describe("resolvers -> Query -> organizations", () => { }; const args: QueryOrganizationsArgs = { - orderBy: OrganizationOrderByInput.DescriptionDesc, + orderBy: "description_DESC", }; const organizationsPayload = await organizationsResolver?.({}, args, {}); @@ -226,7 +223,7 @@ describe("resolvers -> Query -> organizations", () => { }; const args: QueryOrganizationsArgs = { - orderBy: OrganizationOrderByInput.ApiUrlAsc, + orderBy: "apiUrl_ASC", }; const organizationsPayload = await organizationsResolver?.({}, args, {}); @@ -246,7 +243,7 @@ describe("resolvers -> Query -> organizations", () => { }; const args: QueryOrganizationsArgs = { - orderBy: OrganizationOrderByInput.ApiUrlDesc, + orderBy: "apiUrl_DESC", }; const organizationsPayload = await organizationsResolver?.({}, args, {}); diff --git a/__tests__/resolvers/Query/organizationsConnection.spec.ts b/tests/resolvers/Query/organizationsConnection.spec.ts similarity index 95% rename from __tests__/resolvers/Query/organizationsConnection.spec.ts rename to tests/resolvers/Query/organizationsConnection.spec.ts index afc8f82ac8..579d4a90c2 100644 --- a/__tests__/resolvers/Query/organizationsConnection.spec.ts +++ b/tests/resolvers/Query/organizationsConnection.spec.ts @@ -1,15 +1,12 @@ import "dotenv/config"; -import { organizationsConnection as organizationsConnectionResolver } from "../../../src/lib/resolvers/Query/organizationsConnection"; +import { organizationsConnection as organizationsConnectionResolver } from "../../../src/resolvers/Query/organizationsConnection"; import { Interface_Organization, Organization, User, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { connect, disconnect } from "../../../src/db"; -import { - OrganizationOrderByInput, - QueryOrganizationsConnectionArgs, -} from "../../../src/generated/graphqlCodegen"; +import { QueryOrganizationsConnectionArgs } from "../../../src/types/generatedGraphQLTypes"; import { nanoid } from "nanoid"; import { Document } from "mongoose"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; @@ -137,7 +134,7 @@ describe("resolvers -> Query -> organizationsConnection", () => { visibleInSearch: testOrganizations[1].visibleInSearch, isPublic: testOrganizations[1].isPublic, }, - orderBy: OrganizationOrderByInput.IdAsc, + orderBy: "id_ASC", }; const organizations = await Organization.find(where) @@ -184,7 +181,7 @@ describe("resolvers -> Query -> organizationsConnection", () => { description_not: testOrganizations[0].description, apiUrl_not: testOrganizations[0].apiUrl, }, - orderBy: OrganizationOrderByInput.IdDesc, + orderBy: "id_DESC", }; const organizations = await Organization.find(where) @@ -231,7 +228,7 @@ describe("resolvers -> Query -> organizationsConnection", () => { description_in: [testOrganizations[1].description], apiUrl_in: [testOrganizations[1].apiUrl!], }, - orderBy: OrganizationOrderByInput.NameAsc, + orderBy: "name_ASC", }; const organizations = await Organization.find(where) @@ -278,7 +275,7 @@ describe("resolvers -> Query -> organizationsConnection", () => { description_not_in: [testOrganizations[0].description], apiUrl_not_in: [testOrganizations[0].apiUrl!], }, - orderBy: OrganizationOrderByInput.NameDesc, + orderBy: "name_DESC", }; const organizations = await Organization.find(where) @@ -324,7 +321,7 @@ describe("resolvers -> Query -> organizationsConnection", () => { description_contains: testOrganizations[1].description, apiUrl_contains: testOrganizations[1].apiUrl, }, - orderBy: OrganizationOrderByInput.DescriptionAsc, + orderBy: "description_ASC", }; const organizations = await Organization.find(where) @@ -361,7 +358,7 @@ describe("resolvers -> Query -> organizationsConnection", () => { description_starts_with: testOrganizations[1].description, apiUrl_starts_with: testOrganizations[1].apiUrl, }, - orderBy: OrganizationOrderByInput.DescriptionDesc, + orderBy: "description_DESC", }; const organizations = await Organization.find(where) @@ -386,7 +383,7 @@ describe("resolvers -> Query -> organizationsConnection", () => { where: null, first: 2, skip: 1, - orderBy: OrganizationOrderByInput.ApiUrlAsc, + orderBy: "apiUrl_ASC", }; const organizations = await Organization.find() @@ -411,7 +408,7 @@ describe("resolvers -> Query -> organizationsConnection", () => { where: null, first: 2, skip: 1, - orderBy: OrganizationOrderByInput.ApiUrlDesc, + orderBy: "apiUrl_DESC", }; const organizations = await Organization.find() diff --git a/__tests__/resolvers/Query/organizationsMemberConnection.spec.ts b/tests/resolvers/Query/organizationsMemberConnection.spec.ts similarity index 96% rename from __tests__/resolvers/Query/organizationsMemberConnection.spec.ts rename to tests/resolvers/Query/organizationsMemberConnection.spec.ts index 3762162c09..cdf84aa183 100644 --- a/__tests__/resolvers/Query/organizationsMemberConnection.spec.ts +++ b/tests/resolvers/Query/organizationsMemberConnection.spec.ts @@ -1,13 +1,13 @@ import "dotenv/config"; -import { organizationsMemberConnection as organizationsMemberConnectionResolver } from "../../../src/lib/resolvers/Query/organizationsMemberConnection"; +import { organizationsMemberConnection as organizationsMemberConnectionResolver } from "../../../src/resolvers/Query/organizationsMemberConnection"; import { Interface_Organization, Interface_User, Organization, User, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { connect, disconnect } from "../../../src/db"; -import { QueryOrganizationsMemberConnectionArgs } from "../../../src/generated/graphqlCodegen"; +import { QueryOrganizationsMemberConnectionArgs } from "../../../src/types/generatedGraphQLTypes"; import { Document, Types } from "mongoose"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; @@ -152,7 +152,7 @@ describe("resolvers -> Query -> organizationsMemberConnection", () => { // email: testUsers[1].email, // appLanguageCode: testUsers[1].appLanguageCode, // }, - // orderBy: UserOrderByInput.IdAsc, + // orderBy: "id_ASC", // }; // const organizationsMemberConnectionPayload = @@ -215,7 +215,7 @@ describe("resolvers -> Query -> organizationsMemberConnection", () => { // email_not: testUsers[2].email, // appLanguageCode_not: testUsers[2].appLanguageCode, // }, - // orderBy: UserOrderByInput.IdDesc, + // orderBy: "id_DESC", // }; // const organizationsMemberConnectionPayload = // await organizationsMemberConnectionResolver?.({}, args, {}); @@ -268,7 +268,7 @@ describe("resolvers -> Query -> organizationsMemberConnection", () => { // email_in: [testUsers[1].email], // appLanguageCode_in: [testUsers[1].appLanguageCode], // }, - // orderBy: UserOrderByInput.FirstNameAsc, + // orderBy: "firstName_ASC", // }; // const organizationsMemberConnectionPayload = // await organizationsMemberConnectionResolver?.({}, args, {}); @@ -290,7 +290,7 @@ describe("resolvers -> Query -> organizationsMemberConnection", () => { // args.where === { id_not_in: [testUsers[2]._id], firstName_not_in: [testUsers[2].firstName], // lastName_not_in: [testUsers[2].lastName], email_not_in: [testUsers[2].email], // appLanguageCode_not_in: [testUsers[2].appLanguageCode] } and - // sorted by args.orderBy === 'FirstNameDesc'`, async () => { + // sorted by args.orderBy === 'firstName_DESC'`, async () => { // const where = { // _id: { // $nin: [testUsers[2]._id], @@ -321,7 +321,7 @@ describe("resolvers -> Query -> organizationsMemberConnection", () => { // email_not_in: [testUsers[2].email], // appLanguageCode_not_in: [testUsers[2].appLanguageCode], // }, - // orderBy: UserOrderByInput.FirstNameDesc, + // orderBy: "firstName_DESC", // }; // const organizationsMemberConnectionPayload = // await organizationsMemberConnectionResolver?.({}, args, {}); @@ -374,7 +374,7 @@ describe("resolvers -> Query -> organizationsMemberConnection", () => { // email_contains: testUsers[1].email, // appLanguageCode_contains: testUsers[1].appLanguageCode, // }, - // orderBy: UserOrderByInput.LastNameAsc, + // orderBy: "lastName_ASC", // }; // const organizationsMemberConnectionPayload = // await organizationsMemberConnectionResolver?.({}, args, {}); @@ -415,7 +415,7 @@ describe("resolvers -> Query -> organizationsMemberConnection", () => { // email_starts_with: testUsers[1].email, // appLanguageCode_starts_with: testUsers[1].appLanguageCode, // }, - // orderBy: UserOrderByInput.LastNameDesc, + // orderBy: "lastName_DESC", // }; // const organizationsMemberConnectionPayload = // await organizationsMemberConnectionResolver?.({}, args, {}); @@ -443,7 +443,7 @@ describe("resolvers -> Query -> organizationsMemberConnection", () => { // first: 2, // skip: 1, // where: null, - // orderBy: UserOrderByInput.AppLanguageCodeAsc, + // orderBy: "appLanguageCode_ASC", // }; // const organizationsMemberConnectionPayload = // await organizationsMemberConnectionResolver?.({}, args, {}); @@ -471,7 +471,7 @@ describe("resolvers -> Query -> organizationsMemberConnection", () => { // first: 2, // skip: 1, // where: null, - // orderBy: UserOrderByInput.AppLanguageCodeDesc, + // orderBy: "appLanguageCode_DESC", // }; // const organizationsMemberConnectionPayload = // await organizationsMemberConnectionResolver?.({}, args, {}); @@ -499,7 +499,7 @@ describe("resolvers -> Query -> organizationsMemberConnection", () => { // first: 2, // skip: 1, // where: null, - // orderBy: UserOrderByInput.EmailAsc, + // orderBy: "email_ASC", // }; // const organizationsMemberConnectionPayload = // await organizationsMemberConnectionResolver?.({}, args, {}); @@ -527,7 +527,7 @@ describe("resolvers -> Query -> organizationsMemberConnection", () => { // first: 2, // skip: 1, // where: null, - // orderBy: UserOrderByInput.EmailDesc, + // orderBy: "email_DESC", // }; // const organizationsMemberConnectionPayload = // await organizationsMemberConnectionResolver?.({}, args, {}); diff --git a/__tests__/resolvers/Query/post.spec.ts b/tests/resolvers/Query/post.spec.ts similarity index 94% rename from __tests__/resolvers/Query/post.spec.ts rename to tests/resolvers/Query/post.spec.ts index 7a401a4ce8..acd6f73d3f 100644 --- a/__tests__/resolvers/Query/post.spec.ts +++ b/tests/resolvers/Query/post.spec.ts @@ -1,17 +1,17 @@ import "dotenv/config"; -import { post as postResolver } from "../../../src/lib/resolvers/Query/post"; +import { post as postResolver } from "../../../src/resolvers/Query/post"; import { User, Organization, Post, Comment, Interface_Post, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { connect, disconnect } from "../../../src/db"; import { nanoid } from "nanoid"; import { Document, Types } from "mongoose"; import { POST_NOT_FOUND } from "../../../src/constants"; -import { QueryPostArgs } from "../../../src/generated/graphqlCodegen"; +import { QueryPostArgs } from "../../../src/types/generatedGraphQLTypes"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; let testPost: Interface_Post & Document; diff --git a/__tests__/resolvers/Query/posts.spec.ts b/tests/resolvers/Query/posts.spec.ts similarity index 94% rename from __tests__/resolvers/Query/posts.spec.ts rename to tests/resolvers/Query/posts.spec.ts index 6aee50a3ff..ebf3450abd 100644 --- a/__tests__/resolvers/Query/posts.spec.ts +++ b/tests/resolvers/Query/posts.spec.ts @@ -1,12 +1,9 @@ import "dotenv/config"; -import { posts as postsResolver } from "../../../src/lib/resolvers/Query/posts"; -import { User, Organization, Post, Comment } from "../../../src/lib/models"; +import { posts as postsResolver } from "../../../src/resolvers/Query/posts"; +import { User, Organization, Post, Comment } from "../../../src/models"; import { connect, disconnect } from "../../../src/db"; import { nanoid } from "nanoid"; -import { - QueryPostsArgs, - PostOrderByInput, -} from "../../../src/generated/graphqlCodegen"; +import { QueryPostsArgs } from "../../../src/types/generatedGraphQLTypes"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; beforeAll(async () => { @@ -150,7 +147,7 @@ describe("resolvers -> Query -> posts", () => { }; const args: QueryPostsArgs = { - orderBy: PostOrderByInput.IdAsc, + orderBy: "id_ASC", }; const postsPayload = await postsResolver?.({}, args, {}); @@ -185,7 +182,7 @@ describe("resolvers -> Query -> posts", () => { }; const args: QueryPostsArgs = { - orderBy: PostOrderByInput.IdDesc, + orderBy: "id_DESC", }; const postsPayload = await postsResolver?.({}, args, {}); @@ -220,7 +217,7 @@ describe("resolvers -> Query -> posts", () => { }; const args: QueryPostsArgs = { - orderBy: PostOrderByInput.TextAsc, + orderBy: "text_ASC", }; const postsPayload = await postsResolver?.({}, args, {}); @@ -255,7 +252,7 @@ describe("resolvers -> Query -> posts", () => { }; const args: QueryPostsArgs = { - orderBy: PostOrderByInput.TextDesc, + orderBy: "text_DESC", }; const postsPayload = await postsResolver?.({}, args, {}); @@ -290,7 +287,7 @@ describe("resolvers -> Query -> posts", () => { }; const args: QueryPostsArgs = { - orderBy: PostOrderByInput.TitleAsc, + orderBy: "title_ASC", }; const postsPayload = await postsResolver?.({}, args, {}); @@ -325,7 +322,7 @@ describe("resolvers -> Query -> posts", () => { }; const args: QueryPostsArgs = { - orderBy: PostOrderByInput.TitleDesc, + orderBy: "title_DESC", }; const postsPayload = await postsResolver?.({}, args, {}); @@ -360,7 +357,7 @@ describe("resolvers -> Query -> posts", () => { }; const args: QueryPostsArgs = { - orderBy: PostOrderByInput.CreatedAtAsc, + orderBy: "createdAt_ASC", }; const postsPayload = await postsResolver?.({}, args, {}); @@ -395,7 +392,7 @@ describe("resolvers -> Query -> posts", () => { }; const args: QueryPostsArgs = { - orderBy: PostOrderByInput.CreatedAtDesc, + orderBy: "createdAt_DESC", }; const postsPayload = await postsResolver?.({}, args, {}); @@ -430,7 +427,7 @@ describe("resolvers -> Query -> posts", () => { }; const args: QueryPostsArgs = { - orderBy: PostOrderByInput.ImageUrlAsc, + orderBy: "imageUrl_ASC", }; const postsPayload = await postsResolver?.({}, args, {}); @@ -465,7 +462,7 @@ describe("resolvers -> Query -> posts", () => { }; const args: QueryPostsArgs = { - orderBy: PostOrderByInput.ImageUrlDesc, + orderBy: "imageUrl_DESC", }; const postsPayload = await postsResolver?.({}, args, {}); @@ -500,7 +497,7 @@ describe("resolvers -> Query -> posts", () => { }; const args: QueryPostsArgs = { - orderBy: PostOrderByInput.VideoUrlAsc, + orderBy: "videoUrl_ASC", }; const postsPayload = await postsResolver?.({}, args, {}); @@ -535,7 +532,7 @@ describe("resolvers -> Query -> posts", () => { }; const args: QueryPostsArgs = { - orderBy: PostOrderByInput.VideoUrlDesc, + orderBy: "videoUrl_DESC", }; const postsPayload = await postsResolver?.({}, args, {}); @@ -570,7 +567,7 @@ describe("resolvers -> Query -> posts", () => { }; const args: QueryPostsArgs = { - orderBy: PostOrderByInput.LikeCountAsc, + orderBy: "likeCount_ASC", }; const postsPayload = await postsResolver?.({}, args, {}); @@ -605,7 +602,7 @@ describe("resolvers -> Query -> posts", () => { }; const args: QueryPostsArgs = { - orderBy: PostOrderByInput.LikeCountDesc, + orderBy: "likeCount_DESC", }; const postsPayload = await postsResolver?.({}, args, {}); @@ -640,7 +637,7 @@ describe("resolvers -> Query -> posts", () => { }; const args: QueryPostsArgs = { - orderBy: PostOrderByInput.CommentCountAsc, + orderBy: "commentCount_ASC", }; const postsPayload = await postsResolver?.({}, args, {}); @@ -675,7 +672,7 @@ describe("resolvers -> Query -> posts", () => { }; const args: QueryPostsArgs = { - orderBy: PostOrderByInput.CommentCountDesc, + orderBy: "commentCount_DESC", }; const postsPayload = await postsResolver?.({}, args, {}); diff --git a/__tests__/resolvers/Query/postsByOrganization.spec.ts b/tests/resolvers/Query/postsByOrganization.spec.ts similarity index 95% rename from __tests__/resolvers/Query/postsByOrganization.spec.ts rename to tests/resolvers/Query/postsByOrganization.spec.ts index cc07b73eed..17fdb58970 100644 --- a/__tests__/resolvers/Query/postsByOrganization.spec.ts +++ b/tests/resolvers/Query/postsByOrganization.spec.ts @@ -1,18 +1,15 @@ import "dotenv/config"; -import { postsByOrganization as postsByOrganizationResolver } from "../../../src/lib/resolvers/Query/postsByOrganization"; +import { postsByOrganization as postsByOrganizationResolver } from "../../../src/resolvers/Query/postsByOrganization"; import { User, Organization, Post, Comment, Interface_Organization, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { connect, disconnect } from "../../../src/db"; import { nanoid } from "nanoid"; -import { - QueryPostsByOrganizationArgs, - PostOrderByInput, -} from "../../../src/generated/graphqlCodegen"; +import { QueryPostsByOrganizationArgs } from "../../../src/types/generatedGraphQLTypes"; import { Document } from "mongoose"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; @@ -162,7 +159,7 @@ describe("resolvers -> Query -> posts", () => { const args: QueryPostsByOrganizationArgs = { id: testOrganization.id, - orderBy: PostOrderByInput.IdAsc, + orderBy: "id_ASC", }; const postsByOrganizationPayload = await postsByOrganizationResolver?.( @@ -197,7 +194,7 @@ describe("resolvers -> Query -> posts", () => { const args: QueryPostsByOrganizationArgs = { id: testOrganization.id, - orderBy: PostOrderByInput.IdDesc, + orderBy: "id_DESC", }; const postsByOrganizationPayload = await postsByOrganizationResolver?.( @@ -232,7 +229,7 @@ describe("resolvers -> Query -> posts", () => { const args: QueryPostsByOrganizationArgs = { id: testOrganization.id, - orderBy: PostOrderByInput.TextAsc, + orderBy: "text_ASC", }; const postsByOrganizationPayload = await postsByOrganizationResolver?.( @@ -267,7 +264,7 @@ describe("resolvers -> Query -> posts", () => { const args: QueryPostsByOrganizationArgs = { id: testOrganization.id, - orderBy: PostOrderByInput.TextDesc, + orderBy: "text_DESC", }; const postsByOrganizationPayload = await postsByOrganizationResolver?.( @@ -302,7 +299,7 @@ describe("resolvers -> Query -> posts", () => { const args: QueryPostsByOrganizationArgs = { id: testOrganization.id, - orderBy: PostOrderByInput.TitleAsc, + orderBy: "title_ASC", }; const postsByOrganizationPayload = await postsByOrganizationResolver?.( @@ -337,7 +334,7 @@ describe("resolvers -> Query -> posts", () => { const args: QueryPostsByOrganizationArgs = { id: testOrganization.id, - orderBy: PostOrderByInput.TitleDesc, + orderBy: "title_DESC", }; const postsByOrganizationPayload = await postsByOrganizationResolver?.( @@ -372,7 +369,7 @@ describe("resolvers -> Query -> posts", () => { const args: QueryPostsByOrganizationArgs = { id: testOrganization.id, - orderBy: PostOrderByInput.CreatedAtAsc, + orderBy: "createdAt_ASC", }; const postsByOrganizationPayload = await postsByOrganizationResolver?.( @@ -407,7 +404,7 @@ describe("resolvers -> Query -> posts", () => { const args: QueryPostsByOrganizationArgs = { id: testOrganization.id, - orderBy: PostOrderByInput.CreatedAtDesc, + orderBy: "createdAt_DESC", }; const postsByOrganizationPayload = await postsByOrganizationResolver?.( @@ -442,7 +439,7 @@ describe("resolvers -> Query -> posts", () => { const args: QueryPostsByOrganizationArgs = { id: testOrganization.id, - orderBy: PostOrderByInput.ImageUrlAsc, + orderBy: "imageUrl_ASC", }; const postsByOrganizationPayload = await postsByOrganizationResolver?.( @@ -477,7 +474,7 @@ describe("resolvers -> Query -> posts", () => { const args: QueryPostsByOrganizationArgs = { id: testOrganization.id, - orderBy: PostOrderByInput.ImageUrlDesc, + orderBy: "imageUrl_DESC", }; const postsByOrganizationPayload = await postsByOrganizationResolver?.( @@ -512,7 +509,7 @@ describe("resolvers -> Query -> posts", () => { const args: QueryPostsByOrganizationArgs = { id: testOrganization.id, - orderBy: PostOrderByInput.VideoUrlAsc, + orderBy: "videoUrl_ASC", }; const postsByOrganizationPayload = await postsByOrganizationResolver?.( @@ -547,7 +544,7 @@ describe("resolvers -> Query -> posts", () => { const args: QueryPostsByOrganizationArgs = { id: testOrganization.id, - orderBy: PostOrderByInput.VideoUrlDesc, + orderBy: "videoUrl_DESC", }; const postsByOrganizationPayload = await postsByOrganizationResolver?.( @@ -582,7 +579,7 @@ describe("resolvers -> Query -> posts", () => { const args: QueryPostsByOrganizationArgs = { id: testOrganization.id, - orderBy: PostOrderByInput.LikeCountAsc, + orderBy: "likeCount_ASC", }; const postsByOrganizationPayload = await postsByOrganizationResolver?.( @@ -617,7 +614,7 @@ describe("resolvers -> Query -> posts", () => { const args: QueryPostsByOrganizationArgs = { id: testOrganization.id, - orderBy: PostOrderByInput.LikeCountDesc, + orderBy: "likeCount_DESC", }; const postsByOrganizationPayload = await postsByOrganizationResolver?.( @@ -652,7 +649,7 @@ describe("resolvers -> Query -> posts", () => { const args: QueryPostsByOrganizationArgs = { id: testOrganization.id, - orderBy: PostOrderByInput.CommentCountAsc, + orderBy: "commentCount_ASC", }; const postsByOrganizationPayload = await postsByOrganizationResolver?.( @@ -687,7 +684,7 @@ describe("resolvers -> Query -> posts", () => { const args: QueryPostsByOrganizationArgs = { id: testOrganization.id, - orderBy: PostOrderByInput.CommentCountDesc, + orderBy: "commentCount_DESC", }; const postsByOrganizationPayload = await postsByOrganizationResolver?.( diff --git a/__tests__/resolvers/Query/postsByOrganizationConnection.spec.ts b/tests/resolvers/Query/postsByOrganizationConnection.spec.ts similarity index 96% rename from __tests__/resolvers/Query/postsByOrganizationConnection.spec.ts rename to tests/resolvers/Query/postsByOrganizationConnection.spec.ts index 3fe33b04c6..e5bb01f637 100644 --- a/__tests__/resolvers/Query/postsByOrganizationConnection.spec.ts +++ b/tests/resolvers/Query/postsByOrganizationConnection.spec.ts @@ -1,16 +1,16 @@ import "dotenv/config"; -import { postsByOrganizationConnection as postsByOrganizationConnectionResolver } from "../../../src/lib/resolvers/Query/postsByOrganizationConnection"; +import { postsByOrganizationConnection as postsByOrganizationConnectionResolver } from "../../../src/resolvers/Query/postsByOrganizationConnection"; import { Comment, Interface_Organization, Organization, Post, User, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { connect, disconnect } from "../../../src/db"; import { Document, Types } from "mongoose"; import { nanoid } from "nanoid"; -import { QueryPostsByOrganizationConnectionArgs } from "../../../src/generated/graphqlCodegen"; +import { QueryPostsByOrganizationConnectionArgs } from "../../../src/types/generatedGraphQLTypes"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; let testOrganization: Interface_Organization & @@ -168,7 +168,7 @@ describe("resolvers -> Query -> users", () => { // email_not: testUsers[2].email, // appLanguageCode_not: testUsers[2].appLanguageCode, // }, - // orderBy: UserOrderByInput.IdDesc, + // orderBy: "id_DESC", // }; // const postsByOrganizationConnectionPayload = @@ -227,7 +227,7 @@ describe("resolvers -> Query -> users", () => { // email_in: [testUsers[1].email], // appLanguageCode_in: [testUsers[1].appLanguageCode], // }, - // orderBy: UserOrderByInput.FirstNameAsc, + // orderBy: "firstName_ASC", // }; // const postsByOrganizationConnectionPayload = @@ -253,7 +253,7 @@ describe("resolvers -> Query -> users", () => { // args.where === { id_not_in: [testUsers[2]._id], firstName_not_in: [testUsers[2].firstName], // lastName_not_in: [testUsers[2].lastName], email_not_in: [testUsers[2].email], // appLanguageCode_not_in: [testUsers[2].appLanguageCode] } and - // sorted by args.orderBy === 'FirstNameDesc'`, async () => { + // sorted by args.orderBy === 'firstName_DESC'`, async () => { // const where = { // _id: { // $nin: [testUsers[2]._id], @@ -286,7 +286,7 @@ describe("resolvers -> Query -> users", () => { // email_not_in: [testUsers[2].email], // appLanguageCode_not_in: [testUsers[2].appLanguageCode], // }, - // orderBy: UserOrderByInput.FirstNameDesc, + // orderBy: "firstName_DESC", // }; // const postsByOrganizationConnectionPayload = @@ -345,7 +345,7 @@ describe("resolvers -> Query -> users", () => { // email_contains: testUsers[1].email, // appLanguageCode_contains: testUsers[1].appLanguageCode, // }, - // orderBy: UserOrderByInput.LastNameAsc, + // orderBy: "lastName_ASC", // }; // const postsByOrganizationConnectionPayload = @@ -392,7 +392,7 @@ describe("resolvers -> Query -> users", () => { // email_starts_with: testUsers[1].email, // appLanguageCode_starts_with: testUsers[1].appLanguageCode, // }, - // orderBy: UserOrderByInput.LastNameDesc, + // orderBy: "lastName_DESC", // }; // const postsByOrganizationConnectionPayload = @@ -426,7 +426,7 @@ describe("resolvers -> Query -> users", () => { // first: 2, // skip: 1, // where: null, - // orderBy: UserOrderByInput.AppLanguageCodeAsc, + // orderBy: "appLanguageCode_ASC", // }; // const postsByOrganizationConnectionPayload = @@ -460,7 +460,7 @@ describe("resolvers -> Query -> users", () => { // first: 2, // skip: 1, // where: null, - // orderBy: UserOrderByInput.AppLanguageCodeDesc, + // orderBy: "appLanguageCode_DESC", // }; // const postsByOrganizationConnectionPayload = @@ -494,7 +494,7 @@ describe("resolvers -> Query -> users", () => { // first: 2, // skip: 1, // where: null, - // orderBy: UserOrderByInput.EmailAsc, + // orderBy: "email_ASC", // }; // const postsByOrganizationConnectionPayload = @@ -528,7 +528,7 @@ describe("resolvers -> Query -> users", () => { // first: 2, // skip: 1, // where: null, - // orderBy: UserOrderByInput.EmailDesc, + // orderBy: "email_DESC", // }; // const postsByOrganizationConnectionPayload = diff --git a/__tests__/resolvers/Query/registeredEventsByUser.spec.ts b/tests/resolvers/Query/registeredEventsByUser.spec.ts similarity index 95% rename from __tests__/resolvers/Query/registeredEventsByUser.spec.ts rename to tests/resolvers/Query/registeredEventsByUser.spec.ts index 053454305a..61b9a30c93 100644 --- a/__tests__/resolvers/Query/registeredEventsByUser.spec.ts +++ b/tests/resolvers/Query/registeredEventsByUser.spec.ts @@ -1,18 +1,15 @@ import "dotenv/config"; -import { registeredEventsByUser as registeredEventsByUserResolver } from "../../../src/lib/resolvers/Query/registeredEventsByUser"; +import { registeredEventsByUser as registeredEventsByUserResolver } from "../../../src/resolvers/Query/registeredEventsByUser"; import { Event, User, Organization, Interface_User, Task, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { connect, disconnect } from "../../../src/db"; import { nanoid } from "nanoid"; -import { - EventOrderByInput, - QueryRegisteredEventsByUserArgs, -} from "../../../src/generated/graphqlCodegen"; +import { QueryRegisteredEventsByUserArgs } from "../../../src/types/generatedGraphQLTypes"; import { Document } from "mongoose"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; @@ -160,7 +157,7 @@ describe("resolvers -> Query -> events", () => { const args: QueryRegisteredEventsByUserArgs = { id: testUser._id, - orderBy: EventOrderByInput.IdAsc, + orderBy: "id_ASC", }; const registeredEventsByUser = await Event.find({ @@ -192,7 +189,7 @@ describe("resolvers -> Query -> events", () => { const args: QueryRegisteredEventsByUserArgs = { id: testUser._id, - orderBy: EventOrderByInput.IdDesc, + orderBy: "id_DESC", }; const registeredEventsByUser = await Event.find({ @@ -224,7 +221,7 @@ describe("resolvers -> Query -> events", () => { const args: QueryRegisteredEventsByUserArgs = { id: testUser._id, - orderBy: EventOrderByInput.TitleAsc, + orderBy: "title_ASC", }; const registeredEventsByUser = await Event.find({ @@ -256,7 +253,7 @@ describe("resolvers -> Query -> events", () => { const args: QueryRegisteredEventsByUserArgs = { id: testUser._id, - orderBy: EventOrderByInput.TitleDesc, + orderBy: "title_DESC", }; const registeredEventsByUser = await Event.find({ @@ -288,7 +285,7 @@ describe("resolvers -> Query -> events", () => { const args: QueryRegisteredEventsByUserArgs = { id: testUser._id, - orderBy: EventOrderByInput.DescriptionAsc, + orderBy: "description_ASC", }; const registeredEventsByUser = await Event.find({ @@ -320,7 +317,7 @@ describe("resolvers -> Query -> events", () => { const args: QueryRegisteredEventsByUserArgs = { id: testUser._id, - orderBy: EventOrderByInput.DescriptionDesc, + orderBy: "description_DESC", }; const registeredEventsByUser = await Event.find({ @@ -352,7 +349,7 @@ describe("resolvers -> Query -> events", () => { const args: QueryRegisteredEventsByUserArgs = { id: testUser._id, - orderBy: EventOrderByInput.StartDateAsc, + orderBy: "startDate_ASC", }; const registeredEventsByUser = await Event.find({ @@ -384,7 +381,7 @@ describe("resolvers -> Query -> events", () => { const args: QueryRegisteredEventsByUserArgs = { id: testUser._id, - orderBy: EventOrderByInput.StartDateDesc, + orderBy: "startDate_DESC", }; const registeredEventsByUser = await Event.find({ @@ -416,7 +413,7 @@ describe("resolvers -> Query -> events", () => { const args: QueryRegisteredEventsByUserArgs = { id: testUser._id, - orderBy: EventOrderByInput.EndDateAsc, + orderBy: "endDate_ASC", }; const registeredEventsByUser = await Event.find({ @@ -448,7 +445,7 @@ describe("resolvers -> Query -> events", () => { const args: QueryRegisteredEventsByUserArgs = { id: testUser._id, - orderBy: EventOrderByInput.EndDateDesc, + orderBy: "endDate_DESC", }; const registeredEventsByUser = await Event.find({ @@ -480,7 +477,7 @@ describe("resolvers -> Query -> events", () => { const args: QueryRegisteredEventsByUserArgs = { id: testUser._id, - orderBy: EventOrderByInput.AllDayAsc, + orderBy: "allDay_ASC", }; const registeredEventsByUser = await Event.find({ @@ -512,7 +509,7 @@ describe("resolvers -> Query -> events", () => { const args: QueryRegisteredEventsByUserArgs = { id: testUser._id, - orderBy: EventOrderByInput.AllDayDesc, + orderBy: "allDay_DESC", }; const registeredEventsByUser = await Event.find({ @@ -544,7 +541,7 @@ describe("resolvers -> Query -> events", () => { const args: QueryRegisteredEventsByUserArgs = { id: testUser._id, - orderBy: EventOrderByInput.StartTimeAsc, + orderBy: "startTime_ASC", }; const registeredEventsByUser = await Event.find({ @@ -576,7 +573,7 @@ describe("resolvers -> Query -> events", () => { const args: QueryRegisteredEventsByUserArgs = { id: testUser._id, - orderBy: EventOrderByInput.StartTimeDesc, + orderBy: "startTime_DESC", }; const registeredEventsByUser = await Event.find({ @@ -608,7 +605,7 @@ describe("resolvers -> Query -> events", () => { const args: QueryRegisteredEventsByUserArgs = { id: testUser._id, - orderBy: EventOrderByInput.EndTimeAsc, + orderBy: "endTime_ASC", }; const registeredEventsByUser = await Event.find({ @@ -640,7 +637,7 @@ describe("resolvers -> Query -> events", () => { const args: QueryRegisteredEventsByUserArgs = { id: testUser._id, - orderBy: EventOrderByInput.EndTimeDesc, + orderBy: "endTime_DESC", }; const registeredEventsByUser = await Event.find({ @@ -672,7 +669,7 @@ describe("resolvers -> Query -> events", () => { const args: QueryRegisteredEventsByUserArgs = { id: testUser._id, - orderBy: EventOrderByInput.RecurranceAsc, + orderBy: "recurrance_ASC", }; const registeredEventsByUser = await Event.find({ @@ -704,7 +701,7 @@ describe("resolvers -> Query -> events", () => { const args: QueryRegisteredEventsByUserArgs = { id: testUser._id, - orderBy: EventOrderByInput.RecurranceDesc, + orderBy: "recurrance_DESC", }; const registeredEventsByUser = await Event.find({ @@ -736,7 +733,7 @@ describe("resolvers -> Query -> events", () => { const args: QueryRegisteredEventsByUserArgs = { id: testUser._id, - orderBy: EventOrderByInput.LocationAsc, + orderBy: "location_ASC", }; const registeredEventsByUser = await Event.find({ @@ -768,7 +765,7 @@ describe("resolvers -> Query -> events", () => { const args: QueryRegisteredEventsByUserArgs = { id: testUser._id, - orderBy: EventOrderByInput.LocationDesc, + orderBy: "location_DESC", }; const registeredEventsByUser = await Event.find({ diff --git a/__tests__/resolvers/Query/registrantsByEvent.spec.ts b/tests/resolvers/Query/registrantsByEvent.spec.ts similarity index 94% rename from __tests__/resolvers/Query/registrantsByEvent.spec.ts rename to tests/resolvers/Query/registrantsByEvent.spec.ts index 7facbbbab8..0a150b644e 100644 --- a/__tests__/resolvers/Query/registrantsByEvent.spec.ts +++ b/tests/resolvers/Query/registrantsByEvent.spec.ts @@ -1,15 +1,15 @@ import "dotenv/config"; -import { registrantsByEvent as registrantsByEventResolver } from "../../../src/lib/resolvers/Query/registrantsByEvent"; +import { registrantsByEvent as registrantsByEventResolver } from "../../../src/resolvers/Query/registrantsByEvent"; import { connect, disconnect } from "../../../src/db"; import { User, Organization, Event, Interface_Event, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { nanoid } from "nanoid"; import { Document, Types } from "mongoose"; -import { QueryRegistrantsByEventArgs } from "../../../src/generated/graphqlCodegen"; +import { QueryRegistrantsByEventArgs } from "../../../src/types/generatedGraphQLTypes"; import { EVENT_NOT_FOUND } from "../../../src/constants"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; diff --git a/__tests__/resolvers/Query/tasksByEvent.spec.ts b/tests/resolvers/Query/tasksByEvent.spec.ts similarity index 93% rename from __tests__/resolvers/Query/tasksByEvent.spec.ts rename to tests/resolvers/Query/tasksByEvent.spec.ts index 1535eaff72..ba1f4bddd8 100644 --- a/__tests__/resolvers/Query/tasksByEvent.spec.ts +++ b/tests/resolvers/Query/tasksByEvent.spec.ts @@ -1,5 +1,5 @@ import "dotenv/config"; -import { tasksByEvent as tasksByEventResolver } from "../../../src/lib/resolvers/Query/tasksByEvent"; +import { tasksByEvent as tasksByEventResolver } from "../../../src/resolvers/Query/tasksByEvent"; import { connect, disconnect } from "../../../src/db"; import { User, @@ -7,13 +7,10 @@ import { Event, Task, Interface_Event, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { nanoid } from "nanoid"; import { Document } from "mongoose"; -import { - QueryTasksByEventArgs, - TaskOrderByInput, -} from "../../../src/generated/graphqlCodegen"; +import { QueryTasksByEventArgs } from "../../../src/types/generatedGraphQLTypes"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; let testEvent: Interface_Event & Document; @@ -132,7 +129,7 @@ describe("resolvers -> Query -> tasksByEvent", () => { const args: QueryTasksByEventArgs = { id: testEvent.id, - orderBy: TaskOrderByInput.IdAsc, + orderBy: "id_ASC", }; const tasksByEventPayload = await tasksByEventResolver?.({}, args, {}); @@ -156,7 +153,7 @@ describe("resolvers -> Query -> tasksByEvent", () => { const args: QueryTasksByEventArgs = { id: testEvent.id, - orderBy: TaskOrderByInput.IdDesc, + orderBy: "id_DESC", }; const tasksByEventPayload = await tasksByEventResolver?.({}, args, {}); @@ -180,7 +177,7 @@ describe("resolvers -> Query -> tasksByEvent", () => { const args: QueryTasksByEventArgs = { id: testEvent.id, - orderBy: TaskOrderByInput.TitleAsc, + orderBy: "title_ASC", }; const tasksByEventPayload = await tasksByEventResolver?.({}, args, {}); @@ -204,7 +201,7 @@ describe("resolvers -> Query -> tasksByEvent", () => { const args: QueryTasksByEventArgs = { id: testEvent.id, - orderBy: TaskOrderByInput.TitleDesc, + orderBy: "title_DESC", }; const tasksByEventPayload = await tasksByEventResolver?.({}, args, {}); @@ -228,7 +225,7 @@ describe("resolvers -> Query -> tasksByEvent", () => { const args: QueryTasksByEventArgs = { id: testEvent.id, - orderBy: TaskOrderByInput.DescriptionAsc, + orderBy: "description_ASC", }; const tasksByEventPayload = await tasksByEventResolver?.({}, args, {}); @@ -252,7 +249,7 @@ describe("resolvers -> Query -> tasksByEvent", () => { const args: QueryTasksByEventArgs = { id: testEvent.id, - orderBy: TaskOrderByInput.DescriptionDesc, + orderBy: "description_DESC", }; const tasksByEventPayload = await tasksByEventResolver?.({}, args, {}); @@ -276,7 +273,7 @@ describe("resolvers -> Query -> tasksByEvent", () => { const args: QueryTasksByEventArgs = { id: testEvent.id, - orderBy: TaskOrderByInput.CreatedAtAsc, + orderBy: "createdAt_ASC", }; const tasksByEventPayload = await tasksByEventResolver?.({}, args, {}); @@ -300,7 +297,7 @@ describe("resolvers -> Query -> tasksByEvent", () => { const args: QueryTasksByEventArgs = { id: testEvent.id, - orderBy: TaskOrderByInput.CreatedAtDesc, + orderBy: "createdAt_DESC", }; const tasksByEventPayload = await tasksByEventResolver?.({}, args, {}); @@ -324,7 +321,7 @@ describe("resolvers -> Query -> tasksByEvent", () => { const args: QueryTasksByEventArgs = { id: testEvent.id, - orderBy: TaskOrderByInput.DeadlineAsc, + orderBy: "deadline_ASC", }; const tasksByEventPayload = await tasksByEventResolver?.({}, args, {}); @@ -348,7 +345,7 @@ describe("resolvers -> Query -> tasksByEvent", () => { const args: QueryTasksByEventArgs = { id: testEvent.id, - orderBy: TaskOrderByInput.DeadlineDesc, + orderBy: "deadline_DESC", }; const tasksByEventPayload = await tasksByEventResolver?.({}, args, {}); diff --git a/__tests__/resolvers/Query/tasksByUser.spec.ts b/tests/resolvers/Query/tasksByUser.spec.ts similarity index 93% rename from __tests__/resolvers/Query/tasksByUser.spec.ts rename to tests/resolvers/Query/tasksByUser.spec.ts index 222c4871f2..ae400ca337 100644 --- a/__tests__/resolvers/Query/tasksByUser.spec.ts +++ b/tests/resolvers/Query/tasksByUser.spec.ts @@ -1,5 +1,5 @@ import "dotenv/config"; -import { tasksByUser as tasksByUserResolver } from "../../../src/lib/resolvers/Query/tasksByUser"; +import { tasksByUser as tasksByUserResolver } from "../../../src/resolvers/Query/tasksByUser"; import { connect, disconnect } from "../../../src/db"; import { User, @@ -7,13 +7,10 @@ import { Event, Task, Interface_User, -} from "../../../src/lib/models"; +} from "../../../src/models"; import { nanoid } from "nanoid"; import { Document } from "mongoose"; -import { - QueryTasksByUserArgs, - TaskOrderByInput, -} from "../../../src/generated/graphqlCodegen"; +import { QueryTasksByUserArgs } from "../../../src/types/generatedGraphQLTypes"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; let testUser: Interface_User & Document; @@ -128,7 +125,7 @@ describe("resolvers -> Query -> tasksByUser", () => { const args: QueryTasksByUserArgs = { id: testUser._id, - orderBy: TaskOrderByInput.IdAsc, + orderBy: "id_ASC", }; const tasksByUserPayload = await tasksByUserResolver?.({}, args, {}); @@ -152,7 +149,7 @@ describe("resolvers -> Query -> tasksByUser", () => { const args: QueryTasksByUserArgs = { id: testUser._id, - orderBy: TaskOrderByInput.IdDesc, + orderBy: "id_DESC", }; const tasksByUserPayload = await tasksByUserResolver?.({}, args, {}); @@ -176,7 +173,7 @@ describe("resolvers -> Query -> tasksByUser", () => { const args: QueryTasksByUserArgs = { id: testUser._id, - orderBy: TaskOrderByInput.TitleAsc, + orderBy: "title_ASC", }; const tasksByUserPayload = await tasksByUserResolver?.({}, args, {}); @@ -200,7 +197,7 @@ describe("resolvers -> Query -> tasksByUser", () => { const args: QueryTasksByUserArgs = { id: testUser._id, - orderBy: TaskOrderByInput.TitleDesc, + orderBy: "title_DESC", }; const tasksByUserPayload = await tasksByUserResolver?.({}, args, {}); @@ -224,7 +221,7 @@ describe("resolvers -> Query -> tasksByUser", () => { const args: QueryTasksByUserArgs = { id: testUser._id, - orderBy: TaskOrderByInput.DescriptionAsc, + orderBy: "description_ASC", }; const tasksByUserPayload = await tasksByUserResolver?.({}, args, {}); @@ -248,7 +245,7 @@ describe("resolvers -> Query -> tasksByUser", () => { const args: QueryTasksByUserArgs = { id: testUser._id, - orderBy: TaskOrderByInput.DescriptionDesc, + orderBy: "description_DESC", }; const tasksByUserPayload = await tasksByUserResolver?.({}, args, {}); @@ -272,7 +269,7 @@ describe("resolvers -> Query -> tasksByUser", () => { const args: QueryTasksByUserArgs = { id: testUser._id, - orderBy: TaskOrderByInput.CreatedAtAsc, + orderBy: "createdAt_ASC", }; const tasksByUserPayload = await tasksByUserResolver?.({}, args, {}); @@ -296,7 +293,7 @@ describe("resolvers -> Query -> tasksByUser", () => { const args: QueryTasksByUserArgs = { id: testUser._id, - orderBy: TaskOrderByInput.CreatedAtDesc, + orderBy: "createdAt_DESC", }; const tasksByUserPayload = await tasksByUserResolver?.({}, args, {}); @@ -320,7 +317,7 @@ describe("resolvers -> Query -> tasksByUser", () => { const args: QueryTasksByUserArgs = { id: testUser._id, - orderBy: TaskOrderByInput.DeadlineAsc, + orderBy: "deadline_ASC", }; const tasksByUserPayload = await tasksByUserResolver?.({}, args, {}); @@ -344,7 +341,7 @@ describe("resolvers -> Query -> tasksByUser", () => { const args: QueryTasksByUserArgs = { id: testUser._id, - orderBy: TaskOrderByInput.DeadlineDesc, + orderBy: "deadline_DESC", }; const tasksByUserPayload = await tasksByUserResolver?.({}, args, {}); diff --git a/__tests__/resolvers/Query/user.spec.ts b/tests/resolvers/Query/user.spec.ts similarity index 92% rename from __tests__/resolvers/Query/user.spec.ts rename to tests/resolvers/Query/user.spec.ts index 720b69a378..d533d8c420 100644 --- a/__tests__/resolvers/Query/user.spec.ts +++ b/tests/resolvers/Query/user.spec.ts @@ -1,11 +1,11 @@ import "dotenv/config"; -import { user as userResolver } from "../../../src/lib/resolvers/Query/user"; +import { user as userResolver } from "../../../src/resolvers/Query/user"; import { connect, disconnect } from "../../../src/db"; import { USER_NOT_FOUND } from "../../../src/constants"; -import { Interface_User, Organization, User } from "../../../src/lib/models"; +import { Interface_User, Organization, User } from "../../../src/models"; import { nanoid } from "nanoid"; import { Document, Types } from "mongoose"; -import { QueryUserArgs } from "../../../src/generated/graphqlCodegen"; +import { QueryUserArgs } from "../../../src/types/generatedGraphQLTypes"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; let testUser: Interface_User & Document; diff --git a/__tests__/resolvers/Query/userLanguage.spec.ts b/tests/resolvers/Query/userLanguage.spec.ts similarity index 89% rename from __tests__/resolvers/Query/userLanguage.spec.ts rename to tests/resolvers/Query/userLanguage.spec.ts index 8b3c8de4fb..ccb4f21980 100644 --- a/__tests__/resolvers/Query/userLanguage.spec.ts +++ b/tests/resolvers/Query/userLanguage.spec.ts @@ -2,10 +2,10 @@ import "dotenv/config"; import { Types } from "mongoose"; import { nanoid } from "nanoid"; import { connect, disconnect } from "../../../src/db"; -import { userLanguage as userLanguageResolver } from "../../../src/lib/resolvers/Query/userLanguage"; +import { userLanguage as userLanguageResolver } from "../../../src/resolvers/Query/userLanguage"; import { USER_NOT_FOUND } from "../../../src/constants"; -import { User } from "../../../src/lib/models"; -import { QueryUserLanguageArgs } from "../../../src/generated/graphqlCodegen"; +import { User } from "../../../src/models"; +import { QueryUserLanguageArgs } from "../../../src/types/generatedGraphQLTypes"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; beforeAll(async () => { diff --git a/__tests__/resolvers/Query/users.spec.ts b/tests/resolvers/Query/users.spec.ts similarity index 95% rename from __tests__/resolvers/Query/users.spec.ts rename to tests/resolvers/Query/users.spec.ts index d59c4f4d3c..6a3d4d01f2 100644 --- a/__tests__/resolvers/Query/users.spec.ts +++ b/tests/resolvers/Query/users.spec.ts @@ -1,16 +1,8 @@ import "dotenv/config"; -import { users as usersResolver } from "../../../src/lib/resolvers/Query/users"; -import { - Event, - Interface_User, - Organization, - User, -} from "../../../src/lib/models"; +import { users as usersResolver } from "../../../src/resolvers/Query/users"; +import { Event, Interface_User, Organization, User } from "../../../src/models"; import { connect, disconnect } from "../../../src/db"; -import { - UserOrderByInput, - QueryUsersArgs, -} from "../../../src/generated/graphqlCodegen"; +import { QueryUsersArgs } from "../../../src/types/generatedGraphQLTypes"; import { Document } from "mongoose"; import { nanoid } from "nanoid"; import { USER_NOT_FOUND, USER_NOT_FOUND_MESSAGE } from "../../../src/constants"; @@ -50,7 +42,7 @@ describe("resolvers -> Query -> users", () => { }; const { users: mockedInProductionUserResolver } = await import( - "../../../src/lib/resolvers/Query/users" + "../../../src/resolvers/Query/users" ); await mockedInProductionUserResolver?.({}, args, {}); } catch (error: any) { @@ -74,7 +66,7 @@ describe("resolvers -> Query -> users", () => { }; }); - const { requestContext } = await import("../../../src/lib/libraries"); + const { requestContext } = await import("../../../src/libraries"); const spy = vi .spyOn(requestContext, "translate") @@ -89,7 +81,7 @@ describe("resolvers -> Query -> users", () => { }; const { users: mockedInProductionUserResolver } = await import( - "../../../src/lib/resolvers/Query/users" + "../../../src/resolvers/Query/users" ); await mockedInProductionUserResolver?.({}, args, {}); } catch (error: any) { @@ -198,7 +190,7 @@ describe("resolvers -> Query -> users", () => { email: testUsers[1].email, appLanguageCode: testUsers[1].appLanguageCode, }, - orderBy: UserOrderByInput.IdAsc, + orderBy: "id_ASC", }; const usersPayload = await usersResolver?.({}, args, {}); @@ -257,7 +249,7 @@ describe("resolvers -> Query -> users", () => { email_not: testUsers[2].email, appLanguageCode_not: testUsers[2].appLanguageCode, }, - orderBy: UserOrderByInput.IdDesc, + orderBy: "id_DESC", }; const usersPayload = await usersResolver?.({}, args, {}); @@ -316,7 +308,7 @@ describe("resolvers -> Query -> users", () => { email_in: [testUsers[1].email], appLanguageCode_in: [testUsers[1].appLanguageCode], }, - orderBy: UserOrderByInput.FirstNameAsc, + orderBy: "firstName_ASC", }; const usersPayload = await usersResolver?.({}, args, {}); @@ -375,7 +367,7 @@ describe("resolvers -> Query -> users", () => { email_not_in: [testUsers[2].email], appLanguageCode_not_in: [testUsers[2].appLanguageCode], }, - orderBy: UserOrderByInput.FirstNameDesc, + orderBy: "firstName_DESC", }; const usersPayload = await usersResolver?.({}, args, {}); @@ -434,7 +426,7 @@ describe("resolvers -> Query -> users", () => { email_contains: testUsers[1].email, appLanguageCode_contains: testUsers[1].appLanguageCode, }, - orderBy: UserOrderByInput.LastNameAsc, + orderBy: "lastName_ASC", }; const usersPayload = await usersResolver?.({}, args, {}); @@ -481,7 +473,7 @@ describe("resolvers -> Query -> users", () => { email_starts_with: testUsers[1].email, appLanguageCode_starts_with: testUsers[1].appLanguageCode, }, - orderBy: UserOrderByInput.LastNameDesc, + orderBy: "lastName_DESC", }; const usersPayload = await usersResolver?.({}, args, {}); @@ -515,7 +507,7 @@ describe("resolvers -> Query -> users", () => { const args: QueryUsersArgs = { where: null, - orderBy: UserOrderByInput.AppLanguageCodeAsc, + orderBy: "appLanguageCode_ASC", }; const usersPayload = await usersResolver?.({}, args, {}); @@ -549,7 +541,7 @@ describe("resolvers -> Query -> users", () => { const args: QueryUsersArgs = { where: null, - orderBy: UserOrderByInput.AppLanguageCodeDesc, + orderBy: "appLanguageCode_DESC", }; const usersPayload = await usersResolver?.({}, args, {}); @@ -583,7 +575,7 @@ describe("resolvers -> Query -> users", () => { const args: QueryUsersArgs = { where: null, - orderBy: UserOrderByInput.EmailAsc, + orderBy: "email_ASC", }; const usersPayload = await usersResolver?.({}, args, {}); @@ -617,7 +609,7 @@ describe("resolvers -> Query -> users", () => { const args: QueryUsersArgs = { where: null, - orderBy: UserOrderByInput.EmailDesc, + orderBy: "email_DESC", }; const usersPayload = await usersResolver?.({}, args, {}); diff --git a/__tests__/resolvers/Query/usersConnection.spec.ts b/tests/resolvers/Query/usersConnection.spec.ts similarity index 95% rename from __tests__/resolvers/Query/usersConnection.spec.ts rename to tests/resolvers/Query/usersConnection.spec.ts index 702c12a665..8b14516cc2 100644 --- a/__tests__/resolvers/Query/usersConnection.spec.ts +++ b/tests/resolvers/Query/usersConnection.spec.ts @@ -1,16 +1,8 @@ import "dotenv/config"; -import { usersConnection as usersConnectionResolver } from "../../../src/lib/resolvers/Query/usersConnection"; -import { - Event, - Interface_User, - Organization, - User, -} from "../../../src/lib/models"; +import { usersConnection as usersConnectionResolver } from "../../../src/resolvers/Query/usersConnection"; +import { Event, Interface_User, Organization, User } from "../../../src/models"; import { connect, disconnect } from "../../../src/db"; -import { - UserOrderByInput, - QueryUsersConnectionArgs, -} from "../../../src/generated/graphqlCodegen"; +import { QueryUsersConnectionArgs } from "../../../src/types/generatedGraphQLTypes"; import { Document } from "mongoose"; import { nanoid } from "nanoid"; import { beforeAll, afterAll, describe, it, expect } from "vitest"; @@ -122,7 +114,7 @@ describe("resolvers -> Query -> usersConnection", () => { email: testUsers[1].email, appLanguageCode: testUsers[1].appLanguageCode, }, - orderBy: UserOrderByInput.IdAsc, + orderBy: "id_ASC", }; const usersConnectionPayload = await usersConnectionResolver?.( @@ -184,7 +176,7 @@ describe("resolvers -> Query -> usersConnection", () => { email_not: testUsers[2].email, appLanguageCode_not: testUsers[2].appLanguageCode, }, - orderBy: UserOrderByInput.IdDesc, + orderBy: "id_DESC", }; const usersConnectionPayload = await usersConnectionResolver?.( @@ -246,7 +238,7 @@ describe("resolvers -> Query -> usersConnection", () => { email_in: [testUsers[1].email], appLanguageCode_in: [testUsers[1].appLanguageCode], }, - orderBy: UserOrderByInput.FirstNameAsc, + orderBy: "firstName_ASC", }; const usersConnectionPayload = await usersConnectionResolver?.( @@ -275,7 +267,7 @@ describe("resolvers -> Query -> usersConnection", () => { args.where === { id_not_in: [testUsers[2]._id], firstName_not_in: [testUsers[2].firstName], lastName_not_in: [testUsers[2].lastName], email_not_in: [testUsers[2].email], appLanguageCode_not_in: [testUsers[2].appLanguageCode] } and - sorted by args.orderBy === 'FirstNameDesc'`, async () => { + sorted by args.orderBy === 'firstName_DESC'`, async () => { const where = { _id: { $nin: [testUsers[2]._id], @@ -308,7 +300,7 @@ describe("resolvers -> Query -> usersConnection", () => { email_not_in: [testUsers[2].email], appLanguageCode_not_in: [testUsers[2].appLanguageCode], }, - orderBy: UserOrderByInput.FirstNameDesc, + orderBy: "firstName_DESC", }; const usersConnectionPayload = await usersConnectionResolver?.( @@ -370,7 +362,7 @@ describe("resolvers -> Query -> usersConnection", () => { email_contains: testUsers[1].email, appLanguageCode_contains: testUsers[1].appLanguageCode, }, - orderBy: UserOrderByInput.LastNameAsc, + orderBy: "lastName_ASC", }; const usersConnectionPayload = await usersConnectionResolver?.( @@ -420,7 +412,7 @@ describe("resolvers -> Query -> usersConnection", () => { email_starts_with: testUsers[1].email, appLanguageCode_starts_with: testUsers[1].appLanguageCode, }, - orderBy: UserOrderByInput.LastNameDesc, + orderBy: "lastName_DESC", }; const usersConnectionPayload = await usersConnectionResolver?.( @@ -457,7 +449,7 @@ describe("resolvers -> Query -> usersConnection", () => { first: 2, skip: 1, where: null, - orderBy: UserOrderByInput.AppLanguageCodeAsc, + orderBy: "appLanguageCode_ASC", }; const usersConnectionPayload = await usersConnectionResolver?.( @@ -494,7 +486,7 @@ describe("resolvers -> Query -> usersConnection", () => { first: 2, skip: 1, where: null, - orderBy: UserOrderByInput.AppLanguageCodeDesc, + orderBy: "appLanguageCode_DESC", }; const usersConnectionPayload = await usersConnectionResolver?.( @@ -531,7 +523,7 @@ describe("resolvers -> Query -> usersConnection", () => { first: 2, skip: 1, where: null, - orderBy: UserOrderByInput.EmailAsc, + orderBy: "email_ASC", }; const usersConnectionPayload = await usersConnectionResolver?.( @@ -568,7 +560,7 @@ describe("resolvers -> Query -> usersConnection", () => { first: 2, skip: 1, where: null, - orderBy: UserOrderByInput.EmailDesc, + orderBy: "email_DESC", }; const usersConnectionPayload = await usersConnectionResolver?.( diff --git a/__tests__/utilities/adminCheck.spec.ts b/tests/utilities/adminCheck.spec.ts similarity index 88% rename from __tests__/utilities/adminCheck.spec.ts rename to tests/utilities/adminCheck.spec.ts index 13d6012a3f..d2821b06d2 100644 --- a/__tests__/utilities/adminCheck.spec.ts +++ b/tests/utilities/adminCheck.spec.ts @@ -16,7 +16,7 @@ import { Interface_User, Organization, User, -} from "../../src/lib/models"; +} from "../../src/models"; import { USER_NOT_AUTHORIZED, USER_NOT_AUTHORIZED_MESSAGE, @@ -25,7 +25,7 @@ import { let testUser: Interface_User & Document; let testOrganization: Interface_Organization & Document; -let testUserEmail: string = `email${nanoid().toLowerCase()}@gmail.com`; +const testUserEmail: string = `email${nanoid().toLowerCase()}@gmail.com`; beforeAll(async () => { connect(); @@ -70,7 +70,7 @@ describe("utilities -> adminCheck", () => { }); try { - const { adminCheck } = await import("../../src/lib/utilities"); + const { adminCheck } = await import("../../src/utilities"); adminCheck(testUser._id, testOrganization); } catch (error: any) { expect(error.message).toEqual(USER_NOT_AUTHORIZED); @@ -88,14 +88,14 @@ describe("utilities -> adminCheck", () => { }; }); - const { requestContext } = await import("../../src/lib/libraries"); + const { requestContext } = await import("../../src/libraries"); const spy = vi .spyOn(requestContext, "translate") .mockImplementationOnce((message) => `Translated ${message}`); try { - const { adminCheck } = await import("../../src/lib/utilities"); + const { adminCheck } = await import("../../src/utilities"); adminCheck(testUser._id, testOrganization); } catch (error: any) { expect(error.message).toEqual( diff --git a/__tests__/utilities/deleteDuplicatedImage.spec.ts b/tests/utilities/deleteDuplicatedImage.spec.ts similarity index 90% rename from __tests__/utilities/deleteDuplicatedImage.spec.ts rename to tests/utilities/deleteDuplicatedImage.spec.ts index d85d6d5ef4..474b6d822b 100644 --- a/__tests__/utilities/deleteDuplicatedImage.spec.ts +++ b/tests/utilities/deleteDuplicatedImage.spec.ts @@ -1,10 +1,10 @@ require("dotenv").config(); import { nanoid } from "nanoid"; import { afterEach, describe, expect, it, vi } from "vitest"; -import { deleteDuplicatedImage } from "../../src/lib/utilities/deleteDuplicatedImage"; +import { deleteDuplicatedImage } from "../../src/utilities/deleteDuplicatedImage"; // const fs = require("fs"); import * as fs from "fs"; -import { logger } from "../../src/lib/libraries"; +import { logger } from "../../src/libraries"; vi.mock("fs", () => ({ unlink: vi.fn(), diff --git a/__tests__/utilities/imageAlreadyInDbCheck.spec.ts b/tests/utilities/imageAlreadyInDbCheck.spec.ts similarity index 85% rename from __tests__/utilities/imageAlreadyInDbCheck.spec.ts rename to tests/utilities/imageAlreadyInDbCheck.spec.ts index d33942cab4..ee786ddac1 100644 --- a/__tests__/utilities/imageAlreadyInDbCheck.spec.ts +++ b/tests/utilities/imageAlreadyInDbCheck.spec.ts @@ -1,5 +1,5 @@ import "dotenv/config"; -import { ImageHash } from "../../src/lib/models"; +import { ImageHash } from "../../src/models"; import { afterAll, afterEach, @@ -12,13 +12,13 @@ import { import { connect, disconnect } from "../../src/db"; import { nanoid } from "nanoid"; -let testNewImagePath: string = `${nanoid()}-testNewImagePath`; -let testOldImagePath: string = `${nanoid()}-testOldImagePath`; -let testHash: string = `${nanoid()}-testHash`; -let testDifferentHash: string = `${nanoid()}-testDifferentHash`; -let testMessage: string = "invalid.fileType"; +const testNewImagePath: string = `${nanoid()}-testNewImagePath`; +const testOldImagePath: string = `${nanoid()}-testOldImagePath`; +const testHash: string = `${nanoid()}-testHash`; +const testDifferentHash: string = `${nanoid()}-testDifferentHash`; +const testMessage: string = "invalid.fileType"; -let testErrors = [ +const testErrors = [ { message: "invalid.fileType", code: "invalid.fileType", @@ -57,7 +57,7 @@ describe("utilities -> imageAlreadyInDbCheck", () => { }); const { imageAlreadyInDbCheck } = await import( - "../../src/lib/utilities/imageAlreadyInDbCheck" + "../../src/utilities/imageAlreadyInDbCheck" ); const fileName = await imageAlreadyInDbCheck(null, testNewImagePath); @@ -90,7 +90,7 @@ describe("utilities -> imageAlreadyInDbCheck", () => { }); const deleteDuplicatedImage = await import( - "../../src/lib/utilities/deleteDuplicatedImage" + "../../src/utilities/deleteDuplicatedImage" ); const mockedDeleteDuplicateImage = vi @@ -98,7 +98,7 @@ describe("utilities -> imageAlreadyInDbCheck", () => { .mockImplementation((_imagePath: any) => {}); const { imageAlreadyInDbCheck } = await import( - "../../src/lib/utilities/imageAlreadyInDbCheck" + "../../src/utilities/imageAlreadyInDbCheck" ); const fileName = await imageAlreadyInDbCheck( @@ -114,7 +114,7 @@ describe("utilities -> imageAlreadyInDbCheck", () => { vi.doMock("image-hash", () => { return { imageHash: (...args: any) => { - let callBack = args[3]; + const callBack = args[3]; let imagePath: string = args[0]; if (imagePath.indexOf("./") !== -1) { @@ -137,7 +137,7 @@ describe("utilities -> imageAlreadyInDbCheck", () => { }); const deleteDuplicatedImage = await import( - "../../src/lib/utilities/deleteDuplicatedImage" + "../../src/utilities/deleteDuplicatedImage" ); const mockedDeleteDuplicateImage = vi @@ -145,7 +145,7 @@ describe("utilities -> imageAlreadyInDbCheck", () => { .mockImplementation((_imagePath: any) => {}); const { imageAlreadyInDbCheck } = await import( - "../../src/lib/utilities/imageAlreadyInDbCheck" + "../../src/utilities/imageAlreadyInDbCheck" ); const fileName = await imageAlreadyInDbCheck( @@ -173,7 +173,7 @@ describe("utilities -> imageAlreadyInDbCheck", () => { }; }); - const { requestContext } = await import("../../src/lib/libraries"); + const { requestContext } = await import("../../src/libraries"); const mockedRequestTranslate = vi .spyOn(requestContext, "translate") @@ -182,7 +182,7 @@ describe("utilities -> imageAlreadyInDbCheck", () => { }); const { imageAlreadyInDbCheck } = await import( - "../../src/lib/utilities/imageAlreadyInDbCheck" + "../../src/utilities/imageAlreadyInDbCheck" ); try { diff --git a/__tests__/utilities/imageExtensionCheck.spec.ts b/tests/utilities/imageExtensionCheck.spec.ts similarity index 76% rename from __tests__/utilities/imageExtensionCheck.spec.ts rename to tests/utilities/imageExtensionCheck.spec.ts index 9135e51371..8980bab79a 100644 --- a/__tests__/utilities/imageExtensionCheck.spec.ts +++ b/tests/utilities/imageExtensionCheck.spec.ts @@ -1,11 +1,11 @@ import { afterEach, describe, expect, it, vi } from "vitest"; -import { imageExtensionCheck } from "../../src/lib/utilities/imageExtensionCheck"; -import * as deleteImage from "../../src/lib/utilities/deleteImage"; -import { requestContext } from "../../src/lib/libraries"; +import { imageExtensionCheck } from "../../src/utilities/imageExtensionCheck"; +import * as deleteImage from "../../src/utilities/deleteImage"; +import { requestContext } from "../../src/libraries"; -let testFilename: string = "test.anyOtherExtension"; +const testFilename: string = "test.anyOtherExtension"; -let testErrors = [ +const testErrors = [ { message: "invalid.fileType", code: "invalid.fileType", @@ -13,7 +13,7 @@ let testErrors = [ }, ]; -let testMessage: string = "invalid.fileType"; +const testMessage: string = "invalid.fileType"; describe("utilities -> imageExtensionCheck", () => { afterEach(() => { diff --git a/__tests__/utilities/mailer.spec.ts b/tests/utilities/mailer.spec.ts similarity index 93% rename from __tests__/utilities/mailer.spec.ts rename to tests/utilities/mailer.spec.ts index d98f45da25..fd9693c704 100644 --- a/__tests__/utilities/mailer.spec.ts +++ b/tests/utilities/mailer.spec.ts @@ -1,7 +1,7 @@ import nodemailer from "nodemailer"; import { afterEach, describe, expect, it, vi } from "vitest"; import { ERROR_IN_SENDING_MAIL } from "../../src/constants"; -import { mailer } from "../../src/lib/utilities/mailer"; +import { mailer } from "../../src/utilities/mailer"; import { nanoid } from "nanoid"; import Mail from "nodemailer/lib/mailer"; @@ -11,13 +11,13 @@ interface Test_Interface_MailFields { body: string; } -let testMailFields: Test_Interface_MailFields = { +const testMailFields: Test_Interface_MailFields = { emailTo: `${nanoid().toLowerCase()}@gmail.com`, subject: `${nanoid()}`, body: `${nanoid()}`, }; -let testTransport: object = { +const testTransport: object = { service: "gmail", auth: { user: process.env.MAIL_USERNAME, diff --git a/tsconfig.build.json b/tsconfig.build.json index a0829eeaed..30bb26fab0 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -1,14 +1,14 @@ { - "compilerOptions": { - "target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, - "module": "commonjs" /* Specify what module code is generated. */, - "rootDir": "./src" /* Specify the root folder within your source files. */, - "outDir": "./build" /* Specify an output folder for all emitted files. */, - "removeComments": true /* Disable emitting comments. */, - "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */, - "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, - "strict": true /* Enable all strict type-checking options. */, - "skipLibCheck": true /* Skip type checking all .d.ts files. */ - }, - "include": ["./src"] -} + "compilerOptions": { + "target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, + "module": "commonjs" /* Specify what module code is generated. */, + "rootDir": "./src", /* Specify the root folder within your source files. */ + "outDir": "./build" /* Specify an output folder for all emitted files. */, + "removeComments": true /* Disable emitting comments. */, + "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */, + "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, + "strict": true /* Enable all strict type-checking options. */, + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + }, + "include": ["./src"] + } \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 531c2f93e9..da4333495a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,6 +6,5 @@ "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, "strict": true /* Enable all strict type-checking options. */, "skipLibCheck": true /* Skip type checking all .d.ts files. */ - }, - "include": ["./src","./__tests__"] + } } \ No newline at end of file diff --git a/vite.config.ts b/vite.config.ts index abfc4fc1d6..f682988a6b 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -3,28 +3,36 @@ import { defineConfig } from "vitest/config"; export default defineConfig({ test: { coverage: { - // This tells vitest to include those files from src/lib in test coverage - // as well that don't have an associated test written for them. + // This tells vitest to include all files from ./src in test coverage. all: true, - // This tells vitests the directory to get coverage for. - include: ["src/lib"], - // This tells vitest to exclude files from src/lib directory from the coverage. - // This is intentionally done because these files don't provide any meaningful - // coverage in test coverage report. + + // This tells vitest the directory to get coverage for. + include: ["src/"], + + // This tells vitest the files/directories to exclude from the coverage. + // This is intentionally done because coverage for these files doesn't + // provide any meaningful details for coverage report. exclude: [ - "src/lib/config", - "src/lib/models", - "src/lib/typeDefs", + "src/config", + "src/models", + "src/typeDefs", + "src/types", + "src/constants.ts", + "src/db.ts", + "src/server.ts", ], - // This is used to tell vitest which coverage provider to use. c8 is the default - // and newer coverage provider for node.js applications. You can swap it with + + // This is used to tell vitest which coverage provider to use. c8 is the newer and + // recommended coverage provider for node.js applications. You can swap it with // istanbul as well. provider: "c8", + // This tells vitest in what format the report will be generated. Here lcov // is selected because a file named lcov.info is generated by this reporter which - // is used in codecov/codecov-action github action. + // is used in codecov/codecov-action github action for talawa-api. reporter: ["lcov"], }, + // Tells vitest the time limit for an individual test block run. testTimeout: 30000, },