add and edit

This commit is contained in:
2026-03-07 14:47:42 +01:00
parent 724980fd31
commit 9d015c2e2c
15 changed files with 214 additions and 43 deletions

View File

@@ -15,8 +15,8 @@ export const createTimelineItem = createServerFn({ method: "POST" })
start: z.string().transform((s) => new Date(s)),
end: z
.string()
.optional()
.transform((s) => (s ? new Date(s) : undefined)),
.nullable()
.transform((s) => (s ? new Date(s) : null)),
timelineGroupId: z.string().uuid(),
})
)

View File

@@ -17,6 +17,8 @@ export const updateTimelineItem = createServerFn({ method: "POST" })
.transform((s) => (s ? new Date(s) : null)),
timelineGroupId: z.string().uuid(),
lane: z.number().int().min(1),
title: z.string().min(1).optional(),
description: z.string().optional(),
})
)
.handler(async ({ data }) => {
@@ -27,6 +29,10 @@ export const updateTimelineItem = createServerFn({ method: "POST" })
end: data.end,
timelineGroupId: data.timelineGroupId,
lane: data.lane,
...(data.title !== undefined && { title: data.title }),
...(data.description !== undefined && {
description: data.description,
}),
})
.where(eq(timelineItem.id, data.id))
.returning();