summaryrefslogtreecommitdiff
path: root/includes/external/school/node_modules/pronote-api/src/server/context.js
diff options
context:
space:
mode:
authorRaindropsSys <contact@minteck.org>2023-06-22 23:06:12 +0200
committerRaindropsSys <contact@minteck.org>2023-06-22 23:06:12 +0200
commit23563c7188e089929b60f9e10721c6fc43a220ff (patch)
treeedfe2b009c82900d4ac27db02222d2f68dcad846 /includes/external/school/node_modules/pronote-api/src/server/context.js
parent7a7a49332df7c852abbaa33c7e8e87f93d064d61 (diff)
downloadpluralconnect-23563c7188e089929b60f9e10721c6fc43a220ff.tar.gz
pluralconnect-23563c7188e089929b60f9e10721c6fc43a220ff.tar.bz2
pluralconnect-23563c7188e089929b60f9e10721c6fc43a220ff.zip
Updated 15 files, added includes/maintenance/deleteUnusedAssets.php and deleted 4944 files (automated)
Diffstat (limited to 'includes/external/school/node_modules/pronote-api/src/server/context.js')
-rw-r--r--includes/external/school/node_modules/pronote-api/src/server/context.js73
1 files changed, 0 insertions, 73 deletions
diff --git a/includes/external/school/node_modules/pronote-api/src/server/context.js b/includes/external/school/node_modules/pronote-api/src/server/context.js
deleted file mode 100644
index 9f34442..0000000
--- a/includes/external/school/node_modules/pronote-api/src/server/context.js
+++ /dev/null
@@ -1,73 +0,0 @@
-function common(session) {
- return {
- params: () => session.params,
- user: () => session.user,
-
- keepAlive: async () => {
- await session.keepAlive();
- return true;
- },
- logout: async () => {
- await session.logout();
- return true;
- },
-
- setKeepAlive: async ({ enabled }) => {
- await session.setKeepAlive(enabled);
- return enabled;
- }
- };
-}
-
-function student(session) {
- return {
- timetable: ({ from, to }) => session.timetable(from, to),
- marks: ({ period }) => session.marks(period),
- evaluations: ({ period }) => session.evaluations(period),
- absences: ({ period, from, to }) => session.absences(period, from, to),
- infos: () => session.infos(),
- contents: ({ from, to }) => session.contents(from, to),
- homeworks: ({ from, to }) => session.homeworks(from, to),
- menu: ({ from, to }) => session.menu(from, to),
- files: () => session.files()
- };
-}
-
-function parent(session) {
- function getStudent(student) {
- for (const s of session.user.students) {
- if (s.id === student || s.name === student) {
- return s;
- }
- }
-
- return null;
- }
-
- return {
- timetable: ({ student, from, to }) => session.timetable(getStudent(student), from, to),
- marks: ({ student, period }) => session.marks(getStudent(student), period),
- evaluations: ({ student, period }) => session.evaluations(getStudent(student), period),
- absences: ({ student, period, from, to }) => session.absences(getStudent(student), period, from, to),
- infos: ({ student }) => session.infos(getStudent(student)),
- contents: ({ student, from, to }) => session.contents(getStudent(student), from, to),
- homeworks: ({ student, from, to }) => session.homeworks(getStudent(student), from, to),
- menu: ({ student, from, to }) => session.menu(getStudent(student), from, to),
- files: ({ student }) => session.files(getStudent(student))
- };
-}
-
-function getContext(session) {
- const result = common(session);
-
- switch (session.type.name) {
- case 'student':
- return { ...result, ...student(session) };
- case 'parent':
- return { ...result, ...parent(session) };
- default:
- return result;
- }
-}
-
-module.exports = getContext;