Skip to content
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

Merged
merged 11 commits into from
Apr 18, 2023
Merged

Clone Settings - Add Core APIs #224

merged 11 commits into from
Apr 18, 2023

Conversation

ashwin1111
Copy link
Contributor

No description provided.

@github-actions
Copy link

github-actions bot commented Apr 4, 2023

Coverage

Coverage Report
FileStmtsMissCoverMissing
apps/fyle
   helpers.py370100% 
   models.py233897%241–243, 247–249, 264, 268, 311, 383
   serializers.py210100% 
   tasks.py72297%150–151
   views.py1430100% 
apps/mappings
   constants.py10100% 
   helpers.py11282%26–27
   models.py290100% 
   serializers.py100100% 
   signals.py400100% 
   tasks.py3101795%161, 167, 207–208, 239, 319, 328, 432, 441, 498, 587–591, 677, 680, 686
   utils.py340100% 
   views.py76396%60, 164–165
apps/tasks
   models.py380100% 
   serializers.py60100% 
   views.py330100% 
apps/users
   helpers.py120100% 
   models.py500100% 
   views.py230100% 
apps/workspaces
   email.py340100% 
   models.py1000100% 
   permissions.py20195%21
   serializers.py260100% 
   signals.py130100% 
   tasks.py830100% 
   utils.py96595%223–224, 238–244
   views.py2561395%394–398, 537–539, 592–609
apps/workspaces/apis/advanced_settings
   serializers.py63592%131, 134, 138, 142, 145
   triggers.py80100% 
   views.py70100% 
apps/workspaces/apis/errors
   serializers.py200100% 
   views.py190100% 
apps/workspaces/apis/export_settings
   serializers.py93694%164, 167, 170, 174, 178, 182
   triggers.py100100% 
   views.py70100% 
apps/workspaces/apis/import_settings
   serializers.py76396%175, 178, 181
   triggers.py320100% 
   views.py70100% 
apps/workspaces/apis/prefill_configurations
   serializers.py442348%30, 33, 36, 39, 42–69, 72–81
   views.py7186%12
apps/workspaces/templatetags
   custom_filters.py40100% 
apps/xero
   models.py207598%29–33, 42, 292, 311
   serializers.py150100% 
   tasks.py5542196%269, 401, 427–428, 544, 685, 857, 947–971, 1059–1060, 1171, 1201
   utils.py290598%88, 181, 509, 573, 603
   views.py173597%274, 330–331, 369–370
TOTAL344312596% 

Tests Skipped Failures Errors Time
169 0 💤 0 ❌ 0 🔥 58.068s ⏱️

@github-actions
Copy link

github-actions bot commented Apr 4, 2023

Coverage

Coverage Report
FileStmtsMissCoverMissing
apps/fyle
   helpers.py370100% 
   models.py233897%241–243, 247–249, 264, 268, 311, 383
   serializers.py210100% 
   tasks.py72297%150–151
   views.py1430100% 
apps/mappings
   constants.py10100% 
   helpers.py11282%26–27
   models.py290100% 
   serializers.py100100% 
   signals.py400100% 
   tasks.py3101795%161, 167, 207–208, 239, 319, 328, 432, 441, 498, 587–591, 677, 680, 686
   utils.py340100% 
   views.py76396%60, 164–165
apps/tasks
   models.py380100% 
   serializers.py60100% 
   views.py330100% 
apps/users
   helpers.py120100% 
   models.py500100% 
   views.py230100% 
apps/workspaces
   email.py340100% 
   models.py1000100% 
   permissions.py20195%21
   serializers.py260100% 
   signals.py130100% 
   tasks.py830100% 
   utils.py96595%223–224, 238–244
   views.py2561395%394–398, 537–539, 592–609
apps/workspaces/apis/advanced_settings
   serializers.py63592%131, 134, 138, 142, 145
   triggers.py80100% 
   views.py70100% 
apps/workspaces/apis/errors
   serializers.py200100% 
   views.py190100% 
