Merge pull request 'Bugfix for Heidemanns API Doc' (#13) from bugfix/api into trunk
All checks were successful
Quality Check / Linting (push) Successful in 23s
Quality Check / Linting (pull_request) Successful in 22s

Reviewed-on: #13
This commit is contained in:
Dominik Säume 2025-01-09 09:18:25 +00:00 committed by Euph Forge
commit deadd4bf4b
Signed by: Euph Forge
GPG key ID: 85A06461FB6BDBB7
4 changed files with 495 additions and 528 deletions

View file

@ -1,7 +1,9 @@
import {Injectable} from '@angular/core'; import { Injectable } from '@angular/core';
import UserData from '@core/auth/UserData'; import UserData from '@core/auth/UserData';
import {OidcSecurityService} from 'angular-auth-oidc-client'; import { OidcSecurityService } from 'angular-auth-oidc-client';
import {Observable} from 'rxjs'; import { Observable } from 'rxjs';
import { OpenAPI } from '../ems';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
@ -11,13 +13,14 @@ export class AuthService {
constructor(private readonly oidcSecurityService: OidcSecurityService) { constructor(private readonly oidcSecurityService: OidcSecurityService) {
this.$user = new Observable((publish) => { this.$user = new Observable((publish) => {
this.oidcSecurityService.checkAuth().subscribe(({isAuthenticated, userData}) => { this.oidcSecurityService.checkAuth().subscribe(({ isAuthenticated, userData }) => {
publish.next(isAuthenticated ? { publish.next(isAuthenticated ? {
username: userData.preferred_username, username: userData.preferred_username,
verified: userData.email_verified verified: userData.email_verified
} : undefined); } : undefined);
}); });
}); });
this.oidcSecurityService.getAccessToken().subscribe(token => OpenAPI.TOKEN = token);
} }
@ -26,7 +29,7 @@ export class AuthService {
} }
logout() { logout() {
this.oidcSecurityService.logoff(); this.oidcSecurityService.logoff().subscribe(() => { });
} }
} }

View file

@ -1,24 +1,66 @@
openapi: 3.0.1 openapi: 3.0.1
info: info:
title: Employees Management Micro-Service title: Employees Management Micro-Service
description: "\n## Overview\n\nEmployees Management Service API manages the employees\ description: "## Overview \n
\ of HighTec Gmbh including their qualifications. It offers the possibility to\ \ Employees Management Service API manages the employees <br>
\ create, read, update and delete employees and qualifications. Existing employees\ \ of HighTec Gmbh including their qualifications. It offers the possibility to <br>
\ can be assigned new qualifications or have them withdrawn. \nThe API is organized\ \ create, read, update and delete employees and qualifications. Existing employees <br>
\ around REST. It has predictable resource-oriented URLs, accepts JSON-encoded\ \ can be assigned new qualifications or have them withdrawn. <br>
\ request bodies, returns JSON-encoded responses, uses standard HTTP response\ \ The API is organized <br>
\ codes and authentication.\n" \ around REST. It has predictable resource-oriented URLs, accepts JSON-encoded <br>
\ request bodies, returns JSON-encoded responses, uses standard HTTP response <br>
\ codes and authentication."
version: 1.1.2 version: 1.1.2
servers: servers:
- url: "" - url: ""
security: security:
- bearerAuth: [] - bearerAuth: []
paths: paths:
/qualifications:
get:
tags:
- qualification
summary: Get a list of all available qualifications
operationId: getAllQualifications
responses:
"401":
description: not authorized
"200":
description: list of qualifications
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Qualification'
post:
tags:
- qualification
summary: Creates a new qualification
operationId: createQualification
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/NewQualification'
required: true
responses:
"201":
description: created qualification
content:
application/json:
schema:
$ref: '#/components/schemas/Qualification'
"401":
description: not authorized
"400":
description: invalid JSON posted
/qualifications/{id}: /qualifications/{id}:
put: put:
tags: tags:
- qualification-controller - qualification
summary: updates a qualification summary: Updates a qualification
operationId: updateQualification operationId: updateQualification
parameters: parameters:
- name: id - name: id
@ -31,7 +73,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/QualificationPostDTO' $ref: '#/components/schemas/NewQualification'
required: true required: true
responses: responses:
"200": "200":
@ -39,7 +81,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/QualificationPostDTO' $ref: '#/components/schemas/Qualification'
"401": "401":
description: not authorized description: not authorized
"404": "404":
@ -48,9 +90,9 @@ paths:
description: invalid JSON posted description: invalid JSON posted
delete: delete:
tags: tags:
- qualification-controller - qualification
summary: deletes a qualification by id summary: Deletes a qualification
operationId: deleteQualificationByDesignation operationId: deleteQualification
parameters: parameters:
- name: id - name: id
in: path in: path
@ -67,12 +109,13 @@ paths:
description: delete successful description: delete successful
"403": "403":
description: qualification is in use description: qualification is in use
/employees/{id}:
/qualifications/{id}/employees:
get: get:
tags: tags:
- employee-controller - qualification
summary: find employee by id summary: Get all employees with a specific qualification
operationId: findById operationId: getAllQualificationEmployees
parameters: parameters:
- name: id - name: id
in: path in: path
@ -81,50 +124,86 @@ paths:
type: integer type: integer
format: int64 format: int64
responses: responses:
"401":
description: not authorized
"200": "200":
description: employee description: List of employees who have the desired qualification
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/EmployeeResponseDTO' $ref: '#/components/schemas/QualificationEmployees'
"404":
description: qualification id does not exist
/employees:
get:
tags:
- employee
summary: Get a list of all available employees
operationId: getAllEmployees
responses:
"401": "401":
description: not authorized description: not authorized
"404": "200":
description: resource not found description: list of employees
put: content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Employee'
post:
tags: tags:
- employee-controller - employee
summary: updates employee by id summary: Creates a new employee
operationId: updateEmployee operationId: createEmployee
parameters:
- name: id
in: path
required: true
schema:
type: integer
format: int64
requestBody: requestBody:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/EmployeeRequestPutDTO' $ref: '#/components/schemas/NewEmployee'
required: true required: true
responses:
"401":
description: not authorized
"201":
description: created employee
content:
application/json:
schema:
$ref: '#/components/schemas/Employee'
"400":
description: invalid JSON posted
/employees/{id}:
get:
tags:
- employee
summary: Gets a specific employee
operationId: getEmployee
parameters:
- name: id
in: path
required: true
schema:
type: integer
format: int64
responses: responses:
"200": "200":
description: employee description: employee
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/EmployeeResponseDTO' $ref: '#/components/schemas/Employee'
"401": "401":
description: not authorized description: not authorized
"404": "404":
description: resource not found description: resource not found
delete: delete:
tags: tags:
- employee-controller - employee
summary: deletes a employee by id summary: Deletes a specific employee
operationId: deleteCustomer operationId: DeleteEmployee
parameters: parameters:
- name: id - name: id
in: path in: path
@ -141,9 +220,9 @@ paths:
description: delete successful description: delete successful
patch: patch:
tags: tags:
- employee-controller - employee
summary: updates employee by id summary: Updates a employee
operationId: patchEmployee operationId: updateEmployee
parameters: parameters:
- name: id - name: id
in: path in: path
@ -155,7 +234,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/EmployeeRequestPutDTO' $ref: '#/components/schemas/UpdatedEmployee'
required: true required: true
responses: responses:
"200": "200":
@ -163,93 +242,18 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/EmployeeResponseDTO' $ref: '#/components/schemas/Employee'
"401": "401":
description: not authorized description: not authorized
"404": "404":
description: resource not found description: resource not found
/qualifications:
get:
tags:
- qualification-controller
summary: delivers a list of all available qualifications
operationId: findAll
responses:
"401":
description: not authorized
"200":
description: list of qualifications
content:
application/json:
schema:
$ref: '#/components/schemas/QualificationGetDTO'
post:
tags:
- qualification-controller
summary: creates a new qualification with its id and designation
operationId: createQualification
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/QualificationPostDTO'
required: true
responses:
"201":
description: created qualification
content:
application/json:
schema:
$ref: '#/components/schemas/QualificationPostDTO'
"401":
description: not authorized
"400":
description: invalid JSON posted
/employees:
get:
tags:
- employee-controller
summary: delivers a list of all employees
operationId: findAll_1
responses:
"401":
description: not authorized
"200":
description: list of employees
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/EmployeeResponseDTO'
post:
tags:
- employee-controller
summary: creates a new employee
operationId: createEmployee
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/EmployeeRequestDTO'
required: true
responses:
"401":
description: not authorized
"201":
description: created employee
content:
application/json:
schema:
$ref: '#/components/schemas/EmployeeResponseDTO'
"400":
description: invalid JSON posted
/employees/{id}/qualifications: /employees/{id}/qualifications:
get: get:
tags: tags:
- employee-controller - employee
summary: finds all qualifications of an employee by id summary: Gets all qualifications of a specific employee
operationId: findAllQualificationOfAEmployeeById operationId: getAllEmployeeQualifications
parameters: parameters:
- name: id - name: id
in: path in: path
@ -267,12 +271,12 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/EmployeeNameAndSkillDataDTO' $ref: '#/components/schemas/EmployeeQualifications'
post: post:
tags: tags:
- employee-controller - employee
summary: adds a qualification to an employee by id summary: Adds a qualification to an employee
operationId: addQualificationToEmployeeById operationId: addQualificationToEmployee
parameters: parameters:
- name: id - name: id
in: path in: path
@ -284,7 +288,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/QualificationPostDTO' $ref: '#/components/schemas/NewQualification' # Nobody knows why Heidemann did this.
required: true required: true
responses: responses:
"401": "401":
@ -298,45 +302,23 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/EmployeeNameAndSkillDataDTO' $ref: '#/components/schemas/EmployeeQualifications'
/qualifications/{id}/employees:
get:
tags: /employees/{employeeId}/qualifications/{qualificationId}:
- qualification-controller
summary: find employees by qualification id
operationId: findAllEmployeesByQualification
parameters:
- name: id
in: path
required: true
schema:
type: integer
format: int64
responses:
"401":
description: not authorized
"200":
description: List of employees who have the desired qualification
content:
application/json:
schema:
$ref: '#/components/schemas/EmployeesForAQualificationDTO'
"404":
description: qualification id does not exist
/employees/{eid}/qualifications/{qid}:
delete: delete:
tags: tags:
- employee-controller - employee
summary: deletes a qualification of an employee by id summary: Removes a qualification from an employee
operationId: removeQualificationFromEmployee operationId: removeQualificationFromEmployee
parameters: parameters:
- name: eid - name: employeeId
in: path in: path
required: true required: true
schema: schema:
type: integer type: integer
format: int64 format: int64
- name: qid - name: qualificationId
in: path in: path
required: true required: true
schema: schema:
@ -352,142 +334,155 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/EmployeeNameAndSkillDataDTO' $ref: '#/components/schemas/EmployeeQualifications'
components: components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
schemas: schemas:
QualificationPostDTO: Qualification:
type: object
properties:
id:
type: integer
format: int64
skill:
type: string
required:
- id
- skill
NewQualification:
type: object
properties:
skill:
type: string
required: required:
- skill - skill
type: object QualificationEmployees:
properties:
skill:
type: string
EmployeeRequestPutDTO:
type: object
properties:
lastName:
type: string
firstName:
type: string
street:
type: string
postcode:
type: string
city:
type: string
phone:
type: string
skillSet:
type: array
items:
type: integer
format: int64
EmployeeResponseDTO:
required:
- city
- firstName
- lastName
- phone
- postcode
- street
type: object
properties:
id:
type: integer
format: int64
lastName:
type: string
firstName:
type: string
street:
type: string
postcode:
maxLength: 5
minLength: 5
type: string
city:
type: string
phone:
type: string
skillSet:
type: array
items:
$ref: '#/components/schemas/QualificationGetDTO'
QualificationGetDTO:
type: object
properties:
skill:
type: string
id:
type: integer
format: int64
EmployeeRequestDTO:
required:
- city
- firstName
- lastName
- phone
- postcode
- street
type: object
properties:
lastName:
type: string
firstName:
type: string
street:
type: string
postcode:
maxLength: 5
minLength: 5
type: string
city:
type: string
phone:
type: string
skillSet:
type: array
items:
type: integer
format: int64
EmployeeNameAndSkillDataDTO:
type: object
properties:
id:
type: integer
format: int64
lastName:
type: string
firstName:
type: string
skillSet:
uniqueItems: true
type: array
items:
$ref: '#/components/schemas/QualificationGetDTO'
EmployeeNameDataDTO:
type: object
properties:
id:
type: integer
format: int64
lastName:
type: string
firstName:
type: string
EmployeesForAQualificationDTO:
type: object type: object
properties: properties:
qualification: qualification:
$ref: '#/components/schemas/QualificationGetDTO' $ref: '#/components/schemas/Qualification'
employees: employees:
uniqueItems: true uniqueItems: true
type: array type: array
items: items:
$ref: '#/components/schemas/EmployeeNameDataDTO' $ref: '#/components/schemas/QualificationEmployee'
securitySchemes: required:
bearerAuth: - qualification
type: http - employees
name: bearerAuth QualificationEmployee:
scheme: bearer type: object
bearerFormat: JWT properties:
id:
type: integer
format: int64
lastName:
type: string
firstName:
type: string
required:
- id
- lastName
- firstName
Employee:
type: object
properties:
id:
type: integer
format: int64
firstName:
type: string
lastName:
type: string
postcode:
maxLength: 5
minLength: 5
type: string
city:
type: string
street:
type: string
phone:
type: string
skillSet:
type: array
items:
$ref: '#/components/schemas/Qualification'
required:
- id
- firstName
- lastName
- postcode
- city
- street
- phone
- skillSet
NewEmployee:
type: object
properties:
lastName:
type: string
firstName:
type: string
street:
type: string
postcode:
maxLength: 5
minLength: 5
type: string
city:
type: string
phone:
type: string
skillSet:
type: array
items:
type: integer
format: int64
required:
- firstName
- lastName
- postcode
- city
- street
- phone
- skillSet
UpdatedEmployee:
type: object
properties:
lastName:
type: string
firstName:
type: string
street:
type: string
postcode:
type: string
city:
type: string
phone:
type: string
skillSet:
type: array
items:
type: integer
format: int64
EmployeeQualifications:
type: object
properties:
id:
type: integer
format: int64
lastName:
type: string
firstName:
type: string
skillSet:
uniqueItems: true
type: array
items:
$ref: '#/components/schemas/Qualification'

View file

@ -5,20 +5,55 @@ import { HttpClient } from '@angular/common/http';
import type { Observable } from 'rxjs'; import type { Observable } from 'rxjs';
import { OpenAPI } from './core/OpenAPI'; import { OpenAPI } from './core/OpenAPI';
import { request as __request } from './core/request'; import { request as __request } from './core/request';
import type { UpdateQualificationData, UpdateQualificationResponse, DeleteQualificationByDesignationData, DeleteQualificationByDesignationResponse, FindAllResponse, CreateQualificationData, CreateQualificationResponse, FindAllEmployeesByQualificationData, FindAllEmployeesByQualificationResponse, FindByIdData, FindByIdResponse, UpdateEmployeeData, UpdateEmployeeResponse, DeleteCustomerData, DeleteCustomerResponse, PatchEmployeeData, PatchEmployeeResponse, FindAll1Response, CreateEmployeeData, CreateEmployeeResponse, FindAllQualificationOfAemployeeByIdData, FindAllQualificationOfAemployeeByIdResponse, AddQualificationToEmployeeByIdData, AddQualificationToEmployeeByIdResponse, RemoveQualificationFromEmployeeData, RemoveQualificationFromEmployeeResponse } from './types.gen'; import type { GetAllQualificationsResponse, CreateQualificationData, CreateQualificationResponse, UpdateQualificationData, UpdateQualificationResponse, DeleteQualificationData, DeleteQualificationResponse, GetAllQualificationEmployeesData, GetAllQualificationEmployeesResponse, GetAllEmployeesResponse, CreateEmployeeData, CreateEmployeeResponse, GetEmployeeData, GetEmployeeResponse, DeleteEmployeeData, DeleteEmployeeResponse, UpdateEmployeeData, UpdateEmployeeResponse, GetAllEmployeeQualificationsData, GetAllEmployeeQualificationsResponse, AddQualificationToEmployeeData, AddQualificationToEmployeeResponse, RemoveQualificationFromEmployeeData, RemoveQualificationFromEmployeeResponse } from './types.gen';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class QualificationControllerService { export class QualificationService {
constructor(public readonly http: HttpClient) { } constructor(public readonly http: HttpClient) { }
/** /**
* updates a qualification * Get a list of all available qualifications
* @returns Qualification list of qualifications
* @throws ApiError
*/
public getAllQualifications(): Observable<GetAllQualificationsResponse> {
return __request(OpenAPI, this.http, {
method: 'GET',
url: '/qualifications',
errors: {
401: 'not authorized'
}
});
}
/**
* Creates a new qualification
* @param data The data for the request.
* @param data.requestBody
* @returns Qualification created qualification
* @throws ApiError
*/
public createQualification(data: CreateQualificationData): Observable<CreateQualificationResponse> {
return __request(OpenAPI, this.http, {
method: 'POST',
url: '/qualifications',
body: data.requestBody,
mediaType: 'application/json',
errors: {
400: 'invalid JSON posted',
401: 'not authorized'
}
});
}
/**
* Updates a qualification
* @param data The data for the request. * @param data The data for the request.
* @param data.id * @param data.id
* @param data.requestBody * @param data.requestBody
* @returns QualificationPostDTO updated qualification * @returns Qualification updated qualification
* @throws ApiError * @throws ApiError
*/ */
public updateQualification(data: UpdateQualificationData): Observable<UpdateQualificationResponse> { public updateQualification(data: UpdateQualificationData): Observable<UpdateQualificationResponse> {
@ -39,13 +74,13 @@ export class QualificationControllerService {
} }
/** /**
* deletes a qualification by id * Deletes a qualification
* @param data The data for the request. * @param data The data for the request.
* @param data.id * @param data.id
* @returns void delete successful * @returns void delete successful
* @throws ApiError * @throws ApiError
*/ */
public deleteQualificationByDesignation(data: DeleteQualificationByDesignationData): Observable<DeleteQualificationByDesignationResponse> { public deleteQualification(data: DeleteQualificationData): Observable<DeleteQualificationResponse> {
return __request(OpenAPI, this.http, { return __request(OpenAPI, this.http, {
method: 'DELETE', method: 'DELETE',
url: '/qualifications/{id}', url: '/qualifications/{id}',
@ -61,48 +96,13 @@ export class QualificationControllerService {
} }
/** /**
* delivers a list of all available qualifications * Get all employees with a specific qualification
* @returns QualificationGetDTO list of qualifications
* @throws ApiError
*/
public findAll(): Observable<FindAllResponse> {
return __request(OpenAPI, this.http, {
method: 'GET',
url: '/qualifications',
errors: {
401: 'not authorized'
}
});
}
/**
* creates a new qualification with its id and designation
* @param data The data for the request.
* @param data.requestBody
* @returns QualificationPostDTO created qualification
* @throws ApiError
*/
public createQualification(data: CreateQualificationData): Observable<CreateQualificationResponse> {
return __request(OpenAPI, this.http, {
method: 'POST',
url: '/qualifications',
body: data.requestBody,
mediaType: 'application/json',
errors: {
400: 'invalid JSON posted',
401: 'not authorized'
}
});
}
/**
* find employees by qualification id
* @param data The data for the request. * @param data The data for the request.
* @param data.id * @param data.id
* @returns EmployeesForAQualificationDTO List of employees who have the desired qualification * @returns QualificationEmployees List of employees who have the desired qualification
* @throws ApiError * @throws ApiError
*/ */
public findAllEmployeesByQualification(data: FindAllEmployeesByQualificationData): Observable<FindAllEmployeesByQualificationResponse> { public getAllQualificationEmployees(data: GetAllQualificationEmployeesData): Observable<GetAllQualificationEmployeesResponse> {
return __request(OpenAPI, this.http, { return __request(OpenAPI, this.http, {
method: 'GET', method: 'GET',
url: '/qualifications/{id}/employees', url: '/qualifications/{id}/employees',
@ -121,105 +121,15 @@ export class QualificationControllerService {
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class EmployeeControllerService { export class EmployeeService {
constructor(public readonly http: HttpClient) { } constructor(public readonly http: HttpClient) { }
/** /**
* find employee by id * Get a list of all available employees
* @param data The data for the request. * @returns Employee list of employees
* @param data.id
* @returns EmployeeResponseDTO employee
* @throws ApiError * @throws ApiError
*/ */
public findById(data: FindByIdData): Observable<FindByIdResponse> { public getAllEmployees(): Observable<GetAllEmployeesResponse> {
return __request(OpenAPI, this.http, {
method: 'GET',
url: '/employees/{id}',
path: {
id: data.id
},
errors: {
401: 'not authorized',
404: 'resource not found'
}
});
}
/**
* updates employee by id
* @param data The data for the request.
* @param data.id
* @param data.requestBody
* @returns EmployeeResponseDTO employee
* @throws ApiError
*/
public updateEmployee(data: UpdateEmployeeData): Observable<UpdateEmployeeResponse> {
return __request(OpenAPI, this.http, {
method: 'PUT',
url: '/employees/{id}',
path: {
id: data.id
},
body: data.requestBody,
mediaType: 'application/json',
errors: {
401: 'not authorized',
404: 'resource not found'
}
});
}
/**
* deletes a employee by id
* @param data The data for the request.
* @param data.id
* @returns void delete successful
* @throws ApiError
*/
public deleteCustomer(data: DeleteCustomerData): Observable<DeleteCustomerResponse> {
return __request(OpenAPI, this.http, {
method: 'DELETE',
url: '/employees/{id}',
path: {
id: data.id
},
errors: {
401: 'not authorized',
404: 'resource not found'
}
});
}
/**
* updates employee by id
* @param data The data for the request.
* @param data.id
* @param data.requestBody
* @returns EmployeeResponseDTO employee
* @throws ApiError
*/
public patchEmployee(data: PatchEmployeeData): Observable<PatchEmployeeResponse> {
return __request(OpenAPI, this.http, {
method: 'PATCH',
url: '/employees/{id}',
path: {
id: data.id
},
body: data.requestBody,
mediaType: 'application/json',
errors: {
401: 'not authorized',
404: 'resource not found'
}
});
}
/**
* delivers a list of all employees
* @returns EmployeeResponseDTO list of employees
* @throws ApiError
*/
public findAll1(): Observable<FindAll1Response> {
return __request(OpenAPI, this.http, { return __request(OpenAPI, this.http, {
method: 'GET', method: 'GET',
url: '/employees', url: '/employees',
@ -230,10 +140,10 @@ export class EmployeeControllerService {
} }
/** /**
* creates a new employee * Creates a new employee
* @param data The data for the request. * @param data The data for the request.
* @param data.requestBody * @param data.requestBody
* @returns EmployeeResponseDTO created employee * @returns Employee created employee
* @throws ApiError * @throws ApiError
*/ */
public createEmployee(data: CreateEmployeeData): Observable<CreateEmployeeResponse> { public createEmployee(data: CreateEmployeeData): Observable<CreateEmployeeResponse> {
@ -250,13 +160,79 @@ export class EmployeeControllerService {
} }
/** /**
* finds all qualifications of an employee by id * Gets a specific employee
* @param data The data for the request. * @param data The data for the request.
* @param data.id * @param data.id
* @returns EmployeeNameAndSkillDataDTO employee with a list of his qualifications * @returns Employee employee
* @throws ApiError * @throws ApiError
*/ */
public findAllQualificationOfAemployeeById(data: FindAllQualificationOfAemployeeByIdData): Observable<FindAllQualificationOfAemployeeByIdResponse> { public getEmployee(data: GetEmployeeData): Observable<GetEmployeeResponse> {
return __request(OpenAPI, this.http, {
method: 'GET',
url: '/employees/{id}',
path: {
id: data.id
},
errors: {
401: 'not authorized',
404: 'resource not found'
}
});
}
/**
* Deletes a specific employee
* @param data The data for the request.
* @param data.id
* @returns void delete successful
* @throws ApiError
*/
public deleteEmployee(data: DeleteEmployeeData): Observable<DeleteEmployeeResponse> {
return __request(OpenAPI, this.http, {
method: 'DELETE',
url: '/employees/{id}',
path: {
id: data.id
},
errors: {
401: 'not authorized',
404: 'resource not found'
}
});
}
/**
* Updates a employee
* @param data The data for the request.
* @param data.id
* @param data.requestBody
* @returns Employee employee
* @throws ApiError
*/
public updateEmployee(data: UpdateEmployeeData): Observable<UpdateEmployeeResponse> {
return __request(OpenAPI, this.http, {
method: 'PATCH',
url: '/employees/{id}',
path: {
id: data.id
},
body: data.requestBody,
mediaType: 'application/json',
errors: {
401: 'not authorized',
404: 'resource not found'
}
});
}
/**
* Gets all qualifications of a specific employee
* @param data The data for the request.
* @param data.id
* @returns EmployeeQualifications employee with a list of his qualifications
* @throws ApiError
*/
public getAllEmployeeQualifications(data: GetAllEmployeeQualificationsData): Observable<GetAllEmployeeQualificationsResponse> {
return __request(OpenAPI, this.http, { return __request(OpenAPI, this.http, {
method: 'GET', method: 'GET',
url: '/employees/{id}/qualifications', url: '/employees/{id}/qualifications',
@ -271,14 +247,14 @@ export class EmployeeControllerService {
} }
/** /**
* adds a qualification to an employee by id * Adds a qualification to an employee
* @param data The data for the request. * @param data The data for the request.
* @param data.id * @param data.id
* @param data.requestBody * @param data.requestBody
* @returns EmployeeNameAndSkillDataDTO employee with a list of his qualifications * @returns EmployeeQualifications employee with a list of his qualifications
* @throws ApiError * @throws ApiError
*/ */
public addQualificationToEmployeeById(data: AddQualificationToEmployeeByIdData): Observable<AddQualificationToEmployeeByIdResponse> { public addQualificationToEmployee(data: AddQualificationToEmployeeData): Observable<AddQualificationToEmployeeResponse> {
return __request(OpenAPI, this.http, { return __request(OpenAPI, this.http, {
method: 'POST', method: 'POST',
url: '/employees/{id}/qualifications', url: '/employees/{id}/qualifications',
@ -296,20 +272,20 @@ export class EmployeeControllerService {
} }
/** /**
* deletes a qualification of an employee by id * Removes a qualification from an employee
* @param data The data for the request. * @param data The data for the request.
* @param data.eid * @param data.employeeId
* @param data.qid * @param data.qualificationId
* @returns EmployeeNameAndSkillDataDTO employee with a list of his qualifications * @returns EmployeeQualifications employee with a list of his qualifications
* @throws ApiError * @throws ApiError
*/ */
public removeQualificationFromEmployee(data: RemoveQualificationFromEmployeeData): Observable<RemoveQualificationFromEmployeeResponse> { public removeQualificationFromEmployee(data: RemoveQualificationFromEmployeeData): Observable<RemoveQualificationFromEmployeeResponse> {
return __request(OpenAPI, this.http, { return __request(OpenAPI, this.http, {
method: 'DELETE', method: 'DELETE',
url: '/employees/{eid}/qualifications/{qid}', url: '/employees/{employeeId}/qualifications/{qualificationId}',
path: { path: {
eid: data.eid, employeeId: data.employeeId,
qid: data.qid qualificationId: data.qualificationId
}, },
errors: { errors: {
401: 'not authorized', 401: 'not authorized',

View file

@ -1,10 +1,47 @@
// This file is auto-generated by @hey-api/openapi-ts // This file is auto-generated by @hey-api/openapi-ts
export type QualificationPostDTO = { export type Qualification = {
id: number;
skill: string; skill: string;
}; };
export type EmployeeRequestPutDTO = { export type NewQualification = {
skill: string;
};
export type QualificationEmployees = {
qualification: Qualification;
employees: Array<QualificationEmployee>;
};
export type QualificationEmployee = {
id: number;
lastName: string;
firstName: string;
};
export type Employee = {
id: number;
firstName: string;
lastName: string;
postcode: string;
city: string;
street: string;
phone: string;
skillSet: Array<Qualification>;
};
export type NewEmployee = {
lastName: string;
firstName: string;
street: string;
postcode: string;
city: string;
phone: string;
skillSet: Array<(number)>;
};
export type UpdatedEmployee = {
lastName?: string; lastName?: string;
firstName?: string; firstName?: string;
street?: string; street?: string;
@ -14,127 +51,83 @@ export type EmployeeRequestPutDTO = {
skillSet?: Array<(number)>; skillSet?: Array<(number)>;
}; };
export type EmployeeResponseDTO = { export type EmployeeQualifications = {
id?: number;
lastName: string;
firstName: string;
street: string;
postcode: string;
city: string;
phone: string;
skillSet?: Array<QualificationGetDTO>;
};
export type QualificationGetDTO = {
skill?: string;
id?: number;
};
export type EmployeeRequestDTO = {
lastName: string;
firstName: string;
street: string;
postcode: string;
city: string;
phone: string;
skillSet?: Array<(number)>;
};
export type EmployeeNameAndSkillDataDTO = {
id?: number; id?: number;
lastName?: string; lastName?: string;
firstName?: string; firstName?: string;
skillSet?: Array<QualificationGetDTO>; skillSet?: Array<Qualification>;
}; };
export type EmployeeNameDataDTO = { export type GetAllQualificationsResponse = (Array<Qualification>);
id?: number;
lastName?: string; export type CreateQualificationData = {
firstName?: string; requestBody: NewQualification;
}; };
export type EmployeesForAQualificationDTO = { export type CreateQualificationResponse = (Qualification);
qualification?: QualificationGetDTO;
employees?: Array<EmployeeNameDataDTO>;
};
export type UpdateQualificationData = { export type UpdateQualificationData = {
id: number; id: number;
requestBody: QualificationPostDTO; requestBody: NewQualification;
}; };
export type UpdateQualificationResponse = (QualificationPostDTO); export type UpdateQualificationResponse = (Qualification);
export type DeleteQualificationByDesignationData = { export type DeleteQualificationData = {
id: number; id: number;
}; };
export type DeleteQualificationByDesignationResponse = (void); export type DeleteQualificationResponse = (void);
export type FindAllResponse = (QualificationGetDTO); export type GetAllQualificationEmployeesData = {
export type CreateQualificationData = {
requestBody: QualificationPostDTO;
};
export type CreateQualificationResponse = (QualificationPostDTO);
export type FindAllEmployeesByQualificationData = {
id: number; id: number;
}; };
export type FindAllEmployeesByQualificationResponse = (EmployeesForAQualificationDTO); export type GetAllQualificationEmployeesResponse = (QualificationEmployees);
export type FindByIdData = { export type GetAllEmployeesResponse = (Array<Employee>);
export type CreateEmployeeData = {
requestBody: NewEmployee;
};
export type CreateEmployeeResponse = (Employee);
export type GetEmployeeData = {
id: number; id: number;
}; };
export type FindByIdResponse = (EmployeeResponseDTO); export type GetEmployeeResponse = (Employee);
export type DeleteEmployeeData = {
id: number;
};
export type DeleteEmployeeResponse = (void);
export type UpdateEmployeeData = { export type UpdateEmployeeData = {
id: number; id: number;
requestBody: EmployeeRequestPutDTO; requestBody: UpdatedEmployee;
}; };
export type UpdateEmployeeResponse = (EmployeeResponseDTO); export type UpdateEmployeeResponse = (Employee);
export type DeleteCustomerData = { export type GetAllEmployeeQualificationsData = {
id: number; id: number;
}; };
export type DeleteCustomerResponse = (void); export type GetAllEmployeeQualificationsResponse = (EmployeeQualifications);
export type PatchEmployeeData = { export type AddQualificationToEmployeeData = {
id: number; id: number;
requestBody: EmployeeRequestPutDTO; requestBody: NewQualification;
}; };
export type PatchEmployeeResponse = (EmployeeResponseDTO); export type AddQualificationToEmployeeResponse = (EmployeeQualifications);
export type FindAll1Response = (Array<EmployeeResponseDTO>);
export type CreateEmployeeData = {
requestBody: EmployeeRequestDTO;
};
export type CreateEmployeeResponse = (EmployeeResponseDTO);
export type FindAllQualificationOfAemployeeByIdData = {
id: number;
};
export type FindAllQualificationOfAemployeeByIdResponse = (EmployeeNameAndSkillDataDTO);
export type AddQualificationToEmployeeByIdData = {
id: number;
requestBody: QualificationPostDTO;
};
export type AddQualificationToEmployeeByIdResponse = (EmployeeNameAndSkillDataDTO);
export type RemoveQualificationFromEmployeeData = { export type RemoveQualificationFromEmployeeData = {
eid: number; employeeId: number;
qid: number; qualificationId: number;
}; };
export type RemoveQualificationFromEmployeeResponse = (EmployeeNameAndSkillDataDTO); export type RemoveQualificationFromEmployeeResponse = (EmployeeQualifications);