mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-09 07:03:25 +00:00
refactor: split backend by context instead of type 'controllers/models/...'
This commit is contained in:
16
app/collections/validators/create_collection_validator.ts
Normal file
16
app/collections/validators/create_collection_validator.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { Visibility } from '#collections/enums/visibility';
|
||||
import vine, { SimpleMessagesProvider } from '@vinejs/vine';
|
||||
|
||||
export const createCollectionValidator = vine.compile(
|
||||
vine.object({
|
||||
name: vine.string().trim().minLength(1).maxLength(254),
|
||||
description: vine.string().trim().maxLength(254).nullable(),
|
||||
visibility: vine.enum(Visibility),
|
||||
nextId: vine.number().optional(),
|
||||
})
|
||||
);
|
||||
|
||||
createCollectionValidator.messagesProvider = new SimpleMessagesProvider({
|
||||
name: 'Collection name is required',
|
||||
'visibility.required': 'Collection visibiliy is required',
|
||||
});
|
||||
Reference in New Issue
Block a user