feat(api): sync dialog list interfaces (last_message, participants, search)#4
Merged
Merged
Conversation
…earch)
Synchronize the response shape of GET /api/v1/dialogs and
GET /api/v1/dialogs/by-object/{type}/{id}/list so both expose the same
per-dialog data, and add a search filter to the by-object list endpoint.
- Add full `last_message` object and `participants` list to DialogResponse,
populated in list_dialogs, list_dialogs_by_object, and get_dialog_by_object.
- `last_message` (message content) is returned only to actual participants;
hidden for available/can-join dialogs to preserve the v0.3.7 "no reading
before join" rule. `participants` is not sensitive and is always returned.
- Add `search` query param to the by-object /list endpoint (title OR
participant company, case-insensitive), matching GET /api/v1/dialogs.
- New batch repo methods get_last_message_batch and list_by_dialogs_batch
avoid N+1; find_all_by_object_for_user gains archived + search params.
- Frontend SDK: DialogListItem gains last_message/participants (new
LastMessage/ParticipantSummary types); getDialogsByObject accepts search.
- Integration tests for last_message, participants, search, and the
can-join content-hiding security boundary. Docs (en/ru) + changelog.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add optional type=participating|available query param to
GET /api/v1/dialogs/by-object/{type}/{id}/list, mirroring
GET /api/v1/dialogs. Omitted returns both branches (unchanged,
backward compatible); invalid value returns 400. type=available
ignores the archived filter since potential dialogs have no
per-user archived state.
find_all_by_object_for_user gains a dialog_type param toggling the
participant / potential EXISTS branches via two bound flags, keeping
the single-query no-N+1 shape. SDK getDialogsByObject accepts an
optional type argument.
Also reformats the existing list-by-object tests via cargo fmt to
fix the Rust Format CI check.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adding the dialog_type param pushed the arg count past clippy's threshold. Apply the same #[allow(clippy::too_many_arguments)] used elsewhere in the codebase (e.g. create_test_dialog). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Synchronizes the response shape of the two dialog-list endpoints —
GET /api/v1/dialogsandGET /api/v1/dialogs/by-object/{type}/{id}/list— soboth expose the same per-dialog data, and adds a
searchfilter to theby-object list endpoint to match
GET /api/v1/dialogs.Both endpoints now return a full
last_messageobject and a fullparticipantslist (previously only
last_message_attimestamp andparticipants_count).Changes
last_message(full object:id,content,sender_id,sender_name,sent_at,message_type) andparticipants(user_id,display_name,company) toDialogResponse, populated inlist_dialogs,list_dialogs_by_object, andget_dialog_by_object.last_messageon participation: hidden for available/can-join dialogs.searchquery param to the by-object/listendpoint (dialog title ORparticipant company, case-insensitive ILIKE).
get_last_message_batch(DialogRepository) andlist_by_dialogs_batch(ParticipantRepository) to avoid N+1.find_all_by_object_for_usergainsarchived+searchparameters.last_message_atandparticipants_countfor backward compatibility.DialogListItemgainslast_message/participants(newLastMessage/ParticipantSummaryinterfaces);getDialogsByObjectacceptsan optional
searchargument.last_message/participantspresence on both endpoints,by-object
searchfilter, and a can-join content-hiding security boundary test.CLAUDE.mdchangelog updated.Related Issues
N/A
Checklist
cargo fmtandcargo clippypass (backend changes) — not run locally (cargo unavailable); verified by review, relying on CInpm run typecheckandnpm run buildpass (frontend changes)