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>
72 lines
3.4 KiB
JavaScript
72 lines
3.4 KiB
JavaScript
"use strict";
|
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
};
|
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
};
|
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.UsersController = void 0;
|
|
const common_1 = require("@nestjs/common");
|
|
const swagger_1 = require("@nestjs/swagger");
|
|
const users_service_1 = require("./users.service");
|
|
const jwt_auth_guard_1 = require("../auth/guards/jwt-auth.guard");
|
|
const current_user_decorator_1 = require("../auth/decorators/current-user.decorator");
|
|
let UsersController = class UsersController {
|
|
constructor(usersService) {
|
|
this.usersService = usersService;
|
|
}
|
|
async findAll(user, page = 1, limit = 10) {
|
|
return this.usersService.findAllByTenant(user.tenant_id, page, limit);
|
|
}
|
|
async findOne(id, user) {
|
|
return this.usersService.findOne(id, user.tenant_id);
|
|
}
|
|
async update(id, updateDto, user) {
|
|
return this.usersService.update(id, updateDto, user.tenant_id);
|
|
}
|
|
};
|
|
exports.UsersController = UsersController;
|
|
__decorate([
|
|
(0, common_1.Get)(),
|
|
(0, swagger_1.ApiOperation)({ summary: 'List users in tenant' }),
|
|
__param(0, (0, current_user_decorator_1.CurrentUser)()),
|
|
__param(1, (0, common_1.Query)('page')),
|
|
__param(2, (0, common_1.Query)('limit')),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [Object, Object, Object]),
|
|
__metadata("design:returntype", Promise)
|
|
], UsersController.prototype, "findAll", null);
|
|
__decorate([
|
|
(0, common_1.Get)(':id'),
|
|
(0, swagger_1.ApiOperation)({ summary: 'Get user by ID' }),
|
|
__param(0, (0, common_1.Param)('id')),
|
|
__param(1, (0, current_user_decorator_1.CurrentUser)()),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [String, Object]),
|
|
__metadata("design:returntype", Promise)
|
|
], UsersController.prototype, "findOne", null);
|
|
__decorate([
|
|
(0, common_1.Patch)(':id'),
|
|
(0, swagger_1.ApiOperation)({ summary: 'Update user' }),
|
|
__param(0, (0, common_1.Param)('id')),
|
|
__param(1, (0, common_1.Body)()),
|
|
__param(2, (0, current_user_decorator_1.CurrentUser)()),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [String, Object, Object]),
|
|
__metadata("design:returntype", Promise)
|
|
], UsersController.prototype, "update", null);
|
|
exports.UsersController = UsersController = __decorate([
|
|
(0, swagger_1.ApiTags)('users'),
|
|
(0, common_1.Controller)('users'),
|
|
(0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard),
|
|
(0, swagger_1.ApiBearerAuth)(),
|
|
__metadata("design:paramtypes", [users_service_1.UsersService])
|
|
], UsersController);
|
|
//# sourceMappingURL=users.controller.js.map
|