Build on the developer machine without Docker, commit dist/, and run on the server with Dockerfile.dist plus compose env_file. Co-authored-by: Cursor <cursoragent@cursor.com>
98 lines
4.3 KiB
JavaScript
98 lines
4.3 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.CartsController = void 0;
|
|
const common_1 = require("@nestjs/common");
|
|
const carts_service_1 = require("./carts.service");
|
|
const auth_decorators_1 = require("../common/decorators/auth.decorators");
|
|
const current_user_decorator_1 = require("../common/decorators/current-user.decorator");
|
|
const cart_dto_1 = require("./dto/cart.dto");
|
|
let CartsController = class CartsController {
|
|
cartsService;
|
|
constructor(cartsService) {
|
|
this.cartsService = cartsService;
|
|
}
|
|
getCart(user) {
|
|
return this.cartsService.getCart(user.id);
|
|
}
|
|
addItem(user, dto) {
|
|
return this.cartsService.addItem(user.id, dto);
|
|
}
|
|
updateItem(user, itemId, dto) {
|
|
return this.cartsService.updateItem(user.id, itemId, dto);
|
|
}
|
|
removeItem(user, itemId) {
|
|
return this.cartsService.removeItem(user.id, itemId);
|
|
}
|
|
updateNotes(user, dto) {
|
|
return this.cartsService.updateNotes(user.id, dto);
|
|
}
|
|
clear(user) {
|
|
return this.cartsService.clearCart(user.id);
|
|
}
|
|
};
|
|
exports.CartsController = CartsController;
|
|
__decorate([
|
|
(0, common_1.Get)(),
|
|
__param(0, (0, current_user_decorator_1.CurrentUser)()),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [Object]),
|
|
__metadata("design:returntype", void 0)
|
|
], CartsController.prototype, "getCart", null);
|
|
__decorate([
|
|
(0, common_1.Post)('items'),
|
|
__param(0, (0, current_user_decorator_1.CurrentUser)()),
|
|
__param(1, (0, common_1.Body)()),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [Object, cart_dto_1.AddCartItemDto]),
|
|
__metadata("design:returntype", void 0)
|
|
], CartsController.prototype, "addItem", null);
|
|
__decorate([
|
|
(0, common_1.Patch)('items/:itemId'),
|
|
__param(0, (0, current_user_decorator_1.CurrentUser)()),
|
|
__param(1, (0, common_1.Param)('itemId')),
|
|
__param(2, (0, common_1.Body)()),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [Object, String, cart_dto_1.UpdateCartItemMeterageDto]),
|
|
__metadata("design:returntype", void 0)
|
|
], CartsController.prototype, "updateItem", null);
|
|
__decorate([
|
|
(0, common_1.Delete)('items/:itemId'),
|
|
__param(0, (0, current_user_decorator_1.CurrentUser)()),
|
|
__param(1, (0, common_1.Param)('itemId')),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [Object, String]),
|
|
__metadata("design:returntype", void 0)
|
|
], CartsController.prototype, "removeItem", null);
|
|
__decorate([
|
|
(0, common_1.Patch)('notes'),
|
|
__param(0, (0, current_user_decorator_1.CurrentUser)()),
|
|
__param(1, (0, common_1.Body)()),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [Object, cart_dto_1.UpdateCartNotesDto]),
|
|
__metadata("design:returntype", void 0)
|
|
], CartsController.prototype, "updateNotes", null);
|
|
__decorate([
|
|
(0, common_1.Delete)(),
|
|
__param(0, (0, current_user_decorator_1.CurrentUser)()),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [Object]),
|
|
__metadata("design:returntype", void 0)
|
|
], CartsController.prototype, "clear", null);
|
|
exports.CartsController = CartsController = __decorate([
|
|
(0, common_1.Controller)('carts'),
|
|
(0, auth_decorators_1.AuthType)('customer'),
|
|
__metadata("design:paramtypes", [carts_service_1.CartsService])
|
|
], CartsController);
|
|
//# sourceMappingURL=carts.controller.js.map
|