Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed super admin profile #2340

Closed
Closed
56 changes: 56 additions & 0 deletions src/GraphQl/Queries/Queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
ARYANSHAH1567 marked this conversation as resolved.
Show resolved Hide resolved
ARYANSHAH1567 marked this conversation as resolved.
Show resolved Hide resolved
}
}
`;
ARYANSHAH1567 marked this conversation as resolved.
Show resolved Hide resolved

// Query to take the Organization with data
export const ORGANIZATIONS_LIST = gql`
query Organizations($id: ID!) {
Expand Down
7 changes: 4 additions & 3 deletions src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -304,8 +304,9 @@ describe('Testing LeftDrawerOrg component for SUPERADMIN', () => {
</BrowserRouter>
</MockedProvider>,
);
await wait();
expect(screen.getByTestId(/orgBtn/i)).toBeInTheDocument();
await waitFor(() =>
expect(screen.getByTestId(/OrgBtn/i)).toBeInTheDocument(),
);
});

test('Testing Menu Buttons', async () => {
Expand Down
6 changes: 3 additions & 3 deletions src/components/LeftDrawerOrg/LeftDrawerOrg.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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
Expand Down
Loading