feature(Deltagarlista): Ny kolumn "Effekt" i genomförandehändelser (TV-703)
Squashed commit of the following: commit 4ee981be8779922ce12e4a3158a11186a8666ebe Author: Daniel Appelgren <daniel.appelgren@arbetsformedlingen.se> Date: Tue Sep 28 13:34:03 2021 +0200 Ny kolymn under genomförandehändelser
This commit is contained in:
@@ -1,4 +1,27 @@
|
||||
const GENOMFORANDEHANDELSE_EFFECT_MAP = {
|
||||
Inrapporteringsdatum_GP: 'Inskickad datum',
|
||||
Godkannandedatum_GP: 'Godkänd datum',
|
||||
Avvisatdatum_GP: 'Ej godkänd datum',
|
||||
Inrapporteringsdatum_PR: 'Inrapporterad datum',
|
||||
Godkannandedatum_PR: 'Godkänd datum',
|
||||
Avvisatdatum_PR: 'Ej godkänd datum',
|
||||
Inrapporteringsdatum_SR: 'Inskickad datum',
|
||||
Godkannandedatum_SR: 'Godkänd datum',
|
||||
Avvisatdatum_SR: 'Ej godkänd datum',
|
||||
Handlaggning_startad: 'Handläggning startad',
|
||||
Andringsbeslutdatum: 'Ändringsbeslut datum',
|
||||
Slut_avropsperiod: 'Nytt slutdatum',
|
||||
};
|
||||
|
||||
export interface DeltagareHandelse {
|
||||
description: string;
|
||||
receivedDate: Date;
|
||||
isAvbrott: boolean;
|
||||
effectDate: Date;
|
||||
effectDescription: string;
|
||||
}
|
||||
|
||||
interface DeltagareHandelseApiResponse {
|
||||
description: string;
|
||||
receivedDate: Date;
|
||||
isAvbrott: boolean;
|
||||
@@ -6,6 +29,18 @@ export interface DeltagareHandelse {
|
||||
tidpunktDescription: string;
|
||||
}
|
||||
|
||||
export interface DeltagareHandelseApiResponse {
|
||||
data: DeltagareHandelse[];
|
||||
export interface DeltagareHandelserApiResponse {
|
||||
data: DeltagareHandelseApiResponse[];
|
||||
}
|
||||
|
||||
export function mapDeltagareHandelseApiResponse(
|
||||
deltagareHandelseApiResponse: DeltagareHandelseApiResponse
|
||||
): DeltagareHandelse {
|
||||
const { description, receivedDate, isAvbrott } = deltagareHandelseApiResponse;
|
||||
const effectDate = deltagareHandelseApiResponse.tidpunkt;
|
||||
const effectDescription =
|
||||
GENOMFORANDEHANDELSE_EFFECT_MAP[deltagareHandelseApiResponse.tidpunktDescription] ??
|
||||
deltagareHandelseApiResponse.tidpunktDescription ??
|
||||
'';
|
||||
return { description, receivedDate, isAvbrott, effectDate, effectDescription };
|
||||
}
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
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 {
|
||||
DeltagareHandelse,
|
||||
DeltagareHandelserApiResponse,
|
||||
mapDeltagareHandelseApiResponse,
|
||||
} from '@msfa-models/deltagare-handelse.model';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
@@ -18,11 +22,11 @@ export class DeltagareHandelserApiService {
|
||||
}
|
||||
|
||||
return this.httpClient
|
||||
.get<DeltagareHandelseApiResponse>(`${this._apiBaseUrl}/deltagare/${genomforandeReferens}/handelser`)
|
||||
.get<DeltagareHandelserApiResponse>(`${this._apiBaseUrl}/deltagare/${genomforandeReferens}/handelser`)
|
||||
.pipe(
|
||||
map(({ data }) => {
|
||||
if (data) {
|
||||
return data;
|
||||
return data.map(genomforandeHandelse => mapDeltagareHandelseApiResponse(genomforandeHandelse));
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user