Skip to content

Commit 6fcd886

Browse files
committed
Merge branch 'collab-gorilla' into formatter
# Conflicts: # peerprep/app/actions/session.ts
2 parents d4ce18d + 026e2c7 commit 6fcd886

File tree

6 files changed

+66
-25
lines changed

6 files changed

+66
-25
lines changed

kubernetes/apply_k8s_configs.ps1

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Array of Kubernetes YAML files to apply
2+
$files = @(
3+
"backend-deployment.yaml",
4+
"backend-service.yaml",
5+
"collab-service-deployment.yaml",
6+
"collab-service-service.yaml",
7+
"matching-service-api-deployment.yaml",
8+
"matching-service-api-service.yaml",
9+
"matching-service-deployment.yaml",
10+
"nginx-deployment.yaml",
11+
"nginx-service.yaml",
12+
"peerprep-deployment.yaml",
13+
"peerprep-service.yaml",
14+
"rabbitmq-service.yaml",
15+
"rabbitmq-statefulset.yaml",
16+
"redis-service.yaml",
17+
"redis-statefulset.yaml",
18+
"storage-blob-api-deployment.yaml",
19+
"storage-blob-api-service.yaml",
20+
"user-service-deployment.yaml",
21+
"user-service-service.yaml"
22+
)
23+
24+
# Loop through each file and apply it using kubectl
25+
foreach ($file in $files) {
26+
Write-Output "Applying $file..."
27+
kubectl apply -f $file
28+
}
29+
30+
Write-Output "All files applied."

peerprep/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# environment file
44
.env
5+
.dockerignore
56

67
# dependencies
78
/node_modules

peerprep/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ WORKDIR /frontend
66
COPY package*.json ./
77
RUN npm ci
88
COPY . .
9+
RUN npm run build
910
EXPOSE 3000
10-
CMD ["npm", "run", "dev"]
11+
CMD ["npm", "run", "start"]

peerprep/app/actions/server_actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export async function login(state: FormState, formData: FormData) {
5757
await createSession(json.data);
5858
redirect("/questions");
5959
} else {
60-
console.log(json.error);
60+
console.log("Get session login error: " + json.error + " : " + json.status);
6161
}
6262
}
6363

peerprep/app/actions/session.ts

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,42 @@ export enum CookieNames {
99

1010
export async function createSession(userDataAccessToken: UserDataAccessToken) {
1111
const expiresAt = new Date(Date.now() + 24 * 60 * 60 * 1000);
12-
cookies().set(
13-
CookieNames.SESSION.valueOf(),
14-
userDataAccessToken.accessToken,
15-
{
12+
try {
13+
console.log("Setting cookie...");
14+
15+
cookies().set(
16+
CookieNames.SESSION.valueOf(),
17+
userDataAccessToken.accessToken,
18+
{
19+
httpOnly: true,
20+
// TODO: set this to true
21+
secure: false,
22+
expires: expiresAt,
23+
sameSite: "lax",
24+
path: "/",
25+
},
26+
);
27+
28+
const userData: UserData = {
29+
email: userDataAccessToken.email,
30+
username: userDataAccessToken.username,
31+
id: userDataAccessToken.id,
32+
isAdmin: userDataAccessToken.isAdmin,
33+
createdAt: userDataAccessToken.createdAt,
34+
};
35+
36+
cookies().set(CookieNames.USER_DATA.valueOf(), JSON.stringify(userData), {
1637
httpOnly: true,
17-
secure: true,
38+
secure: false,
1839
expires: expiresAt,
1940
sameSite: "lax",
2041
path: "/",
21-
},
22-
);
23-
24-
const userData: UserData = {
25-
email: userDataAccessToken.email,
26-
username: userDataAccessToken.username,
27-
id: userDataAccessToken.id,
28-
isAdmin: userDataAccessToken.isAdmin,
29-
createdAt: userDataAccessToken.createdAt,
30-
};
42+
});
3143

32-
cookies().set(CookieNames.USER_DATA.valueOf(), JSON.stringify(userData), {
33-
httpOnly: true,
34-
secure: false,
35-
expires: expiresAt,
36-
sameSite: "lax",
37-
path: "/",
38-
});
44+
console.log("Cookies set successfully.");
45+
} catch (error) {
46+
console.error("Error setting cookie:", error);
47+
}
3948
}
4049

4150
export async function expireSession() {

peerprep/components/questionpage/Matchmaking.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
import ResettingStopwatch from "../shared/ResettingStopwatch";
1818
import PeerprepDropdown from "../shared/PeerprepDropdown";
1919

20-
const QUERY_INTERVAL_MILLISECONDS = 1000;
20+
const QUERY_INTERVAL_MILLISECONDS = 5000;
2121
const TIMEOUT_MILLISECONDS = 30000;
2222

2323
const getMatchRequestTime = (): string => {

0 commit comments

Comments
 (0)