// @ts-nocheck /** * 方法 * @param opts 参数 */ type TMethod = "GET" | "POST" | "PUT" | "DELETE" export function method(opts?: TMethod | Array) { return function (target, propertyKey: string, descriptor: PropertyDescriptor) { target[propertyKey].$method = opts } } export function route(route?: string) { return function (target, propertyKey: string, descriptor: PropertyDescriptor) { target[propertyKey].$route = route } } export function route_path(route_path?: string) { return function (target, propertyKey: string, descriptor: PropertyDescriptor) { target[propertyKey].$route_path = route_path } } export function config(options: Object) { return function (target, propertyKey: string, descriptor: PropertyDescriptor) { target[propertyKey].$options = options } } export function auth(isAuth: boolean | "try" | "required" | "optional" = true) { return function (target, propertyKey: string, descriptor: PropertyDescriptor) { target[propertyKey].$auth = isAuth } } export function validate(validate: Object) { return function (target, propertyKey: string, descriptor: PropertyDescriptor) { target[propertyKey].$validate = validate } } export function swagger(desc, notes, tags) { return function (target, propertyKey: string, descriptor: PropertyDescriptor) { target[propertyKey].$swagger = [desc, notes, tags] } }