import { HTTPBody } from "@fastify-modular/route"; import { pito } from "pito"; import { NeedLogin } from "../defines"; import { GenderType, NationalityType } from "../enums"; // ===================================================================================== export const CreateUserInput = pito.Obj({ userName : pito.Opt(pito.Str()), email : pito.Opt(pito.Str()), // TODO : libphonenumber integration? phoneNumber : pito.Str({}), nickName : pito.Str(), birth : pito.Date(), nationalityType: pito.Opt(pito.Enums(NationalityType)), genderType : pito.Opt(pito.Enums(GenderType)), emailRcvYn : pito.Str({}), kakaoRcvYn : pito.Str({}), }); export type CreateUserInput = pito.Type; // ===================================================================================== export const CreateUserOutput = pito.Obj({ userId: pito.Int(), }); export type CreateUserOutput = pito.Type; // ===================================================================================== export const CreateUser = HTTPBody("POST", "/api/v1/admin/user", "admin") .body(CreateUserInput) .response(CreateUserOutput) .presets(NeedLogin) .build(); // =====================================================================================