teacher-tools/api/source/api_modules/classroom_compliance/api.d

31 lines
1.5 KiB
D

module api_modules.classroom_compliance.api;
import handy_httpd.handlers.path_handler : PathHandler;
import handy_httpd.components.request : Method;
import api_modules.classroom_compliance.api_class;
import api_modules.classroom_compliance.api_student;
import api_modules.classroom_compliance.api_entry;
void registerApiEndpoints(PathHandler handler) {
const ROOT_PATH = "/api/classroom-compliance";
handler.addMapping(Method.POST, ROOT_PATH ~ "/classes", &createClass);
handler.addMapping(Method.GET, ROOT_PATH ~ "/classes", &getClasses);
const CLASS_PATH = ROOT_PATH ~ "/classes/:classId:ulong";
handler.addMapping(Method.GET, CLASS_PATH, &getClass);
handler.addMapping(Method.DELETE, CLASS_PATH, &deleteClass);
handler.addMapping(Method.POST, CLASS_PATH ~ "/students", &createStudent);
handler.addMapping(Method.GET, CLASS_PATH ~ "/students", &getStudents);
const STUDENT_PATH = CLASS_PATH ~ "/students/:studentId:ulong";
handler.addMapping(Method.GET, STUDENT_PATH, &getStudent);
handler.addMapping(Method.PUT, STUDENT_PATH, &updateStudent);
handler.addMapping(Method.DELETE, STUDENT_PATH, &deleteStudent);
handler.addMapping(Method.PUT, STUDENT_PATH ~ "/class", &moveStudentToOtherClass);
handler.addMapping(Method.GET, STUDENT_PATH ~ "/entries", &getStudentEntries);
handler.addMapping(Method.GET, STUDENT_PATH ~ "/overview", &getStudentOverview);
handler.addMapping(Method.GET, CLASS_PATH ~ "/entries", &getEntries);
handler.addMapping(Method.POST, CLASS_PATH ~ "/entries", &saveEntries);
}