Skip to content

Commit

Permalink
Merge pull request #356 from developmentseed/fix/resolve-member-names
Browse files Browse the repository at this point in the history
Make sure user ids are integers when resolving member names
  • Loading branch information
vgeorge authored Dec 23, 2022
2 parents 2dde70b + b54cbea commit 0885362
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 0885362

Please sign in to comment.