UNPKG

alapa

Version:

A cutting-edge web development framework designed to revolutionize the way developers build modern web applications.

32 lines (31 loc) 1.64 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.OpenApiMethod = OpenApiMethod; /* eslint-disable @typescript-eslint/no-unused-vars */ /* eslint-disable @typescript-eslint/no-explicit-any */ require("reflect-metadata"); const entry_1 = require("../builder/entry"); function OpenApiMethod(route, property) { return function (target, propertyKey, descriptor) { // Reflect.defineMetadata(ROUTE_KEY, route, target, propertyKey); // Reflect.defineMetadata(METHOD_KEY, method, target, propertyKey); console.log(target, propertyKey); // property instead of propertyKey entry_1.temporalCollections["objects"].push(propertyKey); if (!entry_1.temporalCollections["routes"]) { entry_1.temporalCollections["routes"] = {}; } entry_1.temporalCollections["routes"][propertyKey] = route; if (!entry_1.temporalCollections["methods"]) { entry_1.temporalCollections["methods"] = {}; } // temporalCollections["methods"][propertyKey] = method; }; } // export const openapiGet = (route: string) => OpenApiMethod(route, "get"); // export const openapiPost = (route: string) => OpenApiMethod(route, "post"); // export const openapiPut = (route: string) => OpenApiMethod(route, "put"); // export const openapiDelete = (route: string) => OpenApiMethod(route, "delete"); // export const openapiPatch = (route: string) => OpenApiMethod(route, "patch"); // export const openapiOptions = (route: string) => // OpenApiMethod(route, "options"); // export const openapiHead = (route: string) => OpenApiMethod(route, "head");