Skip to content

Commit

Permalink
dfdf
Browse files Browse the repository at this point in the history
  • Loading branch information
Dobrunia committed Nov 19, 2023
1 parent 54eeac4 commit 7e1af96
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion services/chat-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export async function writeNewUserInChat(DATA) {

export async function returnMessages(chatId) {
const results = await conn.query<RowDataPacket[]>(
'SELECT m.*, u.id as userId, u.username, u.email, u.avatar, u.permission FROM `messages`AS m LEFT JOIN users AS u ON u.Id = m.sendBy WHERE `chatID` = ? ORDER BY `datetime` ASC',
'SELECT m.*, u.id as userId, u.username, u.email, u.avatar, u.status, u.permission FROM `messages`AS m LEFT JOIN users AS u ON u.Id = m.sendBy WHERE `chatID` = ? ORDER BY `datetime` ASC',
[chatId],
);
return results[0].map((u) => {
Expand Down
12 changes: 6 additions & 6 deletions socket/socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ export function initSocket(app) {
chatId: to,
datetime: new Date(),
};
let notifData = {
user_id_from: (socket as any).userId,
chat_id_to: to,
message_content: content,
}
// let notifData = {
// user_id_from: (socket as any).userId,
// chat_id_to: to,
// message_content: content,
// }
await saveMessageToDb(DATA);
await saveNewMessageNotification(notifData);
//await saveNewMessageNotification(notifData);
io.to(to.toString()).emit('private message', {
content,
from: (socket as any).userId,
Expand Down

0 comments on commit 7e1af96

Please sign in to comment.