Skip to content

Commit 636b5d2

Browse files
Fix backend deploy
1 parent d2ed389 commit 636b5d2

File tree

4 files changed

+7
-32
lines changed

4 files changed

+7
-32
lines changed

backend/src/models/shiftModel.ts

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -233,37 +233,6 @@ export default class ShiftModel {
233233
return results;
234234
}
235235

236-
// create a new entry in the absence_request table
237-
async insertAbsenceRequest(shift_id: number, category: string, details: string, comments?: string): Promise<ResultSetHeader> {
238-
const query = `
239-
INSERT INTO absence_request (fk_shift_id, category, details, comments)
240-
VALUES (?, ?, ?, ?)
241-
ON DUPLICATE KEY UPDATE category = VALUES(category), details = VALUES(details), comments = VALUES(comments)
242-
`;
243-
const values = [shift_id, category, details, comments || null];
244-
245-
const [results, _] = await connectionPool.query<ResultSetHeader>(query, values);
246-
247-
return results;
248-
}
249-
250-
// delete corresponding entry in absence_request table
251-
async deleteAbsenceRequest(request_id: number, shift_id: number): Promise<ResultSetHeader> {
252-
const query = `
253-
DELETE FROM absence_request WHERE request_id = ? AND fk_shift_id = ? AND covered_by IS NULL
254-
`;
255-
const values = [request_id, shift_id];
256-
257-
const [results, _] = await connectionPool.query<ResultSetHeader>(query, values);
258-
259-
// Check if it was successfully deleted or not
260-
if (results.affectedRows === 0) {
261-
throw new Error("Shift absence request not found or already fulfilled");
262-
}
263-
264-
return results;
265-
}
266-
267236
private getDaysToAdd(frequency: Frequency) {
268237
switch (frequency) {
269238
case Frequency.weekly:

database/init/createTables.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ create table schedule (
107107
end_time TIME NOT NULL,
108108
frequency VARCHAR(15) NOT NULL DEFAULT 'weekly',
109109
active BOOLEAN NOT NULL DEFAULT TRUE,
110-
fk_instructor_id VARCHAR(36),
110+
fk_instructor_id CHAR(36),
111111
FOREIGN KEY (fk_class_id) REFERENCES class(class_id)
112112
ON DELETE CASCADE
113113
FOREIGN KEY (fk_instructor_id) REFERENCES instructors(instructor_id)

database/migrations/20250221195752_init.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ CREATE TABLE schedule (
6262
day INT NOT NULL,
6363
start_time TIME NOT NULL,
6464
end_time TIME NOT NULL,
65+
frequency VARCHAR(15) NOT NULL DEFAULT 'weekly',
6566
active BOOLEAN NOT NULL DEFAULT TRUE,
67+
fk_instructor_id CHAR(36),
6668
FOREIGN KEY (fk_class_id) REFERENCES class(class_id)
6769
ON DELETE CASCADE
6870
);

deploy/docker-stack.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ services:
1010
- "traefik.http.routers.frontend.entrypoints=websecure"
1111
- "traefik.http.routers.frontend.tls.certresolver=myresolver"
1212
deploy:
13+
restart_policy:
14+
condition: any
1315
update_config:
1416
order: start-first
1517

@@ -40,6 +42,8 @@ services:
4042
- FRONTEND_HOST=${CONTAINER_URL}
4143
- NEURON_ENV=production
4244
deploy:
45+
restart_policy:
46+
condition: any
4347
update_config:
4448
order: start-first
4549

0 commit comments

Comments
 (0)