Files
artdanj-api/app/Validators/post/PostStoreValidator.ts
2021-11-10 12:06:58 +01:00

25 lines
651 B
TypeScript

import { schema } from '@ioc:Adonis/Core/Validator'
import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
export default class PostStoreValidator {
public schema = schema.create({
slug: schema.string(),
likes: schema.number(),
tags: schema.array().members(schema.string()),
title: schema.string(),
description: schema.string(),
cover: schema.string(),
readingTime: schema.number(),
date: schema.string(),
color: schema.string(),
content: schema.string(),
})
public messages = {
required: 'The field {{field}} is required',
}
constructor(protected ctx: HttpContextContract) {
}
}