gbv / jskos-server

Web service to access JSKOS data
https://coli-conc.gbv.de/api/
MIT License
6 stars 4 forks source link

Automaticallly set created and modified field to vocabularies #120

Closed nichtich closed 3 years ago

nichtich commented 3 years ago

The fields created and modified are only added automatically on mappings but they are also needed for editing vocabularies in BARTOC (PUT and POST to /voc). Moreover it should be forbidden to override these fields except for bulk-import as done via command-line.

stefandesu commented 3 years ago

From #92:

The modified value of a concept scheme would refer to the date either its metadata or one of its concepts was last modified, depending which value is higher.

Originally, I thought we would manually set modified to a value when the source information was modified, but I'd be fine with using the same logic as for mappings. (And as you noted, it's different for bulk import.)

stefandesu commented 3 years ago

Just to clarify and/or make a suggestion for the actual implementation:

*This alternative has an issue: For bulk imports, we don't check for each scheme whether we are creating or modifying it, rather we're just using MongoDB's upsert option that will either create or modify an entity. So if we override created for every scheme, we would update the value for those that are bulk imported and already exist. So I'm voting for the other option where we only change created if it doesn't exist on the scheme.

nichtich commented 3 years ago

There is no reason for changing a an already existing creating other than via bulk import so I agree with the suggestion.