Skip to content

Commit 817f69e

Browse files
committed
PEER-252 Add seed logic for questions, remove unnecessary build args
1 parent 2513cca commit 817f69e

File tree

3 files changed

+2
-6
lines changed

3 files changed

+2
-6
lines changed

backend/question/express.Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ COPY src/config.ts ./src
2121
COPY tsconfig.json .
2222
COPY entrypoint.sh .
2323

24-
2524
ARG port
2625
EXPOSE ${port}
2726
ENTRYPOINT [ "/bin/sh", "entrypoint.sh" ]

backend/question/src/lib/db/seed.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const seedQuestions = async () => {
99
const seedRecords = await trx.select().from(adminTable).where(eq(adminTable.action, 'SEED'));
1010
if (seedRecords && seedRecords.length > 0) {
1111
console.info(
12-
`[Users]: Seeded already at: ${(seedRecords[seedRecords.length - 1].createdAt ?? new Date()).toLocaleString()}`
12+
`[Questions]: Seeded already at: ${(seedRecords[seedRecords.length - 1].createdAt ?? new Date()).toLocaleString()}`
1313
);
1414
return;
1515
}
@@ -32,6 +32,7 @@ const seedQuestions = async () => {
3232
.values({ ...question, id: undefined }) // Let DB set ID
3333
.onConflictDoNothing();
3434
}
35+
await trx.insert(adminTable).values({ action: 'SEED' });
3536
});
3637
} catch (error) {
3738
console.log('[Questions]: Error seeding question data', error);

docker-compose.yaml

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

33
services:
44
# Databases
5-
65
user-db:
76
hostname: "user-db"
87
image: postgres:16.4
@@ -64,7 +63,6 @@ services:
6463
timeout: 10s
6564

6665
# Services
67-
6866
user-service:
6967
image: "user-express"
7068
container_name: "user-express"
@@ -74,7 +72,6 @@ services:
7472
target: production
7573
args:
7674
# For building with the correct env vars
77-
- env=${USER_EXPRESS_ENV}
7875
- port=${USER_EXPRESS_PORT}
7976
ports:
8077
- "9001:${USER_EXPRESS_PORT}"
@@ -107,7 +104,6 @@ services:
107104
target: production
108105
args:
109106
# For building with the correct env vars
110-
- env=${QUESTION_EXPRESS_ENV}
111107
- port=${QUESTION_EXPRESS_PORT}
112108
ports:
113109
- "9002:${QUESTION_EXPRESS_PORT}"

0 commit comments

Comments
 (0)