@fdm-monster/server
Version:
FDM Monster is a bulk OctoPrint, Klipper, PrusaLink and BambuLab manager to set up, configure and monitor 3D printers. Our aim is to provide neat overview over your farm.
87 lines (86 loc) • 3.99 kB
JavaScript
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
import { __decorateMetadata } from "../_virtual/_@oxc-project_runtime@0.129.0/helpers/decorateMetadata.js";
import { __decorate } from "../_virtual/_@oxc-project_runtime@0.129.0/helpers/decorate.js";
import { validateInput } from "../handlers/validators.js";
import { AppConstants } from "../server.constants.js";
import { ROLES } from "../constants/authorization.constants.js";
import { authenticate, authorizeRoles } from "../middleware/authenticate.js";
import { batchPrinterSchema, batchPrintersEnabledSchema, executeBatchRePrinterSchema } from "./validation/batch-controller.validation.js";
import { BatchCallService } from "../services/core/batch-call.service.js";
import { POST, before, route } from "awilix-express";
//#region src/controllers/batch-call.controller.ts
var batch_call_controller_exports = /* @__PURE__ */ __exportAll({ BatchCallController: () => BatchCallController });
var _ref;
let BatchCallController = class BatchCallController {
constructor(batchCallService) {
this.batchCallService = batchCallService;
}
async batchConnectUsb(req, res) {
const { printerIds } = await validateInput(req.body, batchPrinterSchema);
const results = await this.batchCallService.batchConnectUsb(printerIds);
res.send(results);
}
async batchConnectSocket(req, res) {
const { printerIds } = await validateInput(req.body, batchPrinterSchema);
this.batchCallService.batchConnectSocket(printerIds);
res.send({});
}
async getLastPrintedFiles(req, res) {
const { printerIds } = await validateInput(req.body, batchPrinterSchema);
const files = await this.batchCallService.getBatchPrinterReprintFile(printerIds);
res.send(files);
}
async batchReprintFiles(req, res) {
const { prints } = await validateInput(req.body, executeBatchRePrinterSchema);
const files = await this.batchCallService.batchReprintCalls(prints);
res.send(files);
}
async batchTogglePrintersEnabled(req, res) {
const { printerIds, enabled } = await validateInput(req.body, batchPrintersEnabledSchema);
const results = await this.batchCallService.batchTogglePrintersEnabled(printerIds, enabled);
res.send(results);
}
};
__decorate([
POST(),
route("/connect/usb"),
__decorateMetadata("design:type", Function),
__decorateMetadata("design:paramtypes", [Object, Object]),
__decorateMetadata("design:returntype", Promise)
], BatchCallController.prototype, "batchConnectUsb", null);
__decorate([
POST(),
route("/connect/socket"),
__decorateMetadata("design:type", Function),
__decorateMetadata("design:paramtypes", [Object, Object]),
__decorateMetadata("design:returntype", Promise)
], BatchCallController.prototype, "batchConnectSocket", null);
__decorate([
POST(),
route("/reprint/list"),
__decorateMetadata("design:type", Function),
__decorateMetadata("design:paramtypes", [Object, Object]),
__decorateMetadata("design:returntype", Promise)
], BatchCallController.prototype, "getLastPrintedFiles", null);
__decorate([
POST(),
route("/reprint/execute"),
__decorateMetadata("design:type", Function),
__decorateMetadata("design:paramtypes", [Object, Object]),
__decorateMetadata("design:returntype", Promise)
], BatchCallController.prototype, "batchReprintFiles", null);
__decorate([
POST(),
route("/toggle-enabled"),
__decorateMetadata("design:type", Function),
__decorateMetadata("design:paramtypes", [Object, Object]),
__decorateMetadata("design:returntype", Promise)
], BatchCallController.prototype, "batchTogglePrintersEnabled", null);
BatchCallController = __decorate([
route(AppConstants.apiRoute + "/batch"),
before([authenticate(), authorizeRoles([ROLES.ADMIN, ROLES.OPERATOR])]),
__decorateMetadata("design:paramtypes", [typeof (_ref = typeof BatchCallService !== "undefined" && BatchCallService) === "function" ? _ref : Object])
], BatchCallController);
//#endregion
export { BatchCallController, batch_call_controller_exports };
//# sourceMappingURL=batch-call.controller.js.map