Dave Edelhart
07/27/2022, 10:18 PMmodel task_type {
id String @id @default(uuid())
name String @unique
tasks task[]
notes String?
order Int @default(0)
parent_id String?
parent task_type? @relation(name: "parent", fields: [parent_id], references: [id])
child_tasks task_type[] @relation(name: "parent")
deleted Boolean @default(false)
interval Int @default(0)
}
model task {
id String @id @default(uuid())
type task_type @relation(fields: [task_type_id], references: [id])
task_type_id String
task_events task_event[]
notes String?
data Json?
createdAt DateTime @default(now())
last_work_done DateTime?
completedAt DateTime?
status String @default("started")
parent_task task? @relation(name: "parent", fields: [parent_task_id], references: [id])
parent_task_id String?
child_tasks task[] @relation(name: "parent")
}
Some of the types have “interval” (numeric) and I want to find all the tasks whose (task_)type.interval field is zero.Austin
08/01/2022, 7:08 PMconst results = await prisma.task.findMany({
where: {
type: { interval: 0 }
}
})Dave Edelhart
08/01/2022, 7:11 PM