refactor(pega): Removed Pega references from the application (TV-242)

Squashed commit of the following:

commit f0af4736b6a196db9a1306ca8b355c62610905ee
Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se>
Date:   Thu Jun 3 06:32:21 2021 +0200

    Removed PEGA references from repository
This commit is contained in:
Erik Tiekstra
2021-06-04 09:23:55 +02:00
parent 61c3c2ff59
commit d91b3e6445
10 changed files with 15 additions and 173 deletions

View File

@@ -12,9 +12,9 @@ To get started, clone the repository and run `npm install` in the root of the pr
Run `npm start` for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files. Run `npm start` for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.
#### Pega #### Dotnet API
Run `npm run start:pega` to run against the Pega API. Run `npm run start:api` to run against the Dotnet API.
### Generate an application ### Generate an application
@@ -32,9 +32,9 @@ Run `npm run new-component my-component --project=my-app` to generate a new comp
Run `npm run build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. Run `npm run build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
#### Pega #### Dotnet API
Run `npm run build:pega` to build the project using the Pega API. Run `npm run build:api` to build the project using the Dotnet API.
### Running unit tests on DAFA-web ### Running unit tests on DAFA-web

View File

@@ -83,19 +83,11 @@
} }
] ]
}, },
"pega": { "api": {
"fileReplacements": [ "fileReplacements": [
{ {
"replace": "apps/dafa-web/src/environments/environment.ts", "replace": "apps/dafa-web/src/environments/environment.ts",
"with": "apps/dafa-web/src/environments/environment.pega.ts" "with": "apps/dafa-web/src/environments/environment.api.ts"
}
]
},
"dotnet": {
"fileReplacements": [
{
"replace": "apps/dafa-web/src/environments/environment.ts",
"with": "apps/dafa-web/src/environments/environment.dotnet.ts"
} }
] ]
} }
@@ -111,12 +103,9 @@
"production": { "production": {
"browserTarget": "dafa-web:build:production" "browserTarget": "dafa-web:build:production"
}, },
"pega": { "api": {
"browserTarget": "dafa-web:build:pega" "proxyConfig": "./config/proxy.conf.api.json",
}, "browserTarget": "dafa-web:build:api"
"dotnet": {
"proxyConfig": "./config/proxy.conf.dotnet.json",
"browserTarget": "dafa-web:build:dotnet"
} }
} }
}, },

View File

@@ -3,26 +3,4 @@ export enum Authorization {
Economy = 'Economy', Economy = 'Economy',
Reports = 'Reports', Reports = 'Reports',
ParticipantManagement = 'ParticipantManagement', ParticipantManagement = 'ParticipantManagement',
User = 'User',
}
export enum PegaAuthorization {
Users = 'MeetTest:Users',
Administrators = 'MeetTest:Administrators',
}
export function mapPegaAuthorizationToAuthorization(pegaAuthorization: PegaAuthorization): Authorization[] {
const authorizations: Authorization[] = [];
switch (pegaAuthorization) {
case PegaAuthorization.Users:
authorizations.push(Authorization.User);
break;
case PegaAuthorization.Administrators:
authorizations.push(Authorization.UserManagement);
break;
default:
break;
}
return authorizations;
} }

View File

@@ -17,86 +17,10 @@ export interface EmployeeApiResponse extends UserApiResponse {
// eslint-disable-next-line @typescript-eslint/no-empty-interface // eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface EmployeeApiRequestData extends Employee {} export interface EmployeeApiRequestData extends Employee {}
export interface PegaEmployeesApiResponse {
pxMore: string;
pxObjClass: string;
pxPageCount: string;
pxQueryTimeStamp: string;
pxResultCount: string;
pxTotalResultCount: string;
pyMaxRecords: string;
pyObjClass: string;
pxResults: PegaEmployeeApiResponse[];
pzPerformanceSettings: string[];
}
export interface PegaEmployeeApiResponse {
pxInsHandle: string;
pxObjClass: string;
pyAccessGroup: string;
pyFirstName: string;
pyLastName: string;
pyOrganization: string;
pyOrgDivision: string;
pyOrgUnit: string;
pyUserIdentifier: string;
pyUserName: string;
}
export interface PegaEmployeeApiRequestData {
pyFirstName: string;
pyLastName: string;
}
export interface PegaEmployeeApiPostResponse {
pxObjClass: string;
pyErrorMessage: string;
pyFirstName: string;
pyHasError: 'true' | 'false';
pyLastName: string;
pyUserIdentifier: string;
}
export function mapEmployeeToEmployeeApiRequestData(data: Employee): EmployeeApiRequestData { export function mapEmployeeToEmployeeApiRequestData(data: Employee): EmployeeApiRequestData {
return data; return data;
} }
export function mapEmployeeToPegaEmployeeApiRequestData(data: Employee): PegaEmployeeApiRequestData {
return {
pyFirstName: data.firstName,
pyLastName: data.lastName,
};
}
export function mapPegaEmployeeReponseToEmployee(data: PegaEmployeeApiResponse): Employee {
return {
id: data.pyUserIdentifier,
lastName: data.pyLastName,
firstName: data.pyFirstName,
fullName: `${data.pyFirstName} ${data.pyLastName}`,
organizations: [
{
id: '',
name: data.pyOrganization,
kaNumber: null,
address: {
street: null,
houseNumber: null,
postalCode: null,
city: null,
kommun: null,
},
},
],
authorizations: null,
// authorizations: mapPegaAuthorizationToAuthorization(data.pyAccessGroup as PegaAuthorization),
services: [],
languages: [],
ssn: '',
participants: [],
};
}
export function mapEmployeeReponseToEmployee(data: EmployeeApiResponse): Employee { export function mapEmployeeReponseToEmployee(data: EmployeeApiResponse): Employee {
const { id, firstName, lastName, ssn, services, languages, organizations, authorizations, participants } = data; const { id, firstName, lastName, ssn, services, languages, organizations, authorizations, participants } = data;
return { return {

View File

@@ -20,22 +20,6 @@ export interface UserApiResponse {
authorizations: Authorization[]; authorizations: Authorization[];
} }
export interface PegaUserApiResponse {
pxInsName: string;
pxLimitedAccess: string;
pxObjClass: string;
pyAccessGroup: string;
pyFirstName: string;
pyLastName: string;
pyLastSignon: string;
pyOrganization: string;
pyOrgDivision: string;
pyOrgUnit: string;
pyUserIdentifier: string;
pyUserName: string;
pyAccessGroupsAdditional: string[];
}
export function mapUserApiResponseToUser(data: UserApiResponse): User { export function mapUserApiResponseToUser(data: UserApiResponse): User {
const { id, firstName, lastName, ssn, organizations, authorizations } = data; const { id, firstName, lastName, ssn, organizations, authorizations } = data;
return { return {
@@ -48,29 +32,3 @@ export function mapUserApiResponseToUser(data: UserApiResponse): User {
authorizations, authorizations,
}; };
} }
export function mapPegaUserApiReponseToUser(data: PegaUserApiResponse): User {
return {
id: data.pyUserIdentifier,
lastName: data.pyLastName,
firstName: data.pyFirstName,
fullName: `${data.pyFirstName} ${data.pyLastName}`,
ssn: null,
organizations: [
{
id: '',
name: data.pyOrganization,
kaNumber: null,
address: {
street: null,
houseNumber: null,
postalCode: null,
city: null,
kommun: null,
},
},
],
authorizations: null,
// authorizations: mapPegaAuthorizationToAuthorization(data.pyAccessGroup as PegaAuthorization),
};
}

View File

@@ -7,7 +7,6 @@ import {
EmployeeApiResponse, EmployeeApiResponse,
mapEmployeeReponseToEmployee, mapEmployeeReponseToEmployee,
mapEmployeeToEmployeeApiRequestData, mapEmployeeToEmployeeApiRequestData,
PegaEmployeeApiPostResponse,
} from '@dafa-models/employee.model'; } from '@dafa-models/employee.model';
import { SortBy } from '@dafa-models/sort-by.model'; import { SortBy } from '@dafa-models/sort-by.model';
import { sort } from '@dafa-utils/sort.util'; import { sort } from '@dafa-utils/sort.util';
@@ -73,11 +72,7 @@ export class EmployeeService {
console.log(employeeData); console.log(employeeData);
return; return;
return this.httpClient return this.httpClient
.post<PegaEmployeeApiPostResponse>( .post<any>(this._employeeApiUrl, mapEmployeeToEmployeeApiRequestData(employeeData), API_HEADERS)
this._employeeApiUrl,
mapEmployeeToEmployeeApiRequestData(employeeData),
API_HEADERS
)
.pipe( .pipe(
map(data => { map(data => {
if (data.pyHasError === 'true') { if (data.pyHasError === 'true') {

View File

@@ -95,7 +95,7 @@ pipeline {
echo '### Building application... ###' echo '### Building application... ###'
sh ''' sh '''
npm run build:pega npm run build:api
cp -r nginx/* ${NGINX_PATH} cp -r nginx/* ${NGINX_PATH}
''' '''

View File

@@ -94,7 +94,7 @@ pipeline {
echo '### Building application... ###' echo '### Building application... ###'
sh ''' sh '''
npm run build:pega npm run build:api
cp -r nginx/* ${NGINX_PATH} cp -r nginx/* ${NGINX_PATH}
''' '''

View File

@@ -96,7 +96,7 @@ pipeline {
steps { steps {
echo '### Building application... ###' echo '### Building application... ###'
sh ''' sh '''
npm run build:pega -- --prod npm run build:api -- --prod
cp -r nginx/* ${NGINX_PATH} cp -r nginx/* ${NGINX_PATH}
''' '''
echo '### Application built! ###' echo '### Application built! ###'

View File

@@ -11,11 +11,9 @@
"postinstall": "node ./decorate-angular-cli.js && ngcc --properties es2015 browser module main", "postinstall": "node ./decorate-angular-cli.js && ngcc --properties es2015 browser module main",
"nx": "nx", "nx": "nx",
"start": "ng serve dafa-web", "start": "ng serve dafa-web",
"start:pega": "ng serve dafa-web --configuration pega", "start:api": "ng serve dafa-web --configuration api",
"start:dotnet": "ng serve dafa-web --configuration dotnet",
"build": "ng build dafa-web", "build": "ng build dafa-web",
"build:pega": "ng build dafa-web --configuration pega", "build:api": "ng build dafa-web --configuration api",
"build:dotnet": "ng build dafa-web --configuration dotnet",
"test": "ng test dafa-web", "test": "ng test dafa-web",
"release": "bash ./tools/release.sh", "release": "bash ./tools/release.sh",
"release:dry": "bash ./tools/release.sh dry", "release:dry": "bash ./tools/release.sh dry",