Unified search algorithm across all lists; per-section record visibility (contacts, deals, activities, leads, finance, tickets, notes, projects)
This commit is contained in:
@@ -46,8 +46,8 @@ export class ReportsService {
|
||||
): Promise<ReportsDashboardDto> {
|
||||
const { start, end } = resolveRange(opts.from, opts.to);
|
||||
const orgId = actor.organizationId;
|
||||
const dealScope = ownerWhere(actor);
|
||||
const invoiceScope = ownerWhere(actor);
|
||||
const dealScope = ownerWhere(actor, 'deals');
|
||||
const invoiceScope = ownerWhere(actor, 'finance');
|
||||
const activityScope = assigneeWhere(actor);
|
||||
const ticketScope = ticketAccessWhere(actor);
|
||||
const personScope = elevated(actor.role) ? {} : { ownerId: actor.userId };
|
||||
@@ -1026,7 +1026,7 @@ export class ReportsService {
|
||||
): Promise<ReportsDrilldownDto> {
|
||||
const { start, end } = resolveRange(opts.from, opts.to);
|
||||
const orgId = actor.organizationId;
|
||||
const dealScope = ownerWhere(actor);
|
||||
const dealScope = ownerWhere(actor, 'deals');
|
||||
const rates = await loadOrgRates(this.prisma, orgId);
|
||||
|
||||
const baseSelect = {
|
||||
@@ -1236,7 +1236,7 @@ export class ReportsService {
|
||||
|
||||
const dealOwnerWhere =
|
||||
ownerFilterIds == null
|
||||
? ownerWhere(actor)
|
||||
? ownerWhere(actor, 'deals')
|
||||
: { ownerId: { in: ownerFilterIds } };
|
||||
const activityAssigneeWhere =
|
||||
ownerFilterIds == null
|
||||
@@ -1458,7 +1458,7 @@ export class ReportsService {
|
||||
actor: Actor,
|
||||
opts: { userId?: string; teamId?: string },
|
||||
): Promise<string[] | null> {
|
||||
const scope = ownerWhere(actor);
|
||||
const scope = ownerWhere(actor, 'deals');
|
||||
let allowed: string[] | null = null;
|
||||
if ('ownerId' in scope && typeof scope.ownerId === 'string') {
|
||||
allowed = [scope.ownerId];
|
||||
@@ -1516,7 +1516,7 @@ export class ReportsService {
|
||||
|
||||
async home(actor: Actor): Promise<HomeDashboardDto> {
|
||||
const orgId = actor.organizationId;
|
||||
const dealScope = ownerWhere(actor);
|
||||
const dealScope = ownerWhere(actor, 'deals');
|
||||
const activityScope = assigneeWhere(actor);
|
||||
const personScope = elevated(actor.role) ? {} : { ownerId: actor.userId };
|
||||
const rates = await loadOrgRates(this.prisma, orgId);
|
||||
|
||||
Reference in New Issue
Block a user