jamesaoverton / cmi-pb-terminology

CMI-PB Controlled Terminology
0 stars 0 forks source link

Implement row update functionality #35

Closed jamesaoverton closed 2 years ago

jamesaoverton commented 2 years ago

For the prototype we want to be able to edit existing rows using HTML forms. The HTML form will make use of the _meta information to show the user any problems. When the user changes data in the form, we need to be able to (1) validate it and (2) update the database. To be clear: these should be independent. A common use case would be: the user submits invalid data, we validate and display the problems in the HTML form (without updating the database yet), then the user fixes the problem and we actually update the database.

The validation step should be very similar to what we already have in validate_row(), but I think we need something more to handle the case where we are validating an existing row. For example, if the row has a primary key with value "X", we should not fail validation because we found a duplicate "X" in the old version of the row and the new version of the row. We probably just need to identify the (existing) row we are validating, and validate it "as if" it were not already present in the database.

The update step should replace a row in the database with the new row.

Note that we also want to use HTML forms to add new rows, but I think we have that covered already.

jamesaoverton commented 2 years ago

Closed by #40