mirror of
https://github.com/ArthurDanjou/artdanj-shortener.git
synced 2026-01-21 10:23:17 +01:00
23 lines
536 B
TypeScript
23 lines
536 B
TypeScript
import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
|
|
import {rules, schema} from '@ioc:Adonis/Core/Validator'
|
|
|
|
export default class UpdateValidator {
|
|
constructor (private ctx: HttpContextContract) {
|
|
}
|
|
|
|
public schema = schema.create({
|
|
code: schema.string.optional({}, [
|
|
rules.unique({table: 'links', column: 'code' }),
|
|
rules.maxLength(10)
|
|
]),
|
|
target: schema.string.optional({}),
|
|
visit_count: schema.number.optional()
|
|
})
|
|
|
|
|
|
public cacheKey = this.ctx.routeKey
|
|
|
|
|
|
public messages = {}
|
|
}
|