Files
recipe-app/backend/dist/meal-plan/meal-plan.controller.js
T
Nils-Johan Gynther 969dafdbc6
Test Suite / test (24.15.0) (push) Has been cancelled
Refactor code structure for improved readability and maintainability
2026-05-06 07:37:59 +02:00

88 lines
4.1 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.MealPlanController = void 0;
const common_1 = require("@nestjs/common");
const meal_plan_service_1 = require("./meal-plan.service");
const create_meal_plan_entry_dto_1 = require("./dto/create-meal-plan-entry.dto");
const current_user_decorator_1 = require("../auth/decorators/current-user.decorator");
let MealPlanController = class MealPlanController {
constructor(mealPlanService) {
this.mealPlanService = mealPlanService;
}
findByRange(user, from, to) {
return this.mealPlanService.findByRange(user.userId, from, to);
}
shoppingList(user, from, to) {
return this.mealPlanService.shoppingList(user.userId, from, to);
}
inventoryCompare(user, from, to) {
return this.mealPlanService.inventoryCompare(user.userId, from, to);
}
upsert(user, dto) {
return this.mealPlanService.upsert(user.userId, dto);
}
removeByDate(user, date) {
return this.mealPlanService.removeByDate(user.userId, date);
}
};
exports.MealPlanController = MealPlanController;
__decorate([
(0, common_1.Get)(),
__param(0, (0, current_user_decorator_1.CurrentUser)()),
__param(1, (0, common_1.Query)('from')),
__param(2, (0, common_1.Query)('to')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, String, String]),
__metadata("design:returntype", void 0)
], MealPlanController.prototype, "findByRange", null);
__decorate([
(0, common_1.Get)('shopping-list'),
__param(0, (0, current_user_decorator_1.CurrentUser)()),
__param(1, (0, common_1.Query)('from')),
__param(2, (0, common_1.Query)('to')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, String, String]),
__metadata("design:returntype", void 0)
], MealPlanController.prototype, "shoppingList", null);
__decorate([
(0, common_1.Get)('inventory-compare'),
__param(0, (0, current_user_decorator_1.CurrentUser)()),
__param(1, (0, common_1.Query)('from')),
__param(2, (0, common_1.Query)('to')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, String, String]),
__metadata("design:returntype", void 0)
], MealPlanController.prototype, "inventoryCompare", 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, create_meal_plan_entry_dto_1.CreateMealPlanEntryDto]),
__metadata("design:returntype", void 0)
], MealPlanController.prototype, "upsert", null);
__decorate([
(0, common_1.Delete)(':date'),
__param(0, (0, current_user_decorator_1.CurrentUser)()),
__param(1, (0, common_1.Param)('date')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, String]),
__metadata("design:returntype", void 0)
], MealPlanController.prototype, "removeByDate", null);
exports.MealPlanController = MealPlanController = __decorate([
(0, common_1.Controller)('meal-plan'),
__metadata("design:paramtypes", [meal_plan_service_1.MealPlanService])
], MealPlanController);
//# sourceMappingURL=meal-plan.controller.js.map