feat(app): changelog version number editable
This commit is contained in:
parent
37be3bc1f5
commit
000a76d28d
@ -62,6 +62,7 @@ export const updateFunc = async ({
|
|||||||
const [versionUpdateResult] = await db
|
const [versionUpdateResult] = await db
|
||||||
.update(changelog_version)
|
.update(changelog_version)
|
||||||
.set({
|
.set({
|
||||||
|
version: payload.version,
|
||||||
status: payload.status,
|
status: payload.status,
|
||||||
markdown: payload.markdown,
|
markdown: payload.markdown,
|
||||||
releasedAt: payload.releasedAt ? new Date(payload.releasedAt) : null,
|
releasedAt: payload.releasedAt ? new Date(payload.releasedAt) : null,
|
||||||
|
@ -8,6 +8,7 @@ import {
|
|||||||
FormItem,
|
FormItem,
|
||||||
FormLabel,
|
FormLabel,
|
||||||
FormMessage,
|
FormMessage,
|
||||||
|
Input,
|
||||||
Popover,
|
Popover,
|
||||||
PopoverContent,
|
PopoverContent,
|
||||||
PopoverTrigger,
|
PopoverTrigger,
|
||||||
@ -55,6 +56,7 @@ const Component = () => {
|
|||||||
const { data, error, isPending, refetch } = useChangelogVersionById({
|
const { data, error, isPending, refetch } = useChangelogVersionById({
|
||||||
id: versionId,
|
id: versionId,
|
||||||
})
|
})
|
||||||
|
|
||||||
const form = useForm<z.infer<typeof VersionUpdateInput>>({
|
const form = useForm<z.infer<typeof VersionUpdateInput>>({
|
||||||
resolver: zodResolver(VersionUpdateInput),
|
resolver: zodResolver(VersionUpdateInput),
|
||||||
defaultValues: data,
|
defaultValues: data,
|
||||||
@ -93,12 +95,25 @@ const Component = () => {
|
|||||||
<Separator />
|
<Separator />
|
||||||
{!isPending && data && (
|
{!isPending && data && (
|
||||||
<div>
|
<div>
|
||||||
<h1 className="text-xl mb-2">Version: {data.version}</h1>
|
|
||||||
<Form {...form}>
|
<Form {...form}>
|
||||||
<form
|
<form
|
||||||
onSubmit={form.handleSubmit(onSubmit)}
|
onSubmit={form.handleSubmit(onSubmit)}
|
||||||
className="space-y-8 max-w-screen-md"
|
className="space-y-8 max-w-screen-md"
|
||||||
>
|
>
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="version"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem>
|
||||||
|
<FormLabel>Version</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<Input placeholder="v1.0.1" {...field} />
|
||||||
|
</FormControl>{' '}
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="markdown"
|
name="markdown"
|
||||||
|
@ -4,6 +4,7 @@ import { VersionOutput } from './base'
|
|||||||
export const VersionUpdateOutput = VersionOutput
|
export const VersionUpdateOutput = VersionOutput
|
||||||
export const VersionUpdateInput = z
|
export const VersionUpdateInput = z
|
||||||
.object({
|
.object({
|
||||||
|
version: z.string(),
|
||||||
markdown: z.string().optional(),
|
markdown: z.string().optional(),
|
||||||
status: z
|
status: z
|
||||||
.enum(['draft', 'review', 'published'])
|
.enum(['draft', 'review', 'published'])
|
||||||
|
Loading…
Reference in New Issue
Block a user