import {HTTPBody} from '@fastify-modular/route'; import {pito} from 'pito'; import {NeedLogin} from '../defines'; import {PriceDefine, UserDefine} from '../types'; // ========================================================================== export const CreateBuyInput = pito.Obj({ sellId: pito.Int(), price : PriceDefine, }); export type CreateBuyInput = pito.Type; // ========================================================================== export const CreateBuyOption = pito.Obj({}); export type CreateBuyOption = pito.Type; // ========================================================================== export const CreateBuyOutput = pito.Obj({ id : pito.Num(), productId: pito.Num(), sellId : pito.Num(), // user : UserDefine, price : PriceDefine, }); export type CreateBuyOutput = pito.Type; // ========================================================================== export const CreateBuy = HTTPBody('POST', '/api/v1/product/create-buy', 'order') .body(CreateBuyInput) .query(CreateBuyOption) .response(CreateBuyOutput) .presets(NeedLogin) .build(); // ==========================================================================