Selection of multiple officials and role sub-categories
This commit is contained in:
@@ -76,17 +76,18 @@ export function projectCardAccessWhere(
|
||||
};
|
||||
}
|
||||
|
||||
/** فعالیتها بر اساس مسئول */
|
||||
/** فعالیتها بر اساس مسئول اصلی یا مسئولان مشترک */
|
||||
export function assigneeWhere(
|
||||
actor: Pick<Actor, 'userId' | 'role' | 'dataVisibility' | 'visibleUserIds'>,
|
||||
):
|
||||
| { assigneeId: string }
|
||||
| { assigneeId: { in: string[] } }
|
||||
| Record<string, never> {
|
||||
): Prisma.ActivityWhereInput {
|
||||
const ids = scopedOwnerIds(actor);
|
||||
if (!ids) return {};
|
||||
if (ids.length === 1) return { assigneeId: ids[0]! };
|
||||
return { assigneeId: { in: ids } };
|
||||
return {
|
||||
OR: [
|
||||
{ assigneeId: { in: ids } },
|
||||
{ assignees: { some: { id: { in: ids } } } },
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
/** یادداشت: نویسنده یا پروندههای تحت مالکیت در محدوده دید + محرمانگی شخصی */
|
||||
|
||||
Reference in New Issue
Block a user