made android client
This commit is contained in:
@@ -3,6 +3,7 @@ import { fileURLToPath } from "node:url";
|
||||
import multer from "multer";
|
||||
import { parseWord, PARSER_VERSION } from "./parser.js";
|
||||
import { scheduleFor } from "./schedules.js";
|
||||
import { timetable } from "./timetable.js";
|
||||
import {
|
||||
getIndex,
|
||||
indexStatus,
|
||||
@@ -87,6 +88,29 @@ app.get("/api/groups", async (req, res, next) => {
|
||||
next(e);
|
||||
}
|
||||
});
|
||||
// A group's lessons by date with weeks applied: for native and other clients.
|
||||
app.get("/api/timetable", async (req, res, next) => {
|
||||
try {
|
||||
const doc = String(req.query.doc || ""),
|
||||
group = String(req.query.group || "").slice(0, 40),
|
||||
from = req.query.from || todayIso();
|
||||
if (!doc || !group) return badRequest(res, "Укажите документ (doc) и группу (group).");
|
||||
if (!isDate(from)) return badRequest(res, "Дата должна быть в формате ГГГГ-ММ-ДД.");
|
||||
const file = await documentFor(doc);
|
||||
res.json(
|
||||
timetable({
|
||||
file,
|
||||
schedule: await scheduleFor(file),
|
||||
calendar: await directoryCalendar(),
|
||||
group,
|
||||
from,
|
||||
days: req.query.days,
|
||||
}),
|
||||
);
|
||||
} catch (e) {
|
||||
next(e);
|
||||
}
|
||||
});
|
||||
app.get("/api/exams", async (req, res, next) => {
|
||||
try {
|
||||
const group = String(req.query.group || "").slice(0, 40);
|
||||
|
||||
Reference in New Issue
Block a user