Skip to content

Commit

Permalink
fix(overige-objecten-api): trefwoorden wip
Browse files Browse the repository at this point in the history
  • Loading branch information
AliKdhim87 committed Mar 4, 2025
1 parent 5198cd7 commit 3ed5b65
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 29 deletions.
27 changes: 3 additions & 24 deletions apps/overige-objecten-api/src/__mocks__/getStrapiVacData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,7 @@ export const getStrapiVacData = () => {
},
],
toelichting: null,
trefwoorden: [
{
trefwoord: 'paspoort',
},
{
trefwoord: 'aanvraag',
},
],
keywords: 'paspoort, aanvraag',
},
},
},
Expand Down Expand Up @@ -70,14 +63,7 @@ export const getStrapiVacData = () => {
},
],
toelichting: null,
trefwoorden: [
{
trefwoord: 'rijbewijs',
},
{
trefwoord: 'aanvraag',
},
],
keywords: 'rijbewijs, aanvraag',
},
},
},
Expand Down Expand Up @@ -105,14 +91,7 @@ export const getStrapiVacData = () => {
},
],
toelichting: null,
trefwoorden: [
{
trefwoord: 'verhuizing',
},
{
trefwoord: 'inschrijven',
},
],
keywords: 'verhuizing, inschrijven',
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const createVacController: RequestHandler = async (req, res, next) => {
afdelingNaam,
})),
toelichting: vac?.toelichting,
trefwoorden: vac?.trefwoorden,
keywords: vac?.trefwoorden?.map(({ trefwoord }) => trefwoord).join(' ,'),
},
};
const { data: responseData } = await fetchData<CreateVacResponse>({
Expand Down
4 changes: 2 additions & 2 deletions apps/overige-objecten-api/src/controllers/objects/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export const updateVacController: RequestHandler = async (req, res, next) => {
uuid: existingVac.attributes.vac.uuid,
afdelingen: existingVac.attributes.vac.afdelingen,
toelichting: existingVac.attributes.vac.toelichting,
trefwoorden: existingVac.attributes.vac.trefwoorden,
keywords: existingVac.attributes.vac.keywords,
},
};
const vacBody = {
Expand All @@ -98,7 +98,7 @@ export const updateVacController: RequestHandler = async (req, res, next) => {
doelgroep: vac?.doelgroep ? snakeCase(vac.doelgroep) : undefined,
afdelingen: vac?.afdelingen,
toelichting: vac?.toelichting,
trefwoorden: vac?.trefwoorden,
keywords: vac?.trefwoorden?.map(({ trefwoord }) => trefwoord).join(' ,'),
},
};
const vacPayload = merge(currentVACObject, vacBody);
Expand Down
2 changes: 1 addition & 1 deletion apps/overige-objecten-api/src/strapi-product-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export interface VacItem {
doelgroep?: Doelgroep;
afdelingen?: Afdeling[];
toelichting?: string;
trefwoorden?: Trefwoorden[];
keywords?: string;
}

export interface AttributesVacItem {
Expand Down
3 changes: 2 additions & 1 deletion apps/overige-objecten-api/src/utils/getVacData.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import kebabCase from 'lodash.kebabcase';
import { concatenateFieldValues } from './concatenateFieldValues';
import { generateKeywords } from './generateKeywords';
import type { Antwoord, DataVacItem, Doelgroep, VacRecordData, VACSData } from '../strapi-product-type';
interface createVacRecordReturnTypes {
index: number;
Expand Down Expand Up @@ -33,7 +34,7 @@ const createVacRecord = (item: DataVacItem, vacUrl: string, antwoord: string): c
doelgroep: kebabCase(item?.attributes?.vac?.doelgroep ?? undefined) as Doelgroep,
afdelingen: item?.attributes?.vac?.afdelingen,
toelichting: item?.attributes?.vac?.toelichting,
trefwoorden: item?.attributes?.vac?.trefwoorden,
trefwoorden: generateKeywords(item?.attributes?.vac?.keywords ?? ''),
url: vacUrl,
},
geometry: null,
Expand Down

0 comments on commit 3ed5b65

Please sign in to comment.