Combine data-access and contact list facets with OR so each selected dimension grants visibility.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -219,15 +219,25 @@ export class PeopleService implements OnModuleInit {
|
||||
}
|
||||
const disc = discFilter(opts?.disc);
|
||||
if (disc) and.push(disc);
|
||||
if (groupIds.length) and.push({ groupLinks: { some: { groupId: { in: groupIds } } } });
|
||||
// گروه / منبع / حال: اتحاد (هر بُعد کافی است)؛ داخل هر بُعد چند مقدار با in = OR
|
||||
const facets: Prisma.PersonWhereInput[] = [];
|
||||
if (groupIds.length) {
|
||||
facets.push({ groupLinks: { some: { groupId: { in: groupIds } } } });
|
||||
}
|
||||
if (moods.length) {
|
||||
facets.push({ mood: { in: moods } });
|
||||
}
|
||||
if (sources.length) {
|
||||
facets.push({ importSource: { in: sources } });
|
||||
}
|
||||
if (facets.length === 1) and.push(facets[0]!);
|
||||
else if (facets.length > 1) and.push({ OR: facets });
|
||||
return {
|
||||
AND: [
|
||||
{
|
||||
organizationId: actor.organizationId,
|
||||
...customersPersonWhere(actor),
|
||||
},
|
||||
...(moods.length ? [{ mood: { in: moods } }] : []),
|
||||
...(sources.length ? [{ importSource: { in: sources } }] : []),
|
||||
...and,
|
||||
],
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user