Skip to content

Feat/expert absent - #68

Merged
phananhkhoa181 merged 3 commits into
devfrom
feat/expert-absent
May 5, 2026
Merged

Feat/expert absent#68
phananhkhoa181 merged 3 commits into
devfrom
feat/expert-absent

Conversation

@phananhkhoa181

@phananhkhoa181 phananhkhoa181 commented May 5, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

Ghi chú phát hành

  • New Features

    • Hỗ trợ tư vấn tức thời (Instant Consultations) trong lịch sử tư vấn
    • Cải thiện tải và phân trang lịch sử tư vấn cho thành viên và chuyên gia
    • Thêm trạng thái mới cho tư vấn tức thời: từ chối và hết hạn
  • Bug Fixes

    • Cải thiện hiển thị avatar với ảnh fallback tự động tạo khi không có ảnh đại diện
  • Documentation

    • Xoá tài liệu hướng dẫn sử dụng mô-đun "Chuyên gia vắng mặt"

@coderabbitai

coderabbitai Bot commented May 5, 2026

Copy link
Copy Markdown
ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Free

Run ID: 6bdf8a34-c713-4c07-82bf-208a88023863

📥 Commits

Reviewing files that changed from the base of the PR and between ec6c530 and 8405b10.

⛔ Files ignored due to path filters (1)
  • pubspec.lock is excluded by !**/*.lock
📒 Files selected for processing (10)
  • docs/consultation-expert-absent.useguide.md
  • lib/app/router.dart
  • lib/features/consultation/models/consultation_history_union_response.dart
  • lib/features/consultation/repository/consultation_repository.dart
  • lib/features/consultation/screens/experts/expert_consultation_detail_screen.dart
  • lib/features/consultation/screens/members/consultation_home_screen.dart
  • lib/features/consultation/screens/members/consultation_waiting_room_screen.dart
  • lib/features/consultation/screens/members/member_consultation_detail_screen.dart
  • lib/features/consultation/screens/members/video_consultation_screen.dart
  • lib/features/expert/screens/expert_home_screen.dart
💤 Files with no reviewable changes (1)
  • docs/consultation-expert-absent.useguide.md

📝 Walkthrough

Walkthrough

PR này loại bỏ tài liệu hướng dẫn sử dụng tính năng "Tư vấn Chuyên gia Vắng mặt" và thêm hỗ trợ toàn diện cho lịch sử tư vấn với các mô hình dữ liệu mới, phương thức kho lưu trữ được phân trang, và cấu trúc màn hình được cập nhật để hiển thị cả tư vấn theo lịch và tư vấn ngay lập tức (SOS), bao gồm cả cải tiến kết xuất avatar và cập nhật định tuyến.

Changes

Loại bỏ Tài liệu Hướng dẫn Sử dụng

Layer / File(s) Summary
Documentation Removal
docs/consultation-expert-absent.useguide.md
Entire use guide for "Consultation Expert Absent" module is removed, including verified backend contract, endpoint specifications, response data models, and changelog entries.

Hỗ Trợ Lịch Sử Tư Vấn và Tư Vấn Ngay Lập Tức

Layer / File(s) Summary
Data Model Layer
lib/features/consultation/models/consultation_history_union_response.dart
New union-based models introduced for member/expert consultation history, including ConsultationHistoryKind, InstantRequestStatus, PagedHistoryResponse<T>, MemberConsultationHistoryUnion, and ExpertConsultationHistoryUnion with JSON parsing and pagination metadata support.
Repository Methods
lib/features/consultation/repository/consultation_repository.dart
Two new paged history fetch methods added: getMyConsultationHistory(...) for members and getExpertConsultationHistory(...) for experts, both returning PagedHistoryResponse with union-based consultation entries and pagination metadata.
Router Updates
lib/app/router.dart
Route builders for /video-waiting/:consultationId and /video-consultation/:consultationId now extract and pass scheduledDurationSeconds, scheduledStartAtMs, and canReportExpertAbsent through route extra payload.
Member Waiting Room
lib/features/consultation/screens/members/consultation_waiting_room_screen.dart
ConsultationWaitingRoomScreen adds scheduledDurationSeconds property (default 1800) and uses it for schedule display; navigation payload to video consultation now includes both scheduledStartAtMs and scheduledDurationSeconds.
Video Consultation
lib/features/consultation/screens/members/video_consultation_screen.dart
VideoConsultationScreen exposes new public fields (canReportExpertAbsent, scheduledStartAtMs, scheduledDurationSeconds) with defaults; end-call navigation now propagates these scheduling and permission values through route extra.
Member History UI
lib/features/consultation/screens/members/consultation_home_screen.dart
ConsultationStatus enum expanded with instantDeclined and instantExpired states; history infrastructure refactored to load unified history via repository using _loadHistoryFirstPage(...) and _loadMoreHistory(...), mapping both scheduled and instant consultations into _ConsultationItem model; new _buildInstantHistoryCard widget added for instant consultation rendering; avatar resolution updated to include ui-avatars fallback.
Member Detail Screens
lib/features/consultation/screens/members/member_consultation_detail_screen.dart, lib/features/consultation/screens/experts/expert_consultation_detail_screen.dart
Avatar rendering refactored in both screens to accept displayName parameter and generate fallback URL via ui-avatars service when primary avatarUrl is missing, then load via NetworkImage(resolvedUrl).
Expert History & Consultation UI
lib/features/consultation/screens/experts/expert_home_screen.dart
New _ExpertHistoryEntry wrapper model and history loading infrastructure (_loadHistory, _mapHistoryEntries) introduced for paginated/infinite-scroll expert consultation history fetching; history tab rendering updated to display both scheduled consultations and new _buildInstantHistoryCard for instant consultations; _buildPatientAvatar refactored to compute and use ui-avatars fallback URL; navigation extras now include patientAvatarUrl.

Sequence Diagram(s)

sequenceDiagram
    participant Member
    participant ConsultationHomeScreen
    participant ConsultationRepository
    participant Backend as Backend API
    participant Member as Paging/Sorting

    Member->>ConsultationHomeScreen: Load history (page 1)
    ConsultationHomeScreen->>ConsultationRepository: getMyConsultationHistory(pageNumber=1)
    ConsultationRepository->>Backend: GET /api/users/me/consultations?pageNumber=1&pageSize=10
    Backend-->>ConsultationRepository: PagedHistoryResponse with union items
    ConsultationRepository-->>ConsultationHomeScreen: PagedHistoryResponse<MemberConsultationHistoryUnion>
    ConsultationHomeScreen->>ConsultationHomeScreen: _mapHistoryItems() - convert to _ConsultationItem
    ConsultationHomeScreen->>Member: Display scheduled + instant history cards
    
    Member->>ConsultationHomeScreen: Scroll to end (load more)
    ConsultationHomeScreen->>ConsultationRepository: getMyConsultationHistory(pageNumber=2)
    ConsultationRepository->>Backend: GET /api/users/me/consultations?pageNumber=2
    Backend-->>ConsultationRepository: Next page of union items
    ConsultationHomeScreen->>ConsultationHomeScreen: Merge & deduplicate, append to _historyItems
    ConsultationHomeScreen->>Member: Display combined history with "load more" spinner
Loading
sequenceDiagram
    participant Member
    participant ConsultationWaitingRoom as Waiting Room Screen
    participant Router
    participant VideoConsultationScreen

    Member->>Router: Navigate to /video-waiting/:consultationId
    Router->>ConsultationWaitingRoom: Pass scheduledDurationSeconds (default 1800)
    ConsultationWaitingRoom->>ConsultationWaitingRoom: Display schedule time range<br/>using scheduledDurationSeconds
    
    Member->>ConsultationWaitingRoom: Join consultation
    ConsultationWaitingRoom->>Router: Navigate to /video-consultation/:consultationId<br/>extra: {scheduledStartAtMs, scheduledDurationSeconds, ...}
    Router->>VideoConsultationScreen: Pass scheduling context + canReportExpertAbsent
    VideoConsultationScreen->>VideoConsultationScreen: Initialize with scheduling context
    
    Member->>VideoConsultationScreen: End call
    VideoConsultationScreen->>Router: Navigate back to waiting room<br/>extra: {scheduledStartAtMs, scheduledDurationSeconds, canReportExpertAbsent}
    Router-->>Member: Return to waiting room with context preserved
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes (Documentation removal)

🎯 4 (Complex) | ⏱️ ~60 minutes (Consultation history, instant consultations, and avatar rendering infrastructure)

Poem

🐰 A rabbit hops with histories new,
Instant calls and scheduled ones too!
Avatar fallbacks bloom like spring clover,
Pagination springs forth, the consultation's over! 🌿✨


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

@phananhkhoa181
phananhkhoa181 merged commit 032f096 into dev May 5, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant