mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
set member to admin
This commit is contained in:
+31
@@ -0,0 +1,31 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { z } from 'zod';
|
||||
import { RoomRepositoryService } from 'src/app/module/chat/data/repository/room-repository.service'
|
||||
import { ValidateSchema } from 'src/app/services/decorators/validate-schema.decorator';
|
||||
|
||||
export const MemberListUPdateStatus = z.object({
|
||||
key: z.string(),
|
||||
value: z.object({
|
||||
userId: z.number(),
|
||||
userName: z.string()
|
||||
})
|
||||
}).array();
|
||||
export type MemberListUPdateStatusInputDTO = z.infer<typeof MemberListUPdateStatus>
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class MemberListUpdateStatusUseCaseService {
|
||||
|
||||
constructor(
|
||||
private RoomRepositoryService: RoomRepositoryService
|
||||
) { }
|
||||
|
||||
|
||||
@ValidateSchema(MemberListUPdateStatus)
|
||||
execute(input: MemberListUPdateStatusInputDTO) {
|
||||
console.log
|
||||
return this.RoomRepositoryService.updateMemberStatus(input)
|
||||
}
|
||||
}
|
||||
+2
-4
@@ -12,16 +12,14 @@ export class SocketMessageCreateUseCaseService {
|
||||
|
||||
async execute(input: any) {
|
||||
|
||||
const id = input.id + ''
|
||||
delete input.id;
|
||||
|
||||
const incomingMessage = {
|
||||
...input,
|
||||
messageId: id,
|
||||
sending: false,
|
||||
roomId:input.chatRoomId
|
||||
}
|
||||
|
||||
delete input.chatRoomId
|
||||
|
||||
const result = await this.messageLocalDataSourceService.sendMessage(incomingMessage)
|
||||
|
||||
if(result.isOk()) {
|
||||
|
||||
+3
-6
@@ -13,19 +13,16 @@ export class SocketMessageUpdateUseCaseService {
|
||||
|
||||
|
||||
async execute(data: MessageOutPutDataDTO) {
|
||||
const result = await this.messageLocalDataSourceService.messageExist({messageId: data.id})
|
||||
|
||||
|
||||
const id = data.id + ''
|
||||
delete data.id;
|
||||
const result = await this.messageLocalDataSourceService.messageExist({id: data.id})
|
||||
|
||||
const incomingMessage = {
|
||||
...data,
|
||||
messageId: id,
|
||||
sending: false,
|
||||
roomId:data.chatRoomId
|
||||
}
|
||||
|
||||
// delete data.chatRoomId
|
||||
|
||||
if(result.isOk()) {
|
||||
console.log('message exist')
|
||||
return this.messageLocalDataSourceService.update({...result.value, ...incomingMessage})
|
||||
|
||||
Reference in New Issue
Block a user