Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #73
checkOrgExists
Since no
org.getInfo
endpoint existed, instead of creatin it i added an extra servicecheckOrgExists
as a named export. It might be likely that we need agetOrgInfo
in the future, but creating it just to use the service in this case seemed kind of an overkill.I also thought about using the
isUserAuthorised
function to bail early if the user has noyeep.org.write
permissions for the provided org id and then check the existance of the given org inside the service, but this wasn't so clean and it would be harder to test.Please advise if you would prefer a different method.
OrgMemberships
Since the orgMemberships model only uses id references i didn't make any changes there.
Edit: Bear in mind that i didn't remove the '/v1/' from the docs for this endpoint. We need to make a good passthrough to all of them and i didn't want this file to miss out 馃棥
Edit2: I added the extra
unauthorisedOrg
inside thebeforeAll
loop. This would be better off inside the only test that is using it, but if the test fails before the org is deleted, then the database needs reset. It is ugly but it was worse if i left it inside the unit test.