-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnotes.txt
More file actions
23 lines (18 loc) · 878 Bytes
/
notes.txt
File metadata and controls
23 lines (18 loc) · 878 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Ao criar um chat entre dois usuários, criar um simples algoritmo que verifique qual usuário tem o
maior ID para que assim se crie o nome do chat com a junção desses 2 IDs separados por *//* na chave
*nameWhen2Users*, por exemplo:
userID-1: 1234 --> Menor
userId-2: 1235 --> Maior
logo, 1235 > 1234
então, nameWhen2Users = '1235//1234'
// if (!chatName) {
// const privateChatusers = [];
// privateChatusers.push(fromUuid, toUuid);
// privateChatusers.sort();
// if (privateChatusers.length > 2) return res.status(StatusCodes.INTERNAL_SERVER_ERROR).json({
// message: 'Something went wrong',
// status: 500
// });
// chatName = `${privateChatusers[0]}//${privateChatusers[1]}`;
// }
PENSAR MELHOR EM COMO CADASTRAR USUÁRIOS, MESSAGENS E CHATS LEVANDO EM CONSIDERAÇÃO A EMISSÃO DE EVENTOS DO SOCKETIO