apps/workspaces/apis/export_settings
   serializers.py93694%164, 167, 170, 174, 178, 182
   triggers.py100100% 
   views.py70100% 
apps/workspaces/apis/import_settings
   serializers.py76396%175, 178, 181
   triggers.py320100% 
   views.py70100% 
apps/workspaces/apis/prefill_configurations
   helpers.py7357%13–17
   serializers.py442348%30, 33, 36, 39, 42–69, 72–81
   views.py9278%13–15
apps/workspaces/templatetags
   custom_filters.py40100% 
apps/xero
   models.py207598%29–33, 42, 292, 311
   serializers.py150100% 
   tasks.py5542196%269, 401, 427–428, 544, 685, 857, 947–971, 1059–1060, 1171, 1201
   utils.py290598%88, 181, 509, 573, 603
   views.py173597%274, 330–331, 369–370
TOTAL345212996% 

Tests Skipped Failures Errors Time
169 0 💤 0 ❌ 0 🔥 59.969s ⏱️

@github-actions
Copy link

github-actions bot commented Apr 4, 2023

Coverage

Coverage Report
FileStmtsMissCoverMissing
apps/fyle
   helpers.py370100% 
   models.py233897%241–243, 247–249, 264, 268, 311, 383
   serializers.py210100% 
   tasks.py72297%150–151
   views.py1430100% 
apps/mappings
   constants.py10100% 
   helpers.py11282%26–27
   models.py290100% 
   serializers.py100100% 
   signals.py400100% 
   tasks.py3101795%161, 167, 207–208, 239, 319, 328, 432, 441, 498, 587–591, 677, 680, 686
   utils.py340100% 
   views.py76396%60, 164–165
apps/tasks
   models.py380100% 
   serializers.py60100% 
   views.py330100% 
apps/users
   helpers.py120100% 
   models.py500100% 
   views.py230100% 
apps/workspaces
   email.py340100% 
   models.py1000100% 
   permissions.py20195%21
   serializers.py260100% 
   signals.py130100% 
   tasks.py830100% 
   utils.py96595%223–224, 238–244
   views.py2561395%394–398, 537–539, 592–609
apps/workspaces/apis/advanced_settings
   serializers.py63592%131, 134, 138, 142, 145
   triggers.py80100% 
   views.py70100% 
apps/workspaces/apis/errors
   serializers.py200100% 
   views.py190100% 
apps/workspaces/apis/export_settings
   serializers.py93694%164, 167, 170, 174, 178, 182
   triggers.py100100% 
   views.py70100% 
apps/workspaces/apis/import_settings
   serializers.py76396%175, 178, 181
   triggers.py320100% 
   views.py70100% 
apps/workspaces/apis/prefill_configurations
   helpers.py10640%13–24
   serializers.py442348%30, 33, 36, 39, 42–69, 72–81
   views.py14471%14–16, 21–23
apps/workspaces/templatetags
   custom_filters.py40100% 
apps/xero
   models.py207598%29–33, 42, 292, 311
   serializers.py150100% 
   tasks.py5542196%269, 401, 427–428, 544, 685, 857, 947–971, 1059–1060, 1171, 1201
   utils.py290598%88, 181, 509, 573, 603
   views.py173597%274, 330–331, 369–370
TOTAL346013496% 

Tests Skipped Failures Errors Time
169 0 💤 0 ❌ 0 🔥 57.241s ⏱️

@ashwin1111 ashwin1111 changed the title Prefill API - POC Clone Settings - Add Core APIs Apr 12, 2023
@github-actions
Copy link

Coverage

Coverage Report
FileStmtsMissCoverMissing
apps/fyle
   helpers.py370100% 
   models.py233897%241–243, 247–249, 264, 268, 311, 383
   serializers.py210100% 
   tasks.py75396%142, 153–154
   views.py1430100% 
apps/mappings
   constants.py10100% 
   helpers.py11282%26–27
   models.py290100% 
   serializers.py100100% 
   signals.py400100% 
   tasks.py3221695%161, 170, 245, 325, 337, 441, 453, 510, 603–607, 693, 696, 699, 705
   utils.py340100% 
   views.py76396%60, 164–165
apps/tasks
   models.py380100% 
   serializers.py60100% 
   views.py330100% 
apps/users
   helpers.py120100% 
   models.py500100% 
   views.py230100% 
apps/workspaces
   email.py340100% 
   models.py1000100% 
   permissions.py20195%21
   serializers.py260100% 
   signals.py130100% 
   tasks.py980100% 
   utils.py96595%223–224, 238–244
   views.py2581395%398–402, 541–543, 596–613
apps/workspaces/apis/advanced_settings
   serializers.py63592%131, 134, 138, 142, 145
   triggers.py80100% 
   views.py70100% 
apps/workspaces/apis/clone_settings
   helpers.py10640%13–24
   serializers.py442348%30, 33, 36, 39, 42–69, 72–81
   views.py16475%15–17, 24–26
apps/workspaces/apis/errors
   serializers.py200100% 
   views.py190100% 
apps/workspaces/apis/export_settings
   serializers.py93694%164, 167, 170, 174, 178, 182
   triggers.py100100% 
   views.py70100% 
apps/workspaces/apis/import_settings
   serializers.py76396%175, 178, 181
   triggers.py320100% 
   views.py70100% 
apps/workspaces/templatetags
   custom_filters.py40100% 
apps/xero
   models.py207598%29–33, 42, 292, 311
   serializers.py150100% 
   tasks.py5542196%269, 401, 427–428, 544, 685, 857, 947–971, 1059–1060, 1171, 1201
   utils.py290598%88, 181, 509, 573, 603
   views.py173597%274, 330–331, 369–370
TOTAL349413496% 

Tests Skipped Failures Errors Time
170 0 💤 0 ❌ 0 🔥 1m 0s ⏱️

@ashwin1111 ashwin1111 temporarily deployed to CI Environment April 14, 2023 10:21 — with GitHub Actions Inactive
@ashwin1111 ashwin1111 temporarily deployed to CI Environment April 14, 2023 10:21 — with GitHub Actions Inactive
@github-actions
Copy link

Coverage

Coverage Report
FileStmtsMissCoverMissing
apps/fyle
   helpers.py370100% 
   models.py233897%241–243, 247–249, 264, 268, 311, 383
   serializers.py210100% 
   tasks.py75396%142, 153–154
   views.py1430100% 
apps/mappings
   constants.py10100% 
   helpers.py110100% 
   models.py290100% 
   serializers.py100100% 
   signals.py400100% 
   tasks.py3341795%161, 170, 252, 332, 347, 451, 466, 523, 619–623, 709, 712, 715, 721, 724
   utils.py340100% 
   views.py76396%60, 164–165
apps/tasks
   models.py380100% 
   serializers.py60100% 
   views.py330100% 
apps/users
   helpers.py120100% 
   models.py500100% 
   views.py230100% 
apps/workspaces
   email.py340100% 
   models.py1000100% 
   permissions.py20195%21
   serializers.py260100% 
   signals.py130100% 
   tasks.py980100% 
   utils.py96397%223–224, 244
   views.py2581395%398–402, 541–543, 596–613
apps/workspaces/apis/advanced_settings
   serializers.py63592%131, 134, 138, 142, 145
   triggers.py80100% 
   views.py70100% 
apps/workspaces/apis/clone_settings
   helpers.py100100% 
   serializers.py44393%73, 76, 79
   views.py160100% 
apps/workspaces/apis/errors
   serializers.py200100% 
   views.py190100% 
apps/workspaces/apis/export_settings
   serializers.py93694%164, 167, 170, 174, 178, 182
   triggers.py100100% 
   views.py70100% 
apps/workspaces/apis/import_settings
   serializers.py76396%175, 178, 181
   triggers.py320100% 
   views.py70100% 
apps/workspaces/templatetags
   custom_filters.py40100% 
apps/xero
   models.py207598%29–33, 42, 292, 311
   serializers.py150100% 
   tasks.py5542196%269, 401, 427–428, 544, 685, 857, 947–971, 1059–1060, 1171, 1201
   utils.py290598%88, 181, 509, 573, 603
   views.py173597%274, 330–331, 369–370
TOTAL350610197% 

Tests Skipped Failures Errors Time
175 0 💤 0 ❌ 0 🔥 1m 5s ⏱️

@github-actions
Copy link

Coverage

Coverage Report
FileStmtsMissCoverMissing
apps/fyle
   helpers.py370100% 
   models.py233897%241–243, 247–249, 264, 268, 311, 383
   serializers.py210100% 
   tasks.py75396%142, 153–154
   views.py1430100% 
apps/mappings
   constants.py10100% 
   helpers.py110100% 
   models.py290100% 
   serializers.py100100% 
   signals.py400100% 
   tasks.py3341795%161, 170, 252, 332, 347, 451, 466, 523, 619–623, 709, 712, 715, 721, 724
   utils.py340100% 
   views.py76396%60, 164–165
apps/tasks
   models.py380100% 
   serializers.py60100% 
   views.py330100% 
apps/users
   helpers.py120100% 
   models.py500100% 
   views.py230100% 
apps/workspaces
   email.py340100% 
   models.py1000100% 
   permissions.py20195%21
   serializers.py260100% 
   signals.py130100% 
   tasks.py980100% 
   utils.py96397%223–224, 244
   views.py2581395%398–402, 541–543, 596–613
apps/workspaces/apis/advanced_settings
   serializers.py63592%131, 134, 138, 142, 145
   triggers.py80100% 
   views.py70100% 
apps/workspaces/apis/clone_settings
   helpers.py100100% 
   serializers.py44393%73, 76, 79
   views.py160100% 
apps/workspaces/apis/errors
   serializers.py200100% 
   views.py190100% 
apps/workspaces/apis/export_settings
   serializers.py93694%164, 167, 170, 174, 178, 182
   triggers.py100100% 
   views.py70100% 
apps/workspaces/apis/import_settings
   serializers.py76396%175, 178, 181
   triggers.py320100% 
   views.py70100% 
apps/workspaces/templatetags
   custom_filters.py40100% 
apps/xero
   models.py207598%29–33, 42, 292, 311
   serializers.py150100% 
   tasks.py5542196%269, 401, 427–428, 544, 685, 857, 947–971, 1059–1060, 1171, 1201
   utils.py290598%88, 181, 509, 573, 603
   views.py173597%274, 330–331, 369–370
TOTAL350610197% 

Tests Skipped Failures Errors Time
175 0 💤 0 ❌ 0 🔥 1m 0s ⏱️

@ashwin1111 ashwin1111 requested a review from Shwetabhk April 14, 2023 11:32
@ashwin1111 ashwin1111 temporarily deployed to CI Environment April 18, 2023 06:01 — with GitHub Actions Inactive
@github-actions
Copy link

Coverage

Coverage Report
FileStmtsMissCoverMissing
apps/fyle
   helpers.py370100% 
   models.py233897%241–243, 247–249, 264, 268, 311, 383
   serializers.py210100% 
   tasks.py75396%142, 153–154
   views.py1430100% 
apps/mappings
   constants.py10100% 
   helpers.py110100% 
   models.py290100% 
   serializers.py100100% 
   signals.py400100% 
   tasks.py3341795%161, 170, 252, 332, 347, 451, 466, 523, 619–623, 709, 712, 715, 721, 724
   utils.py340100% 
   views.py76396%60, 164–165
apps/tasks
   models.py380100% 
   serializers.py60100% 
   views.py330100% 
apps/users
   helpers.py120100% 
   models.py500100% 
   views.py230100% 
apps/workspaces
   email.py340100% 
   models.py1000100% 
   permissions.py20195%21
   serializers.py260100% 
   signals.py130100% 
   tasks.py980100% 
   utils.py96397%223–224, 244
   views.py2581395%398–402, 541–543, 596–613
apps/workspaces/apis/advanced_settings
   serializers.py63592%131, 134, 138, 142, 145
   triggers.py80100% 
   views.py70100% 
apps/workspaces/apis/clone_settings
   helpers.py100100% 
   serializers.py44393%73, 76, 79
   views.py160100% 
apps/workspaces/apis/errors
   serializers.py200100% 
   views.py190100% 
apps/workspaces/apis/export_settings
   serializers.py93694%164, 167, 170, 174, 178, 182
   triggers.py100100% 
   views.py70100% 
apps/workspaces/apis/import_settings
   serializers.py76396%175, 178, 181
   triggers.py320100% 
   views.py70100% 
apps/workspaces/templatetags
   custom_filters.py40100% 
apps/xero
   models.py207598%29–33, 42, 292, 311
   serializers.py150100% 
   tasks.py5542196%269, 401, 427–428, 544, 685, 857, 947–971, 1059–1060, 1171, 1201
   utils.py290598%88, 181, 509, 573, 603
   views.py173597%274, 330–331, 369–370
TOTAL350610197% 

Tests Skipped Failures Errors Time
175 0 💤 0 ❌ 0 🔥 1m 4s ⏱️

path('orgs/', FyleOrgsView.as_view())
path('orgs/', FyleOrgsView.as_view()),
path(
'clone_settings/availability/',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'clone_settings/availability/',
'clone_settings/exists/',

from apps.workspaces.models import Workspace, WorkspaceGeneralSettings

User = get_user_model()

Copy link
Contributor

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
Copy link
Contributor

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, \
Copy link
Contributor

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()
Copy link
Contributor

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

Suggested change
export_settings = ReadWriteSerializerMethodField()
export_settings = ReadWriteSerializerMethodField(null=False, blank=False)

Copy link
Contributor Author

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 \
Copy link
Contributor

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?

Copy link
Contributor Author

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()

Copy link
Contributor

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):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
class CloneSettingsAvailabilityView(generics.RetrieveAPIView):
class CloneSettingsExistsView(generics.RetrieveAPIView):

@@ -2,7 +2,14 @@

from .views import UserProfileView, FyleOrgsView

from apps.workspaces.apis.clone_settings.views \
import CloneSettingsAvailabilityView
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import CloneSettingsAvailabilityView
import CloneSettingsExistsView

@ashwin1111 ashwin1111 temporarily deployed to CI Environment April 18, 2023 10:46 — with GitHub Actions Inactive
@github-actions
Copy link

Tests Skipped Failures Errors Time
175 0 💤 0 ❌ 0 🔥 1m 2s ⏱️

@ashwin1111 ashwin1111 temporarily deployed to CI Environment April 18, 2023 10:56 — with GitHub Actions Inactive
@github-actions
Copy link

Tests Skipped Failures Errors Time
175 0 💤 1 ❌ 0 🔥 1m 1s ⏱️

@codecov-commenter
Copy link

codecov-commenter commented Apr 18, 2023

Codecov Report

Patch coverage: 95.65% and project coverage change: +0.08 🎉

Comparison is base (afa26f8) 97.03% compared to head (190794e) 97.11%.

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     
Impacted Files Coverage Δ
apps/workspaces/apis/clone_settings/serializers.py 93.18% <93.18%> (ø)
apps/workspaces/apis/clone_settings/helpers.py 100.00% <100.00%> (ø)
apps/workspaces/apis/clone_settings/views.py 100.00% <100.00%> (ø)

... 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.
📢 Do you have feedback about the report comment? Let us know in this issue.

@ashwin1111 ashwin1111 temporarily deployed to CI Environment April 18, 2023 11:05 — with GitHub Actions Inactive
@github-actions
Copy link

Tests Skipped Failures Errors Time
175 0 💤 0 ❌ 0 🔥 1m 4s ⏱️

@ashwin1111 ashwin1111 merged commit ee018b2 into master Apr 18, 2023
anishfyle pushed a commit that referenced this pull request Apr 26, 2023
* Prefill API - POC

* Get latest updated workspace

* Prefill availability

* Rename and refactor APIs

* Add unit tests

* Fix PR comments

* fix test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants