Skip to content

Commit

Permalink
Fix/organisation (#2057)
Browse files Browse the repository at this point in the history
* fix(organisation): approval

* fix(organisation): verification rejection
  • Loading branch information
Anuj-Gupta4 authored Jan 6, 2025
1 parent 5334a67 commit bbc4e13
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
5 changes: 5 additions & 0 deletions src/backend/app/organisations/organisation_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ def parse_organisation_input(
slug: Optional[str] = Form(None),
created_by: Optional[int] = Form(None),
community_type: CommunityType = Form(None),
description: Optional[str] = Form(None),
url: Optional[str] = Form(None),
type: OrganisationType = Form(None, alias="type"),
odk_central_url: Optional[str] = Form(None),
odk_central_user: Optional[str] = Form(None),
Expand All @@ -83,6 +85,8 @@ def parse_organisation_input(
name=name,
slug=slug,
created_by=created_by,
description=description,
url=url,
community_type=community_type,
type=type,
odk_central_url=odk_central_url,
Expand All @@ -98,6 +102,7 @@ class OrganisationOut(BaseModel):
name: str
approved: bool
type: OrganisationType
community_type: CommunityType
logo: Optional[str]
description: Optional[str]
slug: Optional[str]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const OrganizationForm = () => {
};

const rejectOrganization = () => {
dispatch(RejectOrganizationService(`${import.meta.env.VITE_API_URL}/organisation/${organizationId}`));
dispatch(RejectOrganizationService(`${import.meta.env.VITE_API_URL}/organisation/unapproved/${organizationId}`));
};

// redirect to manage-organization page after approve/reject success
Expand Down Expand Up @@ -105,7 +105,7 @@ const OrganizationForm = () => {
id="url"
name="url"
label="Community or Organization are you applied for? "
value={organisationFormData?.organization_type}
value={organisationFormData?.community_type}
onChange={() => {}}
fieldType="text"
disabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import { organizationTypeOptionsType } from '@/models/organisation/organisationM
import { useAppSelector } from '@/types/reduxTypes';

const organizationTypeOptions: organizationTypeOptionsType[] = [
{ name: 'osm_community', value: 'osm_community', label: 'OSM Community' },
{ name: 'company', value: 'company', label: 'Company' },
{ name: 'non_profit', value: 'non_profit', label: 'Non-profit' },
{ name: 'university', value: 'university', label: 'University' },
{ name: 'other', value: 'other', label: 'Other' },
{ name: 'osm_community', value: 'OSM_COMMUNITY', label: 'OSM Community' },
{ name: 'company', value: 'COMPANY', label: 'Company' },
{ name: 'non_profit', value: 'NON_PROFIT', label: 'Non-profit' },
{ name: 'university', value: 'UNIVERSITY', label: 'University' },
{ name: 'other', value: 'OTHER', label: 'Other' },
];

const CreateEditOrganizationForm = ({ organizationId }: { organizationId: string }) => {
Expand Down Expand Up @@ -211,12 +211,12 @@ const CreateEditOrganizationForm = ({ organizationId }: { organizationId: string
topic="What type of community or organization are you applying for? "
options={organizationTypeOptions}
direction="column"
value={values.organization_type}
value={values.community_type}
onChangeData={(value) => {
handleCustomChange('organization_type', value);
handleCustomChange('community_type', value);
}}
className="fmtm-text-base fmtm-text-[#7A7676] fmtm-mt-1"
errorMsg={errors.organization_type}
errorMsg={errors.community_type}
required
/>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface OrganisationValues {
odk_central_user: string;
odk_central_password: string;
osm_profile: string;
organization_type: string;
community_type: string;
fillODKCredentials: boolean;
}
interface ValidationErrors {
Expand All @@ -25,7 +25,7 @@ interface ValidationErrors {
odk_central_user?: string;
odk_central_password?: string;
osm_profile?: string;
organization_type?: string;
community_type?: string;
fillODKCredentials?: boolean;
}

Expand All @@ -46,8 +46,8 @@ function OrganizationDetailsValidation(values: OrganisationValues) {
} else if (!isValidUrl(values.url)) {
errors.url = 'Invalid URL.';
}
if (!values?.organization_type) {
errors.organization_type = 'Organization type is Required.';
if (!values?.community_type) {
errors.community_type = 'Community type is Required.';
}
}

Expand Down

0 comments on commit bbc4e13

Please sign in to comment.