Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
static insertMultipleValuesForFeatureStatements(db, form, feature, record) {
const statements = [];
const values = this.multipleValuesForFeature(feature, record);
const tableName = this.multipleValueTableNameWithForm(form);
let parentResourceId = null;
if (feature instanceof _fulcrumCore.RepeatableItemValue) {
parentResourceId = feature.id;
}
for (const multipleValueItem of values) {
const insertValues = Object.assign({}, { key: multipleValueItem.element.key, text_value: multipleValueItem.value }, { record_id: record.rowID, record_resource_id: record.id, parent_resource_id: parentResourceId });
statements.push(db.insertStatement(tableName, insertValues, { pk: 'id' }));
}
return statements;
}
static insertMultipleValuesForFeatureStatements(db, form, feature, record, options = {}) {
const statements = [];
const values = this.multipleValuesForFeature(feature, record);
const tableName = this.multipleValueTableNameWithForm(form, options);
let parentResourceId = null;
if (feature instanceof _fulcrumCore.RepeatableItemValue) {
parentResourceId = feature.id;
}
for (const multipleValueItem of values) {
const insertValues = Object.assign({}, { key: multipleValueItem.element.key, text_value: multipleValueItem.value }, { record_id: record.rowID, record_resource_id: record.id, parent_resource_id: parentResourceId });
statements.push(db.insertStatement(tableName, insertValues, { pk: 'id' }));
}
return statements;
}