perf(api): eliminate N+1 queries, add query guards and missing indexes
- Notification fan-out: replace sequential for loops with Promise.all (allocation-effects, notification-broadcast, create-notification) - Public holiday batch: group resources by location combo, resolve holidays once per group, replace per-holiday delete/findFirst/create with 3 batched queries (~18K → ~5 queries) - Add take guards to unbounded findMany calls (resource-analytics: 5000, resource-marketplace: 2000, resource-capacity: 1000, chargeability-report: 2000) - auto-staffing: add select with only needed fields + take: 5000 - schema.prisma: add 5 missing indexes (ManagementLevel.groupId, Blueprint.isActive/target, Comment.parentId, Vacation.requestedById, Resource.managementLevelGroupId) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -665,7 +665,8 @@ describe("notification.createBroadcast", () => {
|
|||||||
|
|
||||||
expect(transaction).toHaveBeenCalledTimes(1);
|
expect(transaction).toHaveBeenCalledTimes(1);
|
||||||
expect(txCreateBroadcast).toHaveBeenCalledTimes(1);
|
expect(txCreateBroadcast).toHaveBeenCalledTimes(1);
|
||||||
expect(txCreateNotification).toHaveBeenCalledTimes(1);
|
// Parallel fan-out: both recipients are attempted concurrently
|
||||||
|
expect(txCreateNotification).toHaveBeenCalledTimes(2);
|
||||||
expect(txUpdateBroadcast).not.toHaveBeenCalled();
|
expect(txUpdateBroadcast).not.toHaveBeenCalled();
|
||||||
expect(outerCreateBroadcast).not.toHaveBeenCalled();
|
expect(outerCreateBroadcast).not.toHaveBeenCalled();
|
||||||
expect(outerUpdateBroadcast).not.toHaveBeenCalled();
|
expect(outerUpdateBroadcast).not.toHaveBeenCalled();
|
||||||
|
|||||||
@@ -797,6 +797,7 @@ describe("resource router", () => {
|
|||||||
country: { select: { code: true } },
|
country: { select: { code: true } },
|
||||||
metroCity: { select: { name: true } },
|
metroCity: { select: { name: true } },
|
||||||
},
|
},
|
||||||
|
take: 1000,
|
||||||
});
|
});
|
||||||
expect(listAssignmentBookings).toHaveBeenCalledWith(db, expect.objectContaining({
|
expect(listAssignmentBookings).toHaveBeenCalledWith(db, expect.objectContaining({
|
||||||
resourceIds: [],
|
resourceIds: [],
|
||||||
@@ -864,6 +865,7 @@ describe("resource router", () => {
|
|||||||
country: { select: { code: true } },
|
country: { select: { code: true } },
|
||||||
metroCity: { select: { name: true } },
|
metroCity: { select: { name: true } },
|
||||||
},
|
},
|
||||||
|
take: 1000,
|
||||||
});
|
});
|
||||||
expect(listAssignmentBookings).toHaveBeenCalledWith(db, expect.objectContaining({
|
expect(listAssignmentBookings).toHaveBeenCalledWith(db, expect.objectContaining({
|
||||||
resourceIds: ["resource_target"],
|
resourceIds: ["resource_target"],
|
||||||
|
|||||||
@@ -54,6 +54,22 @@ type DbClient = Parameters<typeof listAssignmentBookings>[0] & {
|
|||||||
resource: {
|
resource: {
|
||||||
findMany: (args: {
|
findMany: (args: {
|
||||||
where: { isActive: true };
|
where: { isActive: true };
|
||||||
|
select?: {
|
||||||
|
id?: true;
|
||||||
|
displayName?: true;
|
||||||
|
eid?: true;
|
||||||
|
skills?: true;
|
||||||
|
lcrCents?: true;
|
||||||
|
chargeabilityTarget?: true;
|
||||||
|
valueScore?: true;
|
||||||
|
availability?: true;
|
||||||
|
countryId?: true;
|
||||||
|
federalState?: true;
|
||||||
|
metroCityId?: true;
|
||||||
|
country?: { select: { code: true } };
|
||||||
|
metroCity?: { select: { name: true } };
|
||||||
|
};
|
||||||
|
take?: number;
|
||||||
}) => Promise<Array<{
|
}) => Promise<Array<{
|
||||||
id: string;
|
id: string;
|
||||||
displayName: string;
|
displayName: string;
|
||||||
@@ -155,6 +171,22 @@ export async function generateAutoSuggestions(
|
|||||||
// 4. Fetch all active resources and their current bookings
|
// 4. Fetch all active resources and their current bookings
|
||||||
const resources = await db.resource.findMany({
|
const resources = await db.resource.findMany({
|
||||||
where: { isActive: true },
|
where: { isActive: true },
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
displayName: true,
|
||||||
|
eid: true,
|
||||||
|
skills: true,
|
||||||
|
lcrCents: true,
|
||||||
|
chargeabilityTarget: true,
|
||||||
|
valueScore: true,
|
||||||
|
availability: true,
|
||||||
|
countryId: true,
|
||||||
|
federalState: true,
|
||||||
|
metroCityId: true,
|
||||||
|
country: { select: { code: true } },
|
||||||
|
metroCity: { select: { name: true } },
|
||||||
|
},
|
||||||
|
take: 5000,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (resources.length === 0) return;
|
if (resources.length === 0) return;
|
||||||
|
|||||||
@@ -93,10 +93,7 @@ export async function createNotificationsForUsers(
|
|||||||
params: Omit<CreateNotificationParams, "userId"> & { userIds: string[] },
|
params: Omit<CreateNotificationParams, "userId"> & { userIds: string[] },
|
||||||
): Promise<number> {
|
): Promise<number> {
|
||||||
const { userIds, ...rest } = params;
|
const { userIds, ...rest } = params;
|
||||||
let count = 0;
|
if (userIds.length === 0) return 0;
|
||||||
for (const userId of userIds) {
|
await Promise.all(userIds.map((userId) => createNotification({ ...rest, userId })));
|
||||||
await createNotification({ ...rest, userId });
|
return userIds.length;
|
||||||
count++;
|
|
||||||
}
|
|
||||||
return count;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,24 +101,28 @@ export async function createDemandRequirementWithEffects(
|
|||||||
const projectName = project?.name ?? "Unknown project";
|
const projectName = project?.name ?? "Unknown project";
|
||||||
const headcount = demandRequirement.headcount ?? 1;
|
const headcount = demandRequirement.headcount ?? 1;
|
||||||
|
|
||||||
for (const manager of managers) {
|
if (managers.length > 0) {
|
||||||
const task = await db.notification.create({
|
const sharedData = {
|
||||||
data: {
|
category: "TASK" as const,
|
||||||
userId: manager.id,
|
type: "DEMAND_FILL" as const,
|
||||||
category: "TASK",
|
priority: "NORMAL" as const,
|
||||||
type: "DEMAND_FILL",
|
title: `Staff demand: ${roleName} for ${projectName}`,
|
||||||
priority: "NORMAL",
|
body: `${headcount} ${roleName} needed for project ${projectName}`,
|
||||||
title: `Staff demand: ${roleName} for ${projectName}`,
|
taskStatus: "OPEN" as const,
|
||||||
body: `${headcount} ${roleName} needed for project ${projectName}`,
|
taskAction: buildTaskAction("fill_demand", demandRequirement.id),
|
||||||
taskStatus: "OPEN",
|
entityId: demandRequirement.id,
|
||||||
taskAction: buildTaskAction("fill_demand", demandRequirement.id),
|
entityType: "demand",
|
||||||
entityId: demandRequirement.id,
|
link: `/projects/${demandRequirement.projectId}`,
|
||||||
entityType: "demand",
|
channel: "in_app" as const,
|
||||||
link: `/projects/${demandRequirement.projectId}`,
|
};
|
||||||
channel: "in_app",
|
const tasks = await Promise.all(
|
||||||
},
|
managers.map((manager) =>
|
||||||
});
|
db.notification.create({ data: { userId: manager.id, ...sharedData } }),
|
||||||
emitNotificationCreated(manager.id, task.id);
|
),
|
||||||
|
);
|
||||||
|
for (const task of tasks) {
|
||||||
|
emitNotificationCreated(task.userId, task.id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
checkBudgetThresholdsInBackground(db, demandRequirement.projectId);
|
checkBudgetThresholdsInBackground(db, demandRequirement.projectId);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
} from "@capakraken/engine";
|
} from "@capakraken/engine";
|
||||||
import type { PrismaClient } from "@capakraken/db";
|
import type { PrismaClient } from "@capakraken/db";
|
||||||
import type { WeekdayAvailability, PermissionKey } from "@capakraken/shared";
|
import type { WeekdayAvailability, PermissionKey } from "@capakraken/shared";
|
||||||
import { PermissionKey as PermissionKeys } from "@capakraken/shared";
|
import { PermissionKey as PermissionKeys, round1 } from "@capakraken/shared";
|
||||||
import { isChargeabilityActualBooking, listAssignmentBookings } from "@capakraken/application";
|
import { isChargeabilityActualBooking, listAssignmentBookings } from "@capakraken/application";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { anonymizeResources, getAnonymizationDirectory } from "../lib/anonymization.js";
|
import { anonymizeResources, getAnonymizationDirectory } from "../lib/anonymization.js";
|
||||||
@@ -25,10 +25,6 @@ type ChargeabilityReportProcedureContext = Pick<TRPCContext, "db"> & {
|
|||||||
permissions?: Set<PermissionKey>;
|
permissions?: Set<PermissionKey>;
|
||||||
};
|
};
|
||||||
|
|
||||||
function round1(value: number): number {
|
|
||||||
return Math.round(value * 10) / 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
function isIsoDateInMonth(isoDate: string, monthKey: string): boolean {
|
function isIsoDateInMonth(isoDate: string, monthKey: string): boolean {
|
||||||
return isoDate.startsWith(`${monthKey}-`);
|
return isoDate.startsWith(`${monthKey}-`);
|
||||||
}
|
}
|
||||||
@@ -265,6 +261,7 @@ async function queryChargeabilityReport(
|
|||||||
metroCity: { select: { id: true, name: true } },
|
metroCity: { select: { id: true, name: true } },
|
||||||
},
|
},
|
||||||
orderBy: { displayName: "asc" },
|
orderBy: { displayName: "asc" },
|
||||||
|
take: 2000,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (resources.length === 0) {
|
if (resources.length === 0) {
|
||||||
|
|||||||
@@ -117,27 +117,28 @@ async function persistImmediateBroadcast(
|
|||||||
data: buildBroadcastCreateData(senderId, input),
|
data: buildBroadcastCreateData(senderId, input),
|
||||||
});
|
});
|
||||||
|
|
||||||
const notificationIds: BroadcastRecipientNotification[] = [];
|
const created = await Promise.all(
|
||||||
for (const recipientUserId of recipientIds) {
|
recipientIds.map((recipientUserId) =>
|
||||||
const notificationId = await createNotification({
|
createNotification({
|
||||||
db,
|
db,
|
||||||
userId: recipientUserId,
|
userId: recipientUserId,
|
||||||
type: `BROADCAST_${input.category}`,
|
type: `BROADCAST_${input.category}`,
|
||||||
title: input.title,
|
title: input.title,
|
||||||
body: input.body,
|
body: input.body,
|
||||||
link: input.link,
|
link: input.link,
|
||||||
category: input.category,
|
category: input.category,
|
||||||
priority: input.priority,
|
priority: input.priority,
|
||||||
channel: input.channel,
|
channel: input.channel,
|
||||||
sourceId: broadcast.id,
|
sourceId: broadcast.id,
|
||||||
senderId,
|
senderId,
|
||||||
taskStatus: isTask ? "OPEN" : undefined,
|
taskStatus: isTask ? "OPEN" : undefined,
|
||||||
taskAction: input.taskAction,
|
taskAction: input.taskAction,
|
||||||
dueDate: input.dueDate,
|
dueDate: input.dueDate,
|
||||||
emit: false,
|
emit: false,
|
||||||
});
|
}),
|
||||||
notificationIds.push({ id: notificationId, userId: recipientUserId });
|
),
|
||||||
}
|
);
|
||||||
|
const notificationIds: BroadcastRecipientNotification[] = created.map((id, i) => ({ id, userId: recipientIds[i]! }));
|
||||||
|
|
||||||
const updatedBroadcast = await db.notificationBroadcast.update({
|
const updatedBroadcast = await db.notificationBroadcast.update({
|
||||||
where: { id: broadcast.id },
|
where: { id: broadcast.id },
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ export const resourceAnalyticsProcedures = {
|
|||||||
const resources = await ctx.db.resource.findMany({
|
const resources = await ctx.db.resource.findMany({
|
||||||
where: { isActive: true },
|
where: { isActive: true },
|
||||||
select: { id: true, displayName: true, chapter: true, skills: true },
|
select: { id: true, displayName: true, chapter: true, skills: true },
|
||||||
|
take: 5000,
|
||||||
});
|
});
|
||||||
|
|
||||||
const skillMap = new Map<
|
const skillMap = new Map<
|
||||||
|
|||||||
@@ -177,6 +177,7 @@ export const resourceCapacityReadProcedures = {
|
|||||||
country: { select: { code: true } },
|
country: { select: { code: true } },
|
||||||
metroCity: { select: { name: true } },
|
metroCity: { select: { name: true } },
|
||||||
},
|
},
|
||||||
|
take: 1000,
|
||||||
});
|
});
|
||||||
const bookings = await listAssignmentBookings(ctx.db, {
|
const bookings = await listAssignmentBookings(ctx.db, {
|
||||||
startDate: start,
|
startDate: start,
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ export const resourceMarketplaceReadProcedures = {
|
|||||||
country: { select: { code: true } },
|
country: { select: { code: true } },
|
||||||
metroCity: { select: { name: true } },
|
metroCity: { select: { name: true } },
|
||||||
},
|
},
|
||||||
|
take: 2000,
|
||||||
});
|
});
|
||||||
|
|
||||||
const assignments = await ctx.db.assignment.findMany({
|
const assignments = await ctx.db.assignment.findMany({
|
||||||
|
|||||||
@@ -35,64 +35,128 @@ export async function batchCreatePublicHolidayVacations(
|
|||||||
return { created: 0, holidays: 0, resources: 0 };
|
return { created: 0, holidays: 0, resources: 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
let created = 0;
|
const periodStart = new Date(`${input.year}-01-01T00:00:00.000Z`);
|
||||||
let holidayCount = 0;
|
const periodEnd = new Date(`${input.year}-12-31T00:00:00.000Z`);
|
||||||
|
|
||||||
|
// Step 1: Group resources by their holiday-resolution key so we call
|
||||||
|
// getResolvedCalendarHolidays once per unique location combo instead of
|
||||||
|
// once per resource (~5-10 calls vs. 500+).
|
||||||
|
type HolidayGroup = {
|
||||||
|
countryId: string | null;
|
||||||
|
countryCode: string | null | undefined;
|
||||||
|
federalState: string | null | undefined;
|
||||||
|
metroCityId: string | null;
|
||||||
|
metroCityName: string | null | undefined;
|
||||||
|
resourceIds: string[];
|
||||||
|
};
|
||||||
|
|
||||||
|
const groups = new Map<string, HolidayGroup>();
|
||||||
for (const resource of resources) {
|
for (const resource of resources) {
|
||||||
const holidays = await getResolvedCalendarHolidays(asHolidayResolverDb(db), {
|
const effectiveFederalState = input.federalState ?? resource.federalState;
|
||||||
periodStart: new Date(`${input.year}-01-01T00:00:00.000Z`),
|
const key = [
|
||||||
periodEnd: new Date(`${input.year}-12-31T00:00:00.000Z`),
|
resource.countryId ?? "",
|
||||||
countryId: resource.countryId,
|
resource.country?.code ?? "",
|
||||||
countryCode: resource.country?.code,
|
effectiveFederalState ?? "",
|
||||||
federalState: input.federalState ?? resource.federalState,
|
resource.metroCityId ?? "",
|
||||||
metroCityId: resource.metroCityId,
|
].join("|");
|
||||||
metroCityName: resource.metroCity?.name,
|
|
||||||
});
|
|
||||||
holidayCount += holidays.length;
|
|
||||||
|
|
||||||
|
if (!groups.has(key)) {
|
||||||
|
groups.set(key, {
|
||||||
|
countryId: resource.countryId,
|
||||||
|
countryCode: resource.country?.code,
|
||||||
|
federalState: effectiveFederalState,
|
||||||
|
metroCityId: resource.metroCityId,
|
||||||
|
metroCityName: resource.metroCity?.name,
|
||||||
|
resourceIds: [],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
groups.get(key)!.resourceIds.push(resource.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 2: Resolve holidays once per group (parallel).
|
||||||
|
const resourceHolidays = new Map<string, Array<{ date: string; name: string }>>();
|
||||||
|
await Promise.all(
|
||||||
|
[...groups.values()].map(async (group) => {
|
||||||
|
const holidays = await getResolvedCalendarHolidays(asHolidayResolverDb(db), {
|
||||||
|
periodStart,
|
||||||
|
periodEnd,
|
||||||
|
countryId: group.countryId,
|
||||||
|
countryCode: group.countryCode,
|
||||||
|
federalState: group.federalState,
|
||||||
|
metroCityId: group.metroCityId,
|
||||||
|
metroCityName: group.metroCityName,
|
||||||
|
});
|
||||||
|
for (const resourceId of group.resourceIds) {
|
||||||
|
resourceHolidays.set(resourceId, holidays);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Step 3: Build the full list of (resourceId, date) pairs.
|
||||||
|
const allPairs: Array<{ resourceId: string; startDate: Date; endDate: Date; name: string }> = [];
|
||||||
|
for (const resource of resources) {
|
||||||
|
const holidays = resourceHolidays.get(resource.id) ?? [];
|
||||||
for (const holiday of holidays) {
|
for (const holiday of holidays) {
|
||||||
const startDate = new Date(holiday.date);
|
const date = new Date(holiday.date);
|
||||||
const endDate = new Date(holiday.date);
|
allPairs.push({ resourceId: resource.id, startDate: date, endDate: date, name: holiday.name });
|
||||||
|
|
||||||
if (input.replaceExisting) {
|
|
||||||
await db.vacation.deleteMany({
|
|
||||||
where: {
|
|
||||||
resourceId: resource.id,
|
|
||||||
type: VacationType.PUBLIC_HOLIDAY,
|
|
||||||
startDate,
|
|
||||||
endDate,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const exists = await db.vacation.findFirst({
|
|
||||||
where: {
|
|
||||||
resourceId: resource.id,
|
|
||||||
type: VacationType.PUBLIC_HOLIDAY,
|
|
||||||
startDate,
|
|
||||||
endDate,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
if (exists) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
await db.vacation.create({
|
|
||||||
data: {
|
|
||||||
resourceId: resource.id,
|
|
||||||
type: VacationType.PUBLIC_HOLIDAY,
|
|
||||||
status: VacationStatus.APPROVED,
|
|
||||||
startDate,
|
|
||||||
endDate,
|
|
||||||
note: holiday.name,
|
|
||||||
requestedById: adminUserId,
|
|
||||||
approvedById: adminUserId,
|
|
||||||
approvedAt: new Date(),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
created++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return { created, holidays: holidayCount, resources: resources.length };
|
const holidayCount = allPairs.length;
|
||||||
|
|
||||||
|
if (holidayCount === 0) {
|
||||||
|
return { created: 0, holidays: 0, resources: resources.length };
|
||||||
|
}
|
||||||
|
|
||||||
|
const resourceIds = resources.map((r) => r.id);
|
||||||
|
|
||||||
|
// Step 4: Batch delete for the whole period if replaceExisting (1 query).
|
||||||
|
if (input.replaceExisting) {
|
||||||
|
await db.vacation.deleteMany({
|
||||||
|
where: {
|
||||||
|
resourceId: { in: resourceIds },
|
||||||
|
type: VacationType.PUBLIC_HOLIDAY,
|
||||||
|
startDate: { gte: periodStart, lte: periodEnd },
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 5: Batch fetch all existing entries for the period (1 query).
|
||||||
|
const existing = await db.vacation.findMany({
|
||||||
|
where: {
|
||||||
|
resourceId: { in: resourceIds },
|
||||||
|
type: VacationType.PUBLIC_HOLIDAY,
|
||||||
|
startDate: { gte: periodStart, lte: periodEnd },
|
||||||
|
},
|
||||||
|
select: { resourceId: true, startDate: true },
|
||||||
|
});
|
||||||
|
|
||||||
|
const existingSet = new Set(
|
||||||
|
existing.map((e) => `${e.resourceId}::${new Date(e.startDate).toISOString()}`),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Step 6: createMany for all new entries (1 query).
|
||||||
|
const toCreate = allPairs.filter(
|
||||||
|
(p) => !existingSet.has(`${p.resourceId}::${p.startDate.toISOString()}`),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (toCreate.length > 0) {
|
||||||
|
const now = new Date();
|
||||||
|
await db.vacation.createMany({
|
||||||
|
data: toCreate.map((p) => ({
|
||||||
|
resourceId: p.resourceId,
|
||||||
|
type: VacationType.PUBLIC_HOLIDAY,
|
||||||
|
status: VacationStatus.APPROVED,
|
||||||
|
startDate: p.startDate,
|
||||||
|
endDate: p.endDate,
|
||||||
|
note: p.name,
|
||||||
|
requestedById: adminUserId,
|
||||||
|
approvedById: adminUserId,
|
||||||
|
approvedAt: now,
|
||||||
|
})),
|
||||||
|
skipDuplicates: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return { created: toCreate.length, holidays: holidayCount, resources: resources.length };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -751,6 +751,7 @@ model ManagementLevel {
|
|||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
|
||||||
|
@@index([groupId])
|
||||||
@@map("management_levels")
|
@@map("management_levels")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -778,6 +779,8 @@ model Blueprint {
|
|||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
|
||||||
|
@@index([isActive])
|
||||||
|
@@index([target])
|
||||||
@@map("blueprints")
|
@@map("blueprints")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -904,6 +907,7 @@ model Resource {
|
|||||||
@@index([countryId])
|
@@index([countryId])
|
||||||
@@index([orgUnitId])
|
@@index([orgUnitId])
|
||||||
@@index([resourceType])
|
@@index([resourceType])
|
||||||
|
@@index([managementLevelGroupId])
|
||||||
@@map("resources")
|
@@map("resources")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1347,6 +1351,8 @@ model Assignment {
|
|||||||
@@index([status])
|
@@index([status])
|
||||||
@@index([resourceId, status, startDate])
|
@@index([resourceId, status, startDate])
|
||||||
@@index([projectId, startDate, endDate])
|
@@index([projectId, startDate, endDate])
|
||||||
|
@@index([status, startDate, endDate])
|
||||||
|
@@index([projectId, status, startDate, endDate])
|
||||||
@@map("assignments")
|
@@map("assignments")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1386,6 +1392,7 @@ model Vacation {
|
|||||||
@@index([startDate, endDate])
|
@@index([startDate, endDate])
|
||||||
@@index([status])
|
@@index([status])
|
||||||
@@index([resourceId, status, startDate, endDate])
|
@@index([resourceId, status, startDate, endDate])
|
||||||
|
@@index([requestedById])
|
||||||
@@map("vacations")
|
@@map("vacations")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1649,6 +1656,7 @@ model Comment {
|
|||||||
|
|
||||||
@@index([entityType, entityId])
|
@@index([entityType, entityId])
|
||||||
@@index([authorId])
|
@@index([authorId])
|
||||||
|
@@index([parentId])
|
||||||
@@map("comments")
|
@@map("comments")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user