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