add repository patter for chat

This commit is contained in:
Peter Maquiran
2024-06-04 09:31:37 +01:00
parent f7d8059f45
commit c057606852
24 changed files with 416 additions and 257 deletions
@@ -1,15 +1,16 @@
import { Injectable } from '@angular/core';
import { ok, err, Result } from 'neverthrow';
import { HttpService } from 'src/app/services/http.service';
import { RoomListOutPutDTO } from '../dto/roomOutputDTO';
import { RoomListOutPutDTO } from '../dto/roomListOutputDTO';
import { RoomListInputDTO } from '../dto/roomInputDTO';
import { RoomOutPutDTO } from '../dto/roomOutputDTO';
@Injectable({
providedIn: 'root'
})
export class RoomRemoteDataSourceService {
private baseUrl = 'https://gdapi-dev.dyndns.info/stage/api/v2'; // Your base URL
private baseUrl = 'https://gdapi-dev.dyndns.info/stage/api/v2/Chat'; // Your base URL
constructor(private httpService: HttpService) {}
@@ -21,11 +22,10 @@ export class RoomRemoteDataSourceService {
return await this.httpService.post<any>(`${this.baseUrl}/Messages/${id}/React`, reaction);
}
async createRoom(room: any): Promise<Result<any ,any>> {
return await this.httpService.post<any>(`${this.baseUrl}/Room`, room);
async createRoom(data: RoomListInputDTO): Promise<Result<RoomOutPutDTO ,any>> {
return await this.httpService.post<any>(`${this.baseUrl}/Room`, data);
}
async getRoomList(): Promise<Result<RoomListOutPutDTO ,any>> {
return await this.httpService.get<any>(`${this.baseUrl}/Room`);
}