refactor(api): align timeline project read routing
This commit is contained in:
@@ -45,6 +45,17 @@ export async function readTimelineProjectShiftPreviewDetail(
|
||||
});
|
||||
}
|
||||
|
||||
export async function readTimelineProjectShiftPreview(
|
||||
db: TimelineProjectProcedureDb,
|
||||
input: {
|
||||
projectId: string;
|
||||
newStartDate: Date;
|
||||
newEndDate: Date;
|
||||
},
|
||||
) {
|
||||
return previewTimelineProjectShift(db, input);
|
||||
}
|
||||
|
||||
export async function readTimelineProjectBudgetStatusResponse(
|
||||
db: TimelineProjectProcedureDb,
|
||||
projectId: string,
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { ShiftProjectSchema } from "@capakraken/shared";
|
||||
import { z } from "zod";
|
||||
import { controllerProcedure } from "../trpc.js";
|
||||
import { previewTimelineProjectShift } from "./timeline-project-load-support.js";
|
||||
import {
|
||||
TimelineProjectContextDetailSchema,
|
||||
TimelineProjectIdSchema,
|
||||
} from "./timeline-read-shared.js";
|
||||
import {
|
||||
readTimelineProjectContextDetailResponse,
|
||||
@@ -11,12 +10,13 @@ import {
|
||||
} from "./timeline-project-context-procedure-support.js";
|
||||
import {
|
||||
readTimelineProjectBudgetStatusResponse,
|
||||
readTimelineProjectShiftPreview,
|
||||
readTimelineProjectShiftPreviewDetail,
|
||||
} from "./timeline-project-procedure-support.js";
|
||||
|
||||
export const timelineProjectReadProcedures = {
|
||||
getProjectContext: controllerProcedure
|
||||
.input(z.object({ projectId: z.string() }))
|
||||
.input(TimelineProjectIdSchema)
|
||||
.query(async ({ ctx, input }) => readTimelineProjectContextResponse(ctx.db, input.projectId)),
|
||||
|
||||
getProjectContextDetail: controllerProcedure
|
||||
@@ -25,13 +25,13 @@ export const timelineProjectReadProcedures = {
|
||||
|
||||
previewShift: controllerProcedure
|
||||
.input(ShiftProjectSchema)
|
||||
.query(async ({ ctx, input }) => previewTimelineProjectShift(ctx.db, input)),
|
||||
.query(async ({ ctx, input }) => readTimelineProjectShiftPreview(ctx.db, input)),
|
||||
|
||||
getShiftPreviewDetail: controllerProcedure
|
||||
.input(ShiftProjectSchema)
|
||||
.query(async ({ ctx, input }) => readTimelineProjectShiftPreviewDetail(ctx.db, input)),
|
||||
|
||||
getBudgetStatus: controllerProcedure
|
||||
.input(z.object({ projectId: z.string() }))
|
||||
.input(TimelineProjectIdSchema)
|
||||
.query(async ({ ctx, input }) => readTimelineProjectBudgetStatusResponse(ctx.db, input.projectId)),
|
||||
};
|
||||
|
||||
@@ -60,6 +60,10 @@ export const TimelineProjectContextDetailSchema = z.object({
|
||||
durationDays: z.number().int().min(1).max(366).optional(),
|
||||
});
|
||||
|
||||
export const TimelineProjectIdSchema = z.object({
|
||||
projectId: z.string(),
|
||||
});
|
||||
|
||||
type TimelineWindowFiltersInput = z.infer<typeof TimelineWindowFiltersSchema>;
|
||||
|
||||
export function getAssignmentResourceIds(
|
||||
|
||||
Reference in New Issue
Block a user