import { HTTPBody } from '@fastify-modular/route'; import { pito } from 'pito'; import { NeedLogin } from '../defines'; // =========================================================================================== export const CheckPasswordInput = pito.Obj({ password: pito.Str(), }); export type CheckPasswordInput = pito.Type; // =========================================================================================== export const CheckPasswordOption = pito.Obj({ }); export type CheckPasswordOption = pito.Type; // =========================================================================================== export const CheckPasswordOutput = pito.Uobj('result') .case('valid', {}) .case('invalid', {}) .end(); export type CheckPasswordOutput = pito.Type; // =========================================================================================== // API : [Stable] export const CheckPassword = HTTPBody( 'PUT', '/api/v1/auth/check-password', 'auth', ) .body(CheckPasswordInput) .query(CheckPasswordOption) .response(CheckPasswordOutput) .presets(NeedLogin) .build(); // ===========================================================================================