Appearance
Type Deep Dive — Message Permission And Search Boundary
1. Conversation permissions
conversation
| Operation | Rule |
|---|---|
select | user phải là member (public_conversation.yaml:36) |
insert | role user tạo conversation mới, Hasura set created_by/updated_by (public_conversation.yaml:19) |
update | member được update subset columns như description, video_room_provider, video_room_id, metadata, visible (public_conversation.yaml:62) |
delete | chỉ member có is_admin = true mới delete được (public_conversation.yaml:81) |
conversation_member
| Operation | Rule |
|---|---|
insert | chỉ admin hiện tại, creator của conversation hoặc conversation cho phép invite mới thêm member được (public_conversation_member.yaml:8) |
select | user chỉ thấy membership thuộc conversation mình liên quan (public_conversation_member.yaml:41) |
update | user chỉ update in_call, mute_until, read_at của chính mình (public_conversation_member.yaml:72) |
delete | user chỉ delete membership của chính mình (public_conversation_member.yaml:84) |
2. Message permissions
conversation_message
| Operation | Rule |
|---|---|
insert | conversation phải chưa closed và user phải là member (public_conversation_message.yaml:33) |
select | user phải là member của conversation (public_conversation_message.yaml:54) |
update | chỉ tác giả message (public_conversation_message.yaml:85) |
delete | chỉ tác giả message (public_conversation_message.yaml:100) |
conversation_message_mention
| Operation | Rule |
|---|---|
insert | chỉ owner của message mới insert mention rows (public_conversation_message_mention.yaml:8) |
select | tác giả message hoặc member liên quan mới đọc được mention row (public_conversation_message_mention.yaml:19) |
update | chỉ user được mention tự update read_at của mình (public_conversation_message_mention.yaml:45) |
3. Read models và search functions
conversation_current
Đây là read model chính cho workspace/list. Nó expose sẵn:
last_message_content,last_message_created_at,read_at,unread_messages_count,video_room_id,video_room_provider,mute_until,pinned,invited_by.
(public_conversation_current.yaml:23)
Search functions
| Function | Vai trò |
|---|---|
search_conversation_current | danh sách conversation runtime user-scoped |
search_unread_conversation_messages | unread feed user-scoped |
Cả hai đều nhận session_argument: hasura_session, tức search results phụ thuộc trực tiếp vào session vars (public_search_conversation_current.yaml:1, public_search_unread_conversation_messages.yaml:1).
4. Boundary đáng chú ý
- Workspace FE hiện không dùng một GraphQL document tập trung trong
graphql/conversation.graphql; file này trống hoàn toàn. - Token queries được colocate ở compositions của provider (
compositions/graphql.ts,vendors/twilio/compositions/graphql.ts), còn CRUD/search conversation thật lại sống ở Hasura metadata/tables/functions. - Điều này làm người đọc rất dễ nhầm rằng module chỉ có “provider tokens”, trong khi thực tế read/write boundary quan trọng nhất nằm ở
conversation_current,conversation_member,conversation_message.
5. Findings kỹ thuật
| ID | Mức độ | Mô tả |
|---|---|---|
| MP-F01 | Trung bình | conversation.graphql trống, làm boundary GraphQL của module khó discover nếu chỉ đọc file colocate thông thường. |
| MP-F02 | Trung bình | Read model chính của list là conversation_current, không phải conversation; nếu FE hoặc BA bám sai table sẽ hiểu nhầm nguồn unread_messages_count và video_room_id. |
| MP-F03 | Cao | createConference mutate field không xuất hiện trong permission columns đã thấy, nên rất có khả năng không tương thích với role-scoped schema của action access client. |