template-saas/apps/backend/dist/modules/webhooks/webhooks.controller.js
rckrdmrd 50a821a415
Some checks failed
CI / Backend CI (push) Has been cancelled
CI / Frontend CI (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / CI Summary (push) Has been cancelled
[SIMCO-V38] feat: Actualizar a SIMCO v3.8.0
- HERENCIA-SIMCO.md actualizado con directivas v3.7 y v3.8
- Actualizaciones de configuracion

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 08:53:08 -06:00

146 lines
6.6 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.WebhooksController = void 0;
const common_1 = require("@nestjs/common");
const jwt_auth_guard_1 = require("@modules/auth/guards/jwt-auth.guard");
const current_user_decorator_1 = require("@modules/auth/decorators/current-user.decorator");
const services_1 = require("./services");
const dto_1 = require("./dto");
let WebhooksController = class WebhooksController {
constructor(webhookService) {
this.webhookService = webhookService;
}
getAvailableEvents() {
return {
events: this.webhookService.getAvailableEvents(),
};
}
async findAll(user) {
return this.webhookService.findAll(user.tenant_id);
}
async findOne(user, id) {
return this.webhookService.findOne(user.tenant_id, id);
}
async create(user, dto) {
return this.webhookService.create(user.tenant_id, user.id, dto);
}
async update(user, id, dto) {
return this.webhookService.update(user.tenant_id, id, dto);
}
async remove(user, id) {
await this.webhookService.remove(user.tenant_id, id);
return { message: 'Webhook deleted successfully' };
}
async regenerateSecret(user, id) {
return this.webhookService.regenerateSecret(user.tenant_id, id);
}
async test(user, id, dto) {
return this.webhookService.testWebhook(user.tenant_id, id, dto);
}
async getDeliveries(user, id, query) {
return this.webhookService.getDeliveries(user.tenant_id, id, query);
}
async retryDelivery(user, id, deliveryId) {
return this.webhookService.retryDelivery(user.tenant_id, id, deliveryId);
}
};
exports.WebhooksController = WebhooksController;
__decorate([
(0, common_1.Get)('events'),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", dto_1.AvailableEventsDto)
], WebhooksController.prototype, "getAvailableEvents", null);
__decorate([
(0, common_1.Get)(),
__param(0, (0, current_user_decorator_1.CurrentUser)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", Promise)
], WebhooksController.prototype, "findAll", null);
__decorate([
(0, common_1.Get)(':id'),
__param(0, (0, current_user_decorator_1.CurrentUser)()),
__param(1, (0, common_1.Param)('id', common_1.ParseUUIDPipe)),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, String]),
__metadata("design:returntype", Promise)
], WebhooksController.prototype, "findOne", null);
__decorate([
(0, common_1.Post)(),
__param(0, (0, current_user_decorator_1.CurrentUser)()),
__param(1, (0, common_1.Body)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, dto_1.CreateWebhookDto]),
__metadata("design:returntype", Promise)
], WebhooksController.prototype, "create", null);
__decorate([
(0, common_1.Put)(':id'),
__param(0, (0, current_user_decorator_1.CurrentUser)()),
__param(1, (0, common_1.Param)('id', common_1.ParseUUIDPipe)),
__param(2, (0, common_1.Body)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, String, dto_1.UpdateWebhookDto]),
__metadata("design:returntype", Promise)
], WebhooksController.prototype, "update", null);
__decorate([
(0, common_1.Delete)(':id'),
__param(0, (0, current_user_decorator_1.CurrentUser)()),
__param(1, (0, common_1.Param)('id', common_1.ParseUUIDPipe)),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, String]),
__metadata("design:returntype", Promise)
], WebhooksController.prototype, "remove", null);
__decorate([
(0, common_1.Post)(':id/regenerate-secret'),
__param(0, (0, current_user_decorator_1.CurrentUser)()),
__param(1, (0, common_1.Param)('id', common_1.ParseUUIDPipe)),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, String]),
__metadata("design:returntype", Promise)
], WebhooksController.prototype, "regenerateSecret", null);
__decorate([
(0, common_1.Post)(':id/test'),
__param(0, (0, current_user_decorator_1.CurrentUser)()),
__param(1, (0, common_1.Param)('id', common_1.ParseUUIDPipe)),
__param(2, (0, common_1.Body)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, String, dto_1.TestWebhookDto]),
__metadata("design:returntype", Promise)
], WebhooksController.prototype, "test", null);
__decorate([
(0, common_1.Get)(':id/deliveries'),
__param(0, (0, current_user_decorator_1.CurrentUser)()),
__param(1, (0, common_1.Param)('id', common_1.ParseUUIDPipe)),
__param(2, (0, common_1.Query)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, String, dto_1.ListDeliveriesQueryDto]),
__metadata("design:returntype", Promise)
], WebhooksController.prototype, "getDeliveries", null);
__decorate([
(0, common_1.Post)(':id/deliveries/:deliveryId/retry'),
__param(0, (0, current_user_decorator_1.CurrentUser)()),
__param(1, (0, common_1.Param)('id', common_1.ParseUUIDPipe)),
__param(2, (0, common_1.Param)('deliveryId', common_1.ParseUUIDPipe)),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, String, String]),
__metadata("design:returntype", Promise)
], WebhooksController.prototype, "retryDelivery", null);
exports.WebhooksController = WebhooksController = __decorate([
(0, common_1.Controller)('webhooks'),
(0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard),
__metadata("design:paramtypes", [services_1.WebhookService])
], WebhooksController);
//# sourceMappingURL=webhooks.controller.js.map