From 4e79a6fe7cb039128756ddd8a17a73f6679626f1 Mon Sep 17 00:00:00 2001 From: Aryan Shah Date: Fri, 18 Oct 2024 23:09:09 +0530 Subject: [PATCH 01/14] fixed super admin profile --- src/GraphQl/Queries/Queries.ts | 58 ++++++++++++++++++- .../LeftDrawerOrg/LeftDrawerOrg.test.tsx | 7 +-- .../LeftDrawerOrg/LeftDrawerOrg.tsx | 8 +-- 3 files changed, 64 insertions(+), 9 deletions(-) diff --git a/src/GraphQl/Queries/Queries.ts b/src/GraphQl/Queries/Queries.ts index c3999ba00e..c010b83c2c 100644 --- a/src/GraphQl/Queries/Queries.ts +++ b/src/GraphQl/Queries/Queries.ts @@ -335,6 +335,62 @@ export const EVENT_FEEDBACKS = gql` } `; +// Query to take the Organization with data +export const ORGANIZATIONS_LIST_BY_CREATOR_ID = gql` + query OrganizationsByCreator($creatorId: ID!) { + organizations(where: { creatorId: $creatorId }) { + _id + image + creator { + firstName + lastName + email + } + name + description + address { + city + countryCode + dependentLocality + line1 + line2 + postalCode + sortingCode + state + } + userRegistrationRequired + visibleInSearch + members { + _id + firstName + lastName + email + } + admins { + _id + firstName + lastName + email + createdAt + } + membershipRequests { + _id + user { + firstName + lastName + email + } + } + blockedUsers { + _id + firstName + lastName + email + } + } + } +`; + // Query to take the Organization with data export const ORGANIZATIONS_LIST = gql` query Organizations($id: ID!) { @@ -818,4 +874,4 @@ export { USER_CREATED_ORGANIZATIONS, USER_JOINED_ORGANIZATIONS, USER_ORGANIZATION_CONNECTION, -} from './OrganizationQueries'; +} from './OrganizationQueries'; \ No newline at end of file diff --git a/src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx b/src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx index 76f112741c..bcdec1eff5 100644 --- a/src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx +++ b/src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx @@ -1,5 +1,5 @@ import React, { act } from 'react'; -import { fireEvent, render, screen } from '@testing-library/react'; +import { fireEvent, render, screen , waitFor} from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import 'jest-localstorage-mock'; import { I18nextProvider } from 'react-i18next'; @@ -304,8 +304,7 @@ describe('Testing LeftDrawerOrg component for SUPERADMIN', () => { , ); - await wait(); - expect(screen.getByTestId(/orgBtn/i)).toBeInTheDocument(); + await waitFor(() => expect(screen.getByTestId(/OrgBtn/i)).toBeInTheDocument()); }); test('Testing Menu Buttons', async () => { @@ -429,4 +428,4 @@ describe('Testing LeftDrawerOrg component for SUPERADMIN', () => { , ); }); -}); +}); \ No newline at end of file diff --git a/src/components/LeftDrawerOrg/LeftDrawerOrg.tsx b/src/components/LeftDrawerOrg/LeftDrawerOrg.tsx index e9495187ee..39d06613ab 100644 --- a/src/components/LeftDrawerOrg/LeftDrawerOrg.tsx +++ b/src/components/LeftDrawerOrg/LeftDrawerOrg.tsx @@ -1,6 +1,6 @@ import { useQuery } from '@apollo/client'; import { WarningAmberOutlined } from '@mui/icons-material'; -import { ORGANIZATIONS_LIST } from 'GraphQl/Queries/Queries'; +import { ORGANIZATIONS_LIST_BY_CREATOR_ID } from 'GraphQl/Queries/Queries'; import CollapsibleDropdown from 'components/CollapsibleDropdown/CollapsibleDropdown'; import IconComponent from 'components/IconComponent/IconComponent'; import React, { useEffect, useState } from 'react'; @@ -49,8 +49,8 @@ const leftDrawerOrg = ({ | { organizations: InterfaceQueryOrganizationsListObject[] } | undefined; loading: boolean; - } = useQuery(ORGANIZATIONS_LIST, { - variables: { id: orgId }, + } = useQuery(ORGANIZATIONS_LIST_BY_CREATOR_ID, { + variables: { creatorId: orgId }, }); // Set organization data when query data is available @@ -183,4 +183,4 @@ const leftDrawerOrg = ({ ); }; -export default leftDrawerOrg; +export default leftDrawerOrg; \ No newline at end of file From dc9617c60c6ebae6d4f600dd9997e6f5feb9003d Mon Sep 17 00:00:00 2001 From: Aryan Shah <149894557+ARYANSHAH1567@users.noreply.github.com> Date: Fri, 18 Oct 2024 23:13:18 +0530 Subject: [PATCH 02/14] Update LeftDrawerOrg.test.tsx --- src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx b/src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx index bcdec1eff5..446c80be80 100644 --- a/src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx +++ b/src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx @@ -1,5 +1,5 @@ import React, { act } from 'react'; -import { fireEvent, render, screen , waitFor} from '@testing-library/react'; +import { fireEvent, render, screen, waitFor} from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import 'jest-localstorage-mock'; import { I18nextProvider } from 'react-i18next'; @@ -428,4 +428,4 @@ describe('Testing LeftDrawerOrg component for SUPERADMIN', () => { , ); }); -}); \ No newline at end of file +}); From 63e4334ba99b1de17fd6cd5ab87b9e0e2e187f58 Mon Sep 17 00:00:00 2001 From: Aryan Shah <149894557+ARYANSHAH1567@users.noreply.github.com> Date: Fri, 18 Oct 2024 23:21:10 +0530 Subject: [PATCH 03/14] Update Queries.ts --- src/GraphQl/Queries/Queries.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GraphQl/Queries/Queries.ts b/src/GraphQl/Queries/Queries.ts index c010b83c2c..27597c4e54 100644 --- a/src/GraphQl/Queries/Queries.ts +++ b/src/GraphQl/Queries/Queries.ts @@ -874,4 +874,4 @@ export { USER_CREATED_ORGANIZATIONS, USER_JOINED_ORGANIZATIONS, USER_ORGANIZATION_CONNECTION, -} from './OrganizationQueries'; \ No newline at end of file +} from './OrganizationQueries'; From 755b97e2ffe9f7bde6eacd25150d0364afc64a2b Mon Sep 17 00:00:00 2001 From: Aryan Shah <149894557+ARYANSHAH1567@users.noreply.github.com> Date: Fri, 18 Oct 2024 23:21:40 +0530 Subject: [PATCH 04/14] Update LeftDrawerOrg.test.tsx --- src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx b/src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx index 446c80be80..566b863600 100644 --- a/src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx +++ b/src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx @@ -1,5 +1,5 @@ import React, { act } from 'react'; -import { fireEvent, render, screen, waitFor} from '@testing-library/react'; +import { fireEvent, render, screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import 'jest-localstorage-mock'; import { I18nextProvider } from 'react-i18next'; @@ -304,7 +304,9 @@ describe('Testing LeftDrawerOrg component for SUPERADMIN', () => { , ); - await waitFor(() => expect(screen.getByTestId(/OrgBtn/i)).toBeInTheDocument()); + await waitFor(() => + expect(screen.getByTestId(/OrgBtn/i)).toBeInTheDocument(), + ); }); test('Testing Menu Buttons', async () => { From e09895dc8e9f2e3033db5846353e19fade54d3d4 Mon Sep 17 00:00:00 2001 From: Aryan Shah <149894557+ARYANSHAH1567@users.noreply.github.com> Date: Fri, 18 Oct 2024 23:22:03 +0530 Subject: [PATCH 05/14] Update LeftDrawerOrg.tsx --- src/components/LeftDrawerOrg/LeftDrawerOrg.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/LeftDrawerOrg/LeftDrawerOrg.tsx b/src/components/LeftDrawerOrg/LeftDrawerOrg.tsx index 39d06613ab..e14feb9cf0 100644 --- a/src/components/LeftDrawerOrg/LeftDrawerOrg.tsx +++ b/src/components/LeftDrawerOrg/LeftDrawerOrg.tsx @@ -183,4 +183,4 @@ const leftDrawerOrg = ({ ); }; -export default leftDrawerOrg; \ No newline at end of file +export default leftDrawerOrg; From ebc8ac051cccadb3d51c63be63a2ad6da43e4832 Mon Sep 17 00:00:00 2001 From: Aryan Shah <149894557+ARYANSHAH1567@users.noreply.github.com> Date: Fri, 18 Oct 2024 23:42:47 +0530 Subject: [PATCH 06/14] Update LeftDrawerOrg.test.tsx --- src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx b/src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx index 566b863600..cf8921f574 100644 --- a/src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx +++ b/src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx @@ -11,7 +11,7 @@ import LeftDrawerOrg from './LeftDrawerOrg'; import { Provider } from 'react-redux'; import { MockedProvider } from '@apollo/react-testing'; import { store } from 'state/store'; -import { ORGANIZATIONS_LIST } from 'GraphQl/Queries/Queries'; +import { ORGANIZATIONS_LIST_BY_CREATOR_ID } from 'GraphQl/Queries/Queries'; import { StaticMockLink } from 'utils/StaticMockLink'; import { REVOKE_REFRESH_TOKEN } from 'GraphQl/Mutations/mutations'; import useLocalStorage from 'utils/useLocalstorage'; @@ -305,7 +305,7 @@ describe('Testing LeftDrawerOrg component for SUPERADMIN', () => { , ); await waitFor(() => - expect(screen.getByTestId(/OrgBtn/i)).toBeInTheDocument(), + expect(screen.getByTestId(/orgBtn/i)).toBeInTheDocument(), ); }); From b97ec0316ebd7b8e01e8727a927745afc88a4d89 Mon Sep 17 00:00:00 2001 From: Aryan Shah <149894557+ARYANSHAH1567@users.noreply.github.com> Date: Sat, 19 Oct 2024 01:42:11 +0530 Subject: [PATCH 07/14] Update LeftDrawerOrg.test.tsx --- src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx b/src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx index cf8921f574..6e01bfc9e6 100644 --- a/src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx +++ b/src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx @@ -77,7 +77,7 @@ const MOCKS = [ }, { request: { - query: ORGANIZATIONS_LIST, + query: ORGANIZATIONS_LIST_BY_CREATOR_ID, variables: { id: '123' }, }, result: { @@ -140,7 +140,7 @@ const MOCKS = [ const MOCKS_WITH_IMAGE = [ { request: { - query: ORGANIZATIONS_LIST, + query: ORGANIZATIONS_LIST_BY_CREATOR_ID, variables: { id: '123' }, }, result: { @@ -204,7 +204,7 @@ const MOCKS_WITH_IMAGE = [ const MOCKS_EMPTY = [ { request: { - query: ORGANIZATIONS_LIST, + query: ORGANIZATIONS_LIST_BY_CREATOR_ID, variables: { id: '123' }, }, result: { From 6f47f26ee5387ad84cb57550473a6dd754b2ef0e Mon Sep 17 00:00:00 2001 From: Aryan Shah <149894557+ARYANSHAH1567@users.noreply.github.com> Date: Sat, 19 Oct 2024 02:30:28 +0530 Subject: [PATCH 08/14] Update LeftDrawerOrg.test.tsx --- src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx b/src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx index 6e01bfc9e6..3e425a5c6c 100644 --- a/src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx +++ b/src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx @@ -1,5 +1,5 @@ import React, { act } from 'react'; -import { fireEvent, render, screen, waitFor } from '@testing-library/react'; +import { fireEvent, render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import 'jest-localstorage-mock'; import { I18nextProvider } from 'react-i18next'; @@ -304,9 +304,8 @@ describe('Testing LeftDrawerOrg component for SUPERADMIN', () => { , ); - await waitFor(() => - expect(screen.getByTestId(/orgBtn/i)).toBeInTheDocument(), - ); + await wait(); + expect(screen.getByTestId(/orgBtn/i)).toBeInTheDocument(); }); test('Testing Menu Buttons', async () => { From 6ca5501a3aa8e4d9e9594d5f886a50cb343246c9 Mon Sep 17 00:00:00 2001 From: Aryan Shah <149894557+ARYANSHAH1567@users.noreply.github.com> Date: Tue, 22 Oct 2024 19:08:47 +0530 Subject: [PATCH 09/14] Update LeftDrawerOrg.tsx --- src/components/LeftDrawerOrg/LeftDrawerOrg.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/LeftDrawerOrg/LeftDrawerOrg.tsx b/src/components/LeftDrawerOrg/LeftDrawerOrg.tsx index e14feb9cf0..d8c58e89d8 100644 --- a/src/components/LeftDrawerOrg/LeftDrawerOrg.tsx +++ b/src/components/LeftDrawerOrg/LeftDrawerOrg.tsx @@ -116,7 +116,7 @@ const leftDrawerOrg = ({ ) : ( -