-
Notifications
You must be signed in to change notification settings - Fork 32
✨ web-api: trashed resources include trashedBy with the primary GID of the user that trashed it
#7052
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
Merged
Merged
✨ web-api: trashed resources include trashedBy with the primary GID of the user that trashed it
#7052
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
4d0245c
drafts tests
pcrespov 41b94c4
back to uid
pcrespov 47d5255
rm import
pcrespov 10b5e79
fixes userid
pcrespov a900b67
fixes folders
pcrespov 5e2e63c
doc
pcrespov b3f671b
updates OAS
pcrespov 9384eef
services/webserver api version: 0.50.0 → 0.51.0
pcrespov f5357ad
updates workspaces to return groupid
pcrespov 607c6a3
updates fakes in api-server
pcrespov a51dedf
fixes tests
pcrespov 9582a27
folders trashed-by
pcrespov 908e453
domain models in folders
pcrespov 4abded4
doc
pcrespov 93dbfda
fixes tests
pcrespov d9c57cd
projects schema, domain and data models
pcrespov 92951c0
projects trashed by primary gid
pcrespov 2f574a5
fix tests
pcrespov fa42231
fix tests
pcrespov afbbc44
fix mypy
pcrespov c069123
fix bad merge
pcrespov a77e643
split ProjectDB
pcrespov a0d8de7
read functions returning ProjectDict
pcrespov 007a1e6
list of project dict gets trashed_by_primary_gid
pcrespov 4d438e0
list of project dict gets trashed_by_primary_gid
pcrespov d5016e3
doc
pcrespov 5905876
handlers return item
pcrespov ced0e98
by_alias since Page is strict
pcrespov b3cc85e
fixes test_proejcts_cancellations
pcrespov 4e069ef
fixes tests
pcrespov 294dc0b
adapts folders
pcrespov 667daa8
testing folders
pcrespov f4c6886
minor
pcrespov 23fca69
fixes test and refactor query
pcrespov 1bf2942
fixes order
pcrespov 347d565
@GitHK review: annotations
pcrespov 8f0a626
@bisgaard-itis review: camelcase or not
pcrespov 906a875
refactor to reduce complexity (sonarcloud)
pcrespov 09644ab
fixes cancelation errors
pcrespov 5b8a385
cleanup
pcrespov fadfb3a
sonarcloud complexity and pylint
pcrespov 7a92b48
drop
pcrespov 0a7b242
fixes tests
pcrespov 1340862
fixes bug introduced in workspaces
pcrespov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,13 +5,11 @@ | |
|
|
||
| """ | ||
|
|
||
| import copy | ||
| from datetime import datetime | ||
| from typing import Annotated, Any, Literal, Self, TypeAlias | ||
|
|
||
| from common_library.dict_tools import remap_keys | ||
| from models_library.folders import FolderID | ||
| from models_library.utils._original_fastapi_encoders import jsonable_encoder | ||
| from models_library.workspaces import WorkspaceID | ||
| from pydantic import ( | ||
| BeforeValidator, | ||
| ConfigDict, | ||
|
|
@@ -25,10 +23,12 @@ | |
| from ..basic_types import LongTruncatedStr, ShortTruncatedStr | ||
| from ..emails import LowerCaseEmailStr | ||
| from ..folders import FolderID | ||
| from ..groups import GroupID | ||
| from ..projects import ClassifierID, DateTimeStr, NodesDict, ProjectID | ||
| from ..projects_access import AccessRights, GroupIDStr | ||
| from ..projects_state import ProjectState | ||
| from ..projects_ui import StudyUI | ||
| from ..utils._original_fastapi_encoders import jsonable_encoder | ||
| from ..utils.common_validators import ( | ||
| empty_str_to_none_pre_validator, | ||
| none_to_empty_str_pre_validator, | ||
|
|
@@ -98,6 +98,9 @@ class ProjectGet(OutputSchema): | |
| folder_id: FolderID | None | ||
|
|
||
| trashed_at: datetime | None | ||
| trashed_by: Annotated[ | ||
| GroupID | None, Field(description="The primary gid of the user who trashed") | ||
| ] | ||
|
|
||
| _empty_description = field_validator("description", mode="before")( | ||
| none_to_empty_str_pre_validator | ||
|
|
@@ -107,10 +110,20 @@ class ProjectGet(OutputSchema): | |
|
|
||
| @classmethod | ||
| def from_domain_model(cls, project_data: dict[str, Any]) -> Self: | ||
| trimmed_data = copy.copy(project_data) | ||
| # project_data["trashed_by"] is a UserID | ||
| # project_data["trashed_by_primary_gid"] is a GroupID | ||
|
Comment on lines
+114
to
+115
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe remove these if they are unsued? |
||
| trimmed_data.pop("trashed_by", None) | ||
| trimmed_data.pop("trashedBy", None) | ||
|
|
||
| return cls.model_validate( | ||
| remap_keys( | ||
| project_data, | ||
| rename={"trashed": "trashed_at"}, | ||
| trimmed_data, | ||
| rename={ | ||
| "trashed": "trashed_at", | ||
| "trashed_by_primary_gid": "trashed_by", | ||
| "trashedByPrimaryGid": "trashedBy", | ||
| }, | ||
| ) | ||
| ) | ||
|
|
||
|
|
@@ -127,7 +140,8 @@ class ProjectReplace(InputSchema): | |
| name: ShortTruncatedStr | ||
| description: LongTruncatedStr | ||
| thumbnail: Annotated[ | ||
| HttpUrl | None, BeforeValidator(empty_str_to_none_pre_validator) | ||
| HttpUrl | None, | ||
| BeforeValidator(empty_str_to_none_pre_validator), | ||
| ] = Field(default=None) | ||
| creation_date: DateTimeStr | ||
| last_change_date: DateTimeStr | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.