mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-09 23:15:36 +00:00
feat: add create/edit link form + controller methods
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import vine from '@vinejs/vine';
|
||||
|
||||
export const linkValidator = vine.compile(
|
||||
export const createLinkValidator = vine.compile(
|
||||
vine.object({
|
||||
name: vine.string().trim().minLength(1).maxLength(254),
|
||||
description: vine.string().trim().maxLength(300).optional(),
|
||||
@@ -9,3 +9,27 @@ export const linkValidator = vine.compile(
|
||||
collectionId: vine.string().trim(),
|
||||
})
|
||||
);
|
||||
|
||||
export const updateLinkValidator = vine.compile(
|
||||
vine.object({
|
||||
name: vine.string().trim().minLength(1).maxLength(254),
|
||||
description: vine.string().trim().maxLength(300).optional(),
|
||||
url: vine.string().trim(),
|
||||
favorite: vine.boolean(),
|
||||
collectionId: vine.string().trim(),
|
||||
|
||||
params: vine.object({
|
||||
id: vine.string().trim(),
|
||||
}),
|
||||
})
|
||||
);
|
||||
|
||||
export const updateLinkFavoriteStatusValidator = vine.compile(
|
||||
vine.object({
|
||||
favorite: vine.boolean(),
|
||||
|
||||
params: vine.object({
|
||||
id: vine.string().trim(),
|
||||
}),
|
||||
})
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user