Mentorship: session booking + ICS emails (Phase 6.4)

Đang mở
#11 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
csharp, postgresql

Hướng nghiên cứu

Trước tiên, hãy xem lại phần triển khai trong #9 và #10, sau đó tuân theo các mẫu IEndpointModule.MapEndpoints hiện có và test harness trong tests/CommunityPro.Tests/Members/MembersTestHarness.cs. Triển khai ba session endpoint và hành vi đặt lịch/email được mô tả ở đây, kèm theo các test bao quát cả hai lần chuyển đổi DST, các khoảng chồng lấn giữa các quan hệ mentoring, việc đặt lịch đồng thời và nội dung ICS được kiểm tra.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

mentorship

Scope

Book sessions against mentor availability, with calendar-attachment emails.

Data model

public sealed class Session
{
    public Guid Id { get; set; }
    public Guid MentorshipId { get; set; }
    public DateTimeOffset StartUtc { get; set; }  // stored UTC, always
    public int DurationMinutes { get; set; }      // 30 | 60
    public SessionStatus Status { get; set; }     // Scheduled | Completed | Cancelled
    public string? MeetingUrl { get; set; }       // mentor-provided free text (Meet/Zoom)
}

Endpoints (participants of the mentorship only)

Method Path Notes
GET /mentorship/{id}/slots?weekOf= open slots: availability minus existing sessions, computed in the mentor's IANA tz via NodaTime, returned as UTC instants
POST /mentorship/{id}/sessions book; validations below
POST /mentorship/sessions/{id}/cancel either participant, only while Scheduled

Booking validations

  1. Slot falls entirely inside the mentor's availability (evaluated in mentor-local time — DST-correct via NodaTime).
  2. No overlap with any of the mentor's existing Scheduled sessions (across all their mentorships).
  3. Start ≥ 12h in the future.
  4. Duration ∈ {30, 60}; mentorship is Active.

Emails

Booked/cancelled → both parties via Brevo, with an .ics attachment generated via Ical.Net (UTC times, summary, meeting URL when present). Best-effort as always.

Error codes

mentorship.not_found, mentorship.slot_unavailable, mentorship.slot_conflict, mentorship.too_soon, mentorship.invalid_state, mentorship.forbidden

Dependencies

Blocked by #9 and #10.

Acceptance criteria

  • DST boundary tests are mandatory: a slot spanning a DST transition in e.g. Europe/London or America/New_York books correctly; test both spring-forward and fall-back weeks
  • Overlap check covers sessions from the mentor's other mentorships
  • Concurrent booking of the same slot → exactly one succeeds
  • ICS content asserted in tests (times, attendees)
Conventions (project-wide, non-negotiable)
  • .NET 9, records for immutable shapes, file-scoped namespaces, primary constructors where they read well. Minimal-API endpoints grouped per module via IEndpointModule.MapEndpoints.
  • Result<T> (SharedKernel) instead of exception-driven control flow. Endpoint results map failures to ProblemDetails with the stable error codes listed above — the frontend keys off them.
  • Module owns its EF Core DbContext mapped to its own Postgres schema. Modules never reference each other's internals — cross-module needs go through a public contract interface or an in-process domain event (IEventPublisher).
  • All external calls (GitHub, Stripe, Brevo, Cloudinary, Meilisearch) behind interfaces owned by the consuming module.
  • Every list endpoint paginated (offset is fine). xUnit tests in tests/CommunityPro.Tests/<Module>/ following the existing harness patterns (see Members/MembersTestHarness.cs).
Ngôn ngữ chính
C#
Star
0
Fork
0
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

  • Có Dockerfile hoặc tệp Docker Compose
  • Không có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của CommunityPro/community-pro-api

Tất cả issue của CommunityPro/community-pro-api

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.