feat(deltagare): Fetching data from avrop to show list of deltagare.

Squashed commit of the following:

commit d1f44901caa22422c8398ab199f1cf2f6f6d6f1a
Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se>
Date:   Tue Aug 3 13:40:29 2021 +0200

    Fixed some more conflicts

commit 78678aa266fa319d9542c19ff5a09726ca7e2315
Merge: 7d27c3a 1d69b4b
Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se>
Date:   Tue Aug 3 13:29:16 2021 +0200

    Merged develop and fixed conflicts

commit 7d27c3a8239feebe2b2e3209d5bd0e1d1aa805de
Author: panpe <perham.panbehchi@arbetsformedlingen.se>
Date:   Wed Jul 28 16:15:09 2021 +0200

    fixed small path issue.

commit 259e45487b988c66ebee34bf59659b24390ca083
Author: panpe <perham.panbehchi@arbetsformedlingen.se>
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 <perham.panbehchi@arbetsformedlingen.se>
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 <cecilia.varnava@arbetsformedlingen.se>
Date:   Mon Jul 12 01:12:35 2021 +0200

    TV-269 wip

commit 5e7252d0dbe33ca3aca0e2e82860fa5b799745cc
Author: Cecilia Varnava <cecilia.varnava@arbetsformedlingen.se>
Date:   Mon Jul 12 01:03:47 2021 +0200

    TV-269 Deltagare - mocked workexperiences

commit f50fa65e2e297f7f551be53a2c181983b53119e4
Author: Cecilia Varnava <cecilia.varnava@arbetsformedlingen.se>
Date:   Thu Jul 8 11:15:47 2021 +0200

    TV-269 added tabs style and deltagare data
This commit is contained in:
Erik Tiekstra
2021-08-03 13:45:21 +02:00
parent 1d69b4b013
commit 4fc23530ef
7 changed files with 44 additions and 18 deletions

View File

@@ -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<Deltagare[]> = this.deltagareService.allDeltagare$;
allDeltagare$: Observable<DeltagareCompact[]> = this.deltagareService.allDeltagare$;
constructor(private deltagareService: DeltagareService) {}
}

View File

@@ -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,

View File

@@ -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:
</p>
<digi-ng-button routerLink="/" [queryParams]="{ code: 'auth_code_from_CIAM_with_all_permissions' }">
<digi-ng-button routerLink="/" [queryParams]="{ code: 'auth_code_from_CIAM_with_all_permissions'}">
Logga in med fullständiga rättigheter
</digi-ng-button>
</section>

View File

@@ -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 {}

View File

@@ -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;

View File

@@ -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,

View File

@@ -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<DeltagareResponse[]> = this.httpClient
.get<{ data: DeltagareResponse[] }>(`${this._apiBaseUrl}`, { ...API_HEADERS })
.pipe(map(response => response.data));
// private _fetchAllDeltagare: Observable<DeltagareCompactResponse[]> = this.httpClient
// .get<{ data: DeltagareCompactResponse[] }>(`${this._apiAvropUrl}`, { ...API_HEADERS })
// .pipe(map(response => response.data));
public allDeltagare$: Observable<Deltagare[]> = this._fetchAllDeltagare.pipe(
map(data => data.map(deltagare => mapResponseToDeltagare(deltagare)))
private _fetchAllDeltagare: Observable<DeltagareCompactResponse[]> = this.httpClient.get<DeltagareCompactResponse[]>(
`${this._apiAvropUrl}`,
{ ...API_HEADERS }
);
public allDeltagare$: Observable<DeltagareCompact[]> = this._fetchAllDeltagare.pipe(
map(data => data.map(deltagare => mapResponseToDeltagareCompact(deltagare)))
);
private _fetchContactInformation$(id: string): Observable<ContactInformation> {