import { FastifyRequest } from "fastify";
|
|
import validate from "validate.js";
|
|
import { constraints } from "@common/validation";
|
|
import Request from "./Request";
|
|
|
|
export interface IRegisterFormBody {
|
|
token: string,
|
|
name: string,
|
|
email: string,
|
|
password: string,
|
|
retypePassword: string
|
|
}
|
|
|
|
export default class RegisterRequest extends Request
|
|
{
|
|
/**
|
|
* Validate the request
|
|
*/
|
|
public validate(request: FastifyRequest) {
|
|
return validate.async(request.body, {
|
|
token: constraints.register.token,
|
|
name: constraints.register.name,
|
|
email: constraints.register.email,
|
|
password: constraints.register.password,
|
|
retypePassword: constraints.register.retypePassword
|
|
},<any>{ fullMessages: false });
|
|
}
|
|
}
|