Skip to content

Commit

Permalink
feat(api+admin-react): updated agency creation api and form to add de…
Browse files Browse the repository at this point in the history
…grees and domaines
  • Loading branch information
agarbe committed Jul 16, 2024
1 parent ebdc10a commit d206cde
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ const AddAgencyPage = () => {
contactAdministrativePhone: data.telephone,
website: data.siteInternet,
conformeNormesAccessbilite: data.conformeNormesAccessbilite,
domaineIds: data.organismDomaines
.filter((d) => d.checked)
.map((d) => d.id),
degreeIds: data.organismDegrees.filter((d) => d.checked).map((d) => d.id),
};

try {
Expand Down
7 changes: 3 additions & 4 deletions packages/reva-api/modules/organism/features/createAgency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { getLLToEarthFromZip } from "./getLLToEarthFromZip";
import { getMaisonMereAAPByGestionnaireAccountId } from "./getMaisonMereAAPByGestionnaireAccountId";
import { getMaisonMereOnCCNByMaisonMereId } from "./getMaisonMereOnCCNByMaisonMereId";
import { getAccountByKeycloakId } from "../../account/features/getAccountByKeycloakId";
import { getDegrees } from "../../referential/features/getDegrees";

export const createAgency = async ({
keycloakId,
Expand Down Expand Up @@ -52,6 +51,8 @@ export const createAgency = async ({
adresseInformationsComplementaires,
website,
nom,
domaineIds,
degreeIds,
} = params;
const {
typologie,
Expand All @@ -77,8 +78,6 @@ export const createAgency = async ({
zip: params.zip,
});

const degrees = await getDegrees();

//organism creation
const newOrganism = (
await createOrganism({
Expand All @@ -95,7 +94,7 @@ export const createAgency = async ({
llToEarth,
isOnSite: true,
domaineIds,
degreeIds: degrees.map((d) => d.id),
degreeIds,
})
).unsafeCoerce();

Expand Down
2 changes: 2 additions & 0 deletions packages/reva-api/modules/organism/organism.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ input CreateAgencyInput {
contactAdministrativePhone: String!
website: String
conformeNormesAccessbilite: ConformiteNormeAccessibilite!
degreeIds: [ID!]!
domaineIds: [ID!]!
}

input UpdateOrganismDegreesAndDomainesInput {
Expand Down
2 changes: 2 additions & 0 deletions packages/reva-api/modules/organism/organism.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ export interface CreateAgencyInput {
contactAdministrativePhone?: string;
website?: string;
conformeNormesAccessbilite: ConformiteNormeAccessibilite;
degreeIds: string[];
domaineIds: string[];
}

export interface UpdateOrganismInterventionZoneInput {
Expand Down

0 comments on commit d206cde

Please sign in to comment.