Hide prices until admin sends the invoice, enforce status transitions, add customer/admin SMS+in-app notifications, schedule cash invoice reminders, and ship updated dist/prisma-client/deploy-bundle for git-pull deploys. Co-authored-by: Cursor <cursoragent@cursor.com>
161 lines
7.0 KiB
JavaScript
161 lines
7.0 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.AdminOrdersController = exports.CustomerOrdersController = void 0;
|
|
const common_1 = require("@nestjs/common");
|
|
const orders_service_1 = require("./orders.service");
|
|
const auth_decorators_1 = require("../common/decorators/auth.decorators");
|
|
const current_user_decorator_1 = require("../common/decorators/current-user.decorator");
|
|
const order_dto_1 = require("./dto/order.dto");
|
|
let CustomerOrdersController = class CustomerOrdersController {
|
|
ordersService;
|
|
constructor(ordersService) {
|
|
this.ordersService = ordersService;
|
|
}
|
|
findMine(user) {
|
|
return this.ordersService.findMyOrders(user.id);
|
|
}
|
|
findOne(user, id) {
|
|
return this.ordersService.findMyOrder(user.id, id);
|
|
}
|
|
submit(user, dto) {
|
|
return this.ordersService.submitOrder(user.id, dto);
|
|
}
|
|
chooseSettlement(user, id, dto) {
|
|
return this.ordersService.chooseSettlement(user.id, id, dto);
|
|
}
|
|
updateChecks(user, id, dto) {
|
|
return this.ordersService.updateChecks(user.id, id, dto);
|
|
}
|
|
};
|
|
exports.CustomerOrdersController = CustomerOrdersController;
|
|
__decorate([
|
|
(0, auth_decorators_1.AuthType)('customer'),
|
|
(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)
|
|
], CustomerOrdersController.prototype, "findMine", null);
|
|
__decorate([
|
|
(0, auth_decorators_1.AuthType)('customer'),
|
|
(0, common_1.Get)(':id'),
|
|
__param(0, (0, current_user_decorator_1.CurrentUser)()),
|
|
__param(1, (0, common_1.Param)('id')),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [Object, String]),
|
|
__metadata("design:returntype", void 0)
|
|
], CustomerOrdersController.prototype, "findOne", null);
|
|
__decorate([
|
|
(0, auth_decorators_1.AuthType)('customer'),
|
|
(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, order_dto_1.SubmitOrderDto]),
|
|
__metadata("design:returntype", void 0)
|
|
], CustomerOrdersController.prototype, "submit", null);
|
|
__decorate([
|
|
(0, auth_decorators_1.AuthType)('customer'),
|
|
(0, common_1.Post)(':id/settlement'),
|
|
__param(0, (0, current_user_decorator_1.CurrentUser)()),
|
|
__param(1, (0, common_1.Param)('id')),
|
|
__param(2, (0, common_1.Body)()),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [Object, String, order_dto_1.ChooseSettlementDto]),
|
|
__metadata("design:returntype", void 0)
|
|
], CustomerOrdersController.prototype, "chooseSettlement", null);
|
|
__decorate([
|
|
(0, auth_decorators_1.AuthType)('customer'),
|
|
(0, common_1.Patch)(':id/checks'),
|
|
__param(0, (0, current_user_decorator_1.CurrentUser)()),
|
|
__param(1, (0, common_1.Param)('id')),
|
|
__param(2, (0, common_1.Body)()),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [Object, String, order_dto_1.UpdateOrderChecksDto]),
|
|
__metadata("design:returntype", void 0)
|
|
], CustomerOrdersController.prototype, "updateChecks", null);
|
|
exports.CustomerOrdersController = CustomerOrdersController = __decorate([
|
|
(0, common_1.Controller)('orders'),
|
|
__metadata("design:paramtypes", [orders_service_1.OrdersService])
|
|
], CustomerOrdersController);
|
|
let AdminOrdersController = class AdminOrdersController {
|
|
ordersService;
|
|
constructor(ordersService) {
|
|
this.ordersService = ordersService;
|
|
}
|
|
findAll(status, q) {
|
|
return this.ordersService.findAdminOrders({ status, q });
|
|
}
|
|
findOne(id) {
|
|
return this.ordersService.findAdminOrder(id);
|
|
}
|
|
create(user, dto) {
|
|
return this.ordersService.adminCreate(user.id, dto);
|
|
}
|
|
updatePricing(user, id, dto) {
|
|
return this.ordersService.updatePricing(id, user.id, dto);
|
|
}
|
|
updateStatus(user, id, dto) {
|
|
return this.ordersService.updateStatus(id, user.id, dto);
|
|
}
|
|
};
|
|
exports.AdminOrdersController = AdminOrdersController;
|
|
__decorate([
|
|
(0, common_1.Get)(),
|
|
__param(0, (0, common_1.Query)('status')),
|
|
__param(1, (0, common_1.Query)('q')),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [String, String]),
|
|
__metadata("design:returntype", void 0)
|
|
], AdminOrdersController.prototype, "findAll", null);
|
|
__decorate([
|
|
(0, common_1.Get)(':id'),
|
|
__param(0, (0, common_1.Param)('id')),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [String]),
|
|
__metadata("design:returntype", void 0)
|
|
], AdminOrdersController.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, order_dto_1.AdminCreateOrderDto]),
|
|
__metadata("design:returntype", void 0)
|
|
], AdminOrdersController.prototype, "create", null);
|
|
__decorate([
|
|
(0, common_1.Patch)(':id/pricing'),
|
|
__param(0, (0, current_user_decorator_1.CurrentUser)()),
|
|
__param(1, (0, common_1.Param)('id')),
|
|
__param(2, (0, common_1.Body)()),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [Object, String, order_dto_1.UpdateOrderPricingDto]),
|
|
__metadata("design:returntype", void 0)
|
|
], AdminOrdersController.prototype, "updatePricing", null);
|
|
__decorate([
|
|
(0, common_1.Patch)(':id/status'),
|
|
__param(0, (0, current_user_decorator_1.CurrentUser)()),
|
|
__param(1, (0, common_1.Param)('id')),
|
|
__param(2, (0, common_1.Body)()),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [Object, String, order_dto_1.UpdateOrderStatusDto]),
|
|
__metadata("design:returntype", void 0)
|
|
], AdminOrdersController.prototype, "updateStatus", null);
|
|
exports.AdminOrdersController = AdminOrdersController = __decorate([
|
|
(0, common_1.Controller)('admin/orders'),
|
|
(0, auth_decorators_1.AuthType)('admin'),
|
|
__metadata("design:paramtypes", [orders_service_1.OrdersService])
|
|
], AdminOrdersController);
|
|
//# sourceMappingURL=orders.controller.js.map
|