mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
34 lines
732 B
TypeScript
34 lines
732 B
TypeScript
import { Injectable, Input } from '@angular/core';
|
|
import { MessageLocalDataSourceService } from '../../../data/data-source/message/message-local-data-source.service';
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class SocketMessageCreateUseCaseService {
|
|
|
|
constructor(
|
|
private messageLocalDataSourceService: MessageLocalDataSourceService,
|
|
) { }
|
|
|
|
async execute(input: any) {
|
|
|
|
const id = input.id + ''
|
|
delete input.id;
|
|
|
|
const incomingMessage = {
|
|
...input,
|
|
messageId: id,
|
|
sending: false,
|
|
roomId:input.chatRoomId
|
|
}
|
|
|
|
const result = await this.messageLocalDataSourceService.sendMessage(incomingMessage)
|
|
|
|
if(result.isOk()) {
|
|
|
|
} else {
|
|
console.log(result.error)
|
|
}
|
|
}
|
|
}
|