Skip to content

Commit bf953ab

Browse files
committed
Switch back to node:14
Later versions of node does not handle SIGINT termination signals from docker
1 parent b5f6f31 commit bf953ab

File tree

9 files changed

+44
-11
lines changed

9 files changed

+44
-11
lines changed

ApiGatewayService/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Use an official Node.js runtime as a parent image
2-
FROM node:bookworm-slim
2+
FROM node:14
33

44
# Set the working directory in the container
55
WORKDIR /usr/src/api-gateway
@@ -17,4 +17,4 @@ COPY . .
1717
EXPOSE 3001
1818

1919
# Define the command to start your API gateway
20-
CMD [ "npm", "run", "dev"]
20+
CMD [ "npm", "run", "dev" ]

AuthService/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Use an official Node.js runtime as a parent image
2-
FROM node:bookworm-slim
2+
FROM node:14
33

44
# Set the working directory in the container
55
WORKDIR /usr/src/auth-service

ChatService/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Use an official Node.js runtime as a parent image
2-
FROM node:bookworm-slim
2+
FROM node:14
33

44
# Set the working directory in the container
55
WORKDIR /usr/src/chat-service

CollabService/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Use an official Node.js runtime as a parent image
2-
FROM node:bookworm-slim
2+
FROM node:14
33

44
# Set the working directory in the container
55
WORKDIR /usr/src/collab-service

MatchingService/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Use an official Node.js runtime as a parent image
2-
FROM node:bookworm-slim
2+
FROM node:14
33

44
# Set the working directory in the container
55
WORKDIR /usr/src/matching-service

QuestionService/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Use an official Node.js runtime as a parent image
2-
FROM node:bookworm-slim
2+
FROM node:14
33

44
# Set the working directory in the container
55
WORKDIR /usr/src/question-service

QuestionService/javascript/question/question.controller.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,20 @@ const firestore_1 = require("firebase/firestore");
1515
function handleGetQuestions(req, res) {
1616
return __awaiter(this, void 0, void 0, function* () {
1717
try {
18-
// console.log(req.query.email);
19-
// const { email } = req.query;
18+
console.log("getting questions");
19+
const { token } = req.query;
20+
if (!token) {
21+
res.status(500).send("unauthorized access");
22+
}
23+
if (typeof token === "string") {
24+
const response = yield (0, question_service_1.isValidToken)(token);
25+
if (!response) {
26+
res.status(500).send("unauthorized access");
27+
}
28+
}
29+
else {
30+
res.status(500).send("invalid params");
31+
}
2032
const query = yield (0, firestore_1.getDocs)((0, firestore_1.collection)(question_service_1.db, "questions"));
2133
const result = yield Promise.all(query.docs.map((d) => __awaiter(this, void 0, void 0, function* () {
2234
const q = d.data();

QuestionService/javascript/question/question.service.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
99
});
1010
};
1111
Object.defineProperty(exports, "__esModule", { value: true });
12-
exports.addQuestion = exports.updateQuestion = exports.deleteQuestion = exports.db = void 0;
12+
exports.isValidToken = exports.addQuestion = exports.updateQuestion = exports.deleteQuestion = exports.db = void 0;
1313
const app_1 = require("firebase/app");
1414
const firestore_1 = require("firebase/firestore");
1515
const firebase_config_1 = require("../firebase/firebase.config");
@@ -61,3 +61,24 @@ function addQuestion(question) {
6161
});
6262
}
6363
exports.addQuestion = addQuestion;
64+
function isValidToken(token) {
65+
return __awaiter(this, void 0, void 0, function* () {
66+
try {
67+
const q = (0, firestore_1.query)((0, firestore_1.collection)(exports.db, "users"));
68+
const querySnapshot = yield (0, firestore_1.getDocs)(q);
69+
const tokens = new Set();
70+
querySnapshot.forEach((doc) => {
71+
const user = doc.data();
72+
tokens.add(user.token);
73+
});
74+
if (tokens.has(token)) {
75+
return Promise.resolve(true);
76+
}
77+
return Promise.resolve(false);
78+
}
79+
catch (error) {
80+
return Promise.reject(error);
81+
}
82+
});
83+
}
84+
exports.isValidToken = isValidToken;

UserService/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Use an official Node.js runtime as a parent image
2-
FROM node:bookworm-slim
2+
FROM node:14
33

44
# Set the working directory in the container
55
WORKDIR /usr/src/user-service

0 commit comments

Comments
 (0)