receive error when sending message on offline

This commit is contained in:
Peter Maquiran
2024-08-07 11:18:41 +01:00
parent 95a6d01aae
commit b0a334c9dd
10 changed files with 132 additions and 51 deletions
@@ -0,0 +1,33 @@
import { Injectable } from '@angular/core';
import { MessageEntity } from '../entity/message';
import { SessionStore } from 'src/app/store/session.service';
import { MessageRepositoryService } from "src/app/module/chat/data/repository/message-respository.service"
import { z } from 'zod';
const MessageInputUseCaseSchema = z.object({
memberId: z.number(),
roomId: z.string(),
message: z.string()
})
export type MessageInputUseCase = z.infer< typeof MessageInputUseCaseSchema>
@Injectable({
providedIn: 'root'
})
export class MessageCreateUseCaseService {
constructor(
private MessageRepositoryService: MessageRepositoryService
) { }
async execute(input: MessageEntity) {
input.sendAttemp++;
const result = await this.MessageRepositoryService.sendMessage(input)
return result
}
}