feat: project colors, timeline filters, sidebar fix, GitLooper agent, and misc improvements
- Fix sidebar double-highlight on /vacations/my (Gitea #6): add isNavItemActive() helper - Add project color picker (schema + API + modal + timeline rendering) - Add ProjectCombobox/ResourceCombobox to timeline toolbar - Show PENDING vacations on timeline with dashed/dimmed style - Add "show demand projects" preference with localStorage persistence - Add ProjectAssignmentsTable with total hours/cost columns - Extend vacation API to accept status arrays - Add GitLooper formal YAML agent configuration - Extend user admin with permission overrides UI - Add delete-assignment use case tests - Add status-styles.ts shared badge constants - Centralize formatMoney/formatCents in format.ts Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
import type { Prisma, PrismaClient } from "@planarchy/db";
|
||||
import { AllocationStatus } from "@planarchy/shared";
|
||||
|
||||
type DbClient =
|
||||
| Pick<PrismaClient, "assignment">
|
||||
| Pick<Prisma.TransactionClient, "assignment">;
|
||||
| Pick<PrismaClient, "assignment" | "demandRequirement">
|
||||
| Pick<Prisma.TransactionClient, "assignment" | "demandRequirement">;
|
||||
|
||||
export interface DeleteAssignmentResult {
|
||||
deletedId: string;
|
||||
projectId: string;
|
||||
resourceId: string;
|
||||
reopenedDemandId: string | null;
|
||||
}
|
||||
|
||||
export async function deleteAssignment(
|
||||
@@ -20,6 +22,7 @@ export async function deleteAssignment(
|
||||
id: true,
|
||||
projectId: true,
|
||||
resourceId: true,
|
||||
demandRequirementId: true,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -31,9 +34,31 @@ export async function deleteAssignment(
|
||||
where: { id: assignment.id },
|
||||
});
|
||||
|
||||
// Reverse demand fill progress: re-open the demand if the assignment was linked
|
||||
let reopenedDemandId: string | null = null;
|
||||
if (assignment.demandRequirementId) {
|
||||
const demand = await db.demandRequirement.findUnique({
|
||||
where: { id: assignment.demandRequirementId },
|
||||
select: { id: true, headcount: true, status: true },
|
||||
});
|
||||
|
||||
if (demand) {
|
||||
const wasCompleted = demand.status === AllocationStatus.COMPLETED;
|
||||
await db.demandRequirement.update({
|
||||
where: { id: demand.id },
|
||||
data: {
|
||||
headcount: wasCompleted ? 1 : demand.headcount + 1,
|
||||
status: AllocationStatus.ACTIVE,
|
||||
},
|
||||
});
|
||||
reopenedDemandId = demand.id;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
deletedId: assignment.id,
|
||||
projectId: assignment.projectId,
|
||||
resourceId: assignment.resourceId,
|
||||
reopenedDemandId,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user