-
Notifications
You must be signed in to change notification settings - Fork 7
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(link): add update endpoint for link #2175
Conversation
…ink-update # Conflicts: # antarest/study/storage/variantstudy/model/command/create_link.py
@@ -198,6 +197,24 @@ def create_link( | |||
params = RequestParameters(user=current_user) | |||
return study_service.create_link(uuid, link_creation_info, params) | |||
|
|||
@bp.put( | |||
"/studies/{uuid}/links", |
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.
Okay. We should probably discuss what's a link id then. Is it area1%area2
or area1/area2
or another id ?
antarest/study/storage/variantstudy/model/command/create_link.py
Outdated
Show resolved
Hide resolved
antarest/study/storage/variantstudy/model/command/create_link.py
Outdated
Show resolved
Hide resolved
antarest/study/storage/variantstudy/model/command/create_link.py
Outdated
Show resolved
Hide resolved
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.
Really minor changes, otherwise looks good to me. With the matrix tests we'll be good to go
antarest/study/storage/variantstudy/model/command/update_link.py
Outdated
Show resolved
Hide resolved
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.
Still got little issues
antarest/study/storage/variantstudy/model/command/create_link.py
Outdated
Show resolved
Hide resolved
antarest/study/storage/variantstudy/model/command/create_link.py
Outdated
Show resolved
Hide resolved
Added new linkDtoForUpdate object to hide area1 and area2 from the client
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.
2 minor comments that don't really need to be adress and 1 question
@@ -78,6 +86,11 @@ def to_internal(self, version: StudyVersion) -> "LinkInternal": | |||
return LinkInternal(**data) | |||
|
|||
|
|||
class LinkDtoForUpdate(LinkDTO): | |||
area1: SkipJsonSchema[str] = Field("a", exclude=True) |
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.
Weird way to do it. Why did you introduce fields a
and b
?
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.
After testing this allows user to specfiy area1 and area2 inside the body and they we'll be ignored. I don't think we want that. I'd prefer you introduce a class that just has the base attributes and make LinkDTO inherit from 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.
I changed it
return self | ||
|
||
|
||
class LinkDTO(Area): | ||
model_config = ConfigDict(alias_generator=to_camel_case, populate_by_name=True, extra="forbid") | ||
model_config = ConfigDict( |
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.
Could be in one line
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.
Indeed
@@ -78,6 +86,11 @@ def to_internal(self, version: StudyVersion) -> "LinkInternal": | |||
return LinkInternal(**data) | |||
|
|||
|
|||
class LinkDtoForUpdate(LinkDTO): |
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.
Could be DTO instead of Dto to fit with existing class
Add an endpoint to update link