-
Notifications
You must be signed in to change notification settings - Fork 0
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
Clone Settings - Add Core APIs #224
Conversation
Coverage Report
|
Coverage Report
|
Coverage Report
|
Coverage Report
|
Coverage Report
|
Coverage Report
|
Coverage Report
|
apps/users/urls.py
Outdated
path('orgs/', FyleOrgsView.as_view()) | ||
path('orgs/', FyleOrgsView.as_view()), | ||
path( | ||
'clone_settings/availability/', |
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.
'clone_settings/availability/', | |
'clone_settings/exists/', |
from apps.workspaces.models import Workspace, WorkspaceGeneralSettings | ||
|
||
User = get_user_model() | ||
|
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.
add 1 more line
if workspace_general_setting: | ||
return workspace_general_setting.workspace | ||
|
||
return None |
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.
we don't need to explicitly return None
|
||
from django.db import transaction | ||
|
||
from apps.workspaces.apis.export_settings.serializers import ExportSettingsSerializer, \ |
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.
instead of using \
you can enclose imports in paranthesis, it is cleaner that way
from apps.workspaces.apis.export_settings.serializers import (
ExportSettingsSerializer,
...
)
|
||
|
||
class CloneSettingsSerializer(serializers.ModelSerializer): | ||
export_settings = ReadWriteSerializerMethodField() |
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.
Check if we can do something like this and that way we'll not need to explicitly add validations, not sure if we can do this, but it will be much cleaner that way
export_settings = ReadWriteSerializerMethodField() | |
export_settings = ReadWriteSerializerMethodField(null=False, blank=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.
this doesn't seem to be possible, have checked it out
instance, data=advanced_settings, partial=True | ||
) | ||
|
||
if export_settings_serializer.is_valid(raise_exception=True) and \ |
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.
I think it will only come to the update function if the serializer are valid, do we need to to this?
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.
validations aren't raising exception if we don't send this
latest_workspace = get_latest_workspace(self.request.user) | ||
|
||
return Workspace.objects.filter(id=latest_workspace.id).first() | ||
|
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.
add one more blank line
|
||
return Workspace.objects.filter(id=latest_workspace.id).first() | ||
|
||
class CloneSettingsAvailabilityView(generics.RetrieveAPIView): |
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.
class CloneSettingsAvailabilityView(generics.RetrieveAPIView): | |
class CloneSettingsExistsView(generics.RetrieveAPIView): |
apps/users/urls.py
Outdated
@@ -2,7 +2,14 @@ | |||
|
|||
from .views import UserProfileView, FyleOrgsView | |||
|
|||
from apps.workspaces.apis.clone_settings.views \ | |||
import CloneSettingsAvailabilityView |
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.
import CloneSettingsAvailabilityView | |
import CloneSettingsExistsView |
|
|
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #224 +/- ##
==========================================
+ Coverage 97.03% 97.11% +0.08%
==========================================
Files 44 47 +3
Lines 3436 3505 +69
==========================================
+ Hits 3334 3404 +70
+ Misses 102 101 -1
... and 2 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
|
* Prefill API - POC * Get latest updated workspace * Prefill availability * Rename and refactor APIs * Add unit tests * Fix PR comments * fix test
No description provided.