Chip Clark
10/05/2021, 2:12 AMthis.prisma.committee.findMany({
include: {
PersonCommittee: {
include: {
Person: {
select: {
PKPersonID: true,
LastName: true,
FirstName: true,
MiddleName: true,
PreferredFirstName: true,
DisplayName: true,
EmploymentStatus: true
}
}
}
}
},
where: {
AND: [
{
Active: true,
PersonCommittee: {
some: {
Person: {
EmploymentStatus: "A"
}
}
}
}
]
},
})
Ryan
10/05/2021, 6:51 AMAND
and OR
separately like this (also this will filter only the parent i.e. committee and not inside the nested relations)
this.prisma.committee.findMany({
include: {
PersonCommittee: {
include: {
Person: {
select: {
PKPersonID: true,
LastName: true,
FirstName: true,
MiddleName: true,
PreferredFirstName: true,
DisplayName: true,
EmploymentStatus: true
}
}
}
}
},
where: {
Active: true,
OR: [
{ PersonCommittee: { some: { Person: { EmploymentStatus: 'A' } } } },
{ PersonCommittee: { some: { Person: { EmploymentStatus: 'B' } } } },
{ PersonCommittee: { some: { Person: { EmploymentStatus: 'C' } } } },
],
}
})
Chip Clark
10/05/2021, 5:43 PMRyan
10/06/2021, 5:26 AMChip Clark
10/11/2021, 10:04 PMChip Clark
10/12/2021, 12:42 AMChip Clark
10/13/2021, 7:28 PMSupportedPerson: {
some: {
Person: { EmploymentStatus: "A" }
}
}
Chip Clark
10/13/2021, 7:29 PMSupportedPerson: {
Person: {
some: { EmploymentStatus: "A" }
}
}
Chip Clark
10/13/2021, 7:29 PMSupportedPerson: {
Person: {
none: { EmploymentStatus: "T" }
}
}
Chip Clark
10/13/2021, 7:32 PMUnknown arg `Person` in where.AND.4.SupportedPerson.Person for type PersonRelationshipListRelationFilter. Did you mean `every`?
Chip Clark
10/13/2021, 7:43 PMSupportedPerson : {
where: {
OR: [
{
RelationshipTypeID: 1
},
{
RelationshipTypeID: 4
},
{
RelationshipTypeID: 5
},
],
AND: [
{
Person: {
EmploymentStatus: 'A'
}
},
]
},