list room

This commit is contained in:
Peter Maquiran
2024-06-05 11:09:03 +01:00
parent 2e9492db68
commit 1a319093ee
6 changed files with 32 additions and 8 deletions
@@ -23,8 +23,8 @@ export class RoomRemoteDataSourceService {
return await this.httpService.post<RoomOutPutDTO>(`${this.baseUrl}/Room`, data);
}
async getRoomList(): Promise<Result<RoomListOutPutDTO ,any>> {
return await this.httpService.get<any>(`${this.baseUrl}/Room`);
async getRoomList(): Promise<DataSourceReturn<RoomListOutPutDTO>> {
return await this.httpService.get<RoomListOutPutDTO>(`${this.baseUrl}/Room`);
}
async getRoom(id: string): Promise<Result<any ,any>> {
@@ -28,6 +28,16 @@ roomDataSource.version(1).stores({
room: '++id, createdBy, roomName, roomType, expirationDate'
});
interface CreateRoomParams {
id?: string;
roomName?: string;
createdBy?: any;
createdAt?: Date;
expirationDate?: Date;
roomType?: any;
}
@Injectable({
providedIn: 'root'
})
@@ -38,10 +48,10 @@ export class RoomLocalDataSourceService {
constructor() {}
async createRoom(data: RoomOutPutDTO) {
async createRoom(data: CreateRoomParams) {
try {
const result = await roomDataSource.room.add(data.data)
const result = await roomDataSource.room.add(data)
return ok(result)
} catch (e) {
return err(false)