-
Notifications
You must be signed in to change notification settings - Fork 4
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
feat: soilDataPush mutation #1472
Conversation
91e4831
to
d29c727
Compare
result: SoilDataBulkUpdateResult! | ||
} | ||
|
||
union SoilDataBulkUpdateResult = SoilDataBulkUpdateSuccess | SoilDataBulkUpdateFailure |
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 there's one of these per entry, maybe make that clear in the name. Imo without looking at the code around it, this name kinda makes it sound like there's one per bulk update
enum SoilDataBulkUpdateFailureReason { | ||
DOES_NOT_EXIST | ||
NOT_ALLOWED | ||
} |
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 seems like a rather niche case that maybe we don't care about, but just a thought:
If this is on a per-site level: is there ever a case where some edits should be allowed, but others not? Like, you're a manager, you edit X and Y, someone changes you to a contributor (who is allowed to edit X but not Y), and then you push?
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.
currently there's no difference in how a manager and contributor can modify soil data (as opposed to sites and projects), so i think this niche case does not exist as things stand (though it could in the future, but i like to live in the present 😎 )
d29c727
to
2142d4e
Compare
d679c5b
to
71992cb
Compare
a04af27
to
5594ee3
Compare
5594ee3
to
b5fe246
Compare
|
||
|
||
class SoilDataPushEntrySuccess(graphene.ObjectType): | ||
site = graphene.Field(SiteNode, required=True) |
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.
suggestion: change to SoilDataNode
65391c7
to
8360648
Compare
# an individual site's updates are invalid, we reject all of that site's updates | ||
# NOTE: changing a depth interval preset causes all depth intervals for that site to be | ||
# deleted. we haven't yet thought through the implications of when/whether to apply | ||
# that change in the context of this mutation |
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.
Could link to a ticket if you've made one for follow-up work
assert history_3.soil_data_changes["slope_aspect"] == 15 | ||
|
||
|
||
def test_push_soil_data_success(client, user): |
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.
suggestion: from a readability perspective it might be easier to have the success case before the mixed case?
Description
This is a Big Ol' PR ™️ which implements the
soilDataPush
mutation. Roughly speaking, this PR:graphql/schema/commons.py
andsoil_id/graphql/soil_data/mutations.py
to expose some functionality for re-useSoilDataHistory
to store changes to soil data over timesoil_id/graphql/soil_data/push_mutation.py
defining the new mutation, which accepts:Implementation decisions/notes
SiteActions.UPDATE_DEPTH_INTERVAL
andSiteActions.ENTER_DATA
. since i believe right now a user will never have one but not both of them, for simplicity i just check if the user has both for each site rather than checking whether the individual update requires each permission on its own.pushSoilData
function duplicates the functionality of four separate previous mutations, which have complicated constraints/permissions conditions and extensive test code of those permissionspushSoilData
, but i haven't implemented it yetpushSoilData
endpoint, do we feel good about deleting the old soil data mutations (which i believe will now be unused) to remove this source of duplication? or do we want to have both aroundChecklist
Related Issues
Related to #1399 and #1485