diff --git a/.eslintrc.json b/.eslintrc.json index 34249b897d..083194b6d5 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -10,7 +10,6 @@ "extends": [ "plugin:react/recommended", "eslint:recommended", - "plugin:jest/recommended", "plugin:prettier/recommended", "plugin:@typescript-eslint/recommended", "eslint-config-prettier", diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 2e8d8b016a..3b3f712135 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -255,7 +255,7 @@ jobs: echo "FULL_Branch_NAME: $FULL_BRANCH_NAME" # Clone the specified repository using the extracted branch name - git clone --branch $FULL_BRANCH_NAME https://github.com/PalisadoesFoundation/talawa-api && ls -a + git clone --branch "$FULL_BRANCH_NAME" https://github.com/PalisadoesFoundation/talawa-api && ls -a - name: Validate Documents run: graphql-inspector validate './src/GraphQl/**/*.ts' './talawa-api/schema.graphql' diff --git a/ISSUE_GUIDELINES.md b/ISSUE_GUIDELINES.md index 1c1dc91746..f857d22399 100644 --- a/ISSUE_GUIDELINES.md +++ b/ISSUE_GUIDELINES.md @@ -2,7 +2,7 @@ :+1::tada: First off, thanks for taking the time to contribute! :tada::+1: -In order to give everyone a chance to submit a issues reports and contribute to the Talawa project, we have put restrictions in place. This section outlines the guidelines that should be imposed upon issue reports in the Talawa project. +To maintain quality and organization, we have established guidelines for submitting issue reports to the Talawa project. This document outlines these guidelines to help you contribute effectively. --- diff --git a/package.json b/package.json index d968f07d95..a08b98c89b 100644 --- a/package.json +++ b/package.json @@ -74,7 +74,6 @@ "serve": "cross-env ESLINT_NO_DEV_ERRORS=true vite --config config/vite.config.ts", "build": "tsc && vite build --config config/vite.config.ts", "preview": "vite preview --config config/vite.config.ts", - "test": "cross-env NODE_ENV=test jest --env=./scripts/custom-test-env.js --watchAll --coverage", "test:vitest": "vitest run", "test:watch": "vitest watch", "eject": "react-scripts eject", @@ -85,7 +84,6 @@ "check-tsdoc": "node .github/workflows/check-tsdoc.js", "typecheck": "tsc --project tsconfig.json --noEmit", "prepare": "husky install", - "jest-preview": "jest-preview", "update:toc": "node scripts/githooks/update-toc.js", "lint-staged": "lint-staged --concurrent false", "setup": "tsx setup.ts", @@ -114,11 +112,9 @@ "@babel/preset-env": "^7.25.4", "@babel/preset-react": "^7.25.7", "@babel/preset-typescript": "^7.26.0", - "@testing-library/jest-dom": "^6.5.0", "@testing-library/react": "^16.0.1", "@testing-library/user-event": "^12.1.10", "@types/inquirer": "^9.0.7", - "@types/jest": "^26.0.24", "@types/js-cookie": "^3.0.6", "@types/node": "^22.5.4", "@types/node-fetch": "^2.6.10", @@ -134,11 +130,9 @@ "@typescript-eslint/eslint-plugin": "^8.11.0", "@typescript-eslint/parser": "^8.5.0", "@vitest/coverage-istanbul": "^2.1.8", - "babel-jest": "^29.7.0", "cross-env": "^7.0.3", "eslint-config-prettier": "^9.1.0", "eslint-plugin-import": "^2.30.0", - "eslint-plugin-jest": "^28.8.0", "eslint-plugin-prettier": "^5.2.1", "eslint-plugin-react": "^7.37.1", "eslint-plugin-tsdoc": "^0.3.0", diff --git a/schema.graphql b/schema.graphql index c53504d10d..8d89033be7 100644 --- a/schema.graphql +++ b/schema.graphql @@ -1013,11 +1013,23 @@ type Query { eventVolunteersByEvent(id: ID!): [EventVolunteer] eventsByOrganization(id: ID, orderBy: EventOrderByInput): [Event] eventsByOrganizationConnection( + after: String first: Int + before: String + last: Int orderBy: EventOrderByInput - skip: Int where: EventWhereInput - ): [Event!]! + ): EventConnection! + + type EventConnection { + edges: [EventEdge!]! + pageInfo: ConnectionPageInfo! + } + + type EventEdge { + cursor: String! + node: Event! + } advertisementsConnection( after: String before: String @@ -1206,57 +1218,6 @@ input UpdateOrganizationInput { visibleInSearch: Boolean } -input AddressInput { - city: String - countryCode: String - dependentLocality: String - line1: String - line2: String - postalCode: String - sortingCode: String - state: String -} - -enum EducationGrade { - GRADE_1 - GRADE_2 - GRADE_3 - GRADE_4 - GRADE_5 - GRADE_6 - GRADE_7 - GRADE_8 - GRADE_9 - GRADE_10 - GRADE_11 - GRADE_12 - GRADUATE - KG - NO_GRADE - PRE_KG -} - -enum EmploymentStatus { - FULL_TIME - PART_TIME - UNEMPLOYED -} - -enum Gender { - FEMALE - MALE - OTHER -} - -enum MaritalStatus { - DIVORCED - ENGAGED - MARRIED - SEPERATED - SINGLE - WIDOWED -} - input UpdateUserInput { address: AddressInput birthDate: Date diff --git a/setup.ts b/setup.ts index 4a2e7c5ea7..691c059d42 100644 --- a/setup.ts +++ b/setup.ts @@ -12,6 +12,9 @@ export async function main(): Promise { try { if (!fs.existsSync('.env')) { + if (!fs.existsSync('.env.example')) { + throw new Error('.env.example file not found'); + } await fs.promises.open('.env', 'w', 0o666); const config = dotenv.parse(await fs.promises.readFile('.env.example')); const envContent = Object.entries(config) @@ -45,12 +48,15 @@ export async function main(): Promise { if (shouldSetCustomPort) { const customPort = await askForCustomPort(); - - const port = dotenv.parse(fs.readFileSync('.env')).PORT; - - const data = await fs.promises.readFile('.env', 'utf8'); - const result = data.replace(`PORT=${port}`, `PORT=${customPort}`); - await fs.promises.writeFile('.env', result, 'utf8'); + try { + const data = await fs.promises.readFile('.env', 'utf8'); + const config = dotenv.parse(data); + const result = data.replace(`PORT=${config.PORT}`, `PORT=${customPort}`); + await fs.promises.writeFile('.env', result, 'utf8'); + } catch (error) { + console.error('Failed to update port configuration:', error); + process.exit(1); + } } let shouldSetTalawaApiUrl: boolean; @@ -117,22 +123,29 @@ export async function main(): Promise { default: true, }); - if (shouldUseRecaptcha) { - const useRecaptcha = dotenv.parse( - fs.readFileSync('.env'), - ).REACT_APP_USE_RECAPTCHA; - + async function updateEnvFile( + key: string, + oldValue: string, + newValue: string, + ): Promise { try { const data = await fs.promises.readFile('.env', 'utf8'); - const result = data.replace( - `REACT_APP_USE_RECAPTCHA=${useRecaptcha}`, - `REACT_APP_USE_RECAPTCHA=yes`, - ); + const result = data.replace(`${key}=${oldValue}`, `${key}=${newValue}`); await fs.promises.writeFile('.env', result, 'utf8'); } catch (error) { - console.error('Failed to update ReCAPTCHA configuration:', error); + console.error(`Failed to update ${key}:`, error); process.exit(1); } + } + + if (shouldUseRecaptcha) { + const data = await fs.promises.readFile('.env', 'utf8'); + const config = dotenv.parse(data); + await updateEnvFile( + 'REACT_APP_USE_RECAPTCHA', + config.REACT_APP_USE_RECAPTCHA, + 'yes', + ); let shouldSetRecaptchaSiteKey: boolean; if (process.env.REACT_APP_RECAPTCHA_SITE_KEY) { @@ -205,4 +218,7 @@ export async function main(): Promise { ); } -main(); +main().catch((error) => { + console.error('Setup failed:', error); + process.exit(1); +});