add and edit
This commit is contained in:
@@ -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(),
|
||||
})
|
||||
)
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user