mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-08 22:53:25 +00:00
44 lines
909 B
TypeScript
44 lines
909 B
TypeScript
import vine from '@vinejs/vine';
|
|
|
|
const params = vine.object({
|
|
id: vine.number(),
|
|
});
|
|
|
|
export const createLinkValidator = 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.number(),
|
|
})
|
|
);
|
|
|
|
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.number(),
|
|
|
|
params,
|
|
})
|
|
);
|
|
|
|
export const deleteLinkValidator = vine.compile(
|
|
vine.object({
|
|
params,
|
|
})
|
|
);
|
|
|
|
export const updateLinkFavoriteStatusValidator = vine.compile(
|
|
vine.object({
|
|
favorite: vine.boolean(),
|
|
|
|
params: vine.object({
|
|
id: vine.number(),
|
|
}),
|
|
})
|
|
);
|