-
Notifications
You must be signed in to change notification settings - Fork 89
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
Adds Download GeoJSON button #2138
base: master
Are you sure you want to change the base?
Adds Download GeoJSON button #2138
Conversation
…ta-to-be-exported-as-geojson
res.status(HttpStatus.FORBIDDEN).send('Permission denied'); | ||
return; | ||
} | ||
const ownerId = canImport(user, surveyDoc) ? undefined : userId; |
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.
Should this logic be reversed? If canImport is true, the ownerId is the userId? Or is this the correct logic? Maybe a comment would help clarify, if this is right.
/** | ||
* Iterates over all LOIsin a job returning a valid GeoJSON file. | ||
*/ | ||
export async function exportGeojsonHandler( |
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 quite a long function. This is a nit, but any way this could be split up into useful chunks of logic? e.g. error checking, writing rows, etc.
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.
There are a fair few things from the function that are not tested here, especially error cases. I understand not testing everything, but anything that's especially important that you think we should test?
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.
After investigating the export-csv test logic, I found that the jsonstream library uses a queue for writing to the stream and I didn't find a way to capture this.
Maybe we can change the mocking strategy, so instead of mocking the entire response, I'll likely get better results by focusing my tests on the transformation of he LOI data into GeoJSON features.
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.
wdyt @nwkotto ?
closes #2013
Registrazione.schermo.2025-02-04.alle.17.14.04.mov