trompamusic/ce-api

automatically set dcterms:created and dcterms:modified when mutations are made

Closed this issue · 3 comments

In some of our types (e.g. Annotation) we want to know when the annotation was made, and if it was changed, when it was changed.
To store this, we have 2 fields, created and modified.
There are 2 ways we can fill these fields. One is to require the client to set them (we can make created required in this case). A problem here is that modified would have to be non-required (and only set when an item is Updated?). Also, it means that a client could change created by sending an Updated mutation.
The other option is to make the CE automatically set the created field on a Create mutation, and set modified on an Update mutation. We would have to decide which types we want this behaviour on. Can we think of a situation when we might want to override this behaviour when creating an object?

This feature would make this really easy:

neo4j-graphql/neo4j-graphql-js#364

My preference is to fill these fields automatically as almost any other API does.

That sounds like a nice solution. How much work do you think it is to push this PR along to get it merged into an upcoming release?