Skip to content

Commit d8a0379

Browse files
committed
Merge branch 'main' of github.com:CS3219-AY2425S1/cs3219-ay2425s1-project-g16 into PEER-232-Match-Initiation-UI
Signed-off-by: SeeuSim <[email protected]>
2 parents d6c5e92 + 397de48 commit d8a0379

File tree

122 files changed

+8628
-11385
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+8628
-11385
lines changed

.env.local

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ QUESTION_PGDATA="/data/qn-db"
1010

1111
COLLAB_SERVICE_NAME=collab-express
1212
COLLAB_EXPRESS_PORT=9003
13+
COLLAB_EXPRESS_DB_PORT=5435
14+
COLLAB_PGDATA="/data/collab-db"
1315

1416
MATCHING_SERVICE_NAME=match-express
1517
MATCHING_EXPRESS_PORT=9004

.eslintrc.json

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
"react",
1818
"@typescript-eslint",
1919
"tailwindcss",
20-
"react-hooks"
20+
"react-hooks",
21+
"simple-import-sort"
2122
],
2223
"rules": {
23-
// "@next/next/no-img-element": "off",
2424
"@typescript-eslint/no-explicit-any": "warn",
2525
"@typescript-eslint/explicit-module-boundary-types": "off",
2626
"@typescript-eslint/explicit-function-return-type": 0,
@@ -36,11 +36,21 @@
3636
"@typescript-eslint/no-empty-interface": "off",
3737
"@typescript-eslint/no-unused-vars": 0,
3838
"@typescript-eslint/no-use-before-define": 0,
39+
3940
// Basic
4041
"array-callback-return": "warn",
4142
"no-console": "warn",
43+
"no-multiple-empty-lines": ["error", { "max":1 }],
4244
"no-prototype-builtins": 0,
43-
// "no-expected-multiline": "warn", // can't find rule definition
45+
// "no-expected-multiline": "warn", // can"t find rule definition
46+
47+
"padding-line-between-statements": [
48+
"warn",
49+
{ "blankLine": "always", "prev": "*", "next": "block" },
50+
{ "blankLine": "always", "prev": "block", "next": "*" },
51+
{ "blankLine": "always", "prev": "*", "next": "block-like" },
52+
{ "blankLine": "always", "prev": "block-like", "next": "*" }
53+
],
4454

4555
// React
4656
"react/display-name": 0,
@@ -54,6 +64,8 @@
5464
}
5565
],
5666
"react-hooks/rules-of-hooks": "off",
67+
"simple-import-sort/imports": "error",
68+
"simple-import-sort/exports": "error",
5769
"tailwindcss/enforces-negative-arbitrary-values": "off",
5870
"unused-imports/no-unused-imports": "error",
5971
"unused-imports/no-unused-vars": [
@@ -73,6 +85,22 @@
7385
"rules": {
7486
"react/prop-types": "off"
7587
}
88+
},
89+
{
90+
"files": ["*.js", "*.ts", "*.tsx"],
91+
"rules": {
92+
"simple-import-sort/imports": [
93+
"error",
94+
{
95+
"groups": [
96+
["^(?:os|path|http|fs|crypto|util|events|stream|url|zlib|querystring|tls|dgram|net|dns|child_process|cluster|readline|vm|assert|buffer|process|timers)(\/.*)?$"],
97+
["^(?!(@\/|\\.\\.\/|\\.\/))"],
98+
["^@\/"],
99+
["^(?:\\.\/|\\.\\.\/|\\.)"]
100+
]
101+
}
102+
]
103+
}
76104
}
77105
]
78106
}

.github/workflows/build-docker.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
name: Build & publish PeerPrep images
22
on:
33
pull_request:
4-
types: [review_requested, ready_for_review]
4+
types:
5+
- opened
6+
- reopened
7+
- synchronize
8+
- ready_for_review
59
push:
610
branches:
711
- main
@@ -16,6 +20,7 @@ env:
1620

1721
jobs:
1822
changes:
23+
if: ${{ !github.event.pull_request.draft && github.event.pull_request.title != 'Feedback' }}
1924
runs-on: ubuntu-latest
2025
# Required permissions
2126
permissions:

backend/collaboration/.env.compose

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,9 @@
22
# PEERPREP_UI_HOST="http://frontend:3000"
33

44
EXPRESS_PORT=9003
5+
EXPRESS_DB_HOST="collab-db"
6+
EXPRESS_DB_PORT=5435
7+
POSTGRES_DB="collab"
8+
POSTGRES_USER="peerprep-collab-express"
9+
POSTGRES_PASSWORD="6rYE0nIzI2ThzDO"
10+
PGDATA="/data/collab-db"

backend/collaboration/.env.docker

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1-
PEERPREP_UI_HOST="http://host.docker.internal:5173"
1+
PEERPREP_UI_HOST=http://host.docker.internal:5173
22

33
EXPRESS_PORT=9003
4+
EXPRESS_DB_HOST=host.docker.internal
5+
EXPRESS_DB_PORT=5435
6+
POSTGRES_DB=collab
7+
POSTGRES_USER=peerprep-collab-express
8+
POSTGRES_PASSWORD=6rYE0nIzI2ThzDO
9+
PGDATA=/data/collab-db

backend/collaboration/.env.local

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
PEERPREP_UI_HOST="http://localhost:5173"
22

33
EXPRESS_PORT=9003
4+
EXPRESS_DB_HOST="localhost"
5+
EXPRESS_DB_PORT=5435
6+
POSTGRES_DB="collab"
7+
POSTGRES_USER="peerprep-collab-express"
8+
POSTGRES_PASSWORD="6rYE0nIzI2ThzDO"
9+
PGDATA="/data/collab-db"
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
11
#!/bin/sh
2-
3-
# To insert WS/RTC health checks
4-
5-
npm run start
2+
npm run start

backend/collaboration/express.Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ FROM node:lts-alpine AS build
22
WORKDIR /data/collab-express
33
COPY package*.json ./
44
RUN npm install
5+
ARG env
56
COPY . .
67
RUN npm run build
78

@@ -12,6 +13,8 @@ COPY --from=build --chown=node:node /data/collab-express/dist ./dist
1213

1314
RUN npm ci --omit=dev
1415

16+
RUN sed -i 's|./ws|ws|g' ./dist/ws.js
17+
1518
COPY entrypoint.sh .
1619

1720
ARG port

backend/collaboration/package.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,23 @@
1919
"cors": "^2.8.5",
2020
"dotenv": "^16.4.5",
2121
"env-cmd": "^10.1.0",
22-
"express": "^4.21.0",
22+
"express": "^4.21.1",
2323
"http-status-codes": "^2.3.0",
24+
"pg": "^8.13.0",
2425
"pino": "^9.4.0",
25-
"pino-http": "^10.3.0"
26+
"pino-http": "^10.3.0",
27+
"postgres": "^3.4.4",
28+
"redis": "^4.7.0",
29+
"ws": "^8.18.0",
30+
"y-postgresql": "^1.0.0",
31+
"y-websocket": "^2.0.4",
32+
"yjs": "^13.6.19"
2633
},
2734
"devDependencies": {
2835
"@types/cors": "^2.8.17",
2936
"@types/express": "^4.17.21",
3037
"@types/node": "^22.5.5",
38+
"@types/ws": "^8.5.12",
3139
"nodemon": "^3.1.4",
3240
"pino-pretty": "^11.2.2",
3341
"ts-node": "^10.9.2",

backend/collaboration/src/config.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,14 @@ import 'dotenv/config';
33
export const UI_HOST = process.env.PEERPREP_UI_HOST!;
44

55
export const EXPRESS_PORT = process.env.EXPRESS_PORT;
6+
7+
export const dbConfig = {
8+
host: process.env.EXPRESS_DB_HOST!,
9+
port: Number.parseInt(process.env.EXPRESS_DB_PORT!),
10+
database: process.env.POSTGRES_DB!,
11+
user: process.env.POSTGRES_USER,
12+
password: process.env.POSTGRES_PASSWORD,
13+
};
14+
15+
// disable gc when using snapshots!
16+
export const GC_ENABLED = process.env.GC !== 'false' && process.env.GC !== '0';

0 commit comments

Comments
 (0)