I’m a little confused on what options to pass in to items.findMany
to achieve the particular result I’m looking for.
My DB Schema looks like this:
enum progress_status {
validating
valid
invalid
}
model items {
id String
item_name String
status item_status
}
model item_status {
id String
item_id String
status progress_status
}
I’d like to query for all items where item_name
starts with a certain value (For a search feature), and where its status is a certain status. So for example, get all items that start with foo
and have a status of valid
So far I have the text query working with:
const result = await client.items.findMany({
where: {
item_name: {
startsWith: query,
}
},
orderBy: {
project_name: 'asc',
}
});
But I’m having trouble adding the condition for the status. I know I can include the status data with an include
parameter, but I am uncertain how to additional filter results by status.