Skip to content

Commit 07ae864

Browse files
author
Aishwarya Nair
committed
Merge branch 'test-updated-merge' of https://github.com/CS3219-AY2324S1/ay2324s1-course-assessment-g16 into test-updated-merge
2 parents 53b2e98 + 673fc6b commit 07ae864

File tree

9 files changed

+171
-117
lines changed

9 files changed

+171
-117
lines changed

CollaborationService/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ Sample data for MatchedPair collection:
163163
- reconnect
164164

165165
- disconnect
166+
167+
Note:
168+
169+
> For other test, please refer to the project report appendix.
166170
167171

168172
#### Jest testing

Frontend/README.md

Lines changed: 14 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,23 @@
1-
# Getting Started with Create React App
1+
# Frontend Setup Guide
22

3-
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
3+
# Quick Start
44

5-
## Available Scripts
5+
1. Navigate to the `Frontend` Directory in Terminal or Powershell
66

7-
In the project directory, you can run:
7+
2. Build the Container.
88

9-
### `npm start`
9+
Command:
1010

11-
Runs the app in the development mode.\
12-
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
11+
```
12+
docker-compose build frontend
13+
```
1314

14-
The page will reload when you make changes.\
15-
You may also see any lint errors in the console.
15+
3. Start the Container.
1616

17-
### `npm test`
17+
Command:
1818

19-
Launches the test runner in the interactive watch mode.\
20-
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
19+
```
20+
docker-compose up frontend
21+
```
2122

22-
### `npm run build`
23-
24-
Builds the app for production to the `build` folder.\
25-
It correctly bundles React in production mode and optimizes the build for the best performance.
26-
27-
The build is minified and the filenames include the hashes.\
28-
Your app is ready to be deployed!
29-
30-
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
31-
32-
### `npm run eject`
33-
34-
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
35-
36-
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
37-
38-
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
39-
40-
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
41-
42-
## Learn More
43-
44-
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45-
46-
To learn React, check out the [React documentation](https://reactjs.org/).
47-
48-
### Code Splitting
49-
50-
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
51-
52-
### Analyzing the Bundle Size
53-
54-
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
55-
56-
### Making a Progressive Web App
57-
58-
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
59-
60-
### Advanced Configuration
61-
62-
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
63-
64-
### Deployment
65-
66-
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
67-
68-
### `npm run build` fails to minify
69-
70-
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
23+
4. Using your preferred Browser, you can go to the following URL `http://localhost:3001/` to see the frontend running.

Frontend/src/App.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ const AIChatWrapper = () => {
4848

4949
const ChatWrapper = () => {
5050
const location = useLocation();
51-
return location.pathname === "/collaboration" ? <CommunicationWindow /> : null;
51+
return location.pathname === "/collaboration" ? (
52+
<CommunicationWindow />
53+
) : null;
5254
};
5355

5456
function App() {

Frontend/src/User/UserStateController.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ async function getUserAdminStatus() {
3737
const result = await getUserData(userId);
3838

3939
console.log(result.data.user.isAdmin);
40+
41+
return result.data.user.isAdmin;
4042
}
4143

4244
return false;

GptService/README.md

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,28 @@
2323

2424
#### Listening port
2525

26-
http://localhost:3004
26+
http://localhost:3008
2727

2828

2929
#### Start the microservice on local machine by:
3030

31-
1. Navigate to peerprep directory.
31+
1. Navigate to GptService directory.
3232

33-
2. Insert your own GPT-API_KEY for the services in the `peer-prep\src\backend\gpt-service\config\config.js` file as below:
33+
2. Insert your own GPT-API_KEY for the services in the `GptService\config\config.js` file as below:
3434

3535
```
3636
const API_KEY = '<Your api key>';
3737
```
38+
39+
Warning:
40+
41+
> Please do not publish your API key to public.
42+
3843

3944
3. Start the microservice in terminal using commands:
4045

4146
```
42-
cd peer-prep\src\backend\gpt-service
47+
cd GptService
4348
npm install
4449
npm start
4550
```
@@ -50,7 +55,7 @@ npm start
5055
5156
> node server.js
5257
53-
GPT service listening on port 3004
58+
GPT service listening on port 3008
5459
```
5560

5661
5. End generative AI service in terminal using `Ctrl+C`.
@@ -66,11 +71,11 @@ GPT service listening on port 3004
6671

6772
Send **POST** request to:
6873

69-
`http://localhost:3004/generate` and specify post fields.
74+
`http://localhost:3008/generate` and specify post fields.
7075

7176
Example:
7277

73-
Url link: `http://localhost:3004`
78+
Url link: `http://localhost:3008`
7479

7580
For testing using Postman, enter data using the `Body` panel (2 methods are available):
7681

@@ -115,11 +120,11 @@ GPT service listening on port 3004
115120
116121
Send **DELETE** request to:
117122
118-
`http://localhost:3004/exitGpt`
123+
`http://localhost:3008/exitGpt`
119124
120125
Example:
121126
122-
`http://localhost:3004/exitGpt`
127+
`http://localhost:3008/exitGpt`
123128
124129
raw:
125130
@@ -145,11 +150,11 @@ GPT service listening on port 3004
145150
146151
Send **GET** request to:
147152
148-
`http://localhost:3004/getCache`
153+
`http://localhost:3008/getCache`
149154
150155
Example:
151156
152-
`http://localhost:3004/getCache`
157+
`http://localhost:3008/getCache`
153158
154159
raw:
155160
@@ -190,7 +195,7 @@ GPT service listening on port 3004
190195
1. Test the service using terminal commands:
191196
192197
```
193-
cd peer-prep\src\backend\gpt-service
198+
cd GptService
194199
npm test
195200
```
196201
@@ -199,20 +204,24 @@ npm test
199204
200205
**Note**:
201206
202-
> Please delete the containers for other microservices.
207+
> Please ensure that there are no active container of the required services.
203208
204-
1. Navigate to peerprep directory.
209+
1. Navigate to GptService directory.
205210
206-
2. Insert your own GPT-API_KEY for the services in the `peer-prep\src\backend\gpt-service\config\config.js` file as below:
211+
2. Insert your own GPT-API_KEY for the services in the `GptService\config\config.js` file as below:
207212
208213
```
209214
const API_KEY = '<Your api key>';
210215
```
216+
Warning:
217+
218+
> Please do not publish your API key to public.
219+
211220
212221
3. Start the microservice in terminal using commands:
213222
214223
```
215-
cd peer-prep\src\backend\gpt-service
224+
cd GptService
216225
docker-compose up --build
217226
```
218227
@@ -221,7 +230,7 @@ docker-compose up --build
221230
```
222231
223232
> node server.js
224-
> GPT service listening on port 3004
233+
> GPT service listening on port 3008
225234
```
226235
227-
5. End matching service in terminal using `Ctrl+C` twice.
236+
5. End GPT service in terminal using `Ctrl+C` twice.

HistoryService/README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@
99
Command:
1010

1111
```
12-
docker-compose build
12+
docker-compose build history-service history-service-database
1313
```
1414

1515
3. Start the Containers.
1616

1717
Command:
1818

1919
```
20-
docker-compose up
20+
docker-compose up history-service history-service-database
2121
```
2222

23-
4. Using Postman or a likewise app, you can connect to `localhost:3006` to send http (REST) queries.
23+
4. Using Postman or a likewise app, you can connect to `http://localhost:3006/history/` to send http (REST) queries.
2424

2525
# Starting Containers Individually
2626

@@ -34,7 +34,7 @@ docker-compose up
3434

3535
Set up a Docker network using the following command, and ensure to use the same network name when starting the various services and databases later. (This step is important if you dont want to run via `docker-compose up` command)
3636

37-
Command:
37+
Using Terminal, Run the following Command:
3838

3939
```
4040
docker network create -d bridge peer-prep-network
@@ -44,6 +44,8 @@ This command is to be run only for the initial set up, and once the network is s
4444

4545
## mySQL Container
4646

47+
Navigate into `HistoryService` Directory
48+
4749
First and foremost change the `databaseUrl` in the `Config/config.js` file to `127.0.0.1`
4850

4951
Start by running this container first, else History Service will not be able to connect to Database.
@@ -64,7 +66,7 @@ docker exec -it history-service-database sh
6466

6567
The above will open a terminal window for the mySql Docker Container, where `mysql` can be used.
6668

67-
## History Service Server
69+
## History Service Microservice
6870

6971
1. Navigate to the `HistoryService` Directory in Terminal or Powershell
7072

@@ -83,3 +85,5 @@ Command:
8385
```
8486
docker run --rm -p 3006:3006 -v $(pwd):/app -it --network peer-prep-network history-service
8587
```
88+
89+
Using Postman or a likewise app, you can connect to `http://localhost:3006/history/` to send http (REST) queries.

0 commit comments

Comments
 (0)