From 4fc23530ef971ad7d792237aa4153e8a3a786dc1 Mon Sep 17 00:00:00 2001
From: Erik Tiekstra
Date: Tue, 3 Aug 2021 13:45:21 +0200
Subject: [PATCH] feat(deltagare): Fetching data from avrop to show list of
deltagare.
Squashed commit of the following:
commit d1f44901caa22422c8398ab199f1cf2f6f6d6f1a
Author: Erik Tiekstra
Date: Tue Aug 3 13:40:29 2021 +0200
Fixed some more conflicts
commit 78678aa266fa319d9542c19ff5a09726ca7e2315
Merge: 7d27c3a 1d69b4b
Author: Erik Tiekstra
Date: Tue Aug 3 13:29:16 2021 +0200
Merged develop and fixed conflicts
commit 7d27c3a8239feebe2b2e3209d5bd0e1d1aa805de
Author: panpe
Date: Wed Jul 28 16:15:09 2021 +0200
fixed small path issue.
commit 259e45487b988c66ebee34bf59659b24390ca083
Author: panpe
Date: Wed Jul 28 15:36:47 2021 +0200
npm start is finally able to integrate to backend. Since i tested it in local the the url needs to get changed back to dafa instead of localhost:5001.
commit c06d16debbe933c1c7f7c927c0f0c32034c6f011
Author: panpe
Date: Fri Jul 16 12:56:05 2021 +0200
fixed some small issues such as disability was not caught. Connected this to the swagger backend. But it needs some better null checks
commit c6a933b3bc2658816bbab5c8399a2de9d3a0bc4a
Author: Cecilia Varnava
Date: Mon Jul 12 01:12:35 2021 +0200
TV-269 wip
commit 5e7252d0dbe33ca3aca0e2e82860fa5b799745cc
Author: Cecilia Varnava
Date: Mon Jul 12 01:03:47 2021 +0200
TV-269 Deltagare - mocked workexperiences
commit f50fa65e2e297f7f551be53a2c181983b53119e4
Author: Cecilia Varnava
Date: Thu Jul 8 11:15:47 2021 +0200
TV-269 added tabs style and deltagare data
---
.../pages/deltagare/deltagare.component.ts | 4 ++--
.../deltagare-card/deltagare-card.module.ts | 6 ------
.../mock-login/mock-login.component.html | 3 ++-
.../app/pages/mock-login/mock-login.module.ts | 11 +++++++++-
.../models/api/deltagare.response.model.ts | 6 ++++++
.../src/app/shared/models/deltagare.model.ts | 12 ++++++++++-
.../shared/services/api/deltagare.service.ts | 20 ++++++++++++-------
7 files changed, 44 insertions(+), 18 deletions(-)
diff --git a/apps/dafa-web/src/app/pages/deltagare/deltagare.component.ts b/apps/dafa-web/src/app/pages/deltagare/deltagare.component.ts
index e7c323f..97cf3ca 100644
--- a/apps/dafa-web/src/app/pages/deltagare/deltagare.component.ts
+++ b/apps/dafa-web/src/app/pages/deltagare/deltagare.component.ts
@@ -1,5 +1,5 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
-import { Deltagare } from '@dafa-models/deltagare.model';
+import { DeltagareCompact } from '@dafa-models/deltagare.model';
import { DeltagareService } from '@dafa-services/api/deltagare.service';
import { Observable } from 'rxjs';
@@ -10,7 +10,7 @@ import { Observable } from 'rxjs';
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class DeltagareComponent {
- allDeltagare$: Observable = this.deltagareService.allDeltagare$;
+ allDeltagare$: Observable = this.deltagareService.allDeltagare$;
constructor(private deltagareService: DeltagareService) {}
}
diff --git a/apps/dafa-web/src/app/pages/deltagare/pages/deltagare-card/deltagare-card.module.ts b/apps/dafa-web/src/app/pages/deltagare/pages/deltagare-card/deltagare-card.module.ts
index 664a0c7..7c5aad7 100644
--- a/apps/dafa-web/src/app/pages/deltagare/pages/deltagare-card/deltagare-card.module.ts
+++ b/apps/dafa-web/src/app/pages/deltagare/pages/deltagare-card/deltagare-card.module.ts
@@ -1,7 +1,5 @@
import { DigiNgLayoutExpansionPanelModule } from '@af/digi-ng/_layout/layout-expansion-panel';
import { DigiNgLinkInternalModule } from '@af/digi-ng/_link/link-internal';
-import { DigiNgNavigationTabModule } from '@af/digi-ng/_navigation/navigation-tab';
-import { DigiNgNavigationTabsModule } from '@af/digi-ng/_navigation/navigation-tabs';
import { DigiNgPopoverModule } from '@af/digi-ng/_popover/popover';
import { DigiNgSkeletonBaseModule } from '@af/digi-ng/_skeleton/skeleton-base';
import { CommonModule } from '@angular/common';
@@ -11,7 +9,6 @@ import { BackLinkModule } from '@dafa-shared/components/back-link/back-link.modu
import { HideTextModule } from '@dafa-shared/components/hide-text/hide-text.module';
import { IconModule } from '@dafa-shared/components/icon/icon.module';
import { LayoutModule } from '@dafa-shared/components/layout/layout.module';
-import { LocalDatePipeModule } from '@dafa-shared/pipes/local-date/local-date.module';
import { DeltagareCardComponent } from './deltagare-card.component';
@NgModule({
@@ -24,10 +21,7 @@ import { DeltagareCardComponent } from './deltagare-card.component';
DigiNgLinkInternalModule,
IconModule,
BackLinkModule,
- DigiNgNavigationTabsModule,
- DigiNgNavigationTabModule,
DigiNgLayoutExpansionPanelModule,
- LocalDatePipeModule,
HideTextModule,
DigiNgSkeletonBaseModule,
DigiNgPopoverModule,
diff --git a/apps/dafa-web/src/app/pages/mock-login/mock-login.component.html b/apps/dafa-web/src/app/pages/mock-login/mock-login.component.html
index 39486d0..8d40584 100644
--- a/apps/dafa-web/src/app/pages/mock-login/mock-login.component.html
+++ b/apps/dafa-web/src/app/pages/mock-login/mock-login.component.html
@@ -5,7 +5,8 @@
Simulera att man loggar in och blir redirectad till startsidan med en Authorization-code som sedan används för att
hämta authentication-token:
-
+
+
Logga in med fullständiga rättigheter
diff --git a/apps/dafa-web/src/app/pages/mock-login/mock-login.module.ts b/apps/dafa-web/src/app/pages/mock-login/mock-login.module.ts
index 36416d6..4e537e4 100644
--- a/apps/dafa-web/src/app/pages/mock-login/mock-login.module.ts
+++ b/apps/dafa-web/src/app/pages/mock-login/mock-login.module.ts
@@ -7,6 +7,15 @@ import { MockLoginComponent } from './mock-login.component';
@NgModule({
schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [MockLoginComponent],
- imports: [CommonModule, RouterModule.forChild([{ path: '', component: MockLoginComponent }]), DigiNgButtonModule],
+ imports: [
+ CommonModule,
+ RouterModule.forChild([
+ {
+ path: '',
+ component: MockLoginComponent,
+ },
+ ]),
+ DigiNgButtonModule,
+ ],
})
export class MockLoginModule {}
diff --git a/apps/dafa-web/src/app/shared/models/api/deltagare.response.model.ts b/apps/dafa-web/src/app/shared/models/api/deltagare.response.model.ts
index 1d5cddd..e0fbac3 100644
--- a/apps/dafa-web/src/app/shared/models/api/deltagare.response.model.ts
+++ b/apps/dafa-web/src/app/shared/models/api/deltagare.response.model.ts
@@ -7,6 +7,12 @@ import { TranslatorResponse } from './translator.response.model';
import { WorkExperiencesResponse } from './work-experiences.response.model';
import { WorkLanguagesResponse } from './work-languages.response.model';
+export interface DeltagareCompactResponse {
+ sokandeId: string;
+ deltagare: string;
+ kommun: string;
+}
+
export interface DeltagareResponse {
id: string;
contact: ContactInformationResponse;
diff --git a/apps/dafa-web/src/app/shared/models/deltagare.model.ts b/apps/dafa-web/src/app/shared/models/deltagare.model.ts
index e5fe975..cc73748 100644
--- a/apps/dafa-web/src/app/shared/models/deltagare.model.ts
+++ b/apps/dafa-web/src/app/shared/models/deltagare.model.ts
@@ -1,5 +1,5 @@
import { Address } from './address.model';
-import { DeltagareResponse } from './api/deltagare.response.model';
+import { DeltagareCompactResponse, DeltagareResponse } from './api/deltagare.response.model';
import { mapResponseToContactInformation } from './contact-information.model';
import { Disability, mapResponseToDisability } from './disability.model';
import { DriversLicense, mapResponseToDriversLicense } from './drivers-license.model';
@@ -11,6 +11,7 @@ import { mapResponseToWorkExperience, WorkExperience } from './work-experience.m
export interface DeltagareCompact {
id: string;
fullName: string;
+ kommun?: string;
}
export interface Deltagare extends DeltagareCompact {
@@ -29,6 +30,15 @@ export interface Deltagare extends DeltagareCompact {
workExperiences: WorkExperience[];
}
+export function mapResponseToDeltagareCompact(data: DeltagareCompactResponse): DeltagareCompact {
+ const { sokandeId, deltagare, kommun } = data;
+ return {
+ id: sokandeId,
+ fullName: deltagare,
+ kommun,
+ };
+}
+
export function mapResponseToDeltagare(data: DeltagareResponse): Deltagare {
const {
id,
diff --git a/apps/dafa-web/src/app/shared/services/api/deltagare.service.ts b/apps/dafa-web/src/app/shared/services/api/deltagare.service.ts
index 3667a8d..5ea57cd 100644
--- a/apps/dafa-web/src/app/shared/services/api/deltagare.service.ts
+++ b/apps/dafa-web/src/app/shared/services/api/deltagare.service.ts
@@ -2,7 +2,7 @@ import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { environment } from '@dafa-environment';
import { ContactInformationResponse } from '@dafa-models/api/contact-information.response.model';
-import { DeltagareResponse } from '@dafa-models/api/deltagare.response.model';
+import { DeltagareCompactResponse } from '@dafa-models/api/deltagare.response.model';
import { DisabilityResponse } from '@dafa-models/api/disability.response.model';
import { DriversLicenseResponse } from '@dafa-models/api/drivers-license.response.model';
import { EducationsResponse } from '@dafa-models/api/educations.response.model';
@@ -11,7 +11,7 @@ import { TranslatorResponse } from '@dafa-models/api/translator.response.model';
import { WorkExperiencesResponse } from '@dafa-models/api/work-experiences.response.model';
import { WorkLanguagesResponse } from '@dafa-models/api/work-languages.response.model';
import { ContactInformation, mapResponseToContactInformation } from '@dafa-models/contact-information.model';
-import { Deltagare, DeltagareCompact, mapResponseToDeltagare } from '@dafa-models/deltagare.model';
+import { Deltagare, DeltagareCompact, mapResponseToDeltagareCompact } from '@dafa-models/deltagare.model';
import { Disability, mapResponseToDisability } from '@dafa-models/disability.model';
import { DriversLicense, mapResponseToDriversLicense } from '@dafa-models/drivers-license.model';
import { Education, mapResponseToEducation } from '@dafa-models/education.model';
@@ -27,13 +27,19 @@ const API_HEADERS = { headers: environment.api.headers };
})
export class DeltagareService {
private _apiBaseUrl = `${environment.api.url}/customerinfo`;
+ private _apiAvropUrl = `${environment.api.url}/avrop`;
- private _fetchAllDeltagare: Observable = this.httpClient
- .get<{ data: DeltagareResponse[] }>(`${this._apiBaseUrl}`, { ...API_HEADERS })
- .pipe(map(response => response.data));
+ // private _fetchAllDeltagare: Observable = this.httpClient
+ // .get<{ data: DeltagareCompactResponse[] }>(`${this._apiAvropUrl}`, { ...API_HEADERS })
+ // .pipe(map(response => response.data));
- public allDeltagare$: Observable = this._fetchAllDeltagare.pipe(
- map(data => data.map(deltagare => mapResponseToDeltagare(deltagare)))
+ private _fetchAllDeltagare: Observable = this.httpClient.get(
+ `${this._apiAvropUrl}`,
+ { ...API_HEADERS }
+ );
+
+ public allDeltagare$: Observable = this._fetchAllDeltagare.pipe(
+ map(data => data.map(deltagare => mapResponseToDeltagareCompact(deltagare)))
);
private _fetchContactInformation$(id: string): Observable {