mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
add chat to mobile
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { z } from 'zod';
|
||||
import { MessageRepositoryService } from '../../data/repository/message-respository.service';
|
||||
import { ValidateSchema } from 'src/app/services/decorators/validate-schema.decorator';
|
||||
import { SafeValidateSchema, ValidateSchema } from 'src/app/services/decorators/validate-schema.decorator';
|
||||
|
||||
export const MessageDeleteInputDTOSchema = z.object({
|
||||
requestId: z.string().optional(),
|
||||
@@ -20,7 +20,7 @@ export class MessageDeleteLiveUseCaseService {
|
||||
public repository: MessageRepositoryService
|
||||
) { }
|
||||
|
||||
@ValidateSchema(MessageDeleteInputDTOSchema)
|
||||
@SafeValidateSchema(MessageDeleteInputDTOSchema, 'MessageDeleteLiveUseCaseService')
|
||||
async execute(data: MessageDeleteInputDTO) {
|
||||
return this.repository.sendMessageDelete(data)
|
||||
}
|
||||
|
||||
+5
-2
@@ -1,6 +1,8 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { MessageLocalDataSourceService } from '../../../data/data-source/message/message-local-data-source.service';
|
||||
import { MessageOutPutDataDTO } from '../../../data/dto/message/messageOutputDTO';
|
||||
import { MessageOutPutDataDTO, MessageOutPutDataDTOSchema } from '../../../data/dto/message/messageOutputDTO';
|
||||
import { SafeValidateSchema, ValidateSchema } from 'src/app/services/decorators/validate-schema.decorator';
|
||||
import { MessageInputDTOSchema } from '../../../data/dto/message/messageInputDtO';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -12,6 +14,7 @@ export class SocketMessageUpdateUseCaseService {
|
||||
) { }
|
||||
|
||||
|
||||
@SafeValidateSchema(MessageOutPutDataDTOSchema, 'SocketMessageUpdateUseCaseService')
|
||||
async execute(data: MessageOutPutDataDTO) {
|
||||
const result = await this.messageLocalDataSourceService.messageExist({id: data.id})
|
||||
|
||||
@@ -23,7 +26,7 @@ export class SocketMessageUpdateUseCaseService {
|
||||
// delete data.chatRoomId
|
||||
|
||||
if(result.isOk()) {
|
||||
console.log('message exist', result.value)
|
||||
console.log('message exist', result.value, incomingMessage)
|
||||
return this.messageLocalDataSourceService.update(result.value.$id, incomingMessage)
|
||||
} else {
|
||||
console.log('message else')
|
||||
|
||||
Reference in New Issue
Block a user