Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BC-6592 - switch get school systems to v3 #3430

Merged
merged 5 commits into from
Mar 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions controllers/administration.js
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ const createSystemHandler = (req, res, next) => {
.patch(`/schools/${req.body.schoolId}`, {
json: {
$push: {
systems: system._id,
systems: system.id,
},
},
})
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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'),
Expand All @@ -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',
Expand Down Expand Up @@ -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);
Expand Down
Loading