add interface

This commit is contained in:
Peter Maquiran
2024-08-27 20:29:57 +01:00
parent 6c0a15fb7c
commit ee30dd2d5b
43 changed files with 470 additions and 221 deletions
@@ -2,7 +2,29 @@ import { Injectable, Input } from '@angular/core';
import { MessageLocalDataSourceService } from '../../../data/repository/message/message-local-data-source.service';
import { TracingType, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
import { ParamsValidation } from 'src/app/services/decorators/validate-schema.decorator';
import { MessageOutPutDataDTOSchema } from '../../../data/dto/message/messageOutputDTO';
import { MessageEntitySchema } from 'src/app/core/chat/entity/message';
import { z } from 'zod';
const SocketMessageCreateOutputSchema = MessageEntitySchema.pick({
id: true,
attachments: true,
canEdit: true,
editedAt: true,
info: true,
isDeleted: true,
message: true,
messageType: true,
oneShot: true,
reactions: true,
receiverId: true,
requireUnlock: true,
roomId: true,
sender: true,
sending: true,
sentAt: true,
})
export type ISocketMessageCreateOutput = z.infer<typeof SocketMessageCreateOutputSchema>
@Injectable({
providedIn: 'root'
@@ -14,9 +36,9 @@ export class SocketMessageCreateUseCaseService {
) { }
@XTracerAsync({name:'Socket-Message-Create-UseCase', module:'chat', bugPrint: true})
async execute(input: any, tracing?: TracingType) {
async execute(input: ISocketMessageCreateOutput, tracing?: TracingType) {
ParamsValidation(MessageOutPutDataDTOSchema, input, tracing)
ParamsValidation(SocketMessageCreateOutputSchema, input, tracing)
const incomingMessage = {
...input,