feat(projekt): Projektmanagement-Tiefe nach Buch & Leitfaden v3.0
Operationalisiert den ToolCTRL-Projektmanagement-Leitfaden auf der Projekt-Detailseite (hybrid: Cockpit-Primitive nativ, Schwergewichtiges per Outline-Link): - Projekt-Modus (Relax/Standard/Eskalation/Taskforce) + Dashboard-Surfacing - Risiko- & Chancen-Register (Wahrscheinlichkeit×Auswirkung, Showstopper, Owner, Strategie) — offene Showstopper landen auf dem Dashboard - Stakeholder-Analyse mit Macht/Interesse-Matrix - Ziel & Definition: SMART-Ziel, Nicht-Ziele, Liefergegenstaende, Maxime, Zieldreieck (welche Ecke gibt nach) - Meilensteine editierbar inkl. Ergebnis/Kundennutzen, Freitags-/ Feiertags-Warnung, Mindest-2-Hinweis - Phasen-Lebenszyklus (Definition→Planung→Umsetzung→Abschluss) mit Gate-Reviews - Projekt-Statusbericht (Ampel/Trend/Text, extern-Flag, Verlauf) — speist statusCache & Pflicht-Minimum - Änderungs-Log (Scope-Creep-Schutz), strukturierter Abschluss mit Checkliste + Abschlussvermerk Migrationen 0009_pm_insights + 0010_leitfaden_phases. Enthält auch die gemeinsame schema.ts (inkl. Lead-Tabellen aus dem Vor-Commit) und Seed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
d72aa9fbf3
commit
864a1cef6a
22 files changed
+9237
-60
No files matched your search
@@ -0,0 +1,62 @@
|
||||
import { TRPCError } from '@trpc/server';
|
||||
import { desc, eq } from 'drizzle-orm';
|
||||
import { changeEntry, user } from '@cockpit/db';
|
||||
import { ChangeSchemas } from '@cockpit/shared';
|
||||
import { router, protectedProcedure } from '../trpc.js';
|
||||
|
||||
export const changeRouter = router({
|
||||
forProject: protectedProcedure
|
||||
.input(ChangeSchemas.changeForProjectInput)
|
||||
.query(async ({ ctx, input }) => {
|
||||
const rows = await ctx.db
|
||||
.select({ change: changeEntry, authorName: user.name })
|
||||
.from(changeEntry)
|
||||
.leftJoin(user, eq(user.id, changeEntry.createdBy))
|
||||
.where(eq(changeEntry.projectId, input.projectId))
|
||||
.orderBy(desc(changeEntry.createdAt));
|
||||
return rows.map((r) => ({ ...r.change, authorName: r.authorName }));
|
||||
}),
|
||||
|
||||
create: protectedProcedure
|
||||
.input(ChangeSchemas.createChangeInput)
|
||||
.mutation(async ({ ctx, input }) => {
|
||||
const [created] = await ctx.db
|
||||
.insert(changeEntry)
|
||||
.values({
|
||||
projectId: input.projectId,
|
||||
titel: input.titel,
|
||||
auswirkung: input.auswirkung ?? null,
|
||||
entscheidung: input.entscheidung,
|
||||
createdBy: ctx.user.id,
|
||||
})
|
||||
.returning();
|
||||
return created;
|
||||
}),
|
||||
|
||||
update: protectedProcedure
|
||||
.input(ChangeSchemas.updateChangeInput)
|
||||
.mutation(async ({ ctx, input }) => {
|
||||
const { id, ...patch } = input;
|
||||
if (Object.keys(patch).length === 0) {
|
||||
const existing = (
|
||||
await ctx.db.select().from(changeEntry).where(eq(changeEntry.id, id)).limit(1)
|
||||
)[0];
|
||||
if (!existing) throw new TRPCError({ code: 'NOT_FOUND', message: 'Eintrag nicht gefunden.' });
|
||||
return existing;
|
||||
}
|
||||
const [updated] = await ctx.db
|
||||
.update(changeEntry)
|
||||
.set(patch)
|
||||
.where(eq(changeEntry.id, id))
|
||||
.returning();
|
||||
if (!updated) throw new TRPCError({ code: 'NOT_FOUND', message: 'Eintrag nicht gefunden.' });
|
||||
return updated;
|
||||
}),
|
||||
|
||||
remove: protectedProcedure
|
||||
.input(ChangeSchemas.removeChangeInput)
|
||||
.mutation(async ({ ctx, input }) => {
|
||||
await ctx.db.delete(changeEntry).where(eq(changeEntry.id, input.id));
|
||||
return { ok: true as const };
|
||||
}),
|
||||
});
|
||||
Reference in new issue
Block a user