merge made with feature/gabinete-search branch

This commit is contained in:
Eudes Inácio
2023-07-12 10:30:16 +01:00
1464 changed files with 11496 additions and 187 deletions
+30 -4
View File
@@ -20,6 +20,7 @@ import { PermissionService } from './permission.service';
import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { captureException } from '@sentry/angular';
import { CPSession } from '../store/documentManagement';
@Injectable({
providedIn: 'root'
})
@@ -32,7 +33,7 @@ export class AuthService {
opts:any;
tabIsActive = true
constructor(
private http: HttpClient,
private storageService:StorageService,
@@ -77,9 +78,6 @@ export class AuthService {
async login(user: UserForm, {saveSession = true}): Promise<LoginUserRespose> {
user.BasicAuthKey = 'Basic ' + btoa(user.username + ':' + this.aesencrypt.encrypt(user.password,user.username ));
// Basic peter.maquiran@equilibrium.co.ao:senha123456
// console.log(user.BasicAuthKey)
this.headers = this.headers.set('Authorization', user.BasicAuthKey);
this.opts = {
headers: this.headers,
@@ -104,6 +102,34 @@ export class AuthService {
}
async loginContenteProduction(user: UserForm, {saveSession = true}): Promise<LoginUserRespose> {
user.BasicAuthKey = 'Basic ' + btoa(user.username + ':' + this.aesencrypt.encrypt(user.password,user.username ));
this.headers = this.headers.set('Authorization', user.BasicAuthKey);
this.opts = {
headers: this.headers,
}
let response: any;
try {
response = await this.http.post<LoginUserRespose>(environment.apiURL + "UserAuthentication/LoginJwt", '', this.opts).toPromise();
console.log('JWT',response)
if(saveSession) {
/* this.SetSession(response, user) */
console.log('teste', response);
CPSession.save(response)
}
} catch (error) {
this.httpErroHandle.httpStatusHandle(error)
} finally {
return response
}
}
// async UpdateLogin() {}
SetSession(response: LoginUserRespose, user:UserForm) {
+2 -2
View File
@@ -882,13 +882,13 @@ export class RoomService {
private async findMessageInDBByData({localReference, _id}) {
const a = await MessageModel.filter({localReference: localReference})
const a = await MessageModel.filter({localReference: localReference}).execute()
if(a.length >= 1) {
return true
}
const c = await MessageModel.filter({_id: _id})
const c = await MessageModel.filter({_id: _id}).execute()
if(c.length >= 1) {
return true
@@ -146,6 +146,12 @@ export class HttpErrorHandle {
case 'Aprovar exp':
this.toastService._successMessage('Expediente enviado!');
break;
case 'Draft Save':
this.toastService._successMessage('Rascunho salvo!');
break;
case 'Draft Concluído':
this.toastService._successMessage('Documento Concluído!');
break;
default:
this.toastService._successMessage('Processo efetuado!')
+40
View File
@@ -10,6 +10,7 @@ import { GetTasksListType } from '../models/GetTasksListType';
import { fullTaskList } from '../models/dailyworktask.model';
import { ChangeProfileService } from './change-profile.service';
import { SessionStore } from '../store/session.service';
import { CPSession } from '../store/documentManagement';
@Injectable({
providedIn: 'root'
})
@@ -18,6 +19,9 @@ export class ProcessesService {
authheader = {};
loggeduser: LoginUserRespose;
headers: HttpHeaders;
headers2: HttpHeaders;
constructor(
private http: HttpClient,
@@ -32,13 +36,22 @@ export class ProcessesService {
this.setHeader()
})
}
setHeader() {
this.headers = new HttpHeaders();
this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey);
this.headers2 = new HttpHeaders();
this.headers2 = this.headers2.set('Authorization',"Bearer "+ CPSession.AuthorizationJwt);
}
uploadFile(formData:any){
@@ -107,6 +120,7 @@ export class ProcessesService {
}
GetTask(serialnumber:string): Observable<any> {
const geturl = environment.apiURL + 'Tasks/FindTask';
let params = new HttpParams();
@@ -119,6 +133,32 @@ export class ProcessesService {
return this.http.get<any>(`${geturl}`, options);
}
GetDraftByID(id:string): Observable<any> {
const geturl = environment.apiPCURL + `Documents/${id}`;
let params = new HttpParams();
/* params = params.set("serialNumber", serialnumber); */
let options = {
headers: this.headers2,
/* params: params */
};
return this.http.get<any>(`${geturl}`, options);
}
SaveDraftByID(id:string, object): Observable<any> {
const geturl = environment.apiPCURL + `Documents/${id}`;
let params = new HttpParams();
/* params = params.set("serialNumber", serialnumber); */
let options = {
headers: this.headers2,
/* params: params */
};
return this.http.put<any>(`${geturl}`, object, options);
}
SetTaskToPending(serialNumber:string): Observable<any>{
const geturl = environment.apiURL + 'Tasks/SetTaskPending';