add contacts

This commit is contained in:
Peter Maquiran
2024-06-10 16:34:43 +01:00
parent 193e7474e9
commit bf1457417d
23 changed files with 348 additions and 481 deletions
@@ -3,13 +3,14 @@ import { Result } from 'neverthrow';
import { HttpService } from 'src/app/services/http.service';
import { RoomListOutPutDTO, RoomListOutPutDTOSchema } from '../../dto/room/roomListOutputDTO';
import { RoomInputDTO, RoomInputDTOSchema } from '../../dto/room/roomInputDTO';
import { RoomOutPutDTO } from '../../dto/room/roomOutputDTO';
import { RoomOutPutDTO, RoomOutPutDTOSchema } from '../../dto/room/roomOutputDTO';
import { AddMemberToRoomInputDTO, AddMemberToRoomInputDTOSchema } from '../../dto/room/addMemberToRoomInputDto';
import { ValidateSchema } from 'src/app/services/decorators/validate-schema.decorator';
import { DataSourceReturn } from '../../../type';
import { RoomByIdInputDTO, RoomByIdInputDTOSchema } from '../../dto/room/roomByIdInputDTO';
import { RoomByIdOutputDTO, RoomByIdOutputDTOSchema } from '../../dto/room/roomByIdOutputDTO';
import { APIReturn } from 'src/app/services/decorators/api-validate-schema.decorator';
import { UserRemoveListInputDTO, UserRemoveListInputDTOSchema } from '../../dto/room/userRemoveListInputDTO';
@Injectable({
providedIn: 'root'
@@ -22,6 +23,7 @@ export class RoomRemoteDataSourceService {
@ValidateSchema(RoomInputDTOSchema)
@APIReturn(RoomOutPutDTOSchema)
async createRoom(data: RoomInputDTO): DataSourceReturn<RoomOutPutDTO> {
return await this.httpService.post<RoomOutPutDTO>(`${this.baseUrl}/Room`, data);
}
@@ -43,16 +45,18 @@ export class RoomRemoteDataSourceService {
}
async deleteRoom(id: string): Promise<Result<any ,any>> {
return await this.httpService.delete<any>(`${this.baseUrl}/Room/${id}`);
return await this.httpService.delete<any>(`${this.baseUrl}/Room/${id}`, {});
}
@ValidateSchema(AddMemberToRoomInputDTOSchema)
async addMemberToRoom(data: AddMemberToRoomInputDTO): DataSourceReturn<AddMemberToRoomInputDTO> {
return await this.httpService.post<any>(`${this.baseUrl}/Room/${data.id}/Member`, data.member);
return await this.httpService.post<any>(`${this.baseUrl}/Room/${data.id}/Member`, { members:data.members });
}
async removeMemberFromRoom(id: string, member: any): Promise<Result<any ,any>> {
return await this.httpService.delete<any>(`${this.baseUrl}/Room/${id}/Member`);
@ValidateSchema(UserRemoveListInputDTOSchema)
async removeMemberFromRoom(data: UserRemoveListInputDTO): Promise<Result<any ,any>> {
return await this.httpService.delete<any>(`${this.baseUrl}/Room/${data.id}/Member`, {members:data.members});
}
}