File size: 1,017 Bytes
e372349 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ValidContent = void 0;
const tslib_1 = require("tslib");
const class_validator_1 = require("class-validator");
const striptags_1 = tslib_1.__importDefault(require("striptags"));
let ValidContent = class ValidContent {
validate(contentRaw, args) {
const content = (0, striptags_1.default)(contentRaw || '');
if ((!args?.object?.image || !Array.isArray(args?.object?.image) || !args?.object?.image.length) &&
(!content || typeof content !== 'string' || content?.trim() === '')) {
return false;
}
return true;
}
defaultMessage(args) {
return ' If images do not exist, content must be a non-empty string.';
}
};
exports.ValidContent = ValidContent;
exports.ValidContent = ValidContent = tslib_1.__decorate([
(0, class_validator_1.ValidatorConstraint)({ name: 'validateContent', async: false })
], ValidContent);
//# sourceMappingURL=valid.images.js.map |