Corey Snyder
09/28/2019, 3:50 AM/* Given This Schema */
type Shape{
id: ID! @id
square: Square @relation(name: "SquareShapeRelation", link: TABLE, onDelete: CASCADE)
price: Float
}
type Square{
id: ID! @id
article: Article @relation(name: "SquareShapeRelation")
area: Float
}
/* I'd like to query
- the first 5 Shapes
- starting with the 6th
- Ordered by price desc
where {
the Square has an area >= 5
}
*/
// I was thinking it'd be:
await context.prisma.shapes({
orderBy: price_DESC,
where: {
square: {
area_gte: 5
}
},
skip: 5,
first: 5,
})
// It's important that the first & skip happen AFTER the filtering on the child relation has been applied.