@fdm-monster/server
Version:
FDM Monster is a bulk OctoPrint manager to set up, configure and monitor 3D printers. Our aim is to provide extremely optimized websocket performance and reliability.
73 lines (72 loc) • 2.41 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
createOrUpdateFloorSchema: function() {
return createOrUpdateFloorSchema;
},
floorLevelValidator: function() {
return floorLevelValidator;
},
floorNameValidator: function() {
return floorNameValidator;
},
printerInFloorSchema: function() {
return printerInFloorSchema;
},
removePrinterInFloorSchema: function() {
return removePrinterInFloorSchema;
},
updateFloorLevelSchema: function() {
return updateFloorLevelSchema;
},
updateFloorNameSchema: function() {
return updateFloorNameSchema;
},
xValidator: function() {
return xValidator;
},
yValidator: function() {
return yValidator;
}
});
const _zod = require("zod");
const _serviceconstants = require("../../constants/service.constants");
const _genericvalidation = require("../../controllers/validation/generic.validation");
const removePrinterInFloorSchema = (isSqlite)=>_zod.z.object({
printerId: (0, _genericvalidation.idRuleV2)(isSqlite)
});
const xValidator = _zod.z.number().int().min(0).max(12);
const yValidator = _zod.z.number().int().min(0).max(12);
const floorLevelValidator = _zod.z.number().int();
const floorNameValidator = _zod.z.string().min(_serviceconstants.minFloorNameLength);
const printerInFloorSchema = (isSqlite)=>_zod.z.object({
printerId: (0, _genericvalidation.idRuleV2)(isSqlite),
floorId: (0, _genericvalidation.idRuleV2)(isSqlite),
x: xValidator,
y: yValidator
});
const updateFloorNameSchema = _zod.z.object({
name: floorNameValidator
});
const updateFloorLevelSchema = _zod.z.object({
floor: floorLevelValidator
});
const createOrUpdateFloorSchema = (isSqlite)=>_zod.z.object({
name: floorNameValidator,
floor: floorLevelValidator,
printers: _zod.z.array(_zod.z.object({
printerId: (0, _genericvalidation.idRuleV2)(isSqlite),
floorId: (0, _genericvalidation.idRuleV2)(isSqlite).optional(),
x: xValidator,
y: yValidator
})).optional()
});
//# sourceMappingURL=floor-service.validation.js.map