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
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ public sealed class CanonicalPassageDto
{
public int? Id { get; set; }
public int? MockTestSectionId { get; set; }
public int? MockTestId { get; set; }
public string? MockTestTitle { get; set; }
public string? MockTestExamKind { get; set; }
public string? SectionTitle { get; set; }
public int QuestionCount { get; set; }
public Guid? PassageIdentity { get; set; }
public string PassageCode { get; set; } = string.Empty;
public int CertificateLevelId { get; set; }
Expand Down Expand Up @@ -142,6 +147,10 @@ public sealed class CanonicalQuestionDto
{
public int? Id { get; set; }
public int? MockTestSectionId { get; set; }
public int? MockTestId { get; set; }
public string? MockTestTitle { get; set; }
public string? MockTestExamKind { get; set; }
public string? SectionTitle { get; set; }
public Guid? QuestionIdentity { get; set; }
public int Version { get; set; } = 1;
public int? ParentQuestionId { get; set; }
Expand Down
2 changes: 2 additions & 0 deletions RikiPath.Application/DTOs/SrsTemplates/SrsTemplateDtos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@ public sealed class SaveSrsCardTemplateRequest
public int? VocabularyId { get; set; }
public int? KanjiId { get; set; }
public int? GrammarPatternId { get; set; }
public bool SubmitForReview { get; set; }
}

public sealed class ReviewSrsCardTemplateRequest
{
public bool Approve { get; set; }
public bool RequestChanges { get; set; }

[MaxLength(1000)]
public string? ReviewNote { get; set; }
Expand Down
46 changes: 4 additions & 42 deletions RikiPath.Application/Helpers/NotificationSemanticResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ private sealed class LiveEntitySnapshot
public Dictionary<int, (string Status, string PaymentStatus)> CourseStates { get; } = [];
public Dictionary<int, MentorVerificationStatus> MentorVerifications { get; } = [];
public Dictionary<int, (string Status, bool MentorResponded, bool IsPaymentCategory)> ComplaintStates { get; } = [];
public Dictionary<int, string> TransferStatuses { get; } = [];
public Dictionary<int, (string Status, string Kind)> CohortScheduleStatuses { get; } = [];
public Dictionary<int, string> CohortMentorInvitationStatuses { get; } = [];
public Dictionary<int, int> PendingCourseScheduleRequestsByCourse { get; } = [];
Expand All @@ -73,7 +72,6 @@ private sealed class LiveEntitySnapshot
"CohortComplaintInformationRequested",
"CohortComplaintMentorRequested",
"LearningFeedbackPending",
"CohortTransfer",
"CohortScheduleRequest",
"CohortMentorInvitation",
"CohortMentorChange",
Expand Down Expand Up @@ -642,37 +640,13 @@ private static SemanticResolution ResolveCore(
return new SemanticResolution(CategoryInfo, false, null);
}

// 9. Cohort Transfer & Roster
// Legacy transfer notifications remain visible as historical, non-actionable records.
if (string.Equals(type, "CohortTransfer", StringComparison.OrdinalIgnoreCase))
{
var transferId = ExtractQueryInt(link, "transferRequestId");
if (linkLower.StartsWith("/admin/", StringComparison.Ordinal) && transferId.HasValue)
{
if (snapshot is not null)
{
if (!snapshot.TransferStatuses.TryGetValue(transferId.Value, out var status))
{
return new SemanticResolution(
CategoryNeutral, false, ActionUnavailable,
"CohortTransfer", transferId.Value, "NotFound", "Không còn khả dụng", false);
}

return string.Equals(status, CohortTransferRequest.Pending, StringComparison.Ordinal)
? new SemanticResolution(
CategoryWarning, true, ActionPending,
"CohortTransfer", transferId.Value, status, "Chờ duyệt", true)
: new SemanticResolution(
CategoryNeutral, false, ActionResolved,
"CohortTransfer", transferId.Value, status, "Đã xử lý", true);
}

return new SemanticResolution(CategoryWarning, true, ActionPending, "CohortTransfer", transferId.Value, CohortTransferRequest.Pending, "Chờ duyệt", true);
}
if (titleLower.Contains("từ chối", StringComparison.Ordinal) || msgLower.Contains("chưa được chấp thuận", StringComparison.Ordinal))
return new SemanticResolution(CategoryDanger, false, null);
if (titleLower.Contains("được chuyển", StringComparison.Ordinal) || titleLower.Contains("phê duyệt", StringComparison.Ordinal) || titleLower.Contains("thành công", StringComparison.Ordinal))
return new SemanticResolution(CategorySuccess, false, null);
return new SemanticResolution(CategoryInfo, false, null);
return new SemanticResolution(
CategoryNeutral, false, ActionUnavailable,
"CohortTransfer", transferId, "Retired", "Không còn khả dụng", false);
}

if (string.Equals(type, "CohortRoster", StringComparison.OrdinalIgnoreCase)
Expand Down Expand Up @@ -1064,7 +1038,6 @@ private static async Task<LiveEntitySnapshot> LoadLiveSnapshotAsync(
var mentorIds = new HashSet<int>();
var complaintIds = new HashSet<int>();
var feedbackIds = new HashSet<int>();
var transferIds = new HashSet<int>();
var cohortScheduleIds = new HashSet<int>();
var cohortMentorInvitationIds = new HashSet<int>();
var homeworkAssignmentIds = new HashSet<int>();
Expand All @@ -1090,7 +1063,6 @@ private static async Task<LiveEntitySnapshot> LoadLiveSnapshotAsync(
TryAdd(proposalIds, ExtractQueryInt(link, "proposalId"));
TryAdd(complaintIds, ExtractQueryInt(link, "complaintId"));
if (type == "LearningFeedbackPending") TryAdd(feedbackIds, ExtractQueryInt(link, "feedbackId"));
TryAdd(transferIds, ExtractQueryInt(link, "transferRequestId"));
TryAdd(cohortScheduleIds, ExtractQueryInt(link, "cohortScheduleRequestId"));
if (string.Equals(type, "CohortMentorInvitation", StringComparison.OrdinalIgnoreCase)
|| string.Equals(type, "CohortMentorChange", StringComparison.OrdinalIgnoreCase))
Expand Down Expand Up @@ -1259,16 +1231,6 @@ private static async Task<LiveEntitySnapshot> LoadLiveSnapshotAsync(
snapshot.ComplaintStates[r.Id] = (r.Status, r.MentorResponded, r.IsPaymentCategory);
}

if (transferIds.Count > 0)
{
var rows = await unitOfWork.CohortTransferRequests.Query().AsNoTracking()
.Where(t => transferIds.Contains(t.Id))
.Select(t => new { t.Id, t.Status })
.ToListAsync(ct);
foreach (var r in rows)
snapshot.TransferStatuses[r.Id] = r.Status;
}

if (cohortScheduleIds.Count > 0)
{
var rows = await unitOfWork.CohortScheduleRequests.Query().AsNoTracking()
Expand Down
16 changes: 16 additions & 0 deletions RikiPath.Application/IServices/IClassQuizService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using RikiPath.Application.Responses;
using RikiPath.Application.Responses.ClassQuizzes;

namespace RikiPath.Application.IServices;

/// <summary>In-class skill quizzes (Stage 5): Mentor builds and publishes, Learner takes them on the assessment engine.</summary>
public interface IClassQuizService
{
Task<ApiResponse<QuizBankDto>> GetBankAsync(int cohortId, CancellationToken cancellationToken = default);
Task<ApiResponse<MentorQuizDetailDto>> CreateAsync(int cohortId, CreateClassQuizRequest request, CancellationToken cancellationToken = default);
Task<ApiResponse<List<MentorQuizListItemDto>>> GetMentorQuizzesAsync(int? cohortId, CancellationToken cancellationToken = default);
Task<ApiResponse<MentorQuizDetailDto>> GetMentorQuizDetailAsync(int quizId, CancellationToken cancellationToken = default);
Task<ApiResponse<QuizResultDto>> GetMentorLearnerResultAsync(int assignmentId, CancellationToken cancellationToken = default);
Task<ApiResponse<List<LearnerQuizCardDto>>> GetLearnerQuizzesAsync(int? cohortId, CancellationToken cancellationToken = default);
Task<ApiResponse<QuizResultDto>> GetLearnerResultAsync(int assignmentId, CancellationToken cancellationToken = default);
}
3 changes: 3 additions & 0 deletions RikiPath.Application/IServices/IContentModerationV2Service.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,7 @@ Task<ApiResponse<ModerationDetailDto>> ModerateAsync(

Task<ApiResponse> UnpublishAsync(
UnpublishContentRequest request, int adminUserId, CancellationToken ct);

Task<ApiResponse> RepublishAsync(
UnpublishContentRequest request, int adminUserId, string adminName, CancellationToken ct);
}
2 changes: 2 additions & 0 deletions RikiPath.Application/IServices/IExamBuilderService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ Task<ApiResponse<PagedResult<ExamBuilderDto>>> ListAuthorExamsAsync(

Task<ApiResponse<ExamBuilderDto>> SaveDraftAsync(ExamBuilderDto request, int actorUserId, CancellationToken ct);

Task<ApiResponse<ExamBuilderDto>> SaveAndSubmitAsync(ExamBuilderDto request, int actorUserId, CancellationToken ct);

Task<ApiResponse<ExamBuilderDto>> CreateNewVersionAsync(int sourceExamId, int actorUserId, CancellationToken ct);

Task<ApiResponse<ExamBlueprintValidationResponse>> ValidateExamAsync(int examId, CancellationToken ct);
Expand Down
41 changes: 41 additions & 0 deletions RikiPath.Application/IServices/IMentorKpiDashboardService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using RikiPath.Application.Responses;
using RikiPath.Application.Responses.MentorKpi;

namespace RikiPath.Application.IServices;

/// <summary>Chính sách chấm công &amp; KPI (phiên bản theo tháng, độc lập với Chính sách lớp học).</summary>
public interface IMentorKpiPolicyService
{
Task<ApiResponse<KpiPolicySnapshotResponse>> GetCurrentAsync(CancellationToken ct = default);
Task<ApiResponse<List<KpiPolicySnapshotResponse>>> GetHistoryAsync(CancellationToken ct = default);
Task<ApiResponse<KpiPolicySnapshotResponse>> PublishAsync(PublishMentorKpiPolicyRequest request, CancellationToken ct = default);
Task<ApiResponse<object>> DeleteAsync(int id, CancellationToken ct = default);
}

/// <summary>
/// Một nguồn tính duy nhất cho Chấm công &amp; KPI Giáo viên: Mentor (cá nhân), Admin (chi tiết từng Giáo viên) và
/// tổng quan toàn trung tâm đều dùng cùng bộ tính toán.
/// </summary>
public interface IMentorKpiDashboardService
{
Task<ApiResponse<MentorKpiDashboardResponse>> GetMyDashboardAsync(string? month, string? level, int? cohortId, CancellationToken ct = default);
Task<ApiResponse<MentorKpiDashboardResponse>> GetMentorDashboardAsync(int mentorId, string? month, string? level, int? cohortId, CancellationToken ct = default);
Task<ApiResponse<KpiOverviewResponse>> GetOverviewAsync(string? month, string? level, CancellationToken ct = default);
Task<ApiResponse<TimesheetRowResponse>> ReconcileAsync(int mentorId, int sessionId, ReconcileTimesheetRequest request, CancellationToken ct = default);
}

public sealed record PublishMentorKpiPolicyRequest(
int ExpectedLatestVersion,
string EffectiveFromMonth,
decimal MinimumPresencePercent,
decimal TeachingCompletionTargetPercent,
int HomeworkMinimumCount,
int HomeworkPerSessionCount,
decimal GradingCompletionTargetPercent,
int ResponseSlaHours,
decimal OnTimeResponseTargetPercent,
decimal AverageRatingTarget,
decimal PositiveReviewTargetPercent,
string? Note);

public sealed record ReconcileTimesheetRequest(string Status, int? ConfirmedMinutes, string Reason, string? Evidence);
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ public interface IMentorLearnerSkillProfileService
{
Task<ApiResponse<MentorLearnerSkillProfileResponse>> GetSkillProfileAsync(
int learnerId, int? cohortId = null, CancellationToken cancellationToken = default);

/// <summary>The signed-in Learner's own competency profile for one class enrollment (same data and rules as the Mentor view).</summary>
Task<ApiResponse<MentorLearnerSkillProfileResponse>> GetLearnerCourseCompetencyAsync(
int enrollmentId, CancellationToken cancellationToken = default);
}
12 changes: 12 additions & 0 deletions RikiPath.Application/IServices/IPracticeTestService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ Task<ApiResponse<PlacementTestResultResponse>> SubmitPlacementTestAsync(
Task<ApiResponse<PlacementTestResultResponse>> GetPlacementTestResultAsync(
int attemptId, CancellationToken cancellationToken = default);

/// <summary>Starts or resumes the learner's attempt for one assigned in-class quiz.</summary>
Task<ApiResponse<PlacementAttemptSnapshotResponse>> StartClassQuizAsync(int assignmentId, CancellationToken cancellationToken = default);

/// <summary>Server-side completion of quiz attempts whose time is over, from answers saved before the deadline.</summary>
Task FinalizeExpiredClassQuizAttemptsAsync(IReadOnlyCollection<int> attemptIds, CancellationToken cancellationToken = default);

/// <summary>End-of-course assessment state for one of the learner's class enrollments.</summary>
Task<ApiResponse<CourseFinalAssessmentStatusResponse>> GetCourseFinalAssessmentAsync(int enrollmentId, CancellationToken cancellationToken = default);

/// <summary>Starts (or resumes) the end-of-course assessment; answers/submit/result reuse the Placement attempt endpoints.</summary>
Task<ApiResponse<PlacementAttemptSnapshotResponse>> StartCourseFinalAssessmentAsync(int enrollmentId, CancellationToken cancellationToken = default);

Task<ApiResponse<StartAttemptResponse>> StartAttemptAsync(int practiceTestId, CancellationToken cancellationToken = default);

Task<ApiResponse<AttemptResultResponse>> SubmitAttemptAsync(int attemptId, SubmitAttemptRequest request, CancellationToken cancellationToken = default);
Expand Down
5 changes: 5 additions & 0 deletions RikiPath.Application/IServices/ISharedBankSearchService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,10 @@ Task<ApiResponse<PagedResult<QuestionBankCardResponse>>> SearchQuestionsAsync(
QuestionBankSearchFilter filter, CancellationToken cancellationToken);

Task<ApiResponse<QuestionBankCardResponse>> GetQuestionDetailAsync(int id, CancellationToken cancellationToken);

Task<ApiResponse<PagedResult<LessonCardResponse>>> SearchLessonsAsync(
LessonSearchFilter filter, CancellationToken cancellationToken);

Task<ApiResponse<LessonCardResponse>> GetLessonDetailAsync(int id, CancellationToken cancellationToken);
}
}
10 changes: 1 addition & 9 deletions RikiPath.Application/IServices/IStudyCourseService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,6 @@ public interface IStudyCourseService
Task<ApiResponse<object>> ReviewRetakeAsync(int id, int requestId, ReviewCourseRetake request, CancellationToken ct);
Task<ApiResponse<object>> SaveRetakeSupportPlanAsync(int id, int requestId, SaveRetakeSupportPlan request, CancellationToken ct);
Task<PrivateVerificationReadResult?> EvidenceAsync(int id, int requestId, CancellationToken ct);
// Chuyển lớp có kiểm soát (Học viên yêu cầu, Admin duyệt).
Task<ApiResponse<object>> RequestTransferAsync(int courseId, int? targetCohortId, string? reason, Guid idempotencyKey, IFormFile? evidence, CancellationToken ct);
Task<ApiResponse<object>> TransferRequestsAsync(string? status, CancellationToken ct);
Task<ApiResponse<object>> TransferRequestDetailAsync(int requestId, CancellationToken ct);
Task<ApiResponse<object>> TransferEligibilityAsync(int requestId, int targetCohortId, CancellationToken ct);
Task<ApiResponse<object>> ApproveTransferAsync(int requestId, ApproveCohortTransfer request, CancellationToken ct);
Task<ApiResponse<object>> RejectTransferAsync(int requestId, RejectCohortTransfer request, CancellationToken ct);
Task<ApiResponse<object>> WithdrawTransferAsync(int requestId, CancellationToken ct);
Task<PrivateVerificationReadResult?> TransferEvidenceAsync(int requestId, CancellationToken ct);
// Admin thay cố vấn chính cho phần còn lại của lớp.
Task<ApiResponse<object>> PreviewMentorReplacementAsync(int cohortId, int mentorId, int? fromSessionNumber, CancellationToken ct);
Task<ApiResponse<object>> ReplaceCohortMentorAsync(int cohortId, ReplaceCohortMentorRequest request, CancellationToken ct);
Expand All @@ -79,6 +70,7 @@ public interface IStudyCourseService
Task<ApiResponse<object>> CreateCohortMentorReviewAsync(int courseId, CreateCohortMentorReviewRequest request, CancellationToken ct);
Task<ApiResponse<object>> UpdateCohortMentorReviewAsync(int courseId, int reviewId, UpdateCohortMentorReviewRequest request, CancellationToken ct);
Task<ApiResponse<object>> CohortMentorReviewsAsync(int courseId, CancellationToken ct);
Task<ApiResponse<object>> MentorReviewPromptsAsync(CancellationToken ct);
Task<ApiResponse<object>> CohortClassMentorReviewsAsync(int cohortId, CancellationToken ct);
Task<ApiResponse<object>> MentorCohortReviewSummaryAsync(int mentorId, CancellationToken ct);
Task<ApiResponse<object>> CreateCohortComplaintAsync(int courseId, string? category, string? message, int? mentorId, bool refundReviewRequested, Guid idempotencyKey, IFormFile? evidence, string? title, int? courseSessionId, CancellationToken ct);
Expand Down
4 changes: 3 additions & 1 deletion RikiPath.Application/IServices/IUnifiedImportService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public sealed class ConfirmUnifiedImportRequest
public string SourceFileName { get; set; } = string.Empty;
public string SourceFormat { get; set; } = "Excel"; // Excel | Json | Zip | Pdf
public string? IdempotencyKey { get; set; }
public bool SubmitForReview { get; set; }
public UnifiedImportExamPreviewDto? ExamBlueprint { get; set; }
public List<UnifiedImportRowPreviewDto> Rows { get; set; } = [];
}
Expand Down Expand Up @@ -137,5 +138,6 @@ Task<ApiResponse<ConfirmUnifiedImportResponse>> ConfirmFromArchiveAsync(
UnifiedImportKind expectedKind,
string? idempotencyKey,
int actorUserId,
CancellationToken ct);
CancellationToken ct,
bool submitForReview = false);
}
2 changes: 2 additions & 0 deletions RikiPath.Application/IUnitOfWork.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ public interface IUnitOfWork
IStudyCourseRepository StudyCourses { get; }
IGenericRepository<StudyCoursePlan> StudyCoursePlans { get; }
IGenericRepository<StudyCohort> StudyCohorts { get; }
IGenericRepository<ClassQuiz> ClassQuizzes { get; }
IGenericRepository<ClassQuizAssignment> ClassQuizAssignments { get; }
IGenericRepository<CohortEnrollmentEntitlement> CohortEnrollmentEntitlements { get; }
IGenericRepository<CourseScheduleRequest> CourseScheduleRequests { get; }
IGenericRepository<CohortTransferRequest> CohortTransferRequests { get; }
Expand Down
1 change: 1 addition & 0 deletions RikiPath.Application/Requests/Content/BulkReviewRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class BulkReviewItem
{
public int RequestId { get; set; }
public bool Approve { get; set; }
public bool RequestChanges { get; set; }
public string? ReviewNote { get; set; } // riêng cho request này
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ public class ConfirmImportRequest
{
public string? SourceFileName { get; set; }
public Guid? BatchId { get; set; }
public bool SubmitForReview { get; set; }
public List<ConfirmImportRowRequest> Rows { get; set; } = new();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ namespace RikiPath.Application.Requests.Content
public class ReviewContentRequest
{
public bool Approve { get; set; }
public bool RequestChanges { get; set; }
public string? ReviewNote { get; set; }
}
}
Loading
Loading