template-saas/apps/backend/node_modules/@nestjs/swagger/dist/utils/get-schema-path.util.js
rckrdmrd 26f0e52ca7 feat: Initial commit - template-saas
Template base para proyectos SaaS multi-tenant.

Estructura inicial:
- apps/backend (NestJS API)
- apps/frontend (React/Vite)
- apps/database (PostgreSQL DDL)
- docs/ (Documentación)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 04:41:24 -06:00

27 lines
959 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSchemaPath = getSchemaPath;
exports.refs = refs;
const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
const constants_1 = require("../constants");
function getSchemaPath(model) {
const modelName = (0, shared_utils_1.isString)(model) ? model : getSchemaNameByClass(model);
return `#/components/schemas/${modelName}`;
}
function getSchemaNameByClass(target) {
var _a;
if (!target || typeof target !== 'function') {
return '';
}
const customSchema = Reflect.getOwnMetadata(constants_1.DECORATORS.API_SCHEMA, target);
if (!customSchema || customSchema.length === 0) {
return target.name;
}
return (_a = customSchema[customSchema.length - 1].name) !== null && _a !== void 0 ? _a : target.name;
}
function refs(...models) {
return models.map((item) => ({
$ref: getSchemaPath(item.name)
}));
}