Skip to content

Commit

Permalink
Removed Support for Private Organizations
Browse files Browse the repository at this point in the history
  • Loading branch information
aialok committed Jan 6, 2024
1 parent 3819bd8 commit 0120a1b
Show file tree
Hide file tree
Showing 16 changed files with 4 additions and 167 deletions.
4 changes: 0 additions & 4 deletions public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@
"createSampleOrganization": "Create Sample Organization",
"description": "Description",
"location": "Location",
"isPublic": "Is Public",
"visibleInSearch": "Visible In Search",
"displayImage": "Display Image",
"enterName": "Enter Name",
"sort": "Sort",
Expand Down Expand Up @@ -468,8 +466,6 @@
"description": "Description",
"location": "Location",
"displayImage": "Display Image",
"isPublic": "Public",
"isVisibleInSearch": "Visible in Search",
"saveChanges": "Save Changes",
"enterNameOrganization": "Enter Organization Name",
"successfulUpdated": "Organization updated successfully",
Expand Down
4 changes: 0 additions & 4 deletions public/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@
"createSampleOrganization": "Créer une organisation d'exemple",
"description": "La description",
"location": "Emplacement",
"isPublic": "Est publique",
"visibleInSearch": "Visible dans la recherche",
"displayImage": "Afficher l'image",
"enterName": "Entrez le nom",
"sort": "Trier",
Expand Down Expand Up @@ -465,8 +463,6 @@
"description": "La description",
"location": "emplacement",
"displayImage": "Afficher l'image",
"isPublic": "Public",
"isVisibleInSearch": "Visible dans la recherche",
"saveChanges": "Sauvegarder les modifications",
"enterNameOrganization": "Entrez le nom de l'organisation",
"successfulUpdated": "Mise à jour réussie",
Expand Down
4 changes: 0 additions & 4 deletions public/locales/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@
"createSampleOrganization": " सैंपल संगठन बनाएं",
"description": "विवरण",
"location": "स्थान",
"isPublic": "सार्वजनिक है",
"visibleInSearch": "खोज में दृश्यमान",
"displayImage": "प्रदर्शन छवि",
"enterName": "नाम दर्ज करें",
"sort": "छांटें",
Expand Down Expand Up @@ -464,8 +462,6 @@
"description": "विवरण",
"location": "जगह",
"displayImage": "प्रदर्शन छवि",
"isPublic": "सार्वजनिक",
"isVisibleInSearch": "खोज में दिखाए जा सकते हैं",
"saveChanges": "परिवर्तनों को सुरक्षित करें",
"cancel": "रद्द करना",
"enterNameOrganization": "संगठन का नाम दर्ज करें",
Expand Down
4 changes: 0 additions & 4 deletions public/locales/sp.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@
"createSampleOrganization": "Crear organización de muestra",
"description": "Descripción",
"location": "Ubicación",
"isPublic": "Es público",
"visibleInSearch": "Visible en la búsqueda",
"displayImage": "Mostrar imagen",
"enterName": "Ingrese su nombre",
"sort": "Ordenar",
Expand Down Expand Up @@ -464,8 +462,6 @@
"description": "Descripción",
"location": "ubicación",
"displayImage": "Mostrar imagen",
"isPublic": "Público",
"isVisibleInSearch": "Visible en la búsqueda",
"saveChanges": "Guardar cambios",
"cancel": "Cancelar",
"enterNameOrganization": "Ingrese el nombre de la organización",
Expand Down
4 changes: 0 additions & 4 deletions public/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@
"createSampleOrganization": "创建示范组织",
"description": "描述",
"location": "地點",
"isPublic": "是否公開",
"visibleInSearch": "在搜索中可見",
"displayImage": "顯示圖像",
"enterName": "输入名字",
"sort": "排序",
Expand Down Expand Up @@ -464,8 +462,6 @@
"description": "描述",
"location": "地點",
"displayImage": "顯示圖像",
"isPublic": "公开",
"isVisibleInSearch": "在搜索中可见",
"saveChanges": "保存更改",
"cancel": "取消",
"enterNameOrganization": "輸入組織名稱",
Expand Down
10 changes: 0 additions & 10 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,6 @@ type Organization {
creator: User!
description: String!
image: String
isPublic: Boolean!
location: String
members: [User]
membershipRequests: [MembershipRequest]
Expand All @@ -557,7 +556,6 @@ type Organization {
first: PositiveInt
last: PositiveInt
): UserTagsConnection
visibleInSearch: Boolean!
}

type OrganizationInfoNode {
Expand All @@ -566,20 +564,16 @@ type OrganizationInfoNode {
creator: User!
description: String!
image: String
isPublic: Boolean!
name: String!
visibleInSearch: Boolean!
}

input OrganizationInput {
apiUrl: URL
attendees: String
description: String!
image: String
isPublic: Boolean!
location: String
name: String!
visibleInSearch: Boolean!
}

enum OrganizationOrderByInput {
Expand Down Expand Up @@ -614,14 +608,12 @@ input OrganizationWhereInput {
id_not: ID
id_not_in: [ID!]
id_starts_with: ID
isPublic: Boolean
name: String
name_contains: String
name_in: [String!]
name_not: String
name_not_in: [String!]
name_starts_with: String
visibleInSearch: Boolean
}

type OtpData {
Expand Down Expand Up @@ -949,10 +941,8 @@ input UpdateEventProjectInput {

input UpdateOrganizationInput {
description: String
isPublic: Boolean
location: String
name: String
visibleInSearch: Boolean
}

input UpdateTaskInput {
Expand Down
20 changes: 2 additions & 18 deletions src/GraphQl/Mutations/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,11 @@ export const UPDATE_ORGANIZATION_MUTATION = gql`
$name: String
$description: String
$location: String
$isPublic: Boolean
$visibleInSearch: Boolean
$file: String
) {
updateOrganization(
id: $id
data: {
name: $name
description: $description
isPublic: $isPublic
visibleInSearch: $visibleInSearch
location: $location
}
data: { name: $name, description: $description, location: $location }
file: $file
) {
_id
Expand Down Expand Up @@ -184,18 +176,10 @@ export const CREATE_ORGANIZATION_MUTATION = gql`
$description: String!
$location: String!
$name: String!
$visibleInSearch: Boolean!
$isPublic: Boolean!
$image: String
) {
createOrganization(
data: {
description: $description
location: $location
name: $name
visibleInSearch: $visibleInSearch
isPublic: $isPublic
}
data: { description: $description, location: $location, name: $name }
file: $image
) {
_id
Expand Down
2 changes: 0 additions & 2 deletions src/GraphQl/Queries/Queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,6 @@ export const ORGANIZATIONS_LIST = gql`
name
description
location
isPublic
visibleInSearch
members {
_id
firstName
Expand Down
18 changes: 0 additions & 18 deletions src/components/OrgUpdate/OrgUpdate.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ describe('Testing Organization Update', () => {
description: 'This is a updated description',
location: 'This is updated location',
displayImage: new File(['hello'], 'hello.png', { type: 'image/png' }),
isPublic: false,
isVisible: true,
};

global.alert = jest.fn();
Expand All @@ -54,22 +52,16 @@ describe('Testing Organization Update', () => {
expect(screen.getByText('Description')).toBeInTheDocument();
expect(screen.getByText('Location')).toBeInTheDocument();
expect(screen.getByText('Display Image:')).toBeInTheDocument();
expect(screen.getByText('Public:')).toBeInTheDocument();
expect(screen.getByText('Visible in Search:')).toBeInTheDocument();

// Get the input fields, and btns
const name = screen.getByPlaceholderText(/Enter Organization Name/i);
const des = screen.getByPlaceholderText(/Description/i);
const location = screen.getByPlaceholderText(/Location/i);
const isPublic = screen.getByPlaceholderText(/Public/i);
const isVisible = screen.getByPlaceholderText(/Visible/i);

// Checking if form fields got updated according to the mock data
expect(name).toHaveValue('Palisadoes');
expect(des).toHaveValue('Equitable Access to STEM Education Jobs');
expect(location).toHaveValue('Jamaica');
expect(isPublic).toBeChecked();
expect(isVisible).not.toBeChecked();
});

test('Should Update organization properly', async () => {
Expand All @@ -90,8 +82,6 @@ describe('Testing Organization Update', () => {
const des = screen.getByPlaceholderText(/Description/i);
const location = screen.getByPlaceholderText(/Location/i);
const displayImage = screen.getByPlaceholderText(/Display Image/i);
const isPublic = screen.getByPlaceholderText(/Public/i);
const isVisible = screen.getByPlaceholderText(/Visible/i);
const saveChangesBtn = screen.getByText(/Save Changes/i);

// Emptying the text fields to add updated data
Expand All @@ -104,8 +94,6 @@ describe('Testing Organization Update', () => {
userEvent.type(des, formData.description);
userEvent.type(location, formData.location);
userEvent.upload(displayImage, formData.displayImage);
userEvent.click(isPublic);
userEvent.click(isVisible);

await wait();
userEvent.click(saveChangesBtn);
Expand All @@ -115,8 +103,6 @@ describe('Testing Organization Update', () => {
expect(des).toHaveValue(formData.description);
expect(location).toHaveValue(formData.location);
expect(displayImage).toBeTruthy();
expect(isPublic).not.toBeChecked();
expect(isVisible).toBeChecked();
});

test('Should render error occured text when Organization Could not be found', async () => {
Expand Down Expand Up @@ -151,8 +137,6 @@ describe('Testing Organization Update', () => {
const des = screen.getByPlaceholderText(/Description/i);
const location = screen.getByPlaceholderText(/Location/i);
const displayImage = screen.getByPlaceholderText(/Display Image/i);
const isPublic = screen.getByPlaceholderText(/Public/i);
const isVisible = screen.getByPlaceholderText(/Visible/i);
const saveChangesBtn = screen.getByText(/Save Changes/i);

// Emptying the text fields to add updated data
Expand All @@ -165,8 +149,6 @@ describe('Testing Organization Update', () => {
userEvent.type(des, formData.description);
userEvent.type(location, formData.location);
userEvent.upload(displayImage, formData.displayImage);
userEvent.click(isPublic);
userEvent.click(isVisible);

await wait();
userEvent.click(saveChangesBtn);
Expand Down
29 changes: 1 addition & 28 deletions src/components/OrgUpdate/OrgUpdate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { WarningAmberRounded } from '@mui/icons-material';
import { UPDATE_ORGANIZATION_MUTATION } from 'GraphQl/Mutations/mutations';
import { ORGANIZATIONS_LIST } from 'GraphQl/Queries/Queries';
import Loader from 'components/Loader/Loader';
import { Col, Form, Row } from 'react-bootstrap';
import { Form } from 'react-bootstrap';
import convertToBase64 from 'utils/convertToBase64';
import { errorHandler } from 'utils/errorHandler';
import type { InterfaceQueryOrganizationsListObject } from 'utils/interfaces';
Expand All @@ -34,9 +34,6 @@ function orgUpdate(props: InterfaceOrgUpdateProps): JSX.Element {
orgImage: null,
});

const [publicchecked, setPublicChecked] = React.useState(false);
const [visiblechecked, setVisibleChecked] = React.useState(false);

const [login] = useMutation(UPDATE_ORGANIZATION_MUTATION);

const { t } = useTranslation('translation', {
Expand Down Expand Up @@ -69,8 +66,6 @@ function orgUpdate(props: InterfaceOrgUpdateProps): JSX.Element {
orgDescrip: data.organizations[0].description,
location: data.organizations[0].location,
});
setPublicChecked(data.organizations[0].isPublic);
setVisibleChecked(data.organizations[0].visibleInSearch);
}
return () => {
isMounted = false;
Expand All @@ -85,8 +80,6 @@ function orgUpdate(props: InterfaceOrgUpdateProps): JSX.Element {
name: formState.orgName,
description: formState.orgDescrip,
location: formState.location,
isPublic: publicchecked,
visibleInSearch: visiblechecked,
file: formState.orgImage,
},
});
Expand Down Expand Up @@ -163,26 +156,6 @@ function orgUpdate(props: InterfaceOrgUpdateProps): JSX.Element {
});
}}
/>
<Row>
<Col sm={6} className="d-flex mb-3">
<Form.Label className="me-3">{t('isPublic')}:</Form.Label>
<Form.Switch
placeholder={t('isPublic')}
checked={publicchecked}
onChange={(): void => setPublicChecked(!publicchecked)}
/>
</Col>
<Col sm={6} className="d-flex mb-3">
<Form.Label className="me-3">
{t('isVisibleInSearch')}:
</Form.Label>
<Form.Switch
placeholder={t('isVisibleInSearch')}
checked={visiblechecked}
onChange={(): void => setVisibleChecked(!visiblechecked)}
/>
</Col>
</Row>
<Form.Label htmlFor="orgphoto">{t('displayImage')}:</Form.Label>
<Form.Control
className="mb-4"
Expand Down
10 changes: 0 additions & 10 deletions src/components/OrgUpdate/OrgUpdateMocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ export const MOCKS = [
name: 'Palisadoes',
description: 'Equitable Access to STEM Education Jobs',
location: 'Jamaica',
isPublic: true,
visibleInSearch: false,
creator: {
firstName: 'John',
lastName: 'Doe',
Expand Down Expand Up @@ -60,8 +58,6 @@ export const MOCKS = [
description: 'This is an updated test organization',
location: 'Updated location',
image: new File(['hello'], 'hello.png', { type: 'image/png' }),
isPublic: true,
visibleInSearch: false,
},
},
result: {
Expand All @@ -71,8 +67,6 @@ export const MOCKS = [
name: 'Updated Organization',
description: 'This is an updated test organization',
location: 'Updated location',
isPublic: true,
visibleInSearch: false,
},
},
},
Expand Down Expand Up @@ -104,8 +98,6 @@ export const MOCKS_ERROR_UPDATE_ORGLIST = [
name: 'Palisadoes',
description: 'Equitable Access to STEM Education Jobs',
location: 'Jamaica',
isPublic: true,
visibleInSearch: false,
creator: {
firstName: 'John',
lastName: 'Doe',
Expand Down Expand Up @@ -148,8 +140,6 @@ export const MOCKS_ERROR_UPDATE_ORGLIST = [
description: 'This is an updated test organization',
location: 'Updated location',
image: new File(['hello'], 'hello.png', { type: 'image/png' }),
isPublic: true,
visibleInSearch: false,
},
},
erorr: new Error('Mock Graphql Updating Organization Error'),
Expand Down
Loading

0 comments on commit 0120a1b

Please sign in to comment.