Files
doneit-web/src/app/module/chat/domain/use-case/message-delete-by-id-live-use-case.service.ts
T

30 lines
1011 B
TypeScript
Raw Normal View History

2024-07-31 17:23:44 +01:00
import { Injectable } from '@angular/core';
import { z } from 'zod';
2024-08-08 11:44:41 +01:00
import { SafeValidateSchema, ValidateSchema } from 'src/app/services/decorators/validate-schema.decorator';
2024-08-19 16:01:58 +01:00
import { MessageRemoteDataSourceService } from '../../data/repository/message/message-remote-data-source.service';
import { MessageSocketRepositoryService } from '../../data/repository/message/message-live-signalr-data-source.service';
2024-07-31 17:23:44 +01:00
export const MessageDeleteInputDTOSchema = z.object({
2024-08-06 11:24:00 +01:00
requestId: z.string().optional(),
2024-07-31 17:23:44 +01:00
roomId: z.string(),
messageId: z.string(),
senderId: z.number(),
});
export type MessageDeleteInputDTO = z.infer<typeof MessageDeleteInputDTOSchema>
@Injectable({
providedIn: 'root'
})
export class MessageDeleteLiveUseCaseService {
constructor(
2024-08-19 16:01:58 +01:00
public repository: MessageSocketRepositoryService
2024-07-31 17:23:44 +01:00
) { }
2024-08-09 10:50:32 +01:00
@SafeValidateSchema(MessageDeleteInputDTOSchema, 'MessageDeleteUseCaseService')
2024-07-31 17:23:44 +01:00
async execute(data: MessageDeleteInputDTO) {
return this.repository.sendMessageDelete(data)
}
}