Normal boolean conditions

Hello, i want to achieve the following:
const record = await drizzle(c.env.DATABASE)
.select()
.from(dataProject)
.where(and(eq(dataProject.id, id), and(eq(dataProject.userId, user.id), user.role == "manager")))
.limit(1);
const record = await drizzle(c.env.DATABASE)
.select()
.from(dataProject)
.where(and(eq(dataProject.id, id), and(eq(dataProject.userId, user.id), user.role == "manager")))
.limit(1);
Show everything for managers (user is an object outside of drizzle) or the records where the userId is the current users id. the user.role == "manager" part doesnt work. is there a alternative for this without unnecessary if statements? Thanks yall
1 Reply
Louis
Louis3mo ago
had i typo it works thx
Want results from more Discord servers?
Add your server