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

feat: add GET /api/v1/me/workspaces & update Workspace class #3390

Merged
merged 25 commits into from
Jul 13, 2023

Conversation

alvarobartt
Copy link
Member

Description

This PR adds the /api/v1/me/workspaces endpoint in the API V1, and also updates the Workspace accordingly so that both users with role annotator and/or admin, can list the workspaces they are part of.

So on, the bug related to the access to the User.workspaces property is now solved, as before just the owners were able to access it and print the model (as workspace was part of the repr).

Besides that, some minor things have also been tackled as part of this PR:

  • Remove unused imports
  • Restrict Workspace.delete_user to users with role owner only

Type of change

(Please delete options that are not relevant. Remember to title the PR according to the type of change)

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

How Has This Been Tested

  • Add unit tests for GET /api/v1/me/workspaces
  • Add unit tests for list_workspaces_me in Python SDK
  • Add unit tests for User.workspaces in Python client

All the above tested for all the roles: owner, admin, and annotator.

Checklist

  • I added relevant documentation
  • follows the style guidelines of this project
  • I did a self-review of my code
  • I made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I filled out the contributor form (see text above)
  • I have added relevant notes to the CHANGELOG.md file (See https://keepachangelog.com/)

@alvarobartt alvarobartt added type: enhancement Indicates new feature requests bugfix labels Jul 12, 2023
@alvarobartt alvarobartt added this to the v1.13.0 milestone Jul 12, 2023
@alvarobartt alvarobartt removed the request for review from jfcalvo July 12, 2023 12:48
When checking `self.role` we were checking the user's instance role, not the active user one
@codecov
Copy link

codecov bot commented Jul 12, 2023

Codecov Report

Patch coverage: 94.35% and project coverage change: +0.35 🎉

Comparison is base (6630d7b) 90.13% compared to head (e5532e7) 90.49%.

❗ Current head e5532e7 differs from pull request most recent head 77ead2c. Consider uploading reports for the commit 77ead2c to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3390      +/-   ##
===========================================
+ Coverage    90.13%   90.49%   +0.35%     
===========================================
  Files          233      240       +7     
  Lines        12493    12925     +432     
===========================================
+ Hits         11261    11696     +435     
+ Misses        1232     1229       -3     
Flag Coverage Δ
pytest ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ack/integrations/huggingface/card/_dataset_card.py 100.00% <ø> (ø)
.../feedback/integrations/huggingface/card/_parser.py 100.00% <ø> (ø)
src/argilla/feedback/__init__.py 100.00% <ø> (ø)
src/argilla/tasks/database/migrate.py 39.13% <ø> (-4.87%) ⬇️
src/argilla/training/autotrain_advanced.py 0.00% <0.00%> (ø)
src/argilla/utils/telemetry.py 89.09% <ø> (ø)
src/argilla/server/settings.py 77.65% <50.00%> (-3.52%) ⬇️
src/argilla/server/database.py 76.47% <60.00%> (-23.53%) ⬇️
...lient/feedback/integrations/huggingface/dataset.py 86.80% <86.80%> (ø)
src/argilla/client/sdk/v1/workspaces/api.py 95.00% <87.50%> (-5.00%) ⬇️
... and 62 more

... and 7 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@alvarobartt alvarobartt merged commit 9be4b00 into develop Jul 13, 2023
@alvarobartt alvarobartt deleted the feat/list-current-user-workspaces branch July 13, 2023 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Indicates new feature requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants