-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate.ts
More file actions
38 lines (35 loc) · 1.04 KB
/
generate.ts
File metadata and controls
38 lines (35 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { Elysia } from "elysia";
import { t } from "elysia";
import { getAcademicYearId } from "../../controllers";
const PYTHON_SERVER_URL = "http://localhost:5000";
const app = new Elysia({ prefix: "/generateTT" })
.get(
"/department/:id",
async ({ params }) => {
const { id } = params;
const academicYearId = await getAcademicYearId("department", id);
return await fetch(`${PYTHON_SERVER_URL}/generate/department/${id}/${academicYearId}`);
},
{
detail: {
summary: "Generate division timetable",
tags: ["Generate Timetable"],
},
params: t.Object({
id: t.Numeric(),
}),
},
)
.get(
"/loading",
async () => {
return await fetch(`${PYTHON_SERVER_URL}/loading`);
},
{
detail: {
summary: "Get loading status",
tags: ["Generate Timetable"],
},
},
);
export default app;