mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
add contacts
This commit is contained in:
+9
-5
@@ -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});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+6
-4
@@ -1,8 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { RoomListItemOutPutDTO, RoomListOutPutDTO } from '../../dto/room/roomListOutputDTO';
|
||||
import { Dexie, EntityTable, liveQuery } from 'Dexie';
|
||||
import { Dexie, EntityTable, liveQuery, Observable } from 'Dexie';
|
||||
import { err, ok } from 'neverthrow';
|
||||
import { Observable } from 'rxjs';
|
||||
import { z } from 'zod';
|
||||
import { UserList } from '../../../contacts/data-source/contacts-data-source.service';
|
||||
|
||||
@@ -114,8 +113,11 @@ export class RoomLocalDataSourceService {
|
||||
return liveQuery(() => roomDataSource.room.get(id)) as any;
|
||||
}
|
||||
|
||||
getRoomMemberByIdLive(roomId: any): Observable<TableMemberList[] | undefined> {
|
||||
return liveQuery(() => roomDataSource.memberList.where('roomId').equals(roomId).toArray()) as any;
|
||||
async getRoomMemberById(roomId: any) {
|
||||
return await roomDataSource.memberList.where('roomId').equals(roomId).toArray()
|
||||
}
|
||||
getRoomMemberByIdLive(roomId: any) {
|
||||
return liveQuery(() => roomDataSource.memberList.where('roomId').equals(roomId).toArray())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user