From ed2761d90aa876002457da5a23701923c7b35e3e Mon Sep 17 00:00:00 2001 From: Cyril Joseph Date: Wed, 17 Sep 2025 21:51:32 -0300 Subject: [PATCH] db switcher updates --- src/app/core/services/carnet/carnet.service.ts | 2 +- src/app/core/services/common/auth.service.ts | 13 +++++++------ src/environments/environment.development.ts | 2 +- src/environments/environment.ts | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/app/core/services/carnet/carnet.service.ts b/src/app/core/services/carnet/carnet.service.ts index 642dba9..f673f32 100644 --- a/src/app/core/services/carnet/carnet.service.ts +++ b/src/app/core/services/carnet/carnet.service.ts @@ -69,7 +69,7 @@ export class CarnetService { const data = { P_SPID: this.userService.getUserSpid(), P_HEADERID: headerid, - P_PRINTGL: 'N' + P_PRINTGL: 'Y' } return this.http.post(`${this.apiUrl}/${this.apiDb}/PrintCarnet`, data, { responseType: 'blob', // Important: Set responseType to 'blob' diff --git a/src/app/core/services/common/auth.service.ts b/src/app/core/services/common/auth.service.ts index 2d7f032..1cd468f 100644 --- a/src/app/core/services/common/auth.service.ts +++ b/src/app/core/services/common/auth.service.ts @@ -15,6 +15,7 @@ import { ApiErrorHandlerService } from './api-error-handler.service'; export class AuthService { private apiUrl = environment.apiUrl; private applicationName = environment.appType; + private apiDb = environment.apiDb; private http = inject(HttpClient); private userService = inject(UserService); @@ -25,16 +26,16 @@ export class AuthService { private errorHandler = inject(ApiErrorHandlerService); login(username: string, password: string): Observable { - return this.http.post(`${this.apiUrl}/login`, { p_emailaddr: username, p_password: password, P_APPLICATIONNAME: this.applicationName }); + return this.http.post(`${this.apiUrl}/${this.apiDb}/login`, { p_emailaddr: username, p_password: password, P_APPLICATIONNAME: this.applicationName }); } refreshToken(): Observable { - return this.http.get(`${this.apiUrl}/refresh-tokens`, {}); + return this.http.get(`${this.apiUrl}/${this.apiDb}/refresh-tokens`, {}); } logout(): void { if (this.userService.isLoggedIn()) { - this.http.post(`${this.apiUrl}/logout`, {}).subscribe({ + this.http.post(`${this.apiUrl}/${this.apiDb}/logout`, {}).subscribe({ next: (response) => { this.userService.clearUser(); this.storageService.clear(); @@ -53,7 +54,7 @@ export class AuthService { register(email: string, password: string): Observable { return this.http.post( - `${this.apiUrl}/register`, + `${this.apiUrl}/${this.apiDb}/register`, { P_EMAILADDR: email, P_PASSWORD: password } ); } @@ -66,7 +67,7 @@ export class AuthService { } return this.http.put( - `${this.apiUrl}/forgot-password`, + `${this.apiUrl}/${this.apiDb}/forgot-password`, { P_EMAILADDR: email, P_PASSWORD: password }, { headers } ); @@ -74,7 +75,7 @@ export class AuthService { sendEmail(email: string, type: string): Observable { return this.http.post( - `${this.apiUrl}/sendmail`, + `${this.apiUrl}/${this.apiDb}/sendmail`, { P_TO: email, P_MAIL_TYPE: type } ); } diff --git a/src/environments/environment.development.ts b/src/environments/environment.development.ts index 3e9903f..402c96a 100644 --- a/src/environments/environment.development.ts +++ b/src/environments/environment.development.ts @@ -1,6 +1,6 @@ export const environment = { production: false, apiUrl: 'https://dev.alphaomegainfosys.com/test-api', - apiDb: 'oracle', + apiDb: '1', appType: 'client', }; diff --git a/src/environments/environment.ts b/src/environments/environment.ts index c6d71ac..e5a385b 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -1,6 +1,6 @@ export const environment = { production: true, apiUrl: 'https://dev.alphaomegainfosys.com/test-api', - apiDb: 'oracle', + apiDb: '1', appType: 'client', }; \ No newline at end of file