mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
39 lines
692 B
TypeScript
39 lines
692 B
TypeScript
import { Injectable } from '@angular/core';
|
|
import { err, ok } from 'neverthrow';
|
|
import { SignalRService } from '../../../infra/socket/signal-r.service';
|
|
|
|
|
|
interface msgObj {
|
|
roomId: string;
|
|
senderId: string;
|
|
message:string;
|
|
messageType:1;
|
|
canEdit:Boolean;
|
|
oneShot:Boolean;
|
|
requestId: string;
|
|
}
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class MessageLiveDataSourceService {
|
|
|
|
constructor(
|
|
private messageLiveSignalRDataSourceService: SignalRService
|
|
) {}
|
|
|
|
async sendMessage(data: msgObj) {
|
|
|
|
try {
|
|
|
|
const result = await this.messageLiveSignalRDataSourceService.sendMessage(data)
|
|
|
|
return ok(result)
|
|
} catch (e) {
|
|
return err(e)
|
|
}
|
|
|
|
}
|
|
|
|
}
|