Browse Source

1-n-data-integrity

master
Martin McKeaveney 6 years ago
parent
commit
19fb11e69d
  1. 8
      packages/server/src/db/linkedRows/LinkController.js

8
packages/server/src/db/linkedRows/LinkController.js

@ -132,6 +132,14 @@ class LinkController {
const rowField = row[fieldName] const rowField = row[fieldName]
const field = table.schema[fieldName] const field = table.schema[fieldName]
if (field.type === FieldTypes.LINK && rowField != null) { if (field.type === FieldTypes.LINK && rowField != null) {
// if 1:N, ensure that this ID is not already attached to another record
const linkedTable = await this._db.get(field.tableId)
const linkedSchema = linkedTable.schema[field.fieldName]
if (linkedSchema.relationshipType === "one-to-many") {
}
// check which links actual pertain to the update in this row // check which links actual pertain to the update in this row
const thisFieldLinkDocs = linkDocs.filter( const thisFieldLinkDocs = linkDocs.filter(
linkDoc => linkDoc =>

Loading…
Cancel
Save