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 list user workspaces endpoint #3308

Merged
merged 5 commits into from
Jul 4, 2023

Conversation

gabrielmbmb
Copy link
Member

Description

This PR adds a new endpoint to API v1 to list the workspaces to which a user belongs.

Closes #3273

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested

Manually and unit tests have been added to test this new endpoint.

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

@gabrielmbmb gabrielmbmb added type: enhancement Indicates new feature requests area: api Indicates that an issue or pull request is related to the Fast API server or REST endpoints labels Jul 3, 2023
@gabrielmbmb gabrielmbmb added this to the v1.13 milestone Jul 3, 2023
@gabrielmbmb gabrielmbmb requested a review from frascuchon July 3, 2023 15:11
CHANGELOG.md Outdated Show resolved Hide resolved
@alvarobartt
Copy link
Member

LGTM, I'll update the Python client accordingly!

@gabrielmbmb gabrielmbmb force-pushed the feature/list_user_workspaces_endpoint branch from f1b5a99 to 56ae37e Compare July 3, 2023 15:14
@codecov
Copy link

codecov bot commented Jul 3, 2023

Codecov Report

Patch coverage: 95.71% and project coverage change: -3.93 ⚠️

Comparison is base (6630d7b) 90.13% compared to head (56ae37e) 86.21%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3308      +/-   ##
===========================================
- Coverage    90.13%   86.21%   -3.93%     
===========================================
  Files          233      235       +2     
  Lines        12493    12681     +188     
===========================================
- Hits         11261    10933     -328     
- Misses        1232     1748     +516     
Flag Coverage Δ
pytest 86.21% <95.71%> (-3.93%) ⬇️

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

Impacted Files Coverage Δ
src/argilla/tasks/database/migrate.py 39.13% <ø> (-4.87%) ⬇️
src/argilla/server/settings.py 77.65% <50.00%> (-3.52%) ⬇️
src/argilla/server/contexts/datasets.py 92.46% <89.84%> (-3.56%) ⬇️
src/argilla/server/apis/v0/handlers/workspaces.py 89.39% <90.90%> (+1.06%) ⬆️
src/argilla/utils/dependency.py 94.82% <92.85%> (-1.40%) ⬇️
src/argilla/server/contexts/accounts.py 96.15% <96.15%> (+0.91%) ⬆️
src/argilla/server/policies.py 98.06% <97.41%> (-0.54%) ⬇️
src/argilla/_version.py 100.00% <100.00%> (ø)
src/argilla/server/apis/v0/handlers/datasets.py 100.00% <100.00%> (ø)
src/argilla/server/apis/v0/handlers/info.py 100.00% <100.00%> (ø)
... and 32 more

... and 16 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.

Copy link
Member

@alvarobartt alvarobartt left a comment

Choose a reason for hiding this comment

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

LGTM, are you planning to solve @frascuchon's comment or are we good to merge?

@alvarobartt alvarobartt merged commit 1594037 into develop Jul 4, 2023
@alvarobartt alvarobartt deleted the feature/list_user_workspaces_endpoint branch July 4, 2023 12:05
leiyre pushed a commit that referenced this pull request Jul 4, 2023
* develop:
  refactor: add `HuggingFaceDatasetMixIn` under `integrations` (#3326)
  feat: add list user workspaces endpoint (#3308)
  ci: Stop linking issues to team work project
  chore: add missing `greenlet` dependency in `server` extra (#3330)
  fix: unit test failing if not local db (#3307)
  ci: Optimize build + test pipeline (#3300)
  refactor: simplify old bulk endpoints to avoid create datasets if does not exists (#3306)
  📝 Update doc site link (#3299)
  🚑 Fix dependencies (#3302)
  feat: migrate to async SQLAlchemy engine (#3162)
gabrielmbmb added a commit that referenced this pull request Jul 4, 2023
# Description

This PR adds the `list_user_workspaces` function in the SDK and the
Python client, as of the recently included API endpoint at
#3308, so this PR needs to
wait upon its parent one to be merged first.

This PR then, solves the issue we had when listing workspaces from an
user, since we were listing all the workspaces, and just available for
certain users.

**Type of change**

- [X] New feature (non-breaking change which adds functionality)

**How Has This Been Tested**

- [X] Add unit tests for both the SDK and the Python client

**Checklist**

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Martin <gabriel@argilla.io>
gabrielmbmb pushed a commit that referenced this pull request Jul 5, 2023
<!-- Thanks for your contribution! As part of our Community Growers
initiative 🌱, we're donating Justdiggit bunds in your name to reforest
sub-Saharan Africa. To claim your Community Growers certificate, please
contact David Berenstein in our Slack community or fill in this form
https://tally.so/r/n9XrxK once your PR has been merged. -->

# Description

This PR changes the `GET /api/v1/users/:user_id/workspaces` endpoint
introduced in #3308 to return all workspaces for owner users

Also, returns 404 if provided user id does not exist


**Type of change**

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

- [X] Bug fix (non-breaking change which fixes an issue)

**How Has This Been Tested**

(Please describe the tests that you ran to verify your changes. And
ideally, reference `tests`)

- [ ] Test A
- [ ] Test B

**Checklist**

- [ ] I added relevant documentation
- [x] follows the style guidelines of this project
- [x] I did a self-review of my code
- [ ] I made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [ ] I filled out [the contributor form](https://tally.so/r/n9XrxK)
(see text above)
- [x] I have added relevant notes to the CHANGELOG.md file (See
https://keepachangelog.com/)
leiyre pushed a commit that referenced this pull request Jul 5, 2023
* develop:
  fix: return all workspaces in system for owner users (#3343)
  fix: `rg.init` with argilla user using quickstart images raise an unexpected error (#3341)
  feat: add `Suggestion` endpoints (#3304)
  feat: add `list_user_workspaces` and `User.workspaces` property (#3334)
  refactor: add `HuggingFaceDatasetMixIn` under `integrations` (#3326)
  feat: add list user workspaces endpoint (#3308)
  ci: Stop linking issues to team work project
  chore: add missing `greenlet` dependency in `server` extra (#3330)
  docs: update developer docs (#3314)
  Docs/3312 docs 112 is not building correctly (#3313)
  fix: unit test failing if not local db (#3307)
  ci: Optimize build + test pipeline (#3300)
  refactor: simplify old bulk endpoints to avoid create datasets if does not exists (#3306)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: api Indicates that an issue or pull request is related to the Fast API server or REST endpoints type: enhancement Indicates new feature requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow request available workspaces for a specific user
3 participants