mapWith not getting called on extras

Hi
const users = await db.query.users.findMany({
limit: 5,
columns: {
id: true,
givenName: true,
familyName: true,
},
extras: (user) => ({
imageUrl: sql`${db
.select({ id: userImages.fileId })
.from(userImages)
.where(eq(userImages.userId, user.id))
.limit(1)}`
.mapWith((x) => (x ? getUploadUrl(x) : null)) // I'm not getting called :(
.as("imageUrl"),
}),
})

console.log(users)
const users = await db.query.users.findMany({
limit: 5,
columns: {
id: true,
givenName: true,
familyName: true,
},
extras: (user) => ({
imageUrl: sql`${db
.select({ id: userImages.fileId })
.from(userImages)
.where(eq(userImages.userId, user.id))
.limit(1)}`
.mapWith((x) => (x ? getUploadUrl(x) : null)) // I'm not getting called :(
.as("imageUrl"),
}),
})

console.log(users)
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?