feat: Re-add initiative branch field and add projects settings page
Allow users to specify a custom branch when creating initiatives (auto-generated if left blank). Add updateProject tRPC procedure and /settings/projects page with inline-editable defaultBranch.
This commit is contained in:
@@ -12,6 +12,7 @@ export function initiativeProcedures(publicProcedure: ProcedureBuilder) {
|
||||
createInitiative: publicProcedure
|
||||
.input(z.object({
|
||||
name: z.string().min(1),
|
||||
branch: z.string().nullable().optional(),
|
||||
projectIds: z.array(z.string().min(1)).min(1).optional(),
|
||||
executionMode: z.enum(['yolo', 'review_per_phase']).optional(),
|
||||
}))
|
||||
@@ -35,6 +36,7 @@ export function initiativeProcedures(publicProcedure: ProcedureBuilder) {
|
||||
name: input.name,
|
||||
status: 'active',
|
||||
...(input.executionMode && { executionMode: input.executionMode }),
|
||||
...(input.branch && { branch: input.branch }),
|
||||
});
|
||||
|
||||
if (input.projectIds && input.projectIds.length > 0) {
|
||||
|
||||
@@ -90,6 +90,24 @@ export function projectProcedures(publicProcedure: ProcedureBuilder) {
|
||||
return { success: true };
|
||||
}),
|
||||
|
||||
updateProject: publicProcedure
|
||||
.input(z.object({
|
||||
id: z.string().min(1),
|
||||
defaultBranch: z.string().min(1).optional(),
|
||||
}))
|
||||
.mutation(async ({ ctx, input }) => {
|
||||
const repo = requireProjectRepository(ctx);
|
||||
const { id, ...data } = input;
|
||||
const existing = await repo.findById(id);
|
||||
if (!existing) {
|
||||
throw new TRPCError({
|
||||
code: 'NOT_FOUND',
|
||||
message: `Project '${id}' not found`,
|
||||
});
|
||||
}
|
||||
return repo.update(id, data);
|
||||
}),
|
||||
|
||||
getInitiativeProjects: publicProcedure
|
||||
.input(z.object({ initiativeId: z.string().min(1) }))
|
||||
.query(async ({ ctx, input }) => {
|
||||
|
||||
Reference in New Issue
Block a user