Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/specs/web-server/_conversations.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async def list_conversations(
): ...


@router.put(
@router.patch(
"/conversations/{conversation_id}",
response_model=Envelope[ConversationRestGet],
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from datetime import datetime
from typing import Annotated, Self
from typing import Annotated, Any, Self

from pydantic import Field

Expand Down Expand Up @@ -47,6 +47,7 @@ def from_domain_model(cls, domain: ConversationGetDB) -> Self:

class ConversationPatch(InputSchema):
name: str | None = None
extra_context: dict[str, Any] | None = None


### CONVERSATION MESSAGES ---------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class ConversationMessageGetDB(BaseModel):

class ConversationPatchDB(BaseModel):
name: ConversationName | None = None
extra_context: dict[str, Any] | None = None


class ConversationMessagePatchDB(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
openapi: 3.1.0
info:
title: simcore-service-webserver
Expand Down Expand Up @@ -571,7 +571,7 @@
schema:
$ref: '#/components/schemas/Page_ConversationRestGet_'
/v0/conversations/{conversation_id}:
put:
patch:
tags:
- conversations
summary: Update Conversation
Expand Down Expand Up @@ -10310,6 +10310,12 @@
- type: string
- type: 'null'
title: Name
extraContext:
anyOf:
- additionalProperties: true
type: object
- type: 'null'
title: Extracontext
type: object
title: ConversationPatch
ConversationRestGet:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ async def get_conversation(request: web.Request):
return envelope_json_response(data)


@routes.put(
@routes.patch(
f"/{VTAG}/conversations/{{conversation_id}}",
name="update_conversation",
)
Expand All @@ -190,7 +190,7 @@ async def update_conversation(request: web.Request):
app=request.app,
project_id=None, # Support conversations don't use project_id
conversation_id=path_params.conversation_id,
updates=ConversationPatchDB(name=body_params.name),
updates=ConversationPatchDB(**body_params.model_dump(exclude_unset=True)),
)

data = ConversationRestGet.from_domain_model(conversation)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ def _update_json_schema_extra(schema: JsonDict) -> None:
"LOGIN_2FA_REQUIRED": False,
},
"group_id": 12345,
"support_standard_group_id": 67890,
"is_payment_enabled": False,
},
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
products.c.registration_email_template,
products.c.max_open_studies_per_user,
products.c.group_id,
products.c.support_standard_group_id,
]

assert {column.name for column in _PRODUCTS_COLUMNS}.issubset( # nosec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ async def create_and_cache_statics_json(app: web.Application) -> None:
release_vtag = _get_release_notes_vtag(vtag)
data["vcsReleaseUrl"] = template_url.format(vtag=release_vtag)

# Add support_standard_group_id
data["supportStandardGroupId"] = product.support_standard_group_id

data_json = json_dumps(data)
_logger.debug("Front-end statics.json: %s", data_json)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ async def test_conversations_update_and_delete(
conversation_id=first_conversation_id
)
updated_name = "Updated Support Request - Bug Report"
resp = await client.put(
resp = await client.patch(
f"{update_url}?type=SUPPORT",
json={"name": updated_name},
)
Expand Down Expand Up @@ -351,7 +351,7 @@ async def test_conversations_access_control(
update_url = client.app.router["update_conversation"].url_for(
conversation_id=conversation_id
)
resp = await client.put(
resp = await client.patch(
f"{update_url}?type=SUPPORT",
json={"name": "Unauthorized update attempt"},
)
Expand Down Expand Up @@ -394,7 +394,7 @@ async def test_conversations_error_handling(
update_url = client.app.router["update_conversation"].url_for(
conversation_id=fake_conversation_id
)
resp = await client.put(
resp = await client.patch(
f"{update_url}?type=SUPPORT",
json={"name": "Update non-existent"},
)
Expand Down Expand Up @@ -434,7 +434,7 @@ async def test_conversations_without_type_query_param(
update_url = client.app.router["update_conversation"].url_for(
conversation_id=conversation_id
)
resp = await client.put(f"{update_url}", json={"name": "Updated"})
resp = await client.patch(f"{update_url}", json={"name": "Updated"})
await assert_status(resp, status.HTTP_422_UNPROCESSABLE_ENTITY)

delete_url = client.app.router["delete_conversation"].url_for(
Expand Down
Loading