Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#187419198 User should interact with each others via chats publicly #48

Merged
merged 1 commit into from
May 15, 2024

Conversation

niyobertin
Copy link
Collaborator

@niyobertin niyobertin commented May 9, 2024

What does this PR do?

Have chats room to interact with each other to ask information publicly.
Description of Task to be completed?

Have the following end point
GET: /api/v1/messages
How should this be manually tested?
After cloning the repo, cd into it and run npm run dev to start the server.

Any background context you want to provide?
when a user send a message it will be echoed to all online users

What are the relevant pivotal tracker stories?

[Delivers #187419198]

public/client.js Outdated
</li>
`
chatsRoom.innerHTML += element;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon.

}

const addMessageToUi = (isOwner,data) =>{
const element = `
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
'template literal syntax' is only available in ES6 (use 'esversion: 6').

active.innerHTML += element;
}

const addMessageToUi = (isOwner,data) =>{
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').
'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

public/client.js Outdated
</li>
`
active.innerHTML += element;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon.

public/client.js Outdated
active.innerHTML += element;
}
const onDisConnect = () =>{
const element = `
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
'template literal syntax' is only available in ES6 (use 'esversion: 6').

public/client.js Outdated
});
});

const onConnected = () =>{
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').
'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

const messagesList = document.getElementById("messages");
messagesList.innerHTML = "";

messages.forEach((msg) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

public/client.js Show resolved Hide resolved
public/client.js Show resolved Hide resolved
public/client.js Show resolved Hide resolved
src/routes/chatRoutes.ts Outdated Show resolved Hide resolved
src/utils/server.ts Outdated Show resolved Hide resolved
public/client.js Show resolved Hide resolved
public/client.js Show resolved Hide resolved
public/client.js Show resolved Hide resolved
public/client.js Outdated
const sender = userNameInput.value;
const message = messageInput.value;

socket.emit('chat message', { sender, message });
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'object short notation' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

form.addEventListener("submit", (e) => {
e.preventDefault();
const sender = userNameInput.value;
const message = messageInput.value;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

const form = document.getElementById('send-message');
const messageInput = document.getElementById("message-input");
const userNameInput = document.getElementById("user-name");
const chatsRoom = document.getElementById("messages");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

const socket = io();
const form = document.getElementById('send-message');
const messageInput = document.getElementById("message-input");
const userNameInput = document.getElementById("user-name");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

@@ -0,0 +1,74 @@
const socket = io();
const form = document.getElementById('send-message');
const messageInput = document.getElementById("message-input");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

@@ -0,0 +1,74 @@
const socket = io();
const form = document.getElementById('send-message');
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

@@ -0,0 +1,74 @@
const socket = io();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

connectedClients.innerHTML = clients;
});

socket.on('connected client',(clients) =>{
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

console.log('Connected to server');
});

socket.on('dis connected client', (clients) =>{
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

messageInput.value = '';
});

socket.on('connect', () => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

public/client.js Outdated
const sender = userNameInput.value;
const message = messageInput.value;

socket.emit('chat message', { sender, message });
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'object short notation' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

form.addEventListener("submit", (e) => {
e.preventDefault();
const sender = userNameInput.value;
const message = messageInput.value;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

@@ -0,0 +1,74 @@
const socket = io();
const form = document.getElementById('send-message');
const messageInput = document.getElementById("message-input");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

@@ -0,0 +1,74 @@
const socket = io();
const form = document.getElementById('send-message');
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

@@ -0,0 +1,74 @@
const socket = io();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

allowNull: false,
type: Sequelize.DATE
}
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrecoverable syntax error. (83% scanned).

/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.createTable('messages', {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected an assignment or function call and instead saw an expression.
Missing semicolon.

'use strict';
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected ':' and instead saw 'up'.
Expected '}' to match '{' from line 3 and instead saw '{'.
Missing semicolon.

@@ -0,0 +1,31 @@
'use strict';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the function form of "use strict".

Copy link

render bot commented May 10, 2024

@codecov-commenter
Copy link

codecov-commenter commented May 10, 2024

Codecov Report

Attention: Patch coverage is 51.25000% with 39 lines in your changes are missing coverage. Please review.

Project coverage is 76.73%. Comparing base (daaae6b) to head (0d3b882).

Files Patch % Lines
src/controllers/chatsController.ts 26.31% 14 Missing ⚠️
src/services/chatServices.ts 17.64% 14 Missing ⚠️
src/config/socketCofing.ts 35.71% 9 Missing ⚠️
src/services/categories.services.ts 50.00% 1 Missing ⚠️
src/services/product.service.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev      #48      +/-   ##
==========================================
- Coverage   79.28%   76.73%   -2.56%     
==========================================
  Files          66       73       +7     
  Lines        1178     1255      +77     
  Branches      176      188      +12     
==========================================
+ Hits          934      963      +29     
- Misses        244      292      +48     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@yvanddniyo yvanddniyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@MugemaneBertin2001 MugemaneBertin2001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

-an active user when joins the chat should be able to read the past
message
-an active user should be able to post publlic message
-an active when send a message it can be encored to every connected user
in real time

[#187419198]
@yvanddniyo yvanddniyo merged commit 3a82f52 into dev May 15, 2024
2 checks passed
MugemaneBertin2001 pushed a commit that referenced this pull request May 15, 2024
#187419198 User should interact with each others via chats publicly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants