-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove submissionCreate from entity audit events #1072
Conversation
lib/model/query/audits.js
Outdated
const details = mergeLeft(audit.details, { | ||
sourceEvent: sourceEvent.orElse(undefined), | ||
submissionCreate: submissionCreate.orElse(undefined), | ||
submission: submission.orElse(undefined) | ||
submission | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just an idea (and maybe for a future PR), but what do you think about grouping sourceEvent
and submission
in a source
object that's similar to the source
object on the entity version response? I.e., details: { source: { event, submission } }
const details = mergeLeft(audit.details, sourceEvent
.map(event => ({ source: { event, submission } }))
.orElse(undefined));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is worth thinking about when we get to getodk/central#583, yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this is worth doing now. I hadn't looked closely at the entity versions, but I don't like that this is called details.sourceEvent
and details.submission
but an entity version has source.event
and source.submission
.
Closes #1036
It used to be that entity events that were triggered by a Submission (e.g. entity create OR update) would return these objects in the
details
:sourceEvent
(the actual event that caused the entity update, whether it was a submission approval, or submission creation, etc.)submission
(the Submission object, but only if a Submission was part of the event AND the Submission was not deleted)submissionCreate
object for the Submission (if a Submission was part of the event) that had enough historical information including the creation time and instance ID to describe the Submission even if it was deleted.Now, entity audits (accessed via
/projects/.../datasets/.../entities/[uuid]/audits
) havedetails.source
. This looks likesource: { submission, event }
(for events like create and update that were triggered by a submission)source: {}
(empty source object for events triggered through the API)This now matches the structure of
source
returned for Entity Versions.What has been done to verify that this works as intended?
Tests
Why is this the best possible solution? Were any other approaches considered?
We've been discussing this for a while.
How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
Does this change require updates to the API documentation? If so, please update docs/api.md as part of this PR.
There's a small documentation change included in this PR showing that an
entityVersion
source no longer containssubmissionCreate
. But we don't document the details of specific audit events, so the main change in this PR doesn't need a docs change.It is super important for us making changes on frontend, though, so I'm trying to document it here 😅
Before submitting this PR, please make sure you have:
make test-full
and confirmed all checks still pass OR confirm CircleCI build passes