Skip to content

Commit

Permalink
Make sure user ids are integers
Browse files Browse the repository at this point in the history
  • Loading branch information
vgeorge committed Dec 23, 2022
1 parent 2dde70b commit b54cbea
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/models/team.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit b54cbea

Please sign in to comment.