add error message

This commit is contained in:
Peter Maquiran
2024-06-11 11:46:04 +01:00
parent f3232c835d
commit fe51b38257
27 changed files with 675 additions and 478 deletions
@@ -23,19 +23,19 @@ export class RoomRemoteDataSourceService {
@ValidateSchema(RoomInputDTOSchema)
@APIReturn(RoomOutPutDTOSchema)
@APIReturn(RoomOutPutDTOSchema, 'post/Room')
async createRoom(data: RoomInputDTO): DataSourceReturn<RoomOutPutDTO> {
return await this.httpService.post<RoomOutPutDTO>(`${this.baseUrl}/Room`, data);
}
@APIReturn(RoomListOutPutDTOSchema)
@APIReturn(RoomListOutPutDTOSchema, 'get/Room')
async getRoomList(): Promise<DataSourceReturn<RoomListOutPutDTO>> {
return await this.httpService.get<RoomListOutPutDTO>(`${this.baseUrl}/Room`);
}
@ValidateSchema(RoomByIdInputDTOSchema)
@APIReturn(RoomByIdOutputDTOSchema)
@APIReturn(RoomByIdOutputDTOSchema,'get/Room/${id}')
async getRoom(id: RoomByIdInputDTO): DataSourceReturn<RoomByIdOutputDTO> {
return await this.httpService.get(`${this.baseUrl}/Room/${id}`);
}
@@ -58,6 +58,16 @@ export class RoomLocalDataSourceService {
}
}
async deleteRoomById(id: string) {
try {
const result = await roomDataSource.room.delete(id)
return ok(result)
} catch (e) {
return err(false)
}
}
async updateRoom(data: TableRoom) {
try {
const result = await roomDataSource.room.update(data.id, data);