mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-11 08:43:04 +00:00
17 lines
563 B
TypeScript
17 lines
563 B
TypeScript
import vine, { SimpleMessagesProvider } from '@vinejs/vine';
|
|
import { Visibility } from '../enums/visibility.js';
|
|
|
|
export const collectionValidator = vine.compile(
|
|
vine.object({
|
|
name: vine.string().trim().minLength(1).maxLength(254),
|
|
description: vine.string().trim().maxLength(300).optional(),
|
|
visibility: vine.enum(Visibility),
|
|
nextId: vine.string().optional(),
|
|
})
|
|
);
|
|
|
|
collectionValidator.messagesProvider = new SimpleMessagesProvider({
|
|
name: 'Collection name is required',
|
|
'visibility.required': 'Collection visibiliy is required',
|
|
});
|