From 211b7d4eaec3f3169060fc5cb504191c9b313755 Mon Sep 17 00:00:00 2001 From: Malte Berg Date: Tue, 20 Feb 2024 11:44:01 +0100 Subject: [PATCH 1/7] add external id column --- controllers/users.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/controllers/users.js b/controllers/users.js index c66131d..7e9851d 100644 --- a/controllers/users.js +++ b/controllers/users.js @@ -369,7 +369,7 @@ router.get('/search', function (req, res, next) { api(req) .get('/roles') .then((role) => { - const head = ['Vorname', 'Nachname', 'E-Mail-Adresse', 'Rollen', 'Schule', '']; + const head = ['ID', 'Vorname', 'Nachname', 'E-Mail-Adresse', 'Rollen', 'External Id', '']; const body = data.data.map((item) => { let roles = item.roles @@ -383,6 +383,7 @@ router.get('/search', function (req, res, next) { item.email || '', roles || '', (item.schoolId || {}).name || '', + item.externalId || '', getTableActions(item, '/users/'), ]; }); @@ -462,9 +463,10 @@ router.get('/', function (req, res, next) { }, }) .then((data) => { - const head = ['ID', 'Vorname', 'Nachname', 'E-Mail-Adresse', 'Rollen', '']; + const head = ['ID', 'Vorname', 'Nachname', 'E-Mail-Adresse', 'Rollen', 'External Id', '']; const body = data.data.map((item) => { + console.log(item); if (!item.deletedAt) { let roles = item.roles .map((role) => { @@ -477,6 +479,7 @@ router.get('/', function (req, res, next) { item.lastName || '', item.email || '', roles || '', + item.externalId || '', getTableActions(item, '/users/'), ]; } From b3688e2b4a0abb21e5217ba890fcbfa105602af7 Mon Sep 17 00:00:00 2001 From: Malte Berg Date: Tue, 20 Feb 2024 11:44:26 +0100 Subject: [PATCH 2/7] add external Id sort --- static/scripts/schools.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/static/scripts/schools.js b/static/scripts/schools.js index d9e1a39..26eab88 100644 --- a/static/scripts/schools.js +++ b/static/scripts/schools.js @@ -107,6 +107,7 @@ $(document).ready(function () { 'Migration abgeschlossen': 'userLoginMigration.closedAt', 'Migration final beendet': 'userLoginMigration.finishedAt', 'Login-System': 'systems', + 'External Id': 'externalId', 'subject': 'Titel', 'firstName': 'Vorname', @@ -135,7 +136,8 @@ $(document).ready(function () { 'userLoginMigration.mandatorySince': 'Migration verpflichtend', 'userLoginMigration.closedAt': 'Migration abgeschlossen', 'userLoginMigration.finishedAt': 'Migration final beendet', - 'systems': 'Login-System' + 'systems': 'Login-System', + 'externalId': 'External Id' }; $('tr th').each(function(i,j) { From c5a5ef5bfa9af7a61c2e219c5df4f29206aa5970 Mon Sep 17 00:00:00 2001 From: Malte Berg Date: Tue, 20 Feb 2024 13:36:25 +0100 Subject: [PATCH 3/7] add externalId to search query --- controllers/users.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/controllers/users.js b/controllers/users.js index 7e9851d..e4cb58b 100644 --- a/controllers/users.js +++ b/controllers/users.js @@ -357,6 +357,12 @@ router.get('/search', function (req, res, next) { $options: 'i', }, }, + { + externalId: { + $regex: _.escapeRegExp(req.query.q), + $options: 'i', + }, + }, ], schoolId: req.query.schoolId ? req.query.schoolId : undefined, $populate: ['roles', 'schoolId'], From 5f6f1d80d04642fad45e39f4479e9c50db1d9ca5 Mon Sep 17 00:00:00 2001 From: Malte Berg Date: Tue, 20 Feb 2024 13:37:08 +0100 Subject: [PATCH 4/7] fix search problem --- controllers/users.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/controllers/users.js b/controllers/users.js index e4cb58b..cac0b90 100644 --- a/controllers/users.js +++ b/controllers/users.js @@ -365,17 +365,17 @@ router.get('/search', function (req, res, next) { }, ], schoolId: req.query.schoolId ? req.query.schoolId : undefined, - $populate: ['roles', 'schoolId'], $limit: itemsPerPage, $skip: itemsPerPage * (currentPage - 1), $sort: req.query.sort, + $populate: ['roles', 'schoolId'], }, }) .then((data) => { api(req) .get('/roles') .then((role) => { - const head = ['ID', 'Vorname', 'Nachname', 'E-Mail-Adresse', 'Rollen', 'External Id', '']; + const head = ['ID', 'Vorname', 'Nachname', 'E-Mail-Adresse', 'Rollen', 'Schule', 'External Id', '']; const body = data.data.map((item) => { let roles = item.roles @@ -384,6 +384,7 @@ router.get('/search', function (req, res, next) { }) .join(', '); return [ + item._id || '', item.firstName || '', item.lastName || '', item.email || '', From 587aa146a46620ee2b78a729569e4e126e5ec10d Mon Sep 17 00:00:00 2001 From: Malte Berg Date: Tue, 20 Feb 2024 16:04:13 +0100 Subject: [PATCH 5/7] adjust search text --- views/ctltools/ctltools.hbs | 2 +- views/schools/schools.hbs | 2 +- views/users/preselect.hbs | 2 +- views/users/users.hbs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/views/ctltools/ctltools.hbs b/views/ctltools/ctltools.hbs index aedfa86..f19e85c 100644 --- a/views/ctltools/ctltools.hbs +++ b/views/ctltools/ctltools.hbs @@ -29,7 +29,7 @@
- +
- - + +
diff --git a/views/users/forms/edit-user.hbs b/views/users/forms/edit-user.hbs index 847db6f..24fc08b 100644 --- a/views/users/forms/edit-user.hbs +++ b/views/users/forms/edit-user.hbs @@ -20,6 +20,6 @@
- - -
\ No newline at end of file + + +