diff --git a/frontend/.eslintrc.js b/frontend/.eslintrc.js index 746425d5..c14a31e0 100644 --- a/frontend/.eslintrc.js +++ b/frontend/.eslintrc.js @@ -208,6 +208,7 @@ module.exports = { 100, 1000, 401, + 404, 2000 ] } diff --git a/frontend/src/app/generated/README.md b/frontend/src/app/generated/README.md index fdd96361..59b1986e 100644 --- a/frontend/src/app/generated/README.md +++ b/frontend/src/app/generated/README.md @@ -147,6 +147,7 @@ export class AppModule { } ``` + ### Set service base path If different than the generated base path, during app bootstrap, you can provide the base path to your service. diff --git a/frontend/src/app/generated/api/default.service.ts b/frontend/src/app/generated/api/default.service.ts index 914f7ea9..1ea9569a 100644 --- a/frontend/src/app/generated/api/default.service.ts +++ b/frontend/src/app/generated/api/default.service.ts @@ -2,8 +2,8 @@ * Mild Blue - Covid Vaxx * Covid Vaxx API * - * The version of the OpenAPI document: 0.0.1 - * Contact: covid-vaxx@mild.blue + * The version of the OpenAPI document: 0.1.0 + * Contact: support@mild.blue * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -17,18 +17,17 @@ import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; import { - BearerTokenDtoOut, - CaptchaVerificationDtoIn, - InsuranceCompanyDetailsDtoOut, - LoginDtoIn, - PatientDeletedDtoOut, - PatientDtoOut, - PatientRegisteredDtoOut, - PatientRegistrationDtoIn, - QuestionDtoOut, - ServiceHealthDtoOut, - UserRegistrationDtoIn, - VersionDtoOut + ApplicationInformationDto, + InsuranceCompanyDetailsDtoOut, + LoginDtoIn, + PatientDtoOut, + PatientRegistrationDtoIn, + PatientUpdateDtoIn, + QuestionDtoOut, + ServiceHealthDtoOut, + UserLoginResponseDtoOut, + UserRegisteredDtoOut, + UserRegistrationDtoIn } from '../model/models'; import { BASE_PATH } from '../variables'; @@ -96,18 +95,24 @@ export class DefaultService { } /** - * Endpoint that issues access to the API for the non-registered users. - * @param captchaVerificationDtoIn + * Returns all questions and refreshes in-memory cache. * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public apiCaptchaPost(captchaVerificationDtoIn?: CaptchaVerificationDtoIn, observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable; - public apiCaptchaPost(captchaVerificationDtoIn?: CaptchaVerificationDtoIn, observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>; - public apiCaptchaPost(captchaVerificationDtoIn?: CaptchaVerificationDtoIn, observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>; - public apiCaptchaPost(captchaVerificationDtoIn?: CaptchaVerificationDtoIn, observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: 'application/json' }): Observable { + public apiAdminCacheRefreshGet(observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>; + public apiAdminCacheRefreshGet(observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>>; + public apiAdminCacheRefreshGet(observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>>; + public apiAdminCacheRefreshGet(observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: 'application/json' }): Observable { let headers = this.defaultHeaders; + let credential: string | undefined; + // authentication (jwtAuth) required + credential = this.configuration.lookupCredential('jwtAuth'); + if (credential) { + headers = headers.set('Authorization', 'Bearer ' + credential); + } + let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; if (httpHeaderAcceptSelected === undefined) { // to determine the Accept header @@ -121,22 +126,12 @@ export class DefaultService { } - // to determine the Content-Type header - const consumes: string[] = [ - 'application/json' - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected !== undefined) { - headers = headers.set('Content-Type', httpContentTypeSelected); - } - let responseType: 'text' | 'json' = 'json'; if (httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { responseType = 'text'; } - return this.httpClient.post(`${this.configuration.basePath}/api/captcha`, - captchaVerificationDtoIn, + return this.httpClient.get>(`${this.configuration.basePath}/api/admin/cache-refresh`, { responseType: responseType, withCredentials: this.configuration.withCredentials, @@ -148,14 +143,15 @@ export class DefaultService { } /** - * Returns list of all available insurance companies. + * Login endpoint for the registered users such as administrators and doctors. + * @param loginDtoIn * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public apiInsuranceCompanyGet(observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>; - public apiInsuranceCompanyGet(observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>>; - public apiInsuranceCompanyGet(observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>>; - public apiInsuranceCompanyGet(observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: 'application/json' }): Observable { + public apiAdminLoginPost(loginDtoIn?: LoginDtoIn, observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable; + public apiAdminLoginPost(loginDtoIn?: LoginDtoIn, observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>; + public apiAdminLoginPost(loginDtoIn?: LoginDtoIn, observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>; + public apiAdminLoginPost(loginDtoIn?: LoginDtoIn, observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: 'application/json' }): Observable { let headers = this.defaultHeaders; @@ -172,12 +168,22 @@ export class DefaultService { } + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + headers = headers.set('Content-Type', httpContentTypeSelected); + } + let responseType: 'text' | 'json' = 'json'; if (httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { responseType = 'text'; } - return this.httpClient.get>(`${this.configuration.basePath}/api/insurance-company`, + return this.httpClient.post(`${this.configuration.basePath}/api/admin/login`, + loginDtoIn, { responseType: responseType, withCredentials: this.configuration.withCredentials, @@ -189,18 +195,41 @@ export class DefaultService { } /** - * Login endpoint for the registered users such as administrators and doctors. - * @param loginDtoIn + * Get patient the parameters. Filters by and clause. Empty parameters return all patients. + * @param email Filter by email. + * @param phoneNumber Filter by phone number. + * @param vaccinated Filter by the fact if the patient was vaccinated or not. * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public apiLoginPost(loginDtoIn?: LoginDtoIn, observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable; - public apiLoginPost(loginDtoIn?: LoginDtoIn, observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>; - public apiLoginPost(loginDtoIn?: LoginDtoIn, observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>; - public apiLoginPost(loginDtoIn?: LoginDtoIn, observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: 'application/json' }): Observable { + public apiAdminPatientFilterGet(email?: string, phoneNumber?: string, vaccinated?: boolean, observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>; + public apiAdminPatientFilterGet(email?: string, phoneNumber?: string, vaccinated?: boolean, observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>>; + public apiAdminPatientFilterGet(email?: string, phoneNumber?: string, vaccinated?: boolean, observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>>; + public apiAdminPatientFilterGet(email?: string, phoneNumber?: string, vaccinated?: boolean, observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: 'application/json' }): Observable { + + let queryParameters = new HttpParams({ encoder: this.encoder }); + if (email !== undefined && email !== null) { + queryParameters = this.addToHttpParams(queryParameters, + email, 'email'); + } + if (phoneNumber !== undefined && phoneNumber !== null) { + queryParameters = this.addToHttpParams(queryParameters, + phoneNumber, 'phoneNumber'); + } + if (vaccinated !== undefined && vaccinated !== null) { + queryParameters = this.addToHttpParams(queryParameters, + vaccinated, 'vaccinated'); + } let headers = this.defaultHeaders; + let credential: string | undefined; + // authentication (jwtAuth) required + credential = this.configuration.lookupCredential('jwtAuth'); + if (credential) { + headers = headers.set('Authorization', 'Bearer ' + credential); + } + let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; if (httpHeaderAcceptSelected === undefined) { // to determine the Accept header @@ -214,23 +243,14 @@ export class DefaultService { } - // to determine the Content-Type header - const consumes: string[] = [ - 'application/json' - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected !== undefined) { - headers = headers.set('Content-Type', httpContentTypeSelected); - } - let responseType: 'text' | 'json' = 'json'; if (httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { responseType = 'text'; } - return this.httpClient.post(`${this.configuration.basePath}/api/login`, - loginDtoIn, + return this.httpClient.get>(`${this.configuration.basePath}/api/admin/patient/filter`, { + params: queryParameters, responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, @@ -241,31 +261,24 @@ export class DefaultService { } /** - * Search endpoint for user, only single parameter is taken in account. - * @param id Patient ID + * Get patient by personal number. * @param personalNumber Patient personal number - * @param email Patient email * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public apiPatientGet(id?: string, personalNumber?: string, email?: string, observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>; - public apiPatientGet(id?: string, personalNumber?: string, email?: string, observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>>; - public apiPatientGet(id?: string, personalNumber?: string, email?: string, observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>>; - public apiPatientGet(id?: string, personalNumber?: string, email?: string, observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: 'application/json' }): Observable { + public apiAdminPatientSingleGet(personalNumber: string, observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable; + public apiAdminPatientSingleGet(personalNumber: string, observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>; + public apiAdminPatientSingleGet(personalNumber: string, observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>; + public apiAdminPatientSingleGet(personalNumber: string, observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: 'application/json' }): Observable { + if (personalNumber === null || personalNumber === undefined) { + throw new Error('Required parameter personalNumber was null or undefined when calling apiAdminPatientSingleGet.'); + } let queryParameters = new HttpParams({ encoder: this.encoder }); - if (id !== undefined && id !== null) { - queryParameters = this.addToHttpParams(queryParameters, - id, 'id'); - } if (personalNumber !== undefined && personalNumber !== null) { queryParameters = this.addToHttpParams(queryParameters, personalNumber, 'personalNumber'); } - if (email !== undefined && email !== null) { - queryParameters = this.addToHttpParams(queryParameters, - email, 'email'); - } let headers = this.defaultHeaders; @@ -294,7 +307,7 @@ export class DefaultService { responseType = 'text'; } - return this.httpClient.get>(`${this.configuration.basePath}/api/patient`, + return this.httpClient.get(`${this.configuration.basePath}/api/admin/patient/single`, { params: queryParameters, responseType: responseType, @@ -312,12 +325,12 @@ export class DefaultService { * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public apiPatientIdDelete(id: string, observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable; - public apiPatientIdDelete(id: string, observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>; - public apiPatientIdDelete(id: string, observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>; - public apiPatientIdDelete(id: string, observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: 'application/json' }): Observable { + public apiAdminPatientSingleIdDelete(id: string, observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: undefined }): Observable; + public apiAdminPatientSingleIdDelete(id: string, observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: undefined }): Observable>; + public apiAdminPatientSingleIdDelete(id: string, observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: undefined }): Observable>; + public apiAdminPatientSingleIdDelete(id: string, observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: undefined }): Observable { if (id === null || id === undefined) { - throw new Error('Required parameter id was null or undefined when calling apiPatientIdDelete.'); + throw new Error('Required parameter id was null or undefined when calling apiAdminPatientSingleIdDelete.'); } let headers = this.defaultHeaders; @@ -333,7 +346,6 @@ export class DefaultService { if (httpHeaderAcceptSelected === undefined) { // to determine the Accept header const httpHeaderAccepts: string[] = [ - 'application/json' ]; httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); } @@ -347,7 +359,7 @@ export class DefaultService { responseType = 'text'; } - return this.httpClient.delete(`${this.configuration.basePath}/api/patient/${encodeURIComponent(String(id))}`, + return this.httpClient.delete(`${this.configuration.basePath}/api/admin/patient/single/${encodeURIComponent(String(id))}`, { responseType: responseType, withCredentials: this.configuration.withCredentials, @@ -364,12 +376,12 @@ export class DefaultService { * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public apiPatientIdGet(id: string, observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable; - public apiPatientIdGet(id: string, observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>; - public apiPatientIdGet(id: string, observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>; - public apiPatientIdGet(id: string, observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: 'application/json' }): Observable { + public apiAdminPatientSingleIdGet(id: string, observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable; + public apiAdminPatientSingleIdGet(id: string, observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>; + public apiAdminPatientSingleIdGet(id: string, observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>; + public apiAdminPatientSingleIdGet(id: string, observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: 'application/json' }): Observable { if (id === null || id === undefined) { - throw new Error('Required parameter id was null or undefined when calling apiPatientIdGet.'); + throw new Error('Required parameter id was null or undefined when calling apiAdminPatientSingleIdGet.'); } let headers = this.defaultHeaders; @@ -399,7 +411,7 @@ export class DefaultService { responseType = 'text'; } - return this.httpClient.get(`${this.configuration.basePath}/api/patient/${encodeURIComponent(String(id))}`, + return this.httpClient.get(`${this.configuration.basePath}/api/admin/patient/single/${encodeURIComponent(String(id))}`, { responseType: responseType, withCredentials: this.configuration.withCredentials, @@ -411,24 +423,33 @@ export class DefaultService { } /** - * Save patient registration to the database. - * @param patientRegistrationDtoIn + * Updates patient with given change set - note you should send just the values that changed and not whole entity. + * @param id Patient ID + * @param patientUpdateDtoIn * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public apiPatientPost(patientRegistrationDtoIn?: PatientRegistrationDtoIn, observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable; - public apiPatientPost(patientRegistrationDtoIn?: PatientRegistrationDtoIn, observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>; - public apiPatientPost(patientRegistrationDtoIn?: PatientRegistrationDtoIn, observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>; - public apiPatientPost(patientRegistrationDtoIn?: PatientRegistrationDtoIn, observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: 'application/json' }): Observable { + public apiAdminPatientSingleIdPut(id: string, patientUpdateDtoIn?: PatientUpdateDtoIn, observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: undefined }): Observable; + public apiAdminPatientSingleIdPut(id: string, patientUpdateDtoIn?: PatientUpdateDtoIn, observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: undefined }): Observable>; + public apiAdminPatientSingleIdPut(id: string, patientUpdateDtoIn?: PatientUpdateDtoIn, observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: undefined }): Observable>; + public apiAdminPatientSingleIdPut(id: string, patientUpdateDtoIn?: PatientUpdateDtoIn, observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: undefined }): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling apiAdminPatientSingleIdPut.'); + } let headers = this.defaultHeaders; + let credential: string | undefined; + // authentication (jwtAuth) required + credential = this.configuration.lookupCredential('jwtAuth'); + if (credential) { + headers = headers.set('Authorization', 'Bearer ' + credential); + } + let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; if (httpHeaderAcceptSelected === undefined) { // to determine the Accept header - const httpHeaderAccepts: string[] = [ - 'application/json' - ]; + const httpHeaderAccepts: string[] = []; httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); } if (httpHeaderAcceptSelected !== undefined) { @@ -450,8 +471,8 @@ export class DefaultService { responseType = 'text'; } - return this.httpClient.post(`${this.configuration.basePath}/api/patient`, - patientRegistrationDtoIn, + return this.httpClient.put(`${this.configuration.basePath}/api/admin/patient/single/${encodeURIComponent(String(id))}`, + patientUpdateDtoIn, { responseType: responseType, withCredentials: this.configuration.withCredentials, @@ -463,17 +484,25 @@ export class DefaultService { } /** - * Returns all questions that patient needs to answer. + * Register new user of the system. + * @param userRegistrationDtoIn * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public apiQuestionGet(observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>; - public apiQuestionGet(observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>>; - public apiQuestionGet(observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>>; - public apiQuestionGet(observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: 'application/json' }): Observable { + public apiAdminRegisterPost(userRegistrationDtoIn?: UserRegistrationDtoIn, observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable; + public apiAdminRegisterPost(userRegistrationDtoIn?: UserRegistrationDtoIn, observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>; + public apiAdminRegisterPost(userRegistrationDtoIn?: UserRegistrationDtoIn, observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>; + public apiAdminRegisterPost(userRegistrationDtoIn?: UserRegistrationDtoIn, observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: 'application/json' }): Observable { let headers = this.defaultHeaders; + let credential: string | undefined; + // authentication (jwtAuth) required + credential = this.configuration.lookupCredential('jwtAuth'); + if (credential) { + headers = headers.set('Authorization', 'Bearer ' + credential); + } + let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; if (httpHeaderAcceptSelected === undefined) { // to determine the Accept header @@ -487,12 +516,22 @@ export class DefaultService { } + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + headers = headers.set('Content-Type', httpContentTypeSelected); + } + let responseType: 'text' | 'json' = 'json'; if (httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { responseType = 'text'; } - return this.httpClient.get>(`${this.configuration.basePath}/api/question`, + return this.httpClient.post(`${this.configuration.basePath}/api/admin/register`, + userRegistrationDtoIn, { responseType: responseType, withCredentials: this.configuration.withCredentials, @@ -504,15 +543,14 @@ export class DefaultService { } /** - * Register new user of the system. - * @param userRegistrationDtoIn + * Verify that the currently used token is valid. Returns 200 if token is correct, 401 otherwise. * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public apiRegisterPost(userRegistrationDtoIn?: UserRegistrationDtoIn, observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: undefined }): Observable; - public apiRegisterPost(userRegistrationDtoIn?: UserRegistrationDtoIn, observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: undefined }): Observable>; - public apiRegisterPost(userRegistrationDtoIn?: UserRegistrationDtoIn, observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: undefined }): Observable>; - public apiRegisterPost(userRegistrationDtoIn?: UserRegistrationDtoIn, observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: undefined }): Observable { + public apiAdminSelfGet(observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: undefined }): Observable; + public apiAdminSelfGet(observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: undefined }): Observable>; + public apiAdminSelfGet(observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: undefined }): Observable>; + public apiAdminSelfGet(observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: undefined }): Observable { let headers = this.defaultHeaders; @@ -534,6 +572,97 @@ export class DefaultService { } + let responseType: 'text' | 'json' = 'json'; + if (httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + + return this.httpClient.get(`${this.configuration.basePath}/api/admin/self`, + { + responseType: responseType, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); + } + + /** + * Returns list of all available insurance companies. + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public apiInsuranceCompaniesGet(observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>; + public apiInsuranceCompaniesGet(observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>>; + public apiInsuranceCompaniesGet(observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>>; + public apiInsuranceCompaniesGet(observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: 'application/json' }): Observable { + + let headers = this.defaultHeaders; + + let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; + if (httpHeaderAcceptSelected === undefined) { + // to determine the Accept header + const httpHeaderAccepts: string[] = [ + 'application/json' + ]; + httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); + } + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + + let responseType: 'text' | 'json' = 'json'; + if (httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + + return this.httpClient.get>(`${this.configuration.basePath}/api/insurance-companies`, + { + responseType: responseType, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); + } + + /** + * Save patient registration to the database. + * @param captcha Token from the Google Captcha. + * @param patientRegistrationDtoIn + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public apiPatientPost(captcha: string, patientRegistrationDtoIn?: PatientRegistrationDtoIn, observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: undefined }): Observable; + public apiPatientPost(captcha: string, patientRegistrationDtoIn?: PatientRegistrationDtoIn, observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: undefined }): Observable>; + public apiPatientPost(captcha: string, patientRegistrationDtoIn?: PatientRegistrationDtoIn, observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: undefined }): Observable>; + public apiPatientPost(captcha: string, patientRegistrationDtoIn?: PatientRegistrationDtoIn, observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: undefined }): Observable { + if (captcha === null || captcha === undefined) { + throw new Error('Required parameter captcha was null or undefined when calling apiPatientPost.'); + } + + let queryParameters = new HttpParams({ encoder: this.encoder }); + if (captcha !== undefined && captcha !== null) { + queryParameters = this.addToHttpParams(queryParameters, + captcha, 'captcha'); + } + + let headers = this.defaultHeaders; + + let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; + if (httpHeaderAcceptSelected === undefined) { + // to determine the Accept header + const httpHeaderAccepts: string[] = []; + httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); + } + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header const consumes: string[] = [ 'application/json' @@ -548,9 +677,10 @@ export class DefaultService { responseType = 'text'; } - return this.httpClient.post(`${this.configuration.basePath}/api/register`, - userRegistrationDtoIn, + return this.httpClient.post(`${this.configuration.basePath}/api/patient`, + patientRegistrationDtoIn, { + params: queryParameters, responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, @@ -561,20 +691,23 @@ export class DefaultService { } /** + * Returns all questions that patient needs to answer. * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public apiStatusGet(observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: undefined }): Observable; - public apiStatusGet(observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: undefined }): Observable>; - public apiStatusGet(observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: undefined }): Observable>; - public apiStatusGet(observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: undefined }): Observable { + public apiQuestionsGet(observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>; + public apiQuestionsGet(observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>>; + public apiQuestionsGet(observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>>; + public apiQuestionsGet(observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: 'application/json' }): Observable { let headers = this.defaultHeaders; let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; if (httpHeaderAcceptSelected === undefined) { // to determine the Accept header - const httpHeaderAccepts: string[] = []; + const httpHeaderAccepts: string[] = [ + 'application/json' + ]; httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); } if (httpHeaderAcceptSelected !== undefined) { @@ -587,7 +720,7 @@ export class DefaultService { responseType = 'text'; } - return this.httpClient.get(`${this.configuration.basePath}/api/status`, + return this.httpClient.get>(`${this.configuration.basePath}/api/questions`, { responseType: responseType, withCredentials: this.configuration.withCredentials, @@ -602,19 +735,17 @@ export class DefaultService { * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public apiStatusHealthGet(observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable; - public apiStatusHealthGet(observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>; - public apiStatusHealthGet(observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>; - public apiStatusHealthGet(observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: 'application/json' }): Observable { + public apiStatusGet(observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: undefined }): Observable; + public apiStatusGet(observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: undefined }): Observable>; + public apiStatusGet(observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: undefined }): Observable>; + public apiStatusGet(observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: undefined }): Observable { let headers = this.defaultHeaders; let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; if (httpHeaderAcceptSelected === undefined) { // to determine the Accept header - const httpHeaderAccepts: string[] = [ - 'application/json' - ]; + const httpHeaderAccepts: string[] = []; httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); } if (httpHeaderAcceptSelected !== undefined) { @@ -627,7 +758,7 @@ export class DefaultService { responseType = 'text'; } - return this.httpClient.get(`${this.configuration.basePath}/api/status/health`, + return this.httpClient.get(`${this.configuration.basePath}/api/status`, { responseType: responseType, withCredentials: this.configuration.withCredentials, @@ -639,14 +770,13 @@ export class DefaultService { } /** - * Returns version of the application. * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public apiVersionGet(observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable; - public apiVersionGet(observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>; - public apiVersionGet(observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>; - public apiVersionGet(observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: 'application/json' }): Observable { + public apiStatusHealthGet(observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable; + public apiStatusHealthGet(observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>; + public apiStatusHealthGet(observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>; + public apiStatusHealthGet(observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: 'application/json' }): Observable { let headers = this.defaultHeaders; @@ -668,7 +798,7 @@ export class DefaultService { responseType = 'text'; } - return this.httpClient.get(`${this.configuration.basePath}/api/version`, + return this.httpClient.get(`${this.configuration.basePath}/api/status/health`, { responseType: responseType, withCredentials: this.configuration.withCredentials, @@ -680,25 +810,17 @@ export class DefaultService { } /** - * Save patient registration to the database. - * @param patientRegistrationDtoIn + * Returns version of the application. * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public authorizedApiPatientPost(patientRegistrationDtoIn?: PatientRegistrationDtoIn, observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable; - public authorizedApiPatientPost(patientRegistrationDtoIn?: PatientRegistrationDtoIn, observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>; - public authorizedApiPatientPost(patientRegistrationDtoIn?: PatientRegistrationDtoIn, observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>; - public authorizedApiPatientPost(patientRegistrationDtoIn?: PatientRegistrationDtoIn, observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: 'application/json' }): Observable { + public apiVersionGet(observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable; + public apiVersionGet(observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>; + public apiVersionGet(observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json' }): Observable>; + public apiVersionGet(observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: 'application/json' }): Observable { let headers = this.defaultHeaders; - let credential: string | undefined; - // authentication (jwtAuth) required - credential = this.configuration.lookupCredential('jwtAuth'); - if (credential) { - headers = headers.set('Authorization', 'Bearer ' + credential); - } - let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; if (httpHeaderAcceptSelected === undefined) { // to determine the Accept header @@ -712,22 +834,12 @@ export class DefaultService { } - // to determine the Content-Type header - const consumes: string[] = [ - 'application/json' - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected !== undefined) { - headers = headers.set('Content-Type', httpContentTypeSelected); - } - let responseType: 'text' | 'json' = 'json'; if (httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { responseType = 'text'; } - return this.httpClient.post(`${this.configuration.basePath}/authorized/api/patient`, - patientRegistrationDtoIn, + return this.httpClient.get(`${this.configuration.basePath}/api/version`, { responseType: responseType, withCredentials: this.configuration.withCredentials, diff --git a/frontend/src/app/generated/encoder.ts b/frontend/src/app/generated/encoder.ts index e89c86e3..138c4d5c 100644 --- a/frontend/src/app/generated/encoder.ts +++ b/frontend/src/app/generated/encoder.ts @@ -8,15 +8,12 @@ export class CustomHttpParameterCodec implements HttpParameterCodec { encodeKey(k: string): string { return encodeURIComponent(k); } - encodeValue(v: string): string { return encodeURIComponent(v); } - decodeKey(k: string): string { return decodeURIComponent(k); } - decodeValue(v: string): string { return decodeURIComponent(v); } diff --git a/frontend/src/app/generated/model/answerDto.ts b/frontend/src/app/generated/model/answerDto.ts index dbab3138..6c330228 100644 --- a/frontend/src/app/generated/model/answerDto.ts +++ b/frontend/src/app/generated/model/answerDto.ts @@ -2,8 +2,8 @@ * Mild Blue - Covid Vaxx * Covid Vaxx API * - * The version of the OpenAPI document: 0.0.1 - * Contact: covid-vaxx@mild.blue + * The version of the OpenAPI document: 0.1.0 + * Contact: support@mild.blue * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech diff --git a/frontend/src/app/generated/model/bearerTokenDtoOut.ts b/frontend/src/app/generated/model/applicationInformationDto.ts similarity index 61% rename from frontend/src/app/generated/model/bearerTokenDtoOut.ts rename to frontend/src/app/generated/model/applicationInformationDto.ts index d2cf415a..102d3b95 100644 --- a/frontend/src/app/generated/model/bearerTokenDtoOut.ts +++ b/frontend/src/app/generated/model/applicationInformationDto.ts @@ -2,8 +2,8 @@ * Mild Blue - Covid Vaxx * Covid Vaxx API * - * The version of the OpenAPI document: 0.0.1 - * Contact: covid-vaxx@mild.blue + * The version of the OpenAPI document: 0.1.0 + * Contact: support@mild.blue * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -11,7 +11,7 @@ */ -export interface BearerTokenDtoOut { - token: string; +export interface ApplicationInformationDto { + version: string; } diff --git a/frontend/src/app/generated/model/captchaVerificationDtoIn.ts b/frontend/src/app/generated/model/captchaVerificationDtoIn.ts deleted file mode 100644 index 498362fe..00000000 --- a/frontend/src/app/generated/model/captchaVerificationDtoIn.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Mild Blue - Covid Vaxx - * Covid Vaxx API - * - * The version of the OpenAPI document: 0.0.1 - * Contact: covid-vaxx@mild.blue - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -export interface CaptchaVerificationDtoIn { - token: string; -} - diff --git a/frontend/src/app/generated/model/confirmationDtoIn.ts b/frontend/src/app/generated/model/confirmationDtoIn.ts index 7705a93b..2ad28150 100644 --- a/frontend/src/app/generated/model/confirmationDtoIn.ts +++ b/frontend/src/app/generated/model/confirmationDtoIn.ts @@ -2,8 +2,8 @@ * Mild Blue - Covid Vaxx * Covid Vaxx API * - * The version of the OpenAPI document: 0.0.1 - * Contact: covid-vaxx@mild.blue + * The version of the OpenAPI document: 0.1.0 + * Contact: support@mild.blue * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -12,8 +12,8 @@ export interface ConfirmationDtoIn { - covid19VaccinationAgreement: boolean; - gdprAgreement: boolean; - healthStateDisclosureConfirmation: boolean; + covid19VaccinationAgreement: boolean; + gdprAgreement: boolean; + healthStateDisclosureConfirmation: boolean; } diff --git a/frontend/src/app/generated/model/insuranceCompanyDetailsDtoOut.ts b/frontend/src/app/generated/model/insuranceCompanyDetailsDtoOut.ts index be538708..f5978def 100644 --- a/frontend/src/app/generated/model/insuranceCompanyDetailsDtoOut.ts +++ b/frontend/src/app/generated/model/insuranceCompanyDetailsDtoOut.ts @@ -2,8 +2,8 @@ * Mild Blue - Covid Vaxx * Covid Vaxx API * - * The version of the OpenAPI document: 0.0.1 - * Contact: covid-vaxx@mild.blue + * The version of the OpenAPI document: 0.1.0 + * Contact: support@mild.blue * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -12,8 +12,20 @@ export interface InsuranceCompanyDetailsDtoOut { - code: number; - csFullName: string; - name: string; + code: InsuranceCompanyDetailsDtoOutCodeEnum; + csFullName: string; + name: string; } +export enum InsuranceCompanyDetailsDtoOutCodeEnum { + Vzp = 'VZP', + Vozp = 'VOZP', + Cpzp = 'CPZP', + Ozp = 'OZP', + Zps = 'ZPS', + Zpmv = 'ZPMV', + Rbp = 'RBP' +}; + + + diff --git a/frontend/src/app/generated/model/loginDtoIn.ts b/frontend/src/app/generated/model/loginDtoIn.ts index 1f4acb31..8dec32c5 100644 --- a/frontend/src/app/generated/model/loginDtoIn.ts +++ b/frontend/src/app/generated/model/loginDtoIn.ts @@ -2,8 +2,8 @@ * Mild Blue - Covid Vaxx * Covid Vaxx API * - * The version of the OpenAPI document: 0.0.1 - * Contact: covid-vaxx@mild.blue + * The version of the OpenAPI document: 0.1.0 + * Contact: support@mild.blue * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech diff --git a/frontend/src/app/generated/model/models.ts b/frontend/src/app/generated/model/models.ts index d6757de7..49789433 100644 --- a/frontend/src/app/generated/model/models.ts +++ b/frontend/src/app/generated/model/models.ts @@ -1,14 +1,13 @@ export * from './answerDto'; -export * from './bearerTokenDtoOut'; -export * from './captchaVerificationDtoIn'; +export * from './applicationInformationDto'; export * from './confirmationDtoIn'; export * from './insuranceCompanyDetailsDtoOut'; export * from './loginDtoIn'; -export * from './patientDeletedDtoOut'; export * from './patientDtoOut'; -export * from './patientRegisteredDtoOut'; export * from './patientRegistrationDtoIn'; +export * from './patientUpdateDtoIn'; export * from './questionDtoOut'; export * from './serviceHealthDtoOut'; +export * from './userLoginResponseDtoOut'; +export * from './userRegisteredDtoOut'; export * from './userRegistrationDtoIn'; -export * from './versionDtoOut'; diff --git a/frontend/src/app/generated/model/patientDeletedDtoOut.ts b/frontend/src/app/generated/model/patientDeletedDtoOut.ts deleted file mode 100644 index fcecfc62..00000000 --- a/frontend/src/app/generated/model/patientDeletedDtoOut.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Mild Blue - Covid Vaxx - * Covid Vaxx API - * - * The version of the OpenAPI document: 0.0.1 - * Contact: covid-vaxx@mild.blue - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -export interface PatientDeletedDtoOut { - deleted: boolean; -} - diff --git a/frontend/src/app/generated/model/patientDtoOut.ts b/frontend/src/app/generated/model/patientDtoOut.ts index 5181298e..4ab1f395 100644 --- a/frontend/src/app/generated/model/patientDtoOut.ts +++ b/frontend/src/app/generated/model/patientDtoOut.ts @@ -2,8 +2,8 @@ * Mild Blue - Covid Vaxx * Covid Vaxx API * - * The version of the OpenAPI document: 0.0.1 - * Contact: covid-vaxx@mild.blue + * The version of the OpenAPI document: 0.1.0 + * Contact: support@mild.blue * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -22,18 +22,18 @@ export interface PatientDtoOut { lastName: string; personalNumber: string; phoneNumber: string; - registrationEmailSent?: string | null; + registrationEmailSentOn?: string | null; updated: string; + vaccinatedOn?: string | null; } - export enum PatientDtoOutInsuranceCompanyEnum { - Czpz = 'CZPZ', - Ozp = 'OZP', - Rbp = 'RBP', Vzp = 'VZP', Vozp = 'VOZP', + Cpzp = 'CPZP', + Ozp = 'OZP', Zps = 'ZPS', - Zpmv = 'ZPMV' + Zpmv = 'ZPMV', + Rbp = 'RBP' }; diff --git a/frontend/src/app/generated/model/patientRegisteredDtoOut.ts b/frontend/src/app/generated/model/patientRegisteredDtoOut.ts deleted file mode 100644 index 128365fe..00000000 --- a/frontend/src/app/generated/model/patientRegisteredDtoOut.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Mild Blue - Covid Vaxx - * Covid Vaxx API - * - * The version of the OpenAPI document: 0.0.1 - * Contact: covid-vaxx@mild.blue - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -export interface PatientRegisteredDtoOut { - patientId: string; -} - diff --git a/frontend/src/app/generated/model/patientRegistrationDtoIn.ts b/frontend/src/app/generated/model/patientRegistrationDtoIn.ts index 4410238d..cfe68fdb 100644 --- a/frontend/src/app/generated/model/patientRegistrationDtoIn.ts +++ b/frontend/src/app/generated/model/patientRegistrationDtoIn.ts @@ -2,8 +2,8 @@ * Mild Blue - Covid Vaxx * Covid Vaxx API * - * The version of the OpenAPI document: 0.0.1 - * Contact: covid-vaxx@mild.blue + * The version of the OpenAPI document: 0.1.0 + * Contact: support@mild.blue * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -23,15 +23,14 @@ export interface PatientRegistrationDtoIn { personalNumber: string; phoneNumber: string; } - export enum PatientRegistrationDtoInInsuranceCompanyEnum { - Cpzp = 'CPZP', - Ozp = 'OZP', - Rbp = 'RBP', Vzp = 'VZP', Vozp = 'VOZP', + Cpzp = 'CPZP', + Ozp = 'OZP', Zps = 'ZPS', - Zpmv = 'ZPMV' + Zpmv = 'ZPMV', + Rbp = 'RBP' }; diff --git a/frontend/src/app/generated/model/patientUpdateDtoIn.ts b/frontend/src/app/generated/model/patientUpdateDtoIn.ts new file mode 100644 index 00000000..26008337 --- /dev/null +++ b/frontend/src/app/generated/model/patientUpdateDtoIn.ts @@ -0,0 +1,37 @@ +/** + * Mild Blue - Covid Vaxx + * Covid Vaxx API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: support@mild.blue + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +import { AnswerDto } from './answerDto'; + + +export interface PatientUpdateDtoIn { + answers?: Array | null; + email?: string | null; + firstName?: string | null; + insuranceCompany?: PatientUpdateDtoInInsuranceCompanyEnum | null; + lastName?: string | null; + personalNumber?: string | null; + phoneNumber?: string | null; + vaccinatedOn?: string | null; +} + +export enum PatientUpdateDtoInInsuranceCompanyEnum { + Vzp = 'VZP', + Vozp = 'VOZP', + Cpzp = 'CPZP', + Ozp = 'OZP', + Zps = 'ZPS', + Zpmv = 'ZPMV', + Rbp = 'RBP' +}; + + + diff --git a/frontend/src/app/generated/model/questionDtoOut.ts b/frontend/src/app/generated/model/questionDtoOut.ts index 7e650a2e..2c663cf0 100644 --- a/frontend/src/app/generated/model/questionDtoOut.ts +++ b/frontend/src/app/generated/model/questionDtoOut.ts @@ -2,8 +2,8 @@ * Mild Blue - Covid Vaxx * Covid Vaxx API * - * The version of the OpenAPI document: 0.0.1 - * Contact: covid-vaxx@mild.blue + * The version of the OpenAPI document: 0.1.0 + * Contact: support@mild.blue * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech diff --git a/frontend/src/app/generated/model/serviceHealthDtoOut.ts b/frontend/src/app/generated/model/serviceHealthDtoOut.ts index b83d9354..6dd99f57 100644 --- a/frontend/src/app/generated/model/serviceHealthDtoOut.ts +++ b/frontend/src/app/generated/model/serviceHealthDtoOut.ts @@ -2,8 +2,8 @@ * Mild Blue - Covid Vaxx * Covid Vaxx API * - * The version of the OpenAPI document: 0.0.1 - * Contact: covid-vaxx@mild.blue + * The version of the OpenAPI document: 0.1.0 + * Contact: support@mild.blue * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech diff --git a/frontend/src/app/generated/model/userLoginResponseDtoOut.ts b/frontend/src/app/generated/model/userLoginResponseDtoOut.ts new file mode 100644 index 00000000..abc38719 --- /dev/null +++ b/frontend/src/app/generated/model/userLoginResponseDtoOut.ts @@ -0,0 +1,25 @@ +/** + * Mild Blue - Covid Vaxx + * Covid Vaxx API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: support@mild.blue + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface UserLoginResponseDtoOut { + role: UserLoginResponseDtoOutRoleEnum; + token: string; +} + +export enum UserLoginResponseDtoOutRoleEnum { + Admin = 'ADMIN', + Doctor = 'DOCTOR' +}; + + + diff --git a/frontend/src/app/generated/model/versionDtoOut.ts b/frontend/src/app/generated/model/userRegisteredDtoOut.ts similarity index 63% rename from frontend/src/app/generated/model/versionDtoOut.ts rename to frontend/src/app/generated/model/userRegisteredDtoOut.ts index 078b938b..ca798950 100644 --- a/frontend/src/app/generated/model/versionDtoOut.ts +++ b/frontend/src/app/generated/model/userRegisteredDtoOut.ts @@ -2,8 +2,8 @@ * Mild Blue - Covid Vaxx * Covid Vaxx API * - * The version of the OpenAPI document: 0.0.1 - * Contact: covid-vaxx@mild.blue + * The version of the OpenAPI document: 0.1.0 + * Contact: support@mild.blue * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -11,7 +11,7 @@ */ -export interface VersionDtoOut { - version: string; +export interface UserRegisteredDtoOut { + id: string; } diff --git a/frontend/src/app/generated/model/userRegistrationDtoIn.ts b/frontend/src/app/generated/model/userRegistrationDtoIn.ts index 3fda3f2c..b7356419 100644 --- a/frontend/src/app/generated/model/userRegistrationDtoIn.ts +++ b/frontend/src/app/generated/model/userRegistrationDtoIn.ts @@ -2,8 +2,8 @@ * Mild Blue - Covid Vaxx * Covid Vaxx API * - * The version of the OpenAPI document: 0.0.1 - * Contact: covid-vaxx@mild.blue + * The version of the OpenAPI document: 0.1.0 + * Contact: support@mild.blue * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech diff --git a/frontend/src/app/interceptors/error/error.interceptor.ts b/frontend/src/app/interceptors/error/error.interceptor.ts index e16b2c15..5d24542e 100644 --- a/frontend/src/app/interceptors/error/error.interceptor.ts +++ b/frontend/src/app/interceptors/error/error.interceptor.ts @@ -17,9 +17,13 @@ export class ErrorInterceptor implements HttpInterceptor { // auto logout if 401 response returned from api this._authService.logout(); throw new Error('Špatné přihlašovací údaje'); + } else if (err.status === 404) { + throw new Error('Je nám líto, ale Vašemu dotazu nic neodpovídá'); } - const message = err.name || err.message; + console.log(err); + const error = err.error; + const message = error?.message ? error.message : 'Něco se pokazilo. Zkuste to prosím znovu.'; throw new Error(message); })); } diff --git a/frontend/src/app/pages/admin/admin.component.html b/frontend/src/app/pages/admin/admin.component.html index 784f142c..7d72e12a 100644 --- a/frontend/src/app/pages/admin/admin.component.html +++ b/frontend/src/app/pages/admin/admin.component.html @@ -12,7 +12,7 @@
- +
@@ -22,13 +22,10 @@

- Nalezení pacienti + Nalezený pacient

-
- - -
+
diff --git a/frontend/src/app/pages/admin/admin.component.scss b/frontend/src/app/pages/admin/admin.component.scss index b4773331..3d06786a 100644 --- a/frontend/src/app/pages/admin/admin.component.scss +++ b/frontend/src/app/pages/admin/admin.component.scss @@ -36,14 +36,6 @@ mat-card { margin-bottom: 30px; } -.patient { - margin-bottom: 20px; - - mat-divider { - margin-top: 20px; - } -} - .history { &:empty { diff --git a/frontend/src/app/pages/admin/admin.component.ts b/frontend/src/app/pages/admin/admin.component.ts index 07cef847..b9581005 100644 --- a/frontend/src/app/pages/admin/admin.component.ts +++ b/frontend/src/app/pages/admin/admin.component.ts @@ -15,7 +15,7 @@ import { AuthService } from '@app/services/auth/auth.service'; export class AdminComponent implements OnInit { public personalNumber: FormControl = new FormControl('', [Validators.required, validatePersonalNumber]); - public patients: Patient[] = []; + public patient?: Patient; public loading: boolean = false; public submitted: boolean = false; @@ -46,9 +46,9 @@ export class AdminComponent implements OnInit { this.loading = true; try { - this.patients = await this._patientService.findPatientByPersonalNumber(personalNumber); + this.patient = await this._patientService.findPatientByPersonalNumber(personalNumber); this._searchHistoryService.saveSearch(personalNumber); - if (!this.patients.length) { + if (!this.patient) { this._alertService.noPatientFoundDialog(personalNumber); } } catch (e) { @@ -65,7 +65,7 @@ export class AdminComponent implements OnInit { } public searchAgain(): void { - this.patients = []; + this.patient = undefined; this.personalNumber.reset(); } diff --git a/frontend/src/app/pages/home/home.component.ts b/frontend/src/app/pages/home/home.component.ts index 0efad9dd..0aab123e 100644 --- a/frontend/src/app/pages/home/home.component.ts +++ b/frontend/src/app/pages/home/home.component.ts @@ -103,7 +103,7 @@ export class HomeComponent implements OnInit, OnDestroy { try { const token = await this._recaptchaV3Service.execute('patientRegistration').toPromise(); - const result = await this._patientService.savePatientInfo( + await this._patientService.savePatientInfo( token, this.getPatientData(), this.questions, @@ -111,9 +111,8 @@ export class HomeComponent implements OnInit, OnDestroy { this.confirmationCheckboxValue, this.gdprCheckboxValue ); - if (result.patientId) { - this._alertService.patientRegisteredDialog(); - } + + this._alertService.patientRegisteredDialog(); } catch (e) { this._alertService.toast(e.message); } diff --git a/frontend/src/app/services/auth/auth.service.ts b/frontend/src/app/services/auth/auth.service.ts index a03a73c2..8990a8b9 100644 --- a/frontend/src/app/services/auth/auth.service.ts +++ b/frontend/src/app/services/auth/auth.service.ts @@ -39,7 +39,7 @@ export class AuthService { public login(username: string, password: string): Observable { return this._http.post( - `${environment.apiUrl}/login`, + `${environment.apiUrl}/admin/login`, { username, password } ).pipe( map((r: Object) => { diff --git a/frontend/src/app/services/patient/patient.service.ts b/frontend/src/app/services/patient/patient.service.ts index e56bc5fe..657508b7 100644 --- a/frontend/src/app/services/patient/patient.service.ts +++ b/frontend/src/app/services/patient/patient.service.ts @@ -1,11 +1,11 @@ import { Injectable } from '@angular/core'; import { environment } from '@environments/environment'; import { first, map } from 'rxjs/operators'; -import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; +import { HttpClient, HttpParams } from '@angular/common/http'; import { Patient } from '@app/model/Patient'; import { parsePatient } from '@app/parsers/patient.parser'; import { QuestionService } from '@app/services/question/question.service'; -import { PatientDtoOut, PatientRegisteredDtoOut, PatientRegistrationDtoIn } from '@app/generated'; +import { PatientDtoOut, PatientRegistrationDtoIn } from '@app/generated'; import { Question } from '@app/model/Question'; import { fromQuestionToAnswerGenerated } from '@app/parsers/to-generated/answer.parser'; import { PatientData } from '@app/model/PatientData'; @@ -20,10 +20,9 @@ export class PatientService { private _questionService: QuestionService) { } - public async savePatientInfo(token: string, patientInfo: PatientData, questions: Question[], agreement: boolean, confirmation: boolean, gdpr: boolean): Promise { - const headers = new HttpHeaders({ - recaptchaToken: token - }); + public async savePatientInfo(token: string, patientInfo: PatientData, questions: Question[], agreement: boolean, confirmation: boolean, gdpr: boolean): Promise { + const params = new HttpParams().set('captcha', token); + const registration: PatientRegistrationDtoIn = { ...patientInfo, insuranceCompany: fromInsuranceToInsuranceGenerated(patientInfo.insuranceCompany), @@ -35,26 +34,25 @@ export class PatientService { } }; - return this._http.post( + return this._http.post( `${environment.apiUrl}/patient`, registration, - { headers } + { params } ).pipe( first() ).toPromise(); } - public async findPatientByPersonalNumber(personalNumber: string): Promise { + public async findPatientByPersonalNumber(personalNumber: string): Promise { const params = new HttpParams().set('personalNumber', personalNumber); - return this._http.get( - `${environment.apiUrl}/patient`, + return this._http.get( + `${environment.apiUrl}/admin/patient/single`, { params } ).pipe( map(data => { const questions = this._questionService.questions; - const patients = data.slice(0, 10); - return patients.map(patient => parsePatient(patient, questions)); + return parsePatient(data, questions); }) ).toPromise(); } diff --git a/frontend/src/app/services/question/question.service.ts b/frontend/src/app/services/question/question.service.ts index 3ae36a6b..ebb83bc0 100644 --- a/frontend/src/app/services/question/question.service.ts +++ b/frontend/src/app/services/question/question.service.ts @@ -28,7 +28,7 @@ export class QuestionService { localStorage.removeItem(this._questionKey); return this._http.get( - `${environment.apiUrl}/question` + `${environment.apiUrl}/questions` ).pipe( first(), map(response => { diff --git a/frontend/src/environments/environment.ts b/frontend/src/environments/environment.ts index a3532ec1..6bc45589 100644 --- a/frontend/src/environments/environment.ts +++ b/frontend/src/environments/environment.ts @@ -4,7 +4,7 @@ export const environment = { production: false, - apiUrl: 'http://localhost:8080/api', + apiUrl: 'https://covid-vaxx.stg.mild.blue/api', recaptchaSiteKey: '6LfyXXgaAAAAADNZwLK3hTMDb49Ol7yO5V-SuxVZ' };