Aaron Fulkerson
10/06/2020, 6:57 PMAaron Fulkerson
10/06/2020, 7:10 PMAaron Fulkerson
10/06/2020, 7:10 PMRyan
10/07/2020, 10:32 AMIn my opinion it doesn’t make sense that you can’t specify optional fields like the companyId in the where clause even though it’s not technically absolutely necessary to find the project, it would cover my use case
Aaron Fulkerson
10/07/2020, 5:57 PMRyan
10/09/2020, 7:29 AMmodel User {
id Int @id @default(autoincrement())
name String
organization Organization? @relation(fields: [organizationId], references: [id])
projects Project[]
organizationId Int?
}
model Project {
id Int @id @default(autoincrement())
name String
usersWorking User[]
belongsTo Organization @relation(fields: [organizationId], references: [id])
features Feature[]
organizationId Int
}
model Feature {
id Int @id @default(autoincrement())
name String
belongsTo Project @relation(fields: [projectId], references: [id])
featureDetails FeatureDetail[]
projectId Int
}
model FeatureDetail {
id Int @id @default(autoincrement())
belongsTo Feature @relation(fields: [featureId], references: [id])
featureId Int
}
I think that you can add a rule that check for the projects and only allow the User query for those projects that they are working on.Aaron Fulkerson
10/09/2020, 5:37 PMAaron Fulkerson
10/10/2020, 6:55 PMreturn await db.project.update({
data: {
features: {
update: {
data: { featureDetails: { delete: { id_complete: { id, complete: false } } } },
where: { id: featureId },
},
},
},
include: {
company: true,
features: { include: { featureDetails: { orderBy: { id: 'asc' } } } },
invoices: true,
},
where: { id: projectId },
})
Ryan
10/12/2020, 10:41 AMmany
version like deleteMany
.