michangarrito/apps/backend/dist/modules/inventory/inventory.controller.js
rckrdmrd 48dea7a5d0 feat: Initial commit - michangarrito
Marketplace móvil para negocios locales mexicanos.

Estructura inicial:
- apps/backend (NestJS API)
- apps/frontend (React Web)
- apps/mobile (Expo/React Native)
- apps/mcp-server (Claude MCP Server)
- apps/whatsapp-service (WhatsApp Business API)
- 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:02 -06:00

141 lines
6.5 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.InventoryController = 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 inventory_service_1 = require("./inventory.service");
const inventory_dto_1 = require("./dto/inventory.dto");
let InventoryController = class InventoryController {
constructor(inventoryService) {
this.inventoryService = inventoryService;
}
getMovements(req, productId, limit) {
return this.inventoryService.getMovements(req.user.tenantId, productId, limit);
}
getProductHistory(req, productId) {
return this.inventoryService.getProductHistory(req.user.tenantId, productId);
}
createMovement(req, dto) {
return this.inventoryService.createMovement(req.user.tenantId, dto, req.user.id);
}
adjustStock(req, dto) {
return this.inventoryService.adjustStock(req.user.tenantId, dto, req.user.id);
}
getAlerts(req) {
return this.inventoryService.getActiveAlerts(req.user.tenantId);
}
dismissAlert(req, id) {
return this.inventoryService.dismissAlert(req.user.tenantId, id);
}
getLowStock(req) {
return this.inventoryService.getLowStockProducts(req.user.tenantId);
}
getOutOfStock(req) {
return this.inventoryService.getOutOfStockProducts(req.user.tenantId);
}
getStats(req) {
return this.inventoryService.getInventoryStats(req.user.tenantId);
}
};
exports.InventoryController = InventoryController;
__decorate([
(0, common_1.Get)('movements'),
(0, swagger_1.ApiOperation)({ summary: 'Listar movimientos de inventario' }),
(0, swagger_1.ApiQuery)({ name: 'productId', required: false }),
(0, swagger_1.ApiQuery)({ name: 'limit', required: false }),
__param(0, (0, common_1.Request)()),
__param(1, (0, common_1.Query)('productId')),
__param(2, (0, common_1.Query)('limit')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, String, Number]),
__metadata("design:returntype", void 0)
], InventoryController.prototype, "getMovements", null);
__decorate([
(0, common_1.Get)('movements/product/:productId'),
(0, swagger_1.ApiOperation)({ summary: 'Historial de movimientos de un producto' }),
__param(0, (0, common_1.Request)()),
__param(1, (0, common_1.Param)('productId')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, String]),
__metadata("design:returntype", void 0)
], InventoryController.prototype, "getProductHistory", null);
__decorate([
(0, common_1.Post)('movements'),
(0, swagger_1.ApiOperation)({ summary: 'Registrar movimiento de inventario' }),
__param(0, (0, common_1.Request)()),
__param(1, (0, common_1.Body)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, inventory_dto_1.CreateMovementDto]),
__metadata("design:returntype", void 0)
], InventoryController.prototype, "createMovement", null);
__decorate([
(0, common_1.Post)('adjust'),
(0, swagger_1.ApiOperation)({ summary: 'Ajustar stock de un producto' }),
__param(0, (0, common_1.Request)()),
__param(1, (0, common_1.Body)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, inventory_dto_1.AdjustStockDto]),
__metadata("design:returntype", void 0)
], InventoryController.prototype, "adjustStock", null);
__decorate([
(0, common_1.Get)('alerts'),
(0, swagger_1.ApiOperation)({ summary: 'Listar alertas activas de stock' }),
__param(0, (0, common_1.Request)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], InventoryController.prototype, "getAlerts", null);
__decorate([
(0, common_1.Patch)('alerts/:id/dismiss'),
(0, swagger_1.ApiOperation)({ summary: 'Descartar una alerta' }),
__param(0, (0, common_1.Request)()),
__param(1, (0, common_1.Param)('id')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, String]),
__metadata("design:returntype", void 0)
], InventoryController.prototype, "dismissAlert", null);
__decorate([
(0, common_1.Get)('low-stock'),
(0, swagger_1.ApiOperation)({ summary: 'Productos con bajo stock' }),
__param(0, (0, common_1.Request)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], InventoryController.prototype, "getLowStock", null);
__decorate([
(0, common_1.Get)('out-of-stock'),
(0, swagger_1.ApiOperation)({ summary: 'Productos sin stock' }),
__param(0, (0, common_1.Request)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], InventoryController.prototype, "getOutOfStock", null);
__decorate([
(0, common_1.Get)('stats'),
(0, swagger_1.ApiOperation)({ summary: 'Estadísticas de inventario' }),
__param(0, (0, common_1.Request)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], InventoryController.prototype, "getStats", null);
exports.InventoryController = InventoryController = __decorate([
(0, swagger_1.ApiTags)('inventory'),
(0, swagger_1.ApiBearerAuth)(),
(0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard),
(0, common_1.Controller)('v1/inventory'),
__metadata("design:paramtypes", [inventory_service_1.InventoryService])
], InventoryController);
//# sourceMappingURL=inventory.controller.js.map