Skip to content
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

Enhance: add entity version number and modify update entity API to work with version #951

Merged

Conversation

sadiqkhoja
Copy link
Contributor

@sadiqkhoja sadiqkhoja commented Aug 16, 2023

Changes:

  • Added version column in the entity_defs table
  • OData Feed returns version number
  • forms/attachment/dataset.csv also returns version number
  • PATCH /entities/:uuid checks conflict if force flag is not provided

What has been done to verify that this works as intended?

Integration tests and manual testing with frontend

Why is this the best possible solution? Were any other approaches considered?

Other option was to add version in query parameter or body, but version in ETag and If-Match is a cleaner approach

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?

None

Does this change require updates to the API documentation? If so, please update docs/api.md as part of this PR.

Will do it in a separate PR

Before submitting this PR, please make sure you have:

  • run make test-full and confirmed all checks still pass OR confirm CircleCI build passes
  • verified that any code from external sources are properly credited in comments or that everything is internally sourced

@sadiqkhoja sadiqkhoja requested a review from ktuite August 16, 2023 19:58
@matthew-white
Copy link
Member

It sounds like this PR closes #832. Does that sound right?

@matthew-white matthew-white linked an issue Aug 17, 2023 that may be closed by this pull request
@sadiqkhoja sadiqkhoja force-pushed the features/entities/entity-version branch from 721f8ee to 8c5c79e Compare August 24, 2023 18:45
}));

it('should reject if version does not match', testEntities(async (service) => {
// TODO: change logic around force flag and enforcing certain kinds of updates
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can remove this and above TODO comment now?

@@ -1317,7 +1317,7 @@ describe('datasets and entities', () => {
.then(({ headers, text }) => {
headers['content-disposition'].should.equal('attachment; filename="goodone.csv"; filename*=UTF-8\'\'goodone.csv');
headers['content-type'].should.equal('text/csv; charset=utf-8');
text.should.equal('name,label,first_name,age\n12345678-1234-4123-8234-123456789abc,Alice (88),Alice,88\n');
text.should.equal('name,label,version,first_name,age\n12345678-1234-4123-8234-123456789abc,Alice (88),1,Alice,88\n');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing I noticed when trying to make a form that looked up the version, and based on what we're talking about in the team meeting on Aug 29, name and label have to be what they are, but should version be __version?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like version for the attachment csv

@sadiqkhoja sadiqkhoja merged commit cedadf2 into getodk:master Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Track entity versionNumbers
3 participants