Merge pull request #154 in TEA/mina-sidor-fa-web from bugfix/TV-709 to develop
Squashed commit of the following: commit 18214dbad7c905366b8996acd7b325239e0b7702 Author: fueno <nicolas.fuentes-maturana@arbetsformedlingen.se> Date: Wed Sep 29 11:11:39 2021 +0200 TV-709 indent commit a696166e8db059b1926be16d730c59e448fc15cc Author: fueno <nicolas.fuentes-maturana@arbetsformedlingen.se> Date: Wed Sep 29 11:09:24 2021 +0200 TV-709 deleted personnummer and use ssn instead commit 3ecb095b0cb1384d463a6ef57aff8ee3989bab05 Author: fueno <nicolas.fuentes-maturana@arbetsformedlingen.se> Date: Wed Sep 29 10:29:21 2021 +0200 TV-709 remove optional commit 073b96ce2cc11d3ec454edad6f0541314198f420 Author: fueno <nicolas.fuentes-maturana@arbetsformedlingen.se> Date: Wed Sep 29 10:23:11 2021 +0200 TV-709 update endpoint for avvikelsereport, contact info refactoring
This commit is contained in:
@@ -10,18 +10,3 @@ export interface ContactInformationResponse {
|
||||
adresser: AddressResponse[];
|
||||
}
|
||||
|
||||
export interface ContactInformationCompact {
|
||||
fornamn: string;
|
||||
efternamn: string;
|
||||
personnummer: string;
|
||||
}
|
||||
|
||||
export function mapResponseToContactInformationCompact(data: ContactInformationResponse): ContactInformationCompact {
|
||||
const { fornamn, efternamn, personnummer } = data;
|
||||
|
||||
return {
|
||||
fornamn,
|
||||
efternamn,
|
||||
personnummer
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,17 +3,10 @@ import { Injectable } from '@angular/core';
|
||||
import { Alternative } from '@msfa-enums/alternative.enum';
|
||||
import { ErrorType } from '@msfa-enums/error-type.enum';
|
||||
import { environment } from '@msfa-environment';
|
||||
|
||||
import {
|
||||
ContactInformationCompact,
|
||||
ContactInformationResponse,
|
||||
mapResponseToContactInformationCompact
|
||||
} from '@msfa-models/api/contact-information.response.model';
|
||||
import { FragorForAvvikelserResponse } from '@msfa-models/api/fragor-for-avvikelser.response';
|
||||
import { KandaAvvikelseKoderResponse } from '@msfa-models/api/kanda-avvikelse-koder.response.model';
|
||||
import { OrsaksKoderAvvikelseResponse } from '@msfa-models/api/orsaks-koder-avvikelse.response.model';
|
||||
import { Avvikelse, AvvikelseRequestData, mapAvvikelseRequestDataToAvvikelse } from '@msfa-models/avvikelse.model';
|
||||
import { errorToCustomError } from '@msfa-models/error/custom-error';
|
||||
import { FragorForAvvikelser, mapResponseToFragorForAvvikelser } from '@msfa-models/fragor-for-avvikelser.model';
|
||||
import { mapResponseToOrsaksKoderAvvikelse, OrsaksKoderAvvikelse } from '@msfa-models/orsaks-koder-avvikelse.model';
|
||||
import {
|
||||
@@ -23,7 +16,7 @@ import {
|
||||
OrsaksKoderFranvaro
|
||||
} from '@msfa-models/orsaks-koder-franvaro.model';
|
||||
import { ErrorService } from '@msfa-services/error.service';
|
||||
import { Observable, of, throwError } from 'rxjs';
|
||||
import { Observable, throwError } from 'rxjs';
|
||||
import { catchError, filter, map, take } from 'rxjs/operators';
|
||||
|
||||
@Injectable({
|
||||
@@ -62,18 +55,6 @@ export class AvvikelseApiService {
|
||||
)
|
||||
}
|
||||
|
||||
public getContactInformation$(id: number): Observable<ContactInformationCompact> {
|
||||
return this.httpClient.get<{ data: ContactInformationResponse }>(`${this._apiBaseUrl}/deltagare/${id}/contact`).pipe(
|
||||
filter(response => !!response?.data),
|
||||
map(({ data }) => mapResponseToContactInformationCompact(data),
|
||||
catchError(error => {
|
||||
this.errorService.add(errorToCustomError(error));
|
||||
return of({});
|
||||
})
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
public createAvvikelse$(avvikelse: Avvikelse, alternative: string): Observable<Avvikelse> {
|
||||
|
||||
return this.httpClient
|
||||
@@ -103,7 +84,3 @@ export class AvvikelseApiService {
|
||||
|
||||
constructor(private httpClient: HttpClient, private errorService: ErrorService) { }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user