Display the change history
Linked to #137
Now that we track the change history on sequences/pictures, we need to display it.
Routes
I think we need several API routes
- Get history of one collection
/api/collections/:cid/history
- Get history of one picture
/api/collections/:cid/items/:id/history
Note: the name of the history route (/history
is proposed) can be discussed.
I'm not sure we need to handle pagination right away apart from maybe the user's change history.
Collection change history
/api/collections/:cid/history
=> All changes on the collection, and all changes on the pictures of the collection that are not part of a global sequence change (that have a sequences_changes_id
).
Picture change history
/api/collections/:cid/items/:id/history
=> All changes on the picture
User change history
Less important, but it could also be interesting to know the modifications done by a user, and the modifications done on a user's data.
Something like:
-
/api/users/:id/catalog/history
<< Get the change history on a user's data -
/api/users/:id/history
<< Get the changes done by a user
For this, maybe we can implement a json get and a RSS feed. This way is would be easy for a user to follow the modification done on their data.
Note: those routes would contains all changes on the sequences and pictures of the user. We will not display picture's change that are part of a global sequence change (that have a sequences_changes_id
).
Json response format
For the form of the response of those API, maybe we can do something simple like:
{
"changes": [
{
"id": "some_uuid", // id of the change
"author": "some_account_uuid", // author of the change
"changed_at": "2023-05-16T11:08:11.247187+00:00", // datetime of the modification, in UTC
"change": {
// all fields changed, with old and updated value
"title": {"old": "old title", "new": "new title"},
"status": {"old": "old title", "new": "new title"},
},
// type of updated object, since we want to always have the same API format and some routes
// will contains changes on pictures, some on sequences, some on both
"entity_type": "picture",
"entity_id": "some_uuid", // id of the changed object
"links": [
// handy links to entity + author
]
}
],
"links": [
// ... some links
]
}
STAC conformance?
There is no STAC extension for this, maybe we need to create one for it.
It will takes some time, but it might be worth it, to be able to better explain what capabilities we expose.