From c74724f8e1fb51d70c03b63a468931869eb2d5fd Mon Sep 17 00:00:00 2001 From: Sergej Hoffmann <97111299+SevenWaysDP@users.noreply.github.com> Date: Tue, 26 Mar 2024 13:27:22 +0100 Subject: [PATCH] BC-6592 - switch get school systems to v3 (#3430) --- controllers/administration.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/controllers/administration.js b/controllers/administration.js index 6d19000a0b..1ae06b2b9a 100644 --- a/controllers/administration.js +++ b/controllers/administration.js @@ -507,7 +507,7 @@ const createSystemHandler = (req, res, next) => { .patch(`/schools/${req.body.schoolId}`, { json: { $push: { - systems: system._id, + systems: system.id, }, }, }) @@ -2837,7 +2837,7 @@ router.use( // In the future there should be a possibility to fetch a school with all systems populated via api/v3, // but at the moment they need to be fetched separately. - school.systems = await Promise.all(school.systemIds.map((systemId) => api(req).get(`/systems/${systemId}`))); + school.systems = await api(req, { version: 'v3' }).get(`/school/${school._id}/systems`); // Maintanance - Show Menu depending on the state const currentTime = new Date(); @@ -2891,8 +2891,8 @@ router.use( if (hasSystemEditPermission) { tableActions = tableActions.concat([ { - link: item.type === 'ldap' ? `/administration/ldap/config?id=${item._id}` - : `/administration/systems/${item._id}`, + link: item.type === 'ldap' ? `/administration/ldap/config?id=${item.id}` + : `/administration/systems/${item.id}`, class: item.type === 'ldap' ? 'btn-edit-ldap' : 'btn-edit', icon: 'edit', title: res.$t('administration.controller.link.editEntry'), @@ -2903,7 +2903,7 @@ router.use( if (hasSystemCreatePermission) { tableActions = tableActions.concat([ { - link: `/administration/systems/${item._id}`, + link: `/administration/systems/${item.id}`, class: 'btn-delete--systems', icon: 'trash-o', method: 'delete', @@ -3197,12 +3197,12 @@ router.post( .patch(`/schools/${res.locals.currentSchool}`, { json: { $push: { - systems: system._id, + systems: system.id, }, }, }) .then(() => { - res.redirect(`/administration/ldap/config?id=${system._id}`); + res.redirect(`/administration/ldap/config?id=${system.id}`); }) .catch((err) => { next(err);