Skip to content

Commit

Permalink
Hent arbeidsgivers vurderinger for stilling (#16)
Browse files Browse the repository at this point in the history
* Hent arbeidsgivers vurderinger for stilling

* Lagt til backend-proxy, og ikke-fungerende mock

* setter opp mock

* Deploy branch til dev

* Legg på outbound policy for kall mot presenterte kandidate-api

* Logg ut bedre vurderinger response

* Flytt kall mot vurderinger lenger inn slik at vi kan sjekke stillingsid

* Legg til dependency array for useffect for vurderinger

* Lag mocken for vuderinger slik at den famnger alle kall, og ikke er knyttet til en spesifikk stillingsId

* Ta bort debuglogging

---------

Co-authored-by: frodank <[email protected]>
  • Loading branch information
joarau and frodank authored Aug 2, 2023
1 parent 6c1516d commit f8d0086
Show file tree
Hide file tree
Showing 10 changed files with 97 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
deploy-til-dev:
name: Deploy til dev-gcp
needs: bygg-og-push-docker-image
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/fiks-kopier-annonse-kontekst-av-kandidat'
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/hent-arbeidsgivers-vurderinger-for-stilling'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
3 changes: 0 additions & 3 deletions deploy/dev-gcp.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@
"modiaContextHolderHost": "modiacontextholder-q0.dev-fss-pub.nais.io",

"statistikkApiUrl": "https://rekrutteringsbistand-statistikk-api.dev-fss-pub.nais.io/rekrutteringsbistand-statistikk-api",
"stillingssokProxyUrl": "http://rekrutteringsbistand-stillingssok-proxy",
"stillingApiUrl": "http://rekrutteringsbistand-stilling-api",
"kandidatApiUrl": "https://rekrutteringsbistand-kandidat-api.dev-fss-pub.nais.io/rekrutteringsbistand-kandidat-api/rest",
"smsApi": "https://rekrutteringsbistand-sms.dev-fss-pub.nais.io/rekrutteringsbistand-sms/sms",
"foresporselOmDelingAvCvApi": "https://foresporsel-om-deling-av-cv-api.dev-fss-pub.nais.io",
"synlighetsmotorApi": "http://toi-synlighetsmotor",
"modiaContextHolderApi": "https://modiacontextholder-q0.dev-fss-pub.nais.io/modiacontextholder"
}
9 changes: 6 additions & 3 deletions deploy/nais.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ spec:
- application: rekrutteringsbistand-stilling-api
- application: rekrutteringsbistand-stillingssok-proxy
- application: toi-synlighetsmotor
- application: presenterte-kandidater-api
external:
- host: {{ statistikkApiHost }}
- host: {{ smsApiHost }}
Expand All @@ -56,16 +57,18 @@ spec:
- name: STATISTIKK_API_URL
value: {{ statistikkApiUrl }}
- name: STILLINGSSOK_PROXY_URL
value: {{ stillingssokProxyUrl }}
value: http://rekrutteringsbistand-stillingssok-proxy
- name: STILLING_API_URL
value: {{ stillingApiUrl }}
value: http://rekrutteringsbistand-stilling-api
- name: KANDIDAT_API_URL
value: {{ kandidatApiUrl }}
- name: SMS_API
value: {{ smsApi }}
- name: FORESPORSEL_OM_DELING_AV_CV_API
value: {{ foresporselOmDelingAvCvApi }}
- name: SYNLIGHETSMOTOR_API
value: {{ synlighetsmotorApi }}
value: http://toi-synlighetsmotor
- name: PRESENTERTE_KANDIDATER_API
value: http://presenterte-kandidater-api
- name: MODIA_CONTEXT_HOLDER_API
value: {{ modiaContextHolderApi }}
3 changes: 0 additions & 3 deletions deploy/prod-gcp.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@
"modiaContextHolderHost": "modiacontextholder.prod-fss-pub.nais.io",

"statistikkApiUrl": "https://rekrutteringsbistand-statistikk-api.prod-fss-pub.nais.io/rekrutteringsbistand-statistikk-api",
"stillingssokProxyUrl": "http://rekrutteringsbistand-stillingssok-proxy",
"stillingApiUrl": "http://rekrutteringsbistand-stilling-api",
"kandidatApiUrl": "https://rekrutteringsbistand-kandidat-api.prod-fss-pub.nais.io/rekrutteringsbistand-kandidat-api/rest",
"smsApi": "https://rekrutteringsbistand-sms.prod-fss-pub.nais.io/rekrutteringsbistand-sms/sms",
"foresporselOmDelingAvCvApi": "https://foresporsel-om-deling-av-cv-api.prod-fss-pub.nais.io",
"synlighetsmotorApi": "http://toi-synlighetsmotor",
"modiaContextHolderApi": "https://modiacontextholder.prod-fss-pub.nais.io/modiacontextholder"
}
15 changes: 15 additions & 0 deletions mock/presenterte-kandidater-api/mock.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { rest } from 'msw';
import { api } from '../../src/felles/api';

export const presenterteKandidaterApiMock = [
rest.get(
`${api.presenterteKandidaterApi}/kandidatliste/:stillingsId/vurdering`,
(_, res, ctx) => res(ctx.json(mockArbeidsgiversVurderinger))
),
];
const mockArbeidsgiversVurderinger: any = [
{
aktørId: '123',
vurdering: 'abc',
},
];
2 changes: 2 additions & 0 deletions mock/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { forespørselOmDelingAvCvMock } from './foresporsel-om-deling-av-cv-api/
import { statistikkApiMock } from './statistikk-api/mock';
import { stillingApiMock } from './stilling-api/mock';
import { stillingssøkMock } from './stillingssok-proxy/mock';
import { presenterteKandidaterApiMock } from './presenterte-kandidater-api/mock';

const handlers = [
...innloggetBrukerMock,
Expand All @@ -17,6 +18,7 @@ const handlers = [
...(import.meta.env.VITE_MOCK_MODIA ? modiaContextHolderMock : []),
...(import.meta.env.VITE_MOCK_AIVEN ? kandidatsøkMock : []),
...(import.meta.env.VITE_MOCK_AIVEN ? stillingssøkMock : []),
...presenterteKandidaterApiMock,
];

const worker = setupWorker(...handlers);
Expand Down
59 changes: 38 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const scopes = {
sms: `api://${clusterOnPrem}.toi.rekrutteringsbistand-sms/.default`,
forespørselOmDelingAvCv: `api://${clusterOnPrem}.arbeidsgiver-inkludering.foresporsel-om-deling-av-cv-api/.default`,
synlighetsmotor: `api://${cluster}.toi.toi-synlighetsmotor/.default`,
presenterteKandidater: `api://${cluster}.toi.presenterte-kandidater-api/.default`,
};

const {
Expand All @@ -36,6 +37,7 @@ const {
SMS_API,
FORESPORSEL_OM_DELING_AV_CV_API,
SYNLIGHETSMOTOR_API,
PRESENTERTE_KANDIDATER_API,
OPEN_SEARCH_URI,
OPEN_SEARCH_USERNAME,
OPEN_SEARCH_PASSWORD,
Expand All @@ -62,7 +64,11 @@ const startServer = () => {
scopes.forespørselOmDelingAvCv
);
proxyMedOboToken('/synlighet-api', SYNLIGHETSMOTOR_API, scopes.synlighetsmotor);

proxyMedOboToken(
'/presenterte-kandidater-api',
PRESENTERTE_KANDIDATER_API,
scopes.presenterteKandidater
);
proxyTilKandidatsøkEs(
'/kandidatsok-proxy',
OPEN_SEARCH_URI,
Expand Down
1 change: 1 addition & 0 deletions src/felles/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const api = {
kandidat: '/kandidat-api',
kandidatsøk: '/kandidatsok-proxy',
forespørselOmDelingAvCv: '/foresporsel-om-deling-av-cv-api',
presenterteKandidaterApi: '/presenterte-kandidater-api',
};

export const videresendTilInnlogging = () => {
Expand Down
27 changes: 27 additions & 0 deletions src/kandidat/kandidatliste/Kandidatliste.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import FeilVedSendingAvForespørsel from './feil-ved-sending-av-forespørsel/Fei
import { Search } from '@navikt/ds-react';
import css from './Kandidatliste.module.css';
import { Kandidatstatus } from 'felles/domene/kandidatliste/KandidatIKandidatliste';
import { api } from 'felles/api';

type Props = {
kandidatliste: Kandidatlistetype;
Expand All @@ -65,6 +66,32 @@ const Kandidatliste: FunctionComponent<Props> = ({
onToggleMarkert,
onToggleArkivert,
}) => {
useEffect(() => {
const hentArbeidsgiversVurderinger = async (stillingId: string) => {
try {
const respons = await fetch(
`${api.presenterteKandidaterApi}/kandidatliste/${stillingId}/vurdering`,
{
method: 'GET',
headers: { 'Content-Type': 'application/json' },
}
);
const vurderingerJson = await respons.json();
console.log(
'Arbeidsgivers vurderinger: ',
vurderingerJson,
JSON.stringify(vurderingerJson)
);
} catch (e) {
console.log('Kall mot arbeidsgivers vurderinger feilet: ' + e);
}
};
if (kandidatliste.stillingId !== null) {
console.log('stillingsId er ' + kandidatliste.stillingId);
hentArbeidsgiversVurderinger(kandidatliste.stillingId);
}
}, [kandidatliste.stillingId]);

useMaskerFødselsnumre();
useHentSendteMeldinger(kandidatliste.kandidatlisteId);
useHentForespørslerOmDelingAvCv(kandidatliste.stillingId);
Expand Down

0 comments on commit f8d0086

Please sign in to comment.