mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
rewrite chat
This commit is contained in:
@@ -1,31 +0,0 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ChatService } from '../chat.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ChatMethodsService {
|
||||
|
||||
constructor(private chatService: ChatService) {
|
||||
}
|
||||
|
||||
sendMessage(roomId:string, data:any) {
|
||||
|
||||
let body = {
|
||||
"message":
|
||||
{
|
||||
"rid": roomId,
|
||||
"msg":"",
|
||||
"file":{
|
||||
"type": "application/meeting",
|
||||
"subject": data.subject,
|
||||
"start_date": data.start,
|
||||
"end_date": data.end,
|
||||
"venue": data.venue,
|
||||
"id": data.id,
|
||||
}
|
||||
}
|
||||
}
|
||||
this.chatService.sendMessage(body).subscribe(res=> {});
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -1,13 +1,13 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ChatMethodsService } from './chat-methods.service';
|
||||
import { ChatUserService } from './chat-user.service';
|
||||
|
||||
describe('ChatMethodsService', () => {
|
||||
let service: ChatMethodsService;
|
||||
describe('ChatUserService', () => {
|
||||
let service: ChatUserService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(ChatMethodsService);
|
||||
service = TestBed.inject(ChatUserService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
@@ -0,0 +1,9 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ChatUserService {
|
||||
|
||||
constructor() { }
|
||||
}
|
||||
@@ -1,9 +1,29 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { RoomService } from './room.service';
|
||||
import { RocketChatClientService } from 'src/app/services/socket/rocket-chat-client.service';
|
||||
import { MessageService } from 'src/app/services/chat/message.service'
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ChatService {
|
||||
|
||||
constructor() { }
|
||||
rooms: RoomService[] = []
|
||||
group = []
|
||||
|
||||
constructor(
|
||||
private RocketChatClientService: RocketChatClientService
|
||||
) {
|
||||
this.getAllRoomAndSubscribe()
|
||||
}
|
||||
|
||||
getAllRoomAndSubscribe() {
|
||||
this.RocketChatClientService.getRooms().then((rooms: any) => {
|
||||
rooms.result.update.forEach((roomData:any) => {
|
||||
const room = new RoomService(new RocketChatClientService(), new MessageService())
|
||||
room.setData({id: roomData.lastMessage.rid})
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,13 +1,13 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { MethodsService } from './methods.service';
|
||||
import { MessageService } from './message.service';
|
||||
|
||||
describe('MethodsService', () => {
|
||||
let service: MethodsService;
|
||||
describe('MessageService', () => {
|
||||
let service: MessageService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(MethodsService);
|
||||
service = TestBed.inject(MessageService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
@@ -0,0 +1,9 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class MessageService {
|
||||
|
||||
constructor() { }
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ChatService } from '../chat.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class MethodsService {
|
||||
|
||||
constructor(private chatService: ChatService) {
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,28 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { Injectable } from '@angular/core'
|
||||
import { RocketChatClientService } from 'src/app/services/socket/rocket-chat-client.service';
|
||||
import { MessageService } from 'src/app/services/chat/message.service'
|
||||
import { ChatUserService } from 'src/app/services/chat/chat-user.service'
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class RoomService {
|
||||
|
||||
constructor() { }
|
||||
massages: MessageService[] = []
|
||||
chatUser: ChatUserService[] = []
|
||||
id = []
|
||||
|
||||
constructor(
|
||||
private RocketChatClientService: RocketChatClientService,
|
||||
private MessageService: MessageService
|
||||
) {}
|
||||
|
||||
setData({id}){
|
||||
this.id= id
|
||||
}
|
||||
|
||||
create() {}
|
||||
sendMessage() {}
|
||||
deleteMessage() {}
|
||||
ReactToMessage() {}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user