diff --git a/README.md b/README.md index 6f25da7..6c0c9dc 100644 --- a/README.md +++ b/README.md @@ -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. -#### 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 @@ -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. -#### 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 diff --git a/angular.json b/angular.json index 797545d..6cf75b3 100644 --- a/angular.json +++ b/angular.json @@ -83,19 +83,11 @@ } ] }, - "pega": { + "api": { "fileReplacements": [ { "replace": "apps/dafa-web/src/environments/environment.ts", - "with": "apps/dafa-web/src/environments/environment.pega.ts" - } - ] - }, - "dotnet": { - "fileReplacements": [ - { - "replace": "apps/dafa-web/src/environments/environment.ts", - "with": "apps/dafa-web/src/environments/environment.dotnet.ts" + "with": "apps/dafa-web/src/environments/environment.api.ts" } ] } @@ -111,12 +103,9 @@ "production": { "browserTarget": "dafa-web:build:production" }, - "pega": { - "browserTarget": "dafa-web:build:pega" - }, - "dotnet": { - "proxyConfig": "./config/proxy.conf.dotnet.json", - "browserTarget": "dafa-web:build:dotnet" + "api": { + "proxyConfig": "./config/proxy.conf.api.json", + "browserTarget": "dafa-web:build:api" } } }, diff --git a/apps/dafa-web/src/app/data/enums/authorization.enum.ts b/apps/dafa-web/src/app/data/enums/authorization.enum.ts index d57c73d..b5cdfe7 100644 --- a/apps/dafa-web/src/app/data/enums/authorization.enum.ts +++ b/apps/dafa-web/src/app/data/enums/authorization.enum.ts @@ -3,26 +3,4 @@ export enum Authorization { Economy = 'Economy', Reports = 'Reports', 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; } diff --git a/apps/dafa-web/src/app/data/models/employee.model.ts b/apps/dafa-web/src/app/data/models/employee.model.ts index 136f0f4..16681bb 100644 --- a/apps/dafa-web/src/app/data/models/employee.model.ts +++ b/apps/dafa-web/src/app/data/models/employee.model.ts @@ -17,86 +17,10 @@ export interface EmployeeApiResponse extends UserApiResponse { // eslint-disable-next-line @typescript-eslint/no-empty-interface 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 { 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 { const { id, firstName, lastName, ssn, services, languages, organizations, authorizations, participants } = data; return { diff --git a/apps/dafa-web/src/app/data/models/user.model.ts b/apps/dafa-web/src/app/data/models/user.model.ts index ccd6f4c..9cc4d49 100644 --- a/apps/dafa-web/src/app/data/models/user.model.ts +++ b/apps/dafa-web/src/app/data/models/user.model.ts @@ -20,22 +20,6 @@ export interface UserApiResponse { 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 { const { id, firstName, lastName, ssn, organizations, authorizations } = data; return { @@ -48,29 +32,3 @@ export function mapUserApiResponseToUser(data: UserApiResponse): User { 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), - }; -} diff --git a/apps/dafa-web/src/app/services/api/employee.service.ts b/apps/dafa-web/src/app/services/api/employee.service.ts index 36b0ff2..e29c6e7 100644 --- a/apps/dafa-web/src/app/services/api/employee.service.ts +++ b/apps/dafa-web/src/app/services/api/employee.service.ts @@ -7,7 +7,6 @@ import { EmployeeApiResponse, mapEmployeeReponseToEmployee, mapEmployeeToEmployeeApiRequestData, - PegaEmployeeApiPostResponse, } from '@dafa-models/employee.model'; import { SortBy } from '@dafa-models/sort-by.model'; import { sort } from '@dafa-utils/sort.util'; @@ -73,11 +72,7 @@ export class EmployeeService { console.log(employeeData); return; return this.httpClient - .post( - this._employeeApiUrl, - mapEmployeeToEmployeeApiRequestData(employeeData), - API_HEADERS - ) + .post(this._employeeApiUrl, mapEmployeeToEmployeeApiRequestData(employeeData), API_HEADERS) .pipe( map(data => { if (data.pyHasError === 'true') { diff --git a/openshift/dev/Jenkinsfile b/openshift/dev/Jenkinsfile index 6ff1f9e..c994c63 100644 --- a/openshift/dev/Jenkinsfile +++ b/openshift/dev/Jenkinsfile @@ -95,7 +95,7 @@ pipeline { echo '### Building application... ###' sh ''' - npm run build:pega + npm run build:api cp -r nginx/* ${NGINX_PATH} ''' diff --git a/openshift/next/Jenkinsfile b/openshift/next/Jenkinsfile index 54d9bd4..ef96a26 100644 --- a/openshift/next/Jenkinsfile +++ b/openshift/next/Jenkinsfile @@ -94,7 +94,7 @@ pipeline { echo '### Building application... ###' sh ''' - npm run build:pega + npm run build:api cp -r nginx/* ${NGINX_PATH} ''' diff --git a/openshift/prod/Jenkinsfile b/openshift/prod/Jenkinsfile index ffc4fe2..c65d2e7 100644 --- a/openshift/prod/Jenkinsfile +++ b/openshift/prod/Jenkinsfile @@ -96,7 +96,7 @@ pipeline { steps { echo '### Building application... ###' sh ''' - npm run build:pega -- --prod + npm run build:api -- --prod cp -r nginx/* ${NGINX_PATH} ''' echo '### Application built! ###' diff --git a/package.json b/package.json index c0d093d..e33f9c5 100644 --- a/package.json +++ b/package.json @@ -11,11 +11,9 @@ "postinstall": "node ./decorate-angular-cli.js && ngcc --properties es2015 browser module main", "nx": "nx", "start": "ng serve dafa-web", - "start:pega": "ng serve dafa-web --configuration pega", - "start:dotnet": "ng serve dafa-web --configuration dotnet", + "start:api": "ng serve dafa-web --configuration api", "build": "ng build dafa-web", - "build:pega": "ng build dafa-web --configuration pega", - "build:dotnet": "ng build dafa-web --configuration dotnet", + "build:api": "ng build dafa-web --configuration api", "test": "ng test dafa-web", "release": "bash ./tools/release.sh", "release:dry": "bash ./tools/release.sh dry",