mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
add message repository
This commit is contained in:
+28
@@ -0,0 +1,28 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpService } from 'src/app/services/http.service';
|
||||
import { MessageOutPutDTO } from '../../dto/message/messageOutputDTO';
|
||||
import { MessageListInputDTO } from '../../dto/message/messageListInputDTO';
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class MessageRemoteDataSourceService {
|
||||
|
||||
private baseUrl = 'https://gdapi-dev.dyndns.info/stage/api/v2/Chat'; // Your base URL
|
||||
|
||||
constructor(private httpService: HttpService) {}
|
||||
|
||||
|
||||
async sendMessage(message: any) {
|
||||
return await this.httpService.post<any>(`${this.baseUrl}/Messages`, message);
|
||||
}
|
||||
|
||||
async reactToMessage(id: string, reaction: any) {
|
||||
return await this.httpService.post<any>(`${this.baseUrl}/Messages/${id}/React`, reaction);
|
||||
}
|
||||
|
||||
async getMessagesFromRoom(id: MessageListInputDTO) {
|
||||
return await this.httpService.get<MessageOutPutDTO>(`${this.baseUrl}/Room/${id}/Messages`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user