- Prefijo v2: MCH - TRACEABILITY-MASTER.yml creado - Listo para integracion como submodulo Workspace: v2.0.0 | SIMCO: v4.0.0
85 lines
3.8 KiB
JavaScript
85 lines
3.8 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.WidgetsController = void 0;
|
|
const common_1 = require("@nestjs/common");
|
|
const swagger_1 = require("@nestjs/swagger");
|
|
const jwt_auth_guard_1 = require("../auth/guards/jwt-auth.guard");
|
|
const widgets_service_1 = require("./widgets.service");
|
|
let WidgetsController = class WidgetsController {
|
|
constructor(widgetsService) {
|
|
this.widgetsService = widgetsService;
|
|
}
|
|
getSummary(req) {
|
|
return this.widgetsService.getSummary(req.user.tenantId);
|
|
}
|
|
getAlerts(req) {
|
|
return this.widgetsService.getAlerts(req.user.tenantId);
|
|
}
|
|
getQuickActions() {
|
|
return this.widgetsService.getQuickActions();
|
|
}
|
|
async getFullWidgetData(req) {
|
|
const [summary, alerts, quickActions] = await Promise.all([
|
|
this.widgetsService.getSummary(req.user.tenantId),
|
|
this.widgetsService.getAlerts(req.user.tenantId),
|
|
this.widgetsService.getQuickActions(),
|
|
]);
|
|
return {
|
|
summary,
|
|
alerts,
|
|
quickActions,
|
|
};
|
|
}
|
|
};
|
|
exports.WidgetsController = WidgetsController;
|
|
__decorate([
|
|
(0, common_1.Get)('summary'),
|
|
(0, swagger_1.ApiOperation)({ summary: 'Obtener resumen para widget (optimizado)' }),
|
|
__param(0, (0, common_1.Request)()),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [Object]),
|
|
__metadata("design:returntype", void 0)
|
|
], WidgetsController.prototype, "getSummary", null);
|
|
__decorate([
|
|
(0, common_1.Get)('alerts'),
|
|
(0, swagger_1.ApiOperation)({ summary: 'Obtener alertas para widget' }),
|
|
__param(0, (0, common_1.Request)()),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [Object]),
|
|
__metadata("design:returntype", void 0)
|
|
], WidgetsController.prototype, "getAlerts", null);
|
|
__decorate([
|
|
(0, common_1.Get)('quick-actions'),
|
|
(0, swagger_1.ApiOperation)({ summary: 'Obtener acciones rapidas para widget' }),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", []),
|
|
__metadata("design:returntype", void 0)
|
|
], WidgetsController.prototype, "getQuickActions", null);
|
|
__decorate([
|
|
(0, common_1.Get)('full'),
|
|
(0, swagger_1.ApiOperation)({ summary: 'Obtener todos los datos del widget en una llamada' }),
|
|
__param(0, (0, common_1.Request)()),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [Object]),
|
|
__metadata("design:returntype", Promise)
|
|
], WidgetsController.prototype, "getFullWidgetData", null);
|
|
exports.WidgetsController = WidgetsController = __decorate([
|
|
(0, swagger_1.ApiTags)('widgets'),
|
|
(0, swagger_1.ApiBearerAuth)(),
|
|
(0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard),
|
|
(0, common_1.Controller)('v1/widget'),
|
|
__metadata("design:paramtypes", [widgets_service_1.WidgetsService])
|
|
], WidgetsController);
|
|
//# sourceMappingURL=widgets.controller.js.map
|