-
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
implement create region in graphql #1449
Conversation
3743ad3
to
5e1b56a
Compare
5e1b56a
to
df9b4fa
Compare
80c9696
to
7dc8d5c
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.
Let's verify with the client If field project
is mandatory or not.
94d0af6
to
528ba78
Compare
f8de780
to
6d317f3
Compare
c8c7600
to
54f6302
Compare
b7e7eef
to
4d2873c
Compare
apps/geo/mutations.py
Outdated
if admin_level_qs is None: | ||
error_data.append('AdminLevel does\'t exist') | ||
elif admin_level_qs.region.created_by != info.context.user: | ||
error_data.append('Region Owner can delete admin level ') | ||
elif admin_level_qs.region.is_published: | ||
error_data.append('Published region can\'t be changed. Please contact') |
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 admin_level_qs is None: | |
error_data.append('AdminLevel does\'t exist') | |
elif admin_level_qs.region.created_by != info.context.user: | |
error_data.append('Region Owner can delete admin level ') | |
elif admin_level_qs.region.is_published: | |
error_data.append('Published region can\'t be changed. Please contact') | |
if admin_level_qs is None: | |
error_data.append("AdminLevel does't exist") | |
elif admin_level_qs.region.created_by_id != info.context.user.id: | |
error_data.append('Only region owner can delete admin level ') | |
elif admin_level_qs.region.is_published: | |
error_data.append("Published region can't be changed. Please contact system admin") |
apps/geo/mutations.py
Outdated
else: | ||
admin_level_qs.delete() | ||
return DeleteAdminLevel(errors=None, ok=True) | ||
return DeleteAdminLevel(errors=[ | ||
dict( | ||
field='nonFieldErrors', | ||
messages=error_data | ||
) | ||
], ok=False) |
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.
else: | |
admin_level_qs.delete() | |
return DeleteAdminLevel(errors=None, ok=True) | |
return DeleteAdminLevel(errors=[ | |
dict( | |
field='nonFieldErrors', | |
messages=error_data | |
) | |
], ok=False) | |
if error_data: | |
return DeleteAdminLevel(errors=[ | |
dict( | |
field='nonFieldErrors', | |
messages=error_data | |
) | |
], ok=False) | |
admin_level.delete() | |
return DeleteAdminLevel(errors=None, ok=True) |
region = data.get('region', (self.instance and self.instance.region)) | ||
if not region.can_modify(self.context['request'].user): | ||
raise serializers.ValidationError('You don\'t have the access to the region or region is published') | ||
return data |
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.
Confirm with @subinasr to check error response in required format
4d2873c
to
f243f01
Compare
@subinasr Please squash and merge this hae... Lots of comments are review fixes. |
* Update testcase of create region * Update testcase of region mutation
* Update testcase of region mutation * Update testcase and refactor
* Update testcase of create region * Update testcase of region mutation
* Update testcase of region mutation * Update testcase and refactor
* Optimize testcases and error messages
f243f01
to
3013525
Compare
Addresses
Changes
This PR doesn't introduce any:
print
This PR contains valid: