-
Notifications
You must be signed in to change notification settings - Fork 77
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
Entities Integrity URL #1348
Entities Integrity URL #1348
Conversation
a1f8727
to
b066ea7
Compare
b066ea7
to
ee4b6f2
Compare
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.
docs/api.yaml
Outdated
|
||
[Offline Entities support](https://forum.getodk.org/t/openrosa-spec-proposal-support-offline-entities/48052): | ||
|
||
* If an attachemnt is linked to a Dataset, then `type="entityList"` attribute is added to the `mediaFile` element. |
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.
* If an attachemnt is linked to a Dataset, then `type="entityList"` attribute is added to the `mediaFile` element. | |
* If an attachment is linked to a Dataset, then `type="entityList"` attribute is added to the `mediaFile` element. |
lib/formats/openrosa.js
Outdated
isDataset: attachment.datasetId != null | ||
isDataset: attachment.datasetId != null, | ||
integrityUrl: attachment.datasetId ? | ||
`${data.domain}${data.projectPath}/datasets/${encodeURIComponent(attachment.name.replace(/\.[^/.]+$/, ''))}/integrity` |
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 building of the dataset name from the attachment name makes me nervous. What if there's a weird name that we matched successfully elsewhere but this doesn't work? How does this work in the case where the dataset is manually linked to the attachment? Can we get the name from the database OR can we have a utility that transforms attachment names to dataset names in a reliable way?
It should be the exact same mechanism in the PATCH attachment resource where an attachment name (with .csv or .CSV) is transformed into a dataset name that is then matched in the database.
Closes #668
Dependent on #1349
What has been done to verify that this works as intended?
Written tests. I have deployed this to dev environment for Collect team to start using this endpoint.
Why is this the best possible solution? Were any other approaches considered?
Used the existing pattern.
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?
Since Form manifest is changed, it should work with older Collect clients.
Does this change require updates to the API documentation? If so, please update docs/api.yaml as part of this PR.
yes
Before submitting this PR, please make sure you have:
make test
and confirmed all checks still pass OR confirm CircleCI build passes