From b54cbea27be345427617e9b4643b4f3d3ca30a5a Mon Sep 17 00:00:00 2001 From: Vitor George Date: Fri, 23 Dec 2022 11:06:32 +0000 Subject: [PATCH] Make sure user ids are integers --- src/models/team.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/models/team.js b/src/models/team.js index feff2451..18c35b1d 100644 --- a/src/models/team.js +++ b/src/models/team.js @@ -66,10 +66,13 @@ const teamAttributes = [ * */ async function resolveMemberNames(ids) { + // TODO Quick fix, we need to do proper type validation + const userIds = ids.map((i) => parseInt(i)) + // get the display names from the database table first - const foundUsers = await db('osm_users').whereIn('id', ids) + const foundUsers = await db('osm_users').whereIn('id', userIds) const foundUserIds = foundUsers.map(prop('id')) - const notFound = difference(ids, foundUserIds) + const notFound = difference(userIds, foundUserIds) let usersFromOSM = [] if (notFound.length > 0) {