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

Chat service #35

Open
wants to merge 149 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
149 commits
Select commit Hold shift + click to select a range
e9879d0
Add collaboration service
meowwtama Oct 17, 2024
9c6b141
Update MonacoEditor.tsx
meowwtama Oct 20, 2024
d2bbcbf
show username when logged in
abstxn Oct 24, 2024
eb4257c
add logout feature
abstxn Oct 24, 2024
60af46a
prompt user to sign in again if signed out when matching
abstxn Oct 24, 2024
d3ee932
Merge branch 'CS3219-AY2425S1:main' into feature/collaboration-service
meowwtama Oct 26, 2024
817d901
Update request param
meowwtama Oct 26, 2024
356b1ff
Install firebase
techjay-c Oct 27, 2024
2cdf9b7
Add frontend component for collaboration code editor page
techjay-c Oct 28, 2024
bca4325
Add profile page functionality to login flow
techjay-c Oct 28, 2024
3424e10
Remove old navbar component and modify new navbar
techjay-c Oct 28, 2024
0232f67
Update usage of variables from local variables to session variables a…
techjay-c Oct 28, 2024
cc67a47
Add About Us page
techjay-c Oct 28, 2024
cdc04d6
Revert to use local storage instead of session storage
techjay-c Oct 28, 2024
a40f7ba
Update typescript error to fix question list fetch bug
techjay-c Oct 28, 2024
a4abe25
Add About Us page ref to nav bar
techjay-c Oct 28, 2024
39e3a42
Add Change Password page and functionality
techjay-c Oct 28, 2024
2e4d595
Add JWT authentication
meowwtama Oct 28, 2024
fea1754
Update nav bar to show match me tab only if user is authenticated
techjay-c Oct 29, 2024
8483d75
Merge pull request #17 from meowwtama/feature/collaboration-service
techjay-c Oct 29, 2024
1cd79d5
Merge branch 'feature/collab-backend' of https://github.com/CS3219-AY…
techjay-c Oct 29, 2024
58debd4
Added add question modal for admin role
ruth-lim Oct 29, 2024
d1f7256
Refresh table upon adding question
ruth-lim Oct 29, 2024
afdf545
Added delete question function
ruth-lim Oct 29, 2024
63be5f5
Enhance dequeue service with status based timer handling for match ev…
techjay-c Oct 29, 2024
5af59c2
Added edit question function
ruth-lim Oct 30, 2024
23bf935
Fix return
meowwtama Oct 30, 2024
879b37c
Merge pull request #18 from CS3219-AY2425S1/feature/collab-env
meowwtama Oct 30, 2024
5ea572e
dequeue timeout is relative to match request time
abstxn Oct 30, 2024
2e3bd38
Merge branch 'feature/collab-env' into feature/profile-page
abstxn Oct 30, 2024
ec07e90
Update questionId in init-question-db to correct type
ruth-lim Oct 30, 2024
535bebc
Insert questionId into payload in backend
ruth-lim Oct 30, 2024
36e2730
Change category to string[]
ruth-lim Oct 30, 2024
dbf84c4
Handle edge cases for question list
ruth-lim Oct 30, 2024
7b015a4
implement basic password change
abstxn Oct 31, 2024
f132745
implement account deletion
abstxn Oct 31, 2024
53f3476
Update CodeEditor frontend to use QuestionSideBar components
techjay-c Oct 31, 2024
a73473c
Change Create Room parameters
meowwtama Oct 31, 2024
17d3235
Change to multiselect for topics
ruth-lim Oct 31, 2024
7a800cf
Change topics to use enum values
ruth-lim Oct 31, 2024
3869fd5
Verify admin status at login
ruth-lim Oct 31, 2024
0ee8014
Integrate Collaboration Service backend
meowwtama Oct 31, 2024
24283a0
set up skeleton for the chat service
alyssaongyx Oct 31, 2024
d8f69d4
secure password change process
abstxn Nov 1, 2024
8a5f384
Dockerize collaboration-service and update collab service to use port…
techjay-c Nov 1, 2024
23b3552
Add logging for room ID
techjay-c Nov 1, 2024
e91caf9
Update Code editor page
techjay-c Nov 1, 2024
2a025a0
implement password reset feature
abstxn Nov 1, 2024
2552a49
Add link redirection to code editor
techjay-c Nov 1, 2024
0dd5004
Fix code editor to take room ID only
techjay-c Nov 1, 2024
65e65ef
update styles of chat
alyssaongyx Nov 1, 2024
079bfe7
Update authenticated routes
techjay-c Nov 1, 2024
6fd4066
Add support for multiple programming languages
techjay-c Nov 1, 2024
fb86685
Merge branch 'feature/profile-page' into feature/collab-env
abstxn Nov 2, 2024
c7b5113
modify room joining logic
abstxn Nov 2, 2024
8f46e55
Create leave room function
techjay-c Nov 2, 2024
fa9e644
Add function for users to leave room and integrate with backend routes
techjay-c Nov 3, 2024
8be5100
Add chakra UI alert dialog component in code editor
techjay-c Nov 3, 2024
223f75f
Update leave room function to reset matching status
techjay-c Nov 3, 2024
18ea480
Update code editor to pull question details from backend route
techjay-c Nov 3, 2024
2e04728
Update manifesto on about us page
techjay-c Nov 4, 2024
bd77aed
Add syntax highlighting using Shikijs
techjay-c Nov 4, 2024
686a86c
Merge branch 'question-service-enhancement' of https://github.com/CS3…
techjay-c Nov 4, 2024
ff7c1d0
Update code editor to sync language template during change in languag…
techjay-c Nov 4, 2024
5e4abd2
Fix username on account button bug
techjay-c Nov 4, 2024
6375941
Update backend code logic for leave room to update room status and ma…
techjay-c Nov 4, 2024
9a9c3b6
Update question model
meowwtama Nov 4, 2024
b0dedb7
Add questionId field to add question
meowwtama Nov 4, 2024
caa6eec
Add duplicate check for title and description
meowwtama Nov 4, 2024
07ca595
Add get question by category
meowwtama Nov 4, 2024
d0a4ece
Add random question assignment
meowwtama Nov 4, 2024
6830252
Add history service
meowwtama Nov 4, 2024
b1c81e6
Update difficulty level of question to show color
techjay-c Nov 4, 2024
88ce6eb
Merge pull request #24 from CS3219-AY2425S1/draft/collab-env
techjay-c Nov 4, 2024
7236b14
Update Time format
meowwtama Nov 5, 2024
3948f80
fix login issue
abstxn Nov 5, 2024
58f986b
fix waiting time not clearing
abstxn Nov 5, 2024
2c4abeb
Update code editor frontend and backend to support storage of 4 progr…
techjay-c Nov 5, 2024
7b19fda
Merge branch 'feature/collab-env' of https://github.com/CS3219-AY2425…
techjay-c Nov 5, 2024
4488c96
Update question-controller.ts
meowwtama Nov 5, 2024
f764b40
Merge branch 'feature/collab-env' of https://github.com/CS3219-AY2425…
techjay-c Nov 5, 2024
f6bece9
Fix bug for question details page on frontend
techjay-c Nov 5, 2024
1473302
Merge changes for support for multiple languages in firebase
techjay-c Nov 5, 2024
d8b8441
Merge branch 'feature/collab-env' of https://github.com/CS3219-AY2425…
alyssaongyx Nov 6, 2024
8f11359
fix type error when fetching questions by id
abstxn Nov 6, 2024
7ab1b66
Merge branch 'bugfixes' of https://github.com/CS3219-AY2425S1/cs3219-…
techjay-c Nov 6, 2024
cb4b855
define proper startup order for kafka dependents
abstxn Nov 6, 2024
79ded5a
transition modal when leaving room
abstxn Nov 6, 2024
1bd3dcd
toast when partner leaves room
abstxn Nov 6, 2024
592a1f2
display room active status
abstxn Nov 6, 2024
019e83c
integrate chat into collab
alyssaongyx Nov 6, 2024
5216b08
Merge branch 'feature/chat-service' into develop
abstxn Nov 6, 2024
c3dd3f9
Merge branch 'features/ux' into develop
abstxn Nov 6, 2024
92c062c
Update editor page to display question assigned to the user
techjay-c Nov 6, 2024
de3fcc5
show username of partner in chat
abstxn Nov 6, 2024
8bfbadb
add history frontend
alyssaongyx Nov 6, 2024
c21fcba
Merge branch 'feature/collab-env' into develop
abstxn Nov 6, 2024
f470dcc
Merge branch 'feature/history-service' into develop
abstxn Nov 6, 2024
db386b8
viewing old attempt brings back to old room
abstxn Nov 6, 2024
65872b4
redirect to / when leaving old room
abstxn Nov 6, 2024
1814513
Remove home page from navbar and fix bug for preserving editor state …
techjay-c Nov 6, 2024
593e730
Merge branch 'develop' of https://github.com/CS3219-AY2425S1/cs3219-a…
techjay-c Nov 6, 2024
54e1156
Merge pull request #30 from CS3219-AY2425S1/feature/collab-enhancement
techjay-c Nov 6, 2024
9b63af6
add jenkins
alyssaongyx Nov 6, 2024
1089874
loading modal before entering matched room
abstxn Nov 7, 2024
835ae8c
random question pool accounts for difficulties
abstxn Nov 7, 2024
706dd70
frontend will not allow invalid topic/difficulty pairs
abstxn Nov 7, 2024
8c6ca1e
prevent users from sending empty chat messages
abstxn Nov 7, 2024
585bf56
add save status check
abstxn Nov 7, 2024
28f61eb
fix the chat length and remove UTC
alyssaongyx Nov 7, 2024
5197ba6
prevent user from typing empty messages
alyssaongyx Nov 7, 2024
33a8ac1
disable editing if one user leaves
abstxn Nov 7, 2024
31f6037
old rooms will not display chat
abstxn Nov 7, 2024
57bf085
Merge branch 'feature/jenkins' into develop
abstxn Nov 7, 2024
d4b7aa9
show status of other user in the collaboration environment
abstxn Nov 7, 2024
9e6e731
remove redundant run button
abstxn Nov 7, 2024
1a6be29
time is shown in singapore locale
abstxn Nov 7, 2024
e6777a7
fix bug with joining old room changing activity status
abstxn Nov 7, 2024
b4b774c
update post
alyssaongyx Nov 8, 2024
05f4533
add build script
alyssaongyx Nov 9, 2024
227890c
Update firebaseConfig.ts
meowwtama Nov 9, 2024
78cff3c
Remove API keys
meowwtama Nov 9, 2024
92bd549
added branchname
alyssaongyx Nov 9, 2024
0a74820
add option for user to download code
abstxn Nov 9, 2024
102c42f
revert to use scm
alyssaongyx Nov 9, 2024
f97e8da
add console log
alyssaongyx Nov 9, 2024
66aabb5
update console log
alyssaongyx Nov 9, 2024
884ef4b
show room active time and fix time format bug
abstxn Nov 9, 2024
3bfc450
ensure topics and difficulties are always sorted
abstxn Nov 9, 2024
e64cb64
remove typo
alyssaongyx Nov 9, 2024
fe053ed
Update env file configurations
meowwtama Nov 9, 2024
63f569d
Add backend for history category
meowwtama Nov 9, 2024
0eecbec
Merge branch 'features/ux' into develop
abstxn Nov 9, 2024
bbb9f28
update logs
alyssaongyx Nov 9, 2024
e3e0247
update logs
alyssaongyx Nov 9, 2024
af341d2
add docker installation
alyssaongyx Nov 9, 2024
f4771db
add console log to trigger pipeline
alyssaongyx Nov 9, 2024
c8bd758
enforce creation of secure passwords
abstxn Nov 9, 2024
73fbfc8
Merge branch 'feature/secure-password' into develop
abstxn Nov 9, 2024
f6e19f9
update docker tool
alyssaongyx Nov 9, 2024
d4f21f2
update docker tool
alyssaongyx Nov 9, 2024
81abddf
Add time spent in History data
meowwtama Nov 9, 2024
673f732
only fetch waiting time on reload
abstxn Nov 10, 2024
f209460
prevent unnecessary stage changes
abstxn Nov 10, 2024
d2dfd91
add tests for question-service
alyssaongyx Nov 9, 2024
77992e3
add tests for history-service
alyssaongyx Nov 9, 2024
5a0e4d6
update tests
alyssaongyx Nov 9, 2024
b1a6abe
update jenkins
alyssaongyx Nov 10, 2024
5f69387
store chat messages in local storage
alyssaongyx Nov 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Dockerize collaboration-service and update collab service to use port…
… 5001
techjay-c committed Nov 1, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 8a5f384dc1ea2fe7ceec9fca892afaa8fdadb62d
2 changes: 1 addition & 1 deletion collaboration-service/.env.sample
Original file line number Diff line number Diff line change
@@ -6,5 +6,5 @@ STORAGE_BUCKET="cs3219-g21.appspot.com"
MESSAGING_SENDER_ID="958024239459"
APP_ID="1:958024239459:web:72f1c7396a441127d72b56"
MEASUREMENT_ID="G-RWHNR4RB38"
PORT=5000
PORT=5001
USER_SERVICE_URL="http://localhost:3001"
2 changes: 1 addition & 1 deletion collaboration-service/Dockerfile
Original file line number Diff line number Diff line change
@@ -8,6 +8,6 @@ RUN npm ci

COPY . .

EXPOSE 5000
EXPOSE 5001

CMD ["npm", "run", "dev"]
2 changes: 1 addition & 1 deletion collaboration-service/app.ts
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ app.use(express.json());
// Allow URL-encoded data in the request body to be parsed
app.use(express.urlencoded({ extended: false }));

// Use the collaboration router to handle requests at http://localhost:5000/room
// Use the collaboration router to handle requests at http://localhost:5001/room
app.use('/room', collaborationRoutes);

// Set the server to listen on a specific port
6 changes: 2 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ services:
collaboration-service:
build: ./collaboration-service
ports:
- 5000:5000
- 5001:5001
volumes:
- ./collaboration-service:/app
- /app/node_modules
@@ -96,7 +96,7 @@ services:
- 3005:3005
depends_on:
- user-service
# - collaboration-service # add after dockerising collaboration-service
- collaboration-service # add after dockerising collaboration-service
volumes:
- ./matching-service/room-service:/app
- /app/node_modules
@@ -132,10 +132,8 @@ services:
volumes:
user-db-data:
name: user-db-data
external: true
question-db-data:
name: question-db-data
external: true


# Notes:
62 changes: 35 additions & 27 deletions matching-service/room-service/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import express from 'express';
import { Kafka } from 'kafkajs';
import cors from 'cors';
import express from "express";
import { Kafka } from "kafkajs";
import cors from "cors";

const app = express();

const kafka = new Kafka({brokers: ["kafka:9092"],});
const kafkaConsumer = kafka.consumer({ groupId: 'room-service' });
const kafka = new Kafka({ brokers: ["kafka:9092"] });
const kafkaConsumer = kafka.consumer({ groupId: "room-service" });

app.use(express.json());
app.use(cors());
@@ -14,30 +14,38 @@ app.use(cors());
const createRoom = async (userA: string, userB: string): Promise<void> => {
try {
const response = await fetch(
"http://collaboration-service:5000/room/createRoom", {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
userId1: userA,
userId2: userB,
}),
});
if (response.status === 201) {
console.log(`Room created successfully for users ${userA} and ${userB}.`);
}
} catch (error) {
console.error(`Error creating room for users ${userA} and ${userB}`);
"http://collaboration-service:5001/room/createRoom",
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
userId1: userA,
userId2: userB,
}),
}
);
if (response.status === 201) {
console.log(`Room created successfully for users ${userA} and ${userB}.`);
} else {
const errorMsg = await response.text();
console.error(
`Failed to create room. Status ${response.status}, Response: ${errorMsg}`
);
}
} catch (error: any) {
console.error(`Error creating room for users ${userA} and ${userB}`);
console.error(error)
}
};

(async () => {
await kafkaConsumer.connect();
await kafkaConsumer.subscribe({
topic: "match-found-events",
fromBeginning: false
});
await kafkaConsumer.connect();
await kafkaConsumer.subscribe({
topic: "match-found-events",
fromBeginning: false,
});

await kafkaConsumer.run({
eachMessage: async ({ message }) => {
@@ -48,12 +56,12 @@ const createRoom = async (userA: string, userB: string): Promise<void> => {

console.log(
`Received match-found-event between User A: ${userA} and User B: ${userB}`
);
);

// calling the helper function
await createRoom(userA, userB);
} catch (error: any) {
console.error('Error processing match-found-event:', error.message);
console.error("Error processing match-found-event:", error.message);
}
}
},