@grouparoo/core
Version:
The Grouparoo Core
26 lines (25 loc) • 1.11 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PropertyUpdateProfileProperties = void 0;
const clsTask_1 = require("../../classes/tasks/clsTask");
const Property_1 = require("../../models/Property");
const RecordProperty_1 = require("../../models/RecordProperty");
class PropertyUpdateProfileProperties extends clsTask_1.CLSTask {
constructor() {
super(...arguments);
this.name = "property:updateRecordProperties";
this.description = "update related information on record properties when a property changes";
this.frequency = 0;
this.queue = "properties";
this.inputs = {
propertyId: { required: true },
};
}
async runWithinTransaction({ propertyId, }) {
const property = await Property_1.Property.findOne({ where: { id: propertyId } });
if (!property)
return;
await RecordProperty_1.RecordProperty.update({ unique: property.unique }, { where: { propertyId: property.id } });
}
}
exports.PropertyUpdateProfileProperties = PropertyUpdateProfileProperties;