UNPKG

@avonjs/avonjs

Version:

A fluent Node.js API generator.

46 lines (45 loc) 1.31 kB
import Joi from 'joi'; import type { Filter } from '../Filters'; import type AvonRequest from '../Http/Requests/AvonRequest'; import type { AnyValue, ResolveCallback } from '../Contracts'; import Field from './Field'; export default class DateTime extends Field { /** * The validation rules callback for creation and updates. */ protected rulesSchema: Joi.DateSchema<Date>; /** * The validation rules callback for creation. */ protected creationRulesSchema: Joi.DateSchema<Date>; /** * The validation rules callback for updates. */ protected updateRulesSchema: Joi.DateSchema<Date>; /** * Indicates the date store / retrieve format. */ protected dateFormat: string; constructor(attribute: string, resolveCallback?: ResolveCallback); /** * Mutate the field value for response. */ getMutatedValue(request: AvonRequest, value: AnyValue): string; /** * Determine field is filterable or not. */ isFilterable(): boolean; /** * Determine field is orderable or not. */ isOrderable(): boolean; /** * Make the field filter. */ makeFilter(request: AvonRequest): Filter; /** * * Specify store / retrieve date format. */ format(dateFormat: string): this; }