Files
doneit-web/src/app/module/user/data/datasource/user-remote-repository.service.ts
T

53 lines
1.7 KiB
TypeScript
Raw Normal View History

import { Injectable } from '@angular/core';
import { HttpService } from 'src/app/services/http.service';
import { environment } from 'src/environments/environment';
import { IProfilePictureInputDTO } from '../dto/profilePictureInputDTO';
import { HttpHeaders } from '@angular/common/http';
2024-07-31 09:35:35 +01:00
import { TracingType } from 'src/app/services/monitoring/opentelemetry/tracer';
2024-11-06 09:13:36 +01:00
import { HttpAdapter } from 'src/app/infra/http/adapter';
import { IUserRepositoryLoginParams } from 'src/app/core/user/repository/user-remote-repository';
import { UserLoginOutput } from 'src/app/core/user/use-case/user-login-use-case.service';
@Injectable({
providedIn: 'root'
})
export class UserRemoteRepositoryService {
2024-11-06 09:13:36 +01:00
private baseUrl = 'https://gdapi-dev.dyndns.info/stage/api/v2'; // Your base URL
constructor(
2024-11-06 09:13:36 +01:00
private httpService: HttpService,
private http: HttpAdapter,
) { }
2024-11-06 09:13:36 +01:00
// @APIReturn(MessageOutPutDTOSchema, 'get/Messages')
async login(input: IUserRepositoryLoginParams) {
return await this.http.post<UserLoginOutput>(`${this.baseUrl}/Users/login`, input)
}
2024-07-31 09:35:35 +01:00
getUserProfilePhoto(guid: string, tracing?: TracingType) {
const geturl = environment.apiURL + 'UserAuthentication/GetPhoto';
2024-07-31 09:35:35 +01:00
const params = {
UserPhoto: guid
}
2024-07-31 09:35:35 +01:00
return this.httpService.get<string>(`${geturl}`, params, tracing);
}
addUserProfilePhoto(data: IProfilePictureInputDTO) {
const geturl = environment.apiURL + 'UserAuthentication/AddPhoto';
let http = new HttpHeaders();
http = http.set('content-type', "application/json");
http = http.set('accept', "application/json");
let options = {
headers: http
};
2024-07-31 09:35:35 +01:00
return this.httpService.post<string>(`${geturl}`, data, options);
}
}