Merge branch 'next' into develop
This commit is contained in:
@@ -19,11 +19,12 @@ export class DeltagareTabReportsComponent {
|
||||
private _type$ = new BehaviorSubject<FormSelectItem>(null);
|
||||
readonly reportsFormControlName = 'reports';
|
||||
|
||||
public currentGenomforandeReferens$: Observable<string> = this.activatedRoute.params.pipe(
|
||||
public currentGenomforandeReferens$: Observable<number> = this.activatedRoute.params.pipe(
|
||||
map(params => params.genomforandeReferens as string),
|
||||
distinctUntilChanged(
|
||||
([prevGenomforandeReferens], [currGenomforandeReferens]) => prevGenomforandeReferens === currGenomforandeReferens
|
||||
)
|
||||
),
|
||||
map(genomforandeReferens => +genomforandeReferens)
|
||||
);
|
||||
|
||||
reportsData$: Observable<ReportsData> = combineLatest([
|
||||
@@ -59,7 +60,7 @@ export class DeltagareTabReportsComponent {
|
||||
return this.reportPickerFormGroup?.get(this.reportsFormControlName);
|
||||
}
|
||||
|
||||
onFormSubmitted(event: Event, reportType: string, genomforandeReferens: string): void {
|
||||
onFormSubmitted(event: Event, reportType: string, genomforandeReferens: number): void {
|
||||
event.preventDefault();
|
||||
|
||||
switch (reportType) {
|
||||
|
||||
@@ -28,11 +28,12 @@ export class DeltagareCardComponent {
|
||||
private _userRoles: Role[] = this.userService.userRolesSnapshot;
|
||||
|
||||
public activeTab$: Observable<string> = this._activeTab$.asObservable();
|
||||
public currentGenomforandeReferens$: Observable<string> = this.activatedRoute.params.pipe(
|
||||
public currentGenomforandeReferens$: Observable<number> = this.activatedRoute.params.pipe(
|
||||
map(params => params.genomforandeReferens as string),
|
||||
distinctUntilChanged(
|
||||
([prevGenomforandeReferens], [currGenomforandeReferens]) => prevGenomforandeReferens === currGenomforandeReferens
|
||||
)
|
||||
),
|
||||
map(genomforandeReferens => +genomforandeReferens)
|
||||
);
|
||||
contactInformation$: Observable<ContactInformation> = this.currentGenomforandeReferens$.pipe(
|
||||
switchMap(genomforandeReferens => this.deltagareCardService.fetchContactInformation$(genomforandeReferens)),
|
||||
|
||||
@@ -17,7 +17,7 @@ export interface DeltagareCompactResponse {
|
||||
utforandeVerksamhet: string;
|
||||
utforandeAdress: string;
|
||||
hasAvbrott: boolean;
|
||||
genomforandeReferens: string;
|
||||
genomforandeReferens: number;
|
||||
startdatumAvrop: Date;
|
||||
slutdatumAvrop: Date;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ export interface DeltagareCompact {
|
||||
utforandeVerksamhet: string;
|
||||
utforandeAdress: string;
|
||||
hasAvbrott: boolean;
|
||||
genomforandeReferens: string;
|
||||
genomforandeReferens: number;
|
||||
startdatumAvrop: Date;
|
||||
slutdatumAvrop: Date;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ export class AvropApiService {
|
||||
return this._lockedAvropSnapshot$.getValue();
|
||||
}
|
||||
|
||||
fetchAvrop$(params: Params): Observable<AvropCompactData> {
|
||||
fetchAvrop$(params: Params): Observable<AvropCompactData | null> {
|
||||
return this.httpClient
|
||||
.get<AvropApiResponse>(`${this._apiBaseUrl}`, { params })
|
||||
.pipe(
|
||||
@@ -36,7 +36,7 @@ export class AvropApiService {
|
||||
catchError((error: Error & { status: number }) => {
|
||||
if (error.status === 403) {
|
||||
this._showUnauthorizedError$.next(true);
|
||||
return of(null);
|
||||
return of(null as null);
|
||||
} else {
|
||||
throw new CustomError(
|
||||
errorToCustomError({ ...error, message: `Kunde inte hämta deltagare.\n\n${error.message}` })
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { environment } from '@msfa-environment';
|
||||
import { DeltagareHandelse, DeltagareHandelseApiResponse } from '@msfa-models/deltagare-handelse.model';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { DeltagareHandelse, DeltagareHandelseApiResponse } from '@msfa-models/deltagare-handelse.model';
|
||||
import { environment } from '@msfa-environment';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
@@ -12,7 +12,7 @@ export class DeltagareHandelserApiService {
|
||||
private _apiBaseUrl = `${environment.api.url}`;
|
||||
constructor(private httpClient: HttpClient) {}
|
||||
|
||||
fetchDeltagareHandelser$(genomforandeReferens: string): Observable<DeltagareHandelse[]> {
|
||||
fetchDeltagareHandelser$(genomforandeReferens: number): Observable<DeltagareHandelse[]> {
|
||||
if (!genomforandeReferens) {
|
||||
throw new Error('Genomförandereferens kunde inte hittas.');
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ export class DeltagareApiService {
|
||||
this._deltagareLoading$.next(true);
|
||||
|
||||
return this.httpClient
|
||||
.get<DeltagareCompactApiResponse>(this._apiBaseUrl, {
|
||||
.get<DeltagareCompactApiResponse | null>(this._apiBaseUrl, {
|
||||
params,
|
||||
})
|
||||
.pipe(
|
||||
@@ -70,7 +70,7 @@ export class DeltagareApiService {
|
||||
catchError((error: Error & { status: number }) => {
|
||||
if (error.status === 403) {
|
||||
this._showUnauthorizedError$.next(true);
|
||||
return of(null);
|
||||
return of(null as null);
|
||||
} else {
|
||||
throw new CustomError(
|
||||
errorToCustomError({ ...error, message: `Kunde inte hämta deltagare.\n\n${error.message}` })
|
||||
@@ -80,7 +80,7 @@ export class DeltagareApiService {
|
||||
);
|
||||
}
|
||||
|
||||
public fetchReports$(limit: number, page: number, genomforandeReferens: string): Observable<ReportsData> {
|
||||
public fetchReports$(limit: number, page: number, genomforandeReferens: number): Observable<ReportsData> {
|
||||
return of({ data: [], meta: null });
|
||||
|
||||
// TODO: When the API/Mock-API has implemented the endpoint, we can remove use following code
|
||||
@@ -104,8 +104,10 @@ export class DeltagareApiService {
|
||||
// );
|
||||
}
|
||||
|
||||
public fetchContactInformation$(id: string): Observable<ContactInformation> {
|
||||
return this.httpClient.get<{ data: ContactInformationResponse }>(`${this._apiBaseUrl}/${id}/contact`).pipe(
|
||||
public fetchContactInformation$(genomforandeReferens: number): Observable<ContactInformation> {
|
||||
return this.httpClient
|
||||
.get<{ data: ContactInformationResponse }>(`${this._apiBaseUrl}/${genomforandeReferens}/contact`)
|
||||
.pipe(
|
||||
map(({ data }) => mapResponseToContactInformation(data)),
|
||||
catchError((error: Error) => {
|
||||
throw new CustomError(
|
||||
@@ -115,8 +117,10 @@ export class DeltagareApiService {
|
||||
);
|
||||
}
|
||||
|
||||
public fetchDriversLicense$(id: string): Observable<DriversLicense> {
|
||||
return this.httpClient.get<{ data: DriversLicenseResponse }>(`${this._apiBaseUrl}/${id}/driverlicense`).pipe(
|
||||
public fetchDriversLicense$(genomforandeReferens: number): Observable<DriversLicense> {
|
||||
return this.httpClient
|
||||
.get<{ data: DriversLicenseResponse }>(`${this._apiBaseUrl}/${genomforandeReferens}/driverlicense`)
|
||||
.pipe(
|
||||
map(({ data }) => mapResponseToDriversLicense(data)),
|
||||
catchError((error: Error) => {
|
||||
throw new CustomError(
|
||||
@@ -126,9 +130,9 @@ export class DeltagareApiService {
|
||||
);
|
||||
}
|
||||
|
||||
public fetchHighestEducation$(id: string): Observable<HighestEducation> {
|
||||
public fetchHighestEducation$(genomforandeReferens: number): Observable<HighestEducation> {
|
||||
return this.httpClient
|
||||
.get<{ data: HighestEducationResponse }>(`${this._apiBaseUrl}/${id}/educationlevels/highest`)
|
||||
.get<{ data: HighestEducationResponse }>(`${this._apiBaseUrl}/${genomforandeReferens}/educationlevels/highest`)
|
||||
.pipe(
|
||||
map(({ data }) => mapResponseToHighestEducation(data)),
|
||||
catchError((error: Error) => {
|
||||
@@ -139,8 +143,10 @@ export class DeltagareApiService {
|
||||
);
|
||||
}
|
||||
|
||||
public fetchEducations$(id: string): Observable<Education[]> {
|
||||
return this.httpClient.get<{ data: EducationsResponse }>(`${this._apiBaseUrl}/${id}/educations`).pipe(
|
||||
public fetchEducations$(genomforandeReferens: number): Observable<Education[]> {
|
||||
return this.httpClient
|
||||
.get<{ data: EducationsResponse }>(`${this._apiBaseUrl}/${genomforandeReferens}/educations`)
|
||||
.pipe(
|
||||
map(({ data }) =>
|
||||
data.utbildningar
|
||||
? data.utbildningar.sort((a, b) =>
|
||||
@@ -157,8 +163,10 @@ export class DeltagareApiService {
|
||||
);
|
||||
}
|
||||
|
||||
public fetchTranslator$(id: string): Observable<string> {
|
||||
return this.httpClient.get<{ data: TranslatorResponse }>(`${this._apiBaseUrl}/${id}/translator`).pipe(
|
||||
public fetchTranslator$(genomforandeReferens: number): Observable<string> {
|
||||
return this.httpClient
|
||||
.get<{ data: TranslatorResponse }>(`${this._apiBaseUrl}/${genomforandeReferens}/translator`)
|
||||
.pipe(
|
||||
map(({ data }) => data.sprak?.beskrivning || null),
|
||||
catchError((error: Error) => {
|
||||
throw new CustomError(
|
||||
@@ -168,8 +176,10 @@ export class DeltagareApiService {
|
||||
);
|
||||
}
|
||||
|
||||
public fetchWorkLanguages$(id: string): Observable<string[]> {
|
||||
return this.httpClient.get<{ data: WorkLanguagesResponse }>(`${this._apiBaseUrl}/${id}/work/languages`).pipe(
|
||||
public fetchWorkLanguages$(genomforandeReferens: number): Observable<string[]> {
|
||||
return this.httpClient
|
||||
.get<{ data: WorkLanguagesResponse }>(`${this._apiBaseUrl}/${genomforandeReferens}/work/languages`)
|
||||
.pipe(
|
||||
map(({ data }) => data?.sprak?.map(sprak => sprak.beskrivning) || []),
|
||||
catchError((error: Error) => {
|
||||
throw new CustomError(
|
||||
@@ -182,8 +192,10 @@ export class DeltagareApiService {
|
||||
);
|
||||
}
|
||||
|
||||
public fetchDisabilities$(id: string): Observable<Disability[]> {
|
||||
return this.httpClient.get<{ data: DisabilityResponse[] }>(`${this._apiBaseUrl}/${id}/work/disabilities`).pipe(
|
||||
public fetchDisabilities$(genomforandeReferens: number): Observable<Disability[]> {
|
||||
return this.httpClient
|
||||
.get<{ data: DisabilityResponse[] }>(`${this._apiBaseUrl}/${genomforandeReferens}/work/disabilities`)
|
||||
.pipe(
|
||||
map(({ data }) => data?.map(funktionsnedsattning => mapResponseToDisability(funktionsnedsattning)) || []),
|
||||
catchError((error: Error) => {
|
||||
throw new CustomError(
|
||||
@@ -193,8 +205,10 @@ export class DeltagareApiService {
|
||||
);
|
||||
}
|
||||
|
||||
public fetchWorkExperiences$(id: string): Observable<WorkExperience[]> {
|
||||
return this.httpClient.get<{ data: WorkExperiencesResponse }>(`${this._apiBaseUrl}/${id}/work/experiences`).pipe(
|
||||
public fetchWorkExperiences$(genomforandeReferens: number): Observable<WorkExperience[]> {
|
||||
return this.httpClient
|
||||
.get<{ data: WorkExperiencesResponse }>(`${this._apiBaseUrl}/${genomforandeReferens}/work/experiences`)
|
||||
.pipe(
|
||||
map(
|
||||
({ data }) =>
|
||||
data?.arbetslivserfarenheter?.sort((a, b) =>
|
||||
@@ -210,8 +224,8 @@ export class DeltagareApiService {
|
||||
);
|
||||
}
|
||||
|
||||
public fetchAvropInformation$(id: string): Observable<Avrop> {
|
||||
return this.httpClient.get<{ data: AvropResponse }>(`${this._apiBaseUrl}/${id}/avrop`).pipe(
|
||||
public fetchAvropInformation$(genomforandeReferens: number): Observable<Avrop> {
|
||||
return this.httpClient.get<{ data: AvropResponse }>(`${this._apiBaseUrl}/${genomforandeReferens}/avrop`).pipe(
|
||||
map(({ data }) => mapAvropResponseToAvrop(data)),
|
||||
catchError((error: Error) => {
|
||||
throw new CustomError(
|
||||
|
||||
@@ -16,31 +16,31 @@ import { DeltagareApiService } from './api/deltagare.api.service';
|
||||
export class DeltagareCardService {
|
||||
constructor(private deltagareApiService: DeltagareApiService) {}
|
||||
|
||||
public fetchContactInformation$(genomforandeReferens: string): Observable<ContactInformation> {
|
||||
public fetchContactInformation$(genomforandeReferens: number): Observable<ContactInformation> {
|
||||
return this.deltagareApiService.fetchContactInformation$(genomforandeReferens);
|
||||
}
|
||||
public fetchAvropInformation$(genomforandeReferens: string): Observable<Avrop> {
|
||||
public fetchAvropInformation$(genomforandeReferens: number): Observable<Avrop> {
|
||||
return this.deltagareApiService.fetchAvropInformation$(genomforandeReferens);
|
||||
}
|
||||
public fetchWorkExperiences$(genomforandeReferens: string): Observable<WorkExperience[]> {
|
||||
public fetchWorkExperiences$(genomforandeReferens: number): Observable<WorkExperience[]> {
|
||||
return this.deltagareApiService.fetchWorkExperiences$(genomforandeReferens);
|
||||
}
|
||||
public fetchHighestEducation$(genomforandeReferens: string): Observable<HighestEducation> {
|
||||
public fetchHighestEducation$(genomforandeReferens: number): Observable<HighestEducation> {
|
||||
return this.deltagareApiService.fetchHighestEducation$(genomforandeReferens);
|
||||
}
|
||||
public fetchEducations$(genomforandeReferens: string): Observable<Education[]> {
|
||||
public fetchEducations$(genomforandeReferens: number): Observable<Education[]> {
|
||||
return this.deltagareApiService.fetchEducations$(genomforandeReferens);
|
||||
}
|
||||
public fetchDriversLicense$(genomforandeReferens: string): Observable<DriversLicense> {
|
||||
public fetchDriversLicense$(genomforandeReferens: number): Observable<DriversLicense> {
|
||||
return this.deltagareApiService.fetchDriversLicense$(genomforandeReferens);
|
||||
}
|
||||
public fetchWorkLanguages$(genomforandeReferens: string): Observable<string[]> {
|
||||
public fetchWorkLanguages$(genomforandeReferens: number): Observable<string[]> {
|
||||
return this.deltagareApiService.fetchWorkLanguages$(genomforandeReferens);
|
||||
}
|
||||
public fetchDisabilities$(genomforandeReferens: string): Observable<Disability[]> {
|
||||
public fetchDisabilities$(genomforandeReferens: number): Observable<Disability[]> {
|
||||
return this.deltagareApiService.fetchDisabilities$(genomforandeReferens);
|
||||
}
|
||||
public fetchReports$(limit: number, page: number, genomforandeReferens: string): Observable<ReportsData> {
|
||||
public fetchReports$(limit: number, page: number, genomforandeReferens: number): Observable<ReportsData> {
|
||||
return this.deltagareApiService.fetchReports$(limit, page, genomforandeReferens);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"/api": {
|
||||
"target": "https://mina-sidor-fa-sys.tocp.arbetsformedlingen.se",
|
||||
"target": "https://mina-sidor-fa-test.tocp.arbetsformedlingen.se",
|
||||
"secure": false,
|
||||
"changeOrigin": true
|
||||
}
|
||||
|
||||
@@ -45,9 +45,9 @@ server.use(
|
||||
'/deltagare*onlyMyDeltagare=*': '/minaDeltagare',
|
||||
'/avrop*tjanstKod*': '/avrop$1tjanstekod$2',
|
||||
'/deltagare?*': '/avrop?$1',
|
||||
'/deltagare/:sokandeId/avrop': '/avrop?sokandeId=:sokandeId',
|
||||
'/deltagare/:genomforandeReferens/avrop': '/avrop?genomforandeReferens=:genomforandeReferens',
|
||||
'/deltagare/:genomforandeReferens/handelser': '/deltagareHandelser?genomforandeReferens=:genomforandeReferens',
|
||||
'/deltagare/:sokandeId/*': '/deltagare/:sokandeId',
|
||||
'/deltagare/:genomforandeReferens/*': '/deltagare/:genomforandeReferens',
|
||||
'*page=*': '$1_page=$2',
|
||||
'*limit=*': '$1_limit=$2',
|
||||
'*sort=*': '$1_sort=$2',
|
||||
|
||||
Reference in New Issue
Block a user