refactor(api): centralize timeline read detail schemas

This commit is contained in:
2026-03-31 18:22:20 +02:00
parent 4758c96543
commit 66a33a5ad6
4 changed files with 55 additions and 22 deletions
@@ -1,6 +1,8 @@
import { describe, expect, it } from "vitest";
import {
buildTimelineEntriesDetailInput,
TimelineDetailFiltersSchema,
TimelineProjectContextDetailSchema,
} from "../router/timeline-read-shared.js";
describe("timeline read shared", () => {
@@ -39,4 +41,32 @@ describe("timeline read shared", () => {
});
});
it("shares detail filter schemas across timeline read endpoints", () => {
expect(TimelineDetailFiltersSchema.parse({
startDate: "2026-04-01",
durationDays: 14,
resourceIds: ["resource_1"],
countryCodes: ["DE"],
})).toEqual({
startDate: "2026-04-01",
endDate: undefined,
durationDays: 14,
resourceIds: ["resource_1"],
projectIds: undefined,
clientIds: undefined,
chapters: undefined,
eids: undefined,
countryCodes: ["DE"],
});
expect(TimelineProjectContextDetailSchema.parse({
projectId: "project_1",
endDate: "2026-04-20",
})).toEqual({
projectId: "project_1",
startDate: undefined,
endDate: "2026-04-20",
durationDays: undefined,
});
});
});