diff --git a/RikiPath.Application/IServices/IContentApprovalService.cs b/RikiPath.Application/IServices/IContentApprovalService.cs index 19c36ba..da11000 100644 --- a/RikiPath.Application/IServices/IContentApprovalService.cs +++ b/RikiPath.Application/IServices/IContentApprovalService.cs @@ -1,4 +1,5 @@ using Microsoft.AspNetCore.Http; +using RikiPath.Application.Common; using RikiPath.Application.Requests.Content; using RikiPath.Application.Responses; using RikiPath.Application.Responses.Content; @@ -23,8 +24,8 @@ Task> SubmitImportRequestsAsync( /// /// Lấy danh sách các yêu cầu đang chờ duyệt (Pending Review). /// - Task>> GetPendingApprovalsAsync( - ImportEntityType? entityType, CancellationToken cancellationToken = default); + Task>> GetPendingApprovalsAsync( + ImportEntityType? entityType, int page, int pageSize, CancellationToken cancellationToken = default); /// /// Duyệt hoặc từ chối một yêu cầu duyệt nội dung cụ thể. diff --git a/RikiPath.Application/IServices/IContentAudioTranscriptionService.cs b/RikiPath.Application/IServices/IContentAudioTranscriptionService.cs index ad7b41b..57ca443 100644 --- a/RikiPath.Application/IServices/IContentAudioTranscriptionService.cs +++ b/RikiPath.Application/IServices/IContentAudioTranscriptionService.cs @@ -10,6 +10,7 @@ Task UploadAsync( Stream audio, string fileName, int authorId, CancellationToken ct); Task QueueAsync(string audioUrl, int? authorId, CancellationToken ct); Task QueuePayloadAsync(JsonElement payload, int authorId, CancellationToken ct); + Task QueuePayloadsAsync(IReadOnlyList payloadJsons, int authorId, CancellationToken ct); Task GetAsync(string audioUrl, CancellationToken ct); Task> ListMineAsync(int authorId, CancellationToken ct); Task> RetryAsync(string audioUrl, CancellationToken ct); diff --git a/RikiPath.Application/Responses/Content/ImportConfirmResponse.cs b/RikiPath.Application/Responses/Content/ImportConfirmResponse.cs index 7a844b7..8553849 100644 --- a/RikiPath.Application/Responses/Content/ImportConfirmResponse.cs +++ b/RikiPath.Application/Responses/Content/ImportConfirmResponse.cs @@ -3,9 +3,10 @@ namespace RikiPath.Application.Responses.Content public class ImportConfirmResponse { public Guid BatchId { get; set; } + /// Tổng số bản nháp đã lưu trong BatchId này, kể cả các phần gửi trước. public int DraftsCreatedCount { get; set; } - /// Số dòng server phòng thủ bỏ qua (Action không phải New/Modified, hoặc thiếu PayloadJson) - lẽ ra FE đã lọc trước khi gửi. + /// Số dòng bị bỏ qua trong request hiện tại, gồm cả các dòng đã lưu trước đó. public int SkippedCount { get; set; } } } diff --git a/RikiPath.Application/Services/ContentApprovalService.cs b/RikiPath.Application/Services/ContentApprovalService.cs index 1fb3d8d..e586498 100644 --- a/RikiPath.Application/Services/ContentApprovalService.cs +++ b/RikiPath.Application/Services/ContentApprovalService.cs @@ -4,6 +4,7 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using RikiPath.Application.Handlers; +using RikiPath.Application.Common; using RikiPath.Application.IClients; using RikiPath.Application.IServices; using RikiPath.Application.Requests.Content; @@ -87,21 +88,29 @@ public Task> SubmitImportRequestsAsync( System.Net.HttpStatusCode.Gone)); } - public async Task>> GetPendingApprovalsAsync( - ImportEntityType? entityType, CancellationToken cancellationToken) + public async Task>> GetPendingApprovalsAsync( + ImportEntityType? entityType, int page, int pageSize, CancellationToken cancellationToken) { try { - var query = unitOfWork.ContentApprovalRequests.Query() + page = Math.Max(1, page); + pageSize = Math.Clamp(pageSize, 1, 100); + var query = unitOfWork.ContentApprovalRequests.Query().AsNoTracking() .Include(r => r.SubmittedBy) .Where(r => !r.IsDeleted && r.Status == ContentApprovalStatus.PendingReview); if (entityType.HasValue) query = query.Where(r => r.EntityType == entityType.Value); - var requests = await query.OrderByDescending(r => r.SubmittedAt).ToListAsync(cancellationToken); + var total = await query.CountAsync(cancellationToken); + var offset = (int)Math.Min((long)(page - 1) * pageSize, int.MaxValue); + var requests = await query.OrderByDescending(r => r.SubmittedAt).ThenByDescending(r => r.Id) + .Skip(offset).Take(pageSize).ToListAsync(cancellationToken); if (requests.Count == 0) - return ApiResponse>.Success([]); + return ApiResponse>.Success(new() + { + Page = page, PageSize = pageSize, TotalCount = total, + }); var builderDict = diffBuilders.ToDictionary(b => b.EntityType); var responseList = new List(); @@ -145,11 +154,17 @@ public async Task>> GetPendingAppr await AttachLessonRelatedContentAsync(requests, responseList, cancellationToken); await AttachMockTestPassagesAsync(requests, responseList, cancellationToken); - return ApiResponse>.Success(responseList); + var requestOrder = requests.Select((request, index) => (request.Id, index)) + .ToDictionary(pair => pair.Id, pair => pair.index); + return ApiResponse>.Success(new() + { + Page = page, PageSize = pageSize, TotalCount = total, + Items = responseList.OrderBy(item => requestOrder[item.RequestId]).ToList(), + }); } catch (Exception ex) { - return ApiResponse>.Fail($"Không thể lấy danh sách chờ duyệt: {ex.Message}"); + return ApiResponse>.Fail($"Không thể lấy danh sách chờ duyệt: {ex.Message}"); } } @@ -270,9 +285,14 @@ private async Task AttachLessonRelatedContentAsync( if (lessons.Count == 0) return; var lessonKeys = lessons.Values.Select(p => LessonKey(p.Title, p.CertificateLevelCode)).ToHashSet(StringComparer.OrdinalIgnoreCase); - var relatedRequests = await unitOfWork.ContentApprovalRequests.Query() - .Where(r => !r.IsDeleted && (r.Status == ContentApprovalStatus.Approved - || r.Status == ContentApprovalStatus.PendingReview) + var batchIds = requests.Where(r => r.EntityType == ImportEntityType.Lesson) + .Select(r => r.BatchId).Where(id => id != Guid.Empty).Distinct().ToArray(); + var manualAuthorIds = requests.Where(r => r.EntityType == ImportEntityType.Lesson && r.BatchId == Guid.Empty) + .Select(r => r.SubmittedByUserId).Distinct().ToArray(); + var relatedRequests = await unitOfWork.ContentApprovalRequests.Query().AsNoTracking() + .Where(r => !r.IsDeleted && (batchIds.Contains(r.BatchId) || + (r.BatchId == Guid.Empty && manualAuthorIds.Contains(r.SubmittedByUserId))) + && (r.Status == ContentApprovalStatus.Approved || r.Status == ContentApprovalStatus.PendingReview) && (r.EntityType == ImportEntityType.Kanji || r.EntityType == ImportEntityType.Grammar || r.EntityType == ImportEntityType.Vocabulary || r.EntityType == ImportEntityType.PracticeExercise)) .ToListAsync(cancellationToken); @@ -336,12 +356,28 @@ private async Task AttachLessonRelatedContentAsync( }).ToList(); } - var dbLessons = await unitOfWork.Lessons.Query() - .Include(l => l.CertificateLevel) + var lessonIds = requests.Where(r => r.EntityType == ImportEntityType.Lesson && r.TargetEntityId.HasValue) + .Select(r => r.TargetEntityId!.Value).Distinct().ToArray(); + var lessonTitles = lessons.Values.Select(lesson => lesson.Title).Distinct().ToArray(); + var levelIds = lessons.Values.Select(lesson => lesson.CertificateLevelId).Distinct().ToArray(); + var dbLessons = await unitOfWork.Lessons.Query().AsNoTracking() .Include(l => l.LessonKanjis!).ThenInclude(x => x.Kanji) .Include(l => l.LessonGrammars!).ThenInclude(x => x.GrammarPattern) .Include(l => l.LessonVocabularies!).ThenInclude(x => x.Vocabulary) - .Where(l => !l.IsDeleted) + .Where(l => !l.IsDeleted && (lessonIds.Contains(l.Id) || + (lessonTitles.Contains(l.Title) && levelIds.Contains(l.CertificateLevelId)))) + .AsSplitQuery() + .ToListAsync(cancellationToken); + + var dbLessonIds = dbLessons.Select(lesson => lesson.Id).ToArray(); + var exercises = await unitOfWork.PracticeExercises.Query().AsNoTracking() + .Where(exercise => !exercise.IsDeleted && exercise.LessonId.HasValue && + dbLessonIds.Contains(exercise.LessonId.Value)) + .Select(exercise => new + { + exercise.LessonId, exercise.Title, exercise.Description, + QuestionCount = exercise.Questions!.Count(question => !question.IsDeleted) + }) .ToListAsync(cancellationToken); foreach (var response in responses.Where(x => x.EntityType == ImportEntityType.Lesson)) @@ -354,11 +390,7 @@ private async Task AttachLessonRelatedContentAsync( AddDbRelated(response, "Kanji", dbLesson.LessonKanjis?.Where(x => x.Kanji is { IsDeleted: false }).Select(x => (x.Kanji.Character, x.Kanji.Meaning))); AddDbRelated(response, "Grammar", dbLesson.LessonGrammars?.Where(x => x.GrammarPattern is { IsDeleted: false }).Select(x => (x.GrammarPattern.Title, x.GrammarPattern.Structure))); AddDbRelated(response, "Vocabulary", dbLesson.LessonVocabularies?.Where(x => x.Vocabulary is { IsDeleted: false }).Select(x => ($"{x.Vocabulary.Word} ({x.Vocabulary.Reading})", x.Vocabulary.Meaning))); - var exercises = await unitOfWork.PracticeExercises.Query() - .Include(x => x.Questions!).ThenInclude(x => x.Options) - .Where(x => !x.IsDeleted && x.LessonId == dbLesson.Id) - .ToListAsync(cancellationToken); - foreach (var exercise in exercises) + foreach (var exercise in exercises.Where(item => item.LessonId == dbLesson.Id)) response.RelatedLessonContent.Add(new PendingLessonContentResponse { EntityType = "PracticeExercise", @@ -366,7 +398,7 @@ private async Task AttachLessonRelatedContentAsync( Status = "Approved", RowKey = exercise.Title, Fields = [new ApprovalFieldDiffResponse { Field = "description", Label = "Mô tả", NewValue = exercise.Description }, - new ApprovalFieldDiffResponse { Field = "questions", Label = "Số câu hỏi", NewValue = (exercise.Questions?.Count(q => !q.IsDeleted) ?? 0).ToString() }] + new ApprovalFieldDiffResponse { Field = "questions", Label = "Số câu hỏi", NewValue = exercise.QuestionCount.ToString() }] }); } } diff --git a/RikiPath.Application/Services/ExcelContentImportService.cs b/RikiPath.Application/Services/ExcelContentImportService.cs index 31e89a4..47c964c 100644 --- a/RikiPath.Application/Services/ExcelContentImportService.cs +++ b/RikiPath.Application/Services/ExcelContentImportService.cs @@ -181,21 +181,13 @@ private async Task> SaveDraftsAsync(ConfirmIm var existingBatch = await unitOfWork.ContentApprovalRequests.Query() .Where(item => !item.IsDeleted && item.BatchId == batchId) - .GroupBy(item => item.SubmittedByUserId) - .Select(group => new { AuthorId = group.Key, Count = group.Count() }) + .GroupBy(item => new { item.SubmittedByUserId, item.SourceFileName }) + .Select(group => new { AuthorId = group.Key.SubmittedByUserId, FileName = group.Key.SourceFileName, + Count = group.Count() }) .ToListAsync(cancellationToken); - if (existingBatch.Count != 0) - { - var existing = existingBatch.SingleOrDefault(item => item.AuthorId == actorUserId); - if (existing is null) - return ApiResponse.Fail("Mã lô import đã được sử dụng."); - return ApiResponse.Success(new ImportConfirmResponse - { - BatchId = batchId, - DraftsCreatedCount = existing.Count, - SkippedCount = Math.Max(0, request.Rows.Count - existing.Count), - }); - } + if (existingBatch.Any(item => item.AuthorId != actorUserId || item.FileName != sourceFileName)) + return ApiResponse.Fail("Mã lô import đã được sử dụng cho file khác."); + var existingCount = existingBatch.Sum(item => item.Count); var now = DateTime.UtcNow; var drafts = new List(); @@ -203,19 +195,34 @@ private async Task> SaveDraftsAsync(ConfirmIm var openRows = await unitOfWork.ContentApprovalRequests.Query() .Where(item => !item.IsDeleted && item.SubmittedByUserId == actorUserId && types.Contains(item.EntityType) && (item.Status == ContentApprovalStatus.Draft || item.Status == ContentApprovalStatus.PendingReview)) - .Select(item => new { item.EntityType, item.RowKey, item.PayloadJson, item.TargetEntityId }).ToListAsync(cancellationToken); + .Select(item => new { item.EntityType, item.RowKey, + PayloadJson = item.EntityType == ImportEntityType.PracticeExercise ? item.PayloadJson : null, + item.TargetEntityId }).ToListAsync(cancellationToken); var seen = openRows.Select(item => (item.EntityType, item.RowKey, item.EntityType == ImportEntityType.PracticeExercise ? ManualContentService.ReadListInfo(item.PayloadJson)?.CertificateLevelId : null)) .ToHashSet(); + var savedBatchRows = existingCount == 0 + ? [] + : await unitOfWork.ContentApprovalRequests.Query().AsNoTracking() + .Where(item => !item.IsDeleted && item.BatchId == batchId) + .Select(item => new { item.EntityType, item.RowKey, + PayloadJson = item.EntityType == ImportEntityType.PracticeExercise ? item.PayloadJson : null, + item.TargetEntityId }) + .ToListAsync(cancellationToken); + seen.UnionWith(savedBatchRows.Select(item => (item.EntityType, item.RowKey, + item.EntityType == ImportEntityType.PracticeExercise ? ManualContentService.ReadListInfo(item.PayloadJson)?.CertificateLevelId : null))); var skillNames = types.Contains(ImportEntityType.MockTest) ? (await unitOfWork.LanguageSkills.GetAllAsync(cancellationToken)).ToDictionary(skill => skill.Id, skill => skill.Name) : new Dictionary(); - var levelCodes = await unitOfWork.CertificateLevels.Query() + var importLevels = await unitOfWork.CertificateLevels.Query().AsNoTracking() .Where(level => !level.IsDeleted && !level.CertificateType.IsDeleted && level.CertificateType.IsActive && level.CertificateType.Name == "JLPT") - .ToDictionaryAsync(level => level.Id, level => level.Code, cancellationToken); + .ToDictionaryAsync(level => level.Id, cancellationToken); + var levelCodes = importLevels.ToDictionary(pair => pair.Key, pair => pair.Value.Code); var seenTargets = openRows.Where(item => item.TargetEntityId.HasValue) .Select(item => (item.EntityType, item.TargetEntityId!.Value)).ToHashSet(); + seenTargets.UnionWith(savedBatchRows.Where(item => item.TargetEntityId.HasValue) + .Select(item => (item.EntityType, item.TargetEntityId!.Value))); foreach (var row in request.Rows) { @@ -224,6 +231,10 @@ private async Task> SaveDraftsAsync(ConfirmIm if (string.IsNullOrWhiteSpace(row.PayloadJson) || string.IsNullOrWhiteSpace(row.RowKey)) continue; if (row.RowKey.Length > 500 || !Enum.IsDefined(row.EntityType)) return ApiResponse.Fail($"Dòng {row.SourceRowNumber}: thông tin học liệu không hợp lệ."); + var info = ManualContentService.ReadListInfo(row.PayloadJson); + if (info?.CertificateLevelId is not int levelId || !levelCodes.TryGetValue(levelId, out _)) + return ApiResponse.Fail($"Dòng {row.SourceRowNumber}: hãy chọn cấp độ hợp lệ."); + if (!seen.Add((row.EntityType, row.RowKey, row.EntityType == ImportEntityType.PracticeExercise ? levelId : null))) continue; if (row.EntityType == ImportEntityType.MockTest) { var validationError = ValidateMockTestPayload(row.PayloadJson, skillNames, levelCodes); @@ -231,13 +242,10 @@ private async Task> SaveDraftsAsync(ConfirmIm return ApiResponse.Fail( $"Dòng {row.SourceRowNumber}: {validationError}"); } - var info = ManualContentService.ReadListInfo(row.PayloadJson); - if (info?.CertificateLevelId is not int levelId || !levelCodes.TryGetValue(levelId, out _)) - return ApiResponse.Fail($"Dòng {row.SourceRowNumber}: hãy chọn cấp độ hợp lệ."); - var payloadError = await manualContent.ValidateImportPayloadAsync(row.EntityType, row.PayloadJson, cancellationToken); + var payloadError = await manualContent.ValidateImportPayloadAsync(row.EntityType, row.PayloadJson, + cancellationToken, importLevels); if (payloadError is not null) return ApiResponse.Fail($"Dòng {row.SourceRowNumber}: {payloadError}"); - if (!seen.Add((row.EntityType, row.RowKey, row.EntityType == ImportEntityType.PracticeExercise ? levelId : null))) continue; if (row.Action == ImportRowAction.Modified) { if (row.TargetEntityId is not > 0) @@ -263,6 +271,13 @@ private async Task> SaveDraftsAsync(ConfirmIm }); } + if (drafts.Count == 0 && existingCount > 0) + return ApiResponse.Success(new ImportConfirmResponse + { + BatchId = batchId, + DraftsCreatedCount = existingCount, + SkippedCount = request.Rows.Count, + }); if (drafts.Count == 0) return ApiResponse.Fail( "Không có nội dung mới để lưu. Hãy kiểm tra các bản nháp hoặc nội dung đang chờ duyệt của bạn."); @@ -273,31 +288,32 @@ private async Task> SaveDraftsAsync(ConfirmIm var bankItems = await unitOfWork.ContentBankItems.Query() .Where(item => !item.IsDeleted && item.OwnerUserId == actorUserId && bankKeys.Contains(item.NaturalKey)) .ToListAsync(cancellationToken); + var bankByKey = bankItems.ToDictionary(item => (item.EntityType, item.NaturalKey)); + var newBankItems = new List(); foreach (var draft in drafts) { var naturalKey = ContentBankKey.From(draft.EntityType, draft.RowKey, draft.PayloadJson); - var bankItem = bankItems.SingleOrDefault(item => item.EntityType == draft.EntityType && item.NaturalKey == naturalKey); - if (bankItem is null) + if (!bankByKey.TryGetValue((draft.EntityType, naturalKey), out var bankItem)) { bankItem = new ContentBankItem { OwnerUserId = actorUserId, EntityType = draft.EntityType, NaturalKey = naturalKey }; - await unitOfWork.ContentBankItems.AddAsync(bankItem, cancellationToken); - bankItems.Add(bankItem); + newBankItems.Add(bankItem); + bankByKey.Add((draft.EntityType, naturalKey), bankItem); } bankItem.PayloadJson = draft.PayloadJson; bankItem.TargetEntityId = draft.TargetEntityId; bankItem.Status = ContentApprovalStatus.Draft; bankItem.LatestBatchId = batchId; } + await unitOfWork.ContentBankItems.AddRangeAsync(newBankItems, cancellationToken); if (audioTranscriptions is not null) - foreach (var draft in drafts) - await audioTranscriptions.QueuePayloadAsync( - JsonSerializer.Deserialize(draft.PayloadJson), actorUserId, cancellationToken); + await audioTranscriptions.QueuePayloadsAsync( + drafts.Select(draft => draft.PayloadJson).ToArray(), actorUserId, cancellationToken); await unitOfWork.SaveChangesAsync(cancellationToken); return ApiResponse.Success(new ImportConfirmResponse { BatchId = batchId, - DraftsCreatedCount = drafts.Count, + DraftsCreatedCount = existingCount + drafts.Count, SkippedCount = request.Rows.Count - drafts.Count, }); } diff --git a/RikiPath.Application/Services/ManualContentService.cs b/RikiPath.Application/Services/ManualContentService.cs index df2a11c..bde7ca3 100644 --- a/RikiPath.Application/Services/ManualContentService.cs +++ b/RikiPath.Application/Services/ManualContentService.cs @@ -465,12 +465,15 @@ private static void ValidateStoredImportPayload(ContentApprovalRequest item) .SingleOrDefaultAsync(x => x.Id == id && !x.IsDeleted && x.SubmittedByUserId == userId, ct); } - private async Task<(object Payload, string RowKey)> ValidateAsync(ImportEntityType type, JsonElement input, CancellationToken ct) + private async Task<(object Payload, string RowKey)> ValidateAsync(ImportEntityType type, JsonElement input, CancellationToken ct, + IReadOnlyDictionary? importLevels = null) { var levelId = Read(input).CertificateLevelId; - var level = await uow.CertificateLevels.Query().SingleOrDefaultAsync(x => x.Id == levelId && !x.IsDeleted - && x.CertificateType.IsActive && !x.CertificateType.IsDeleted, ct) - ?? throw new ArgumentException("Hãy chọn cấp độ hợp lệ."); + var level = importLevels is null + ? await uow.CertificateLevels.Query().SingleOrDefaultAsync(x => x.Id == levelId && !x.IsDeleted + && x.CertificateType.IsActive && !x.CertificateType.IsDeleted, ct) + : importLevels.GetValueOrDefault(levelId); + if (level is null) throw new ArgumentException("Hãy chọn cấp độ hợp lệ."); switch (type) { @@ -530,12 +533,16 @@ private static void ValidateStoredImportPayload(ContentApprovalRequest item) } } - public async Task ValidateImportPayloadAsync(ImportEntityType type, string payloadJson, CancellationToken ct) + public Task ValidateImportPayloadAsync(ImportEntityType type, string payloadJson, CancellationToken ct) + => ValidateImportPayloadAsync(type, payloadJson, ct, null); + + public async Task ValidateImportPayloadAsync(ImportEntityType type, string payloadJson, CancellationToken ct, + IReadOnlyDictionary? importLevels) { try { using var document = JsonDocument.Parse(payloadJson); - await ValidateAsync(type, document.RootElement, ct); + await ValidateAsync(type, document.RootElement, ct, importLevels); return null; } catch (Exception ex) when (ex is JsonException or ArgumentException) diff --git a/RikiPath.Application/Services/PracticeTestService.cs b/RikiPath.Application/Services/PracticeTestService.cs index 0a1c0d2..047b7a3 100644 --- a/RikiPath.Application/Services/PracticeTestService.cs +++ b/RikiPath.Application/Services/PracticeTestService.cs @@ -2430,36 +2430,55 @@ private async Task PopulatePlacementResultDetailsAsync( private async Task> GetAvailableAssessmentLevelIdsAsync(CancellationToken cancellationToken) { - var tests = await unitOfWork.MockTests.GetAllWithSectionsAndQuestionsAsync(cancellationToken); - var approvedTestIds = (await ContentAuthoring.MockContentReviewState.ApprovedExamIds(unitOfWork) - .ToListAsync(cancellationToken)).ToHashSet(); var levels = (await unitOfWork.CertificateLevels.GetAllAsync(cancellationToken)) .Where(l => !l.IsDeleted && JlptCurriculum.IsSupportedStudyLevel(NormalizeLevelCode(l.Code))) .ToList(); + // Status only needs question counts per section. Project scalar fields so EF does not + // materialize the whole MockTest (and query unrelated columns such as PublishStatus). + var approvedTestIds = ContentAuthoring.MockContentReviewState.ApprovedExamIds(unitOfWork); + var questions = await unitOfWork.MockQuestions.Query().AsNoTracking() + .Where(q => !q.IsDeleted && q.MockTestSection != null && !q.MockTestSection.IsDeleted + && !q.MockTestSection.MockTest.IsDeleted + && q.MockTestSection.MockTest.ExamKind == ExamKind.Placement + && !q.MockTestSection.MockTest.IsArchivedVersion + && (!q.MockTestSection.MockTest.IsManagedWorkflow || + approvedTestIds.Contains(q.MockTestSection.MockTestId))) + .Select(q => new + { + SectionId = q.MockTestSection!.Id, + LevelId = q.MockTestSection.MockTest.CertificateLevelId, + SkillName = q.MockTestSection.LanguageSkill.Name, + q.QuestionType, + q.QuestionText, + q.ImageUrl, + q.AudioUrl, + PassageAudioUrl = q.Passage == null ? null : q.Passage.AudioUrl, + OptionCount = q.Options!.Count(o => !o.IsDeleted), + }) + .ToListAsync(cancellationToken); + var skillCountByLevel = new Dictionary>(); - foreach (var test in (tests ?? []).Where(t => t is not null && !t.IsDeleted && t.Id > 0 && t.CertificateLevelId > 0 - && t.ExamKind == ExamKind.Placement - && !t.IsArchivedVersion - && (!t.IsManagedWorkflow || approvedTestIds.Contains(t.Id)))) + foreach (var section in questions.GroupBy(q => q.SectionId)) { - var code = NormalizeLevelCode(test.CertificateLevel?.Code ?? levels.FirstOrDefault(l => l.Id == test.CertificateLevelId)?.Code); + var first = section.First(); + var code = NormalizeLevelCode(levels.FirstOrDefault(l => l.Id == first.LevelId)?.Code); if (JlptCurriculum.Rank(code) == 0) continue; - - foreach (var sec in (test.Sections ?? []).Where(s => s is not null && !s.IsDeleted)) + if (JlptSkillAssessmentPolicy.Classify(first.SkillName) is not { } skill) continue; + var validCount = section.Count(q => + (!string.IsNullOrWhiteSpace(q.QuestionText) || + !string.IsNullOrWhiteSpace(q.ImageUrl) || + !string.IsNullOrWhiteSpace(q.AudioUrl) || + !string.IsNullOrWhiteSpace(q.PassageAudioUrl)) && + (SentenceOrdering.IsType(q.QuestionType) || q.OptionCount >= 2)); + if (validCount >= PlacementAssessmentModePolicy.MinimumQuestionsPerSkillAndLevel) { - if (JlptSkillAssessmentPolicy.Classify(sec.LanguageSkill?.Name) is not { } skill) continue; - var validCount = (sec.Questions ?? []).Count(q => q is not null && !q.IsDeleted && HasUsablePrompt(q) && - (SentenceOrdering.IsType(q.QuestionType) || (q.Options ?? []).Count(o => !o.IsDeleted) >= 2)); - if (validCount >= PlacementAssessmentModePolicy.MinimumQuestionsPerSkillAndLevel) + if (!skillCountByLevel.TryGetValue(code, out var set)) { - if (!skillCountByLevel.TryGetValue(code, out var set)) - { - set = []; - skillCountByLevel[code] = set; - } - set.Add(skill); + set = []; + skillCountByLevel[code] = set; } + set.Add(skill); } } diff --git a/RikiPath.Infrastructure/Migrations/20261130013913_AlignMockQuestionSectionIndex.Designer.cs b/RikiPath.Infrastructure/Migrations/20261130013913_AlignMockQuestionSectionIndex.Designer.cs deleted file mode 100644 index f738c78..0000000 --- a/RikiPath.Infrastructure/Migrations/20261130013913_AlignMockQuestionSectionIndex.Designer.cs +++ /dev/null @@ -1,14091 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using RikiPath.Infrastructure; - -#nullable disable - -namespace RikiPath.Infrastructure.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20261130013913_AlignMockQuestionSectionIndex")] - partial class AlignMockQuestionSectionIndex - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.8") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("FeatureSubscriptionPlan", b => - { - b.Property("FeaturesId") - .HasColumnType("integer"); - - b.Property("SubscriptionPlansId") - .HasColumnType("integer"); - - b.HasKey("FeaturesId", "SubscriptionPlansId"); - - b.HasIndex("SubscriptionPlansId"); - - b.ToTable("FeatureSubscriptionPlan"); - - b.HasData( - new - { - FeaturesId = 1, - SubscriptionPlansId = 1 - }, - new - { - FeaturesId = 2, - SubscriptionPlansId = 1 - }, - new - { - FeaturesId = 3, - SubscriptionPlansId = 1 - }, - new - { - FeaturesId = 4, - SubscriptionPlansId = 1 - }, - new - { - FeaturesId = 5, - SubscriptionPlansId = 1 - }, - new - { - FeaturesId = 6, - SubscriptionPlansId = 1 - }, - new - { - FeaturesId = 1, - SubscriptionPlansId = 2 - }, - new - { - FeaturesId = 2, - SubscriptionPlansId = 2 - }, - new - { - FeaturesId = 3, - SubscriptionPlansId = 2 - }, - new - { - FeaturesId = 4, - SubscriptionPlansId = 2 - }, - new - { - FeaturesId = 5, - SubscriptionPlansId = 2 - }, - new - { - FeaturesId = 6, - SubscriptionPlansId = 2 - }, - new - { - FeaturesId = 1, - SubscriptionPlansId = 3 - }, - new - { - FeaturesId = 2, - SubscriptionPlansId = 3 - }, - new - { - FeaturesId = 3, - SubscriptionPlansId = 3 - }, - new - { - FeaturesId = 4, - SubscriptionPlansId = 3 - }, - new - { - FeaturesId = 5, - SubscriptionPlansId = 3 - }, - new - { - FeaturesId = 6, - SubscriptionPlansId = 3 - }, - new - { - FeaturesId = 1, - SubscriptionPlansId = 4 - }, - new - { - FeaturesId = 2, - SubscriptionPlansId = 4 - }, - new - { - FeaturesId = 3, - SubscriptionPlansId = 4 - }, - new - { - FeaturesId = 4, - SubscriptionPlansId = 4 - }, - new - { - FeaturesId = 5, - SubscriptionPlansId = 4 - }, - new - { - FeaturesId = 6, - SubscriptionPlansId = 4 - }, - new - { - FeaturesId = 1, - SubscriptionPlansId = 5 - }, - new - { - FeaturesId = 2, - SubscriptionPlansId = 5 - }, - new - { - FeaturesId = 3, - SubscriptionPlansId = 5 - }, - new - { - FeaturesId = 4, - SubscriptionPlansId = 5 - }, - new - { - FeaturesId = 5, - SubscriptionPlansId = 5 - }, - new - { - FeaturesId = 6, - SubscriptionPlansId = 5 - }, - new - { - FeaturesId = 1, - SubscriptionPlansId = 6 - }, - new - { - FeaturesId = 2, - SubscriptionPlansId = 6 - }, - new - { - FeaturesId = 3, - SubscriptionPlansId = 6 - }, - new - { - FeaturesId = 4, - SubscriptionPlansId = 6 - }, - new - { - FeaturesId = 5, - SubscriptionPlansId = 6 - }, - new - { - FeaturesId = 6, - SubscriptionPlansId = 6 - }, - new - { - FeaturesId = 7, - SubscriptionPlansId = 7 - }, - new - { - FeaturesId = 8, - SubscriptionPlansId = 7 - }, - new - { - FeaturesId = 13, - SubscriptionPlansId = 8101 - }, - new - { - FeaturesId = 14, - SubscriptionPlansId = 8102 - }, - new - { - FeaturesId = 6, - SubscriptionPlansId = 8103 - }, - new - { - FeaturesId = 12, - SubscriptionPlansId = 8104 - }, - new - { - FeaturesId = 7, - SubscriptionPlansId = 8105 - }, - new - { - FeaturesId = 8, - SubscriptionPlansId = 8105 - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.AdminAuditLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("ActorUserId") - .HasColumnType("integer"); - - b.Property("AfterJson") - .HasColumnType("text"); - - b.Property("BeforeJson") - .HasColumnType("text"); - - b.Property("CreatedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("Reason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.HasKey("Id"); - - b.HasIndex("CreatedAtUtc"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("AdminAuditLogs", (string)null); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.AiCreditTopUp", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ActivatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("PaymentStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("PaymentTransactionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Quantity") - .HasColumnType("integer"); - - b.Property("TotalAmount") - .HasColumnType("decimal(18,2)"); - - b.Property("UnitPrice") - .HasColumnType("decimal(18,2)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "PaymentStatus"); - - b.ToTable("AiCreditTopUps"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.CertificateLevel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CertificateTypeId") - .HasColumnType("integer") - .HasColumnName("CertificationId"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Revision") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(1); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("CertificateTypeId", "Code") - .IsUnique(); - - b.ToTable("CertificateLevels", null, t => - { - t.HasCheckConstraint("CK_CertificateLevels_SortOrder", "\"SortOrder\" >= 1"); - }); - - b.HasData( - new - { - Id = 1, - CertificateTypeId = 1, - Code = "N5", - CreatedDate = new DateTime(2026, 9, 29, 0, 0, 0, 0, DateTimeKind.Utc), - Description = "JLPT N5", - IsDeleted = false, - Revision = 1, - SortOrder = 1 - }, - new - { - Id = 2, - CertificateTypeId = 1, - Code = "N4", - CreatedDate = new DateTime(2026, 9, 29, 0, 0, 0, 0, DateTimeKind.Utc), - Description = "JLPT N4", - IsDeleted = false, - Revision = 1, - SortOrder = 2 - }, - new - { - Id = 3, - CertificateTypeId = 1, - Code = "N3", - CreatedDate = new DateTime(2026, 9, 29, 0, 0, 0, 0, DateTimeKind.Utc), - Description = "JLPT N3", - IsDeleted = false, - Revision = 1, - SortOrder = 3 - }, - new - { - Id = 4, - CertificateTypeId = 1, - Code = "N2", - CreatedDate = new DateTime(2026, 9, 29, 0, 0, 0, 0, DateTimeKind.Utc), - Description = "JLPT N2", - IsDeleted = false, - Revision = 1, - SortOrder = 4 - }, - new - { - Id = 5, - CertificateTypeId = 1, - Code = "N1", - CreatedDate = new DateTime(2026, 9, 29, 0, 0, 0, 0, DateTimeKind.Utc), - Description = "JLPT N1", - IsDeleted = false, - Revision = 1, - SortOrder = 5 - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.CertificateSection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CertificateLevelId") - .HasColumnType("integer") - .HasColumnName("CertificationLevelId"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("DurationMinutes") - .HasColumnType("integer"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("MaxScore") - .HasColumnType("integer"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PassingScore") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("CertificateLevelId", "Code") - .IsUnique() - .HasFilter("\"IsDeleted\" = false"); - - b.ToTable("CertificateSections"); - - b.HasData( - new - { - Id = 1, - CertificateLevelId = 1, - Code = "N5_VOCAB", - CreatedDate = new DateTime(2026, 10, 31, 11, 13, 24, 991, DateTimeKind.Utc).AddTicks(5285), - Description = "Phần thi kiểm tra chữ Hán, cách đọc và từ vựng cấp độ N5", - IsDeleted = false, - MaxScore = 0, - Name = "Kiến thức ngôn ngữ (Từ vựng)", - PassingScore = 0, - SortOrder = 1 - }, - new - { - Id = 2, - CertificateLevelId = 1, - Code = "N5_GRAMMAR", - CreatedDate = new DateTime(2026, 10, 31, 11, 13, 24, 991, DateTimeKind.Utc).AddTicks(5292), - Description = "Phần thi kiểm tra cấu trúc ngữ pháp và sắp xếp câu cấp độ N5", - IsDeleted = false, - MaxScore = 0, - Name = "Kiến thức ngôn ngữ (Ngữ pháp)", - PassingScore = 0, - SortOrder = 2 - }, - new - { - Id = 3, - CertificateLevelId = 1, - Code = "N5_LISTENING", - CreatedDate = new DateTime(2026, 10, 31, 11, 13, 24, 991, DateTimeKind.Utc).AddTicks(5294), - Description = "Phần thi nghe hiểu tình huống giao tiếp hàng ngày cấp độ N5", - IsDeleted = false, - MaxScore = 0, - Name = "Nghe hiểu", - PassingScore = 0, - SortOrder = 4 - }, - new - { - Id = 16, - CertificateLevelId = 1, - Code = "N5_READING", - CreatedDate = new DateTime(2026, 10, 31, 11, 13, 24, 991, DateTimeKind.Utc).AddTicks(5308), - Description = "Phần thi đọc hiểu văn bản, thông báo và đoạn hội thoại ngắn cấp độ N5", - IsDeleted = false, - MaxScore = 0, - Name = "Đọc hiểu", - PassingScore = 0, - SortOrder = 3 - }, - new - { - Id = 4, - CertificateLevelId = 2, - Code = "N4_VOCAB", - CreatedDate = new DateTime(2026, 10, 31, 11, 13, 24, 991, DateTimeKind.Utc).AddTicks(5295), - Description = "Phần thi kiểm tra chữ Hán, cách đọc và từ vựng cấp độ N4", - IsDeleted = false, - MaxScore = 0, - Name = "Kiến thức ngôn ngữ (Từ vựng)", - PassingScore = 0, - SortOrder = 0 - }, - new - { - Id = 5, - CertificateLevelId = 2, - Code = "N4_GRAMMAR", - CreatedDate = new DateTime(2026, 10, 31, 11, 13, 24, 991, DateTimeKind.Utc).AddTicks(5296), - Description = "Phần thi kiểm tra cấu trúc ngữ pháp và sắp xếp câu cấp độ N4", - IsDeleted = false, - MaxScore = 0, - Name = "Kiến thức ngôn ngữ (Ngữ pháp)", - PassingScore = 0, - SortOrder = 0 - }, - new - { - Id = 6, - CertificateLevelId = 2, - Code = "N4_READING", - CreatedDate = new DateTime(2026, 10, 31, 11, 13, 24, 991, DateTimeKind.Utc).AddTicks(5297), - Description = "Phần thi đọc hiểu văn bản, thông báo và biểu mẫu cấp độ N4", - IsDeleted = false, - MaxScore = 0, - Name = "Đọc hiểu", - PassingScore = 0, - SortOrder = 0 - }, - new - { - Id = 7, - CertificateLevelId = 2, - Code = "N4_LISTENING", - CreatedDate = new DateTime(2026, 10, 31, 11, 13, 24, 991, DateTimeKind.Utc).AddTicks(5298), - Description = "Phần thi nghe hiểu hội thoại và tình huống thực tế cấp độ N4", - IsDeleted = false, - MaxScore = 0, - Name = "Nghe hiểu", - PassingScore = 0, - SortOrder = 0 - }, - new - { - Id = 8, - CertificateLevelId = 3, - Code = "N3_VOCAB", - CreatedDate = new DateTime(2026, 10, 31, 11, 13, 24, 991, DateTimeKind.Utc).AddTicks(5300), - Description = "Phần thi kiểm tra chữ Hán, cách đọc và từ vựng cấp độ N3", - IsDeleted = false, - MaxScore = 0, - Name = "Kiến thức ngôn ngữ (Từ vựng)", - PassingScore = 0, - SortOrder = 0 - }, - new - { - Id = 9, - CertificateLevelId = 3, - Code = "N3_GRAMMAR", - CreatedDate = new DateTime(2026, 10, 31, 11, 13, 24, 991, DateTimeKind.Utc).AddTicks(5301), - Description = "Phần thi kiểm tra cấu trúc ngữ pháp và sắp xếp câu cấp độ N3", - IsDeleted = false, - MaxScore = 0, - Name = "Kiến thức ngôn ngữ (Ngữ pháp)", - PassingScore = 0, - SortOrder = 0 - }, - new - { - Id = 10, - CertificateLevelId = 3, - Code = "N3_READING", - CreatedDate = new DateTime(2026, 10, 31, 11, 13, 24, 991, DateTimeKind.Utc).AddTicks(5302), - Description = "Phần thi đọc hiểu văn bản, thông báo và biểu mẫu cấp độ N3", - IsDeleted = false, - MaxScore = 0, - Name = "Đọc hiểu", - PassingScore = 0, - SortOrder = 0 - }, - new - { - Id = 11, - CertificateLevelId = 3, - Code = "N3_LISTENING", - CreatedDate = new DateTime(2026, 10, 31, 11, 13, 24, 991, DateTimeKind.Utc).AddTicks(5303), - Description = "Phần thi nghe hiểu hội thoại và tình huống thực tế cấp độ N3", - IsDeleted = false, - MaxScore = 0, - Name = "Nghe hiểu", - PassingScore = 0, - SortOrder = 0 - }, - new - { - Id = 12, - CertificateLevelId = 4, - Code = "N2_VOCAB", - CreatedDate = new DateTime(2026, 10, 31, 11, 13, 24, 991, DateTimeKind.Utc).AddTicks(5304), - Description = "Phần thi kiểm tra chữ Hán, cách đọc và từ vựng cấp độ N2", - IsDeleted = false, - MaxScore = 0, - Name = "Kiến thức ngôn ngữ (Từ vựng)", - PassingScore = 0, - SortOrder = 0 - }, - new - { - Id = 13, - CertificateLevelId = 4, - Code = "N2_GRAMMAR", - CreatedDate = new DateTime(2026, 10, 31, 11, 13, 24, 991, DateTimeKind.Utc).AddTicks(5305), - Description = "Phần thi kiểm tra cấu trúc ngữ pháp và sắp xếp câu cấp độ N2", - IsDeleted = false, - MaxScore = 0, - Name = "Kiến thức ngôn ngữ (Ngữ pháp)", - PassingScore = 0, - SortOrder = 0 - }, - new - { - Id = 14, - CertificateLevelId = 4, - Code = "N2_READING", - CreatedDate = new DateTime(2026, 10, 31, 11, 13, 24, 991, DateTimeKind.Utc).AddTicks(5306), - Description = "Phần thi đọc hiểu văn bản, thông báo và biểu mẫu cấp độ N2", - IsDeleted = false, - MaxScore = 0, - Name = "Đọc hiểu", - PassingScore = 0, - SortOrder = 0 - }, - new - { - Id = 15, - CertificateLevelId = 4, - Code = "N2_LISTENING", - CreatedDate = new DateTime(2026, 10, 31, 11, 13, 24, 991, DateTimeKind.Utc).AddTicks(5307), - Description = "Phần thi nghe hiểu hội thoại và tình huống thực tế cấp độ N2", - IsDeleted = false, - MaxScore = 0, - Name = "Nghe hiểu", - PassingScore = 0, - SortOrder = 0 - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.CertificateType", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("IsActive") - .HasColumnType("boolean"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Revision") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(1); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("CertificateTypes", null, t => - { - t.HasCheckConstraint("CK_CertificateTypes_SortOrder", "\"SortOrder\" >= 1"); - }); - - b.HasData( - new - { - Id = 1, - CreatedDate = new DateTime(2026, 9, 29, 0, 0, 0, 0, DateTimeKind.Utc), - Description = "Japanese-Language Proficiency Test", - IsActive = true, - IsDeleted = false, - Name = "JLPT", - Revision = 1, - SortOrder = 1 - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.CohortComplaint", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CohortId") - .HasColumnType("integer"); - - b.Property("CourseId") - .HasColumnType("integer"); - - b.Property("CourseSessionId") - .HasColumnType("integer"); - - b.Property("CreatedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("DecidedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("DecidedById") - .HasColumnType("integer"); - - b.Property("Decision") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("EvidenceUrl") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("IdempotencyKey") - .HasColumnType("uuid"); - - b.Property("LearnerId") - .HasColumnType("integer"); - - b.Property("MentorAccessGrantedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("MentorDisclosure") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("MentorEvidenceAllowed") - .HasColumnType("boolean"); - - b.Property("MentorId") - .HasColumnType("integer"); - - b.Property("MentorRespondedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("MentorResponse") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("RefundReviewRequested") - .HasColumnType("boolean"); - - b.Property("Revision") - .IsConcurrencyToken() - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Title") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("CohortId"); - - b.HasIndex("CourseId"); - - b.HasIndex("CourseSessionId"); - - b.HasIndex("DecidedById"); - - b.HasIndex("LearnerId", "IdempotencyKey") - .IsUnique(); - - b.HasIndex("Status", "CreatedAtUtc"); - - b.HasIndex("MentorId", "Status", "CreatedAtUtc"); - - b.ToTable("CohortComplaints", null, t => - { - t.HasCheckConstraint("CK_CohortComplaint_Category", "\"Category\" IN ('TeachingQuality', 'MentorConduct', 'Schedule', 'PaymentEnrollment', 'Other')"); - - t.HasCheckConstraint("CK_CohortComplaint_Decision", "(\"Status\" NOT IN ('Resolved', 'Rejected') OR (\"Decision\" IS NOT NULL AND length(btrim(\"Decision\")) > 0 AND \"DecidedById\" IS NOT NULL AND \"DecidedAtUtc\" IS NOT NULL))"); - - t.HasCheckConstraint("CK_CohortComplaint_Message", "length(btrim(\"Message\")) BETWEEN 10 AND 2000"); - - t.HasCheckConstraint("CK_CohortComplaint_RefundReview", "NOT \"RefundReviewRequested\" OR \"Category\" = 'PaymentEnrollment'"); - - t.HasCheckConstraint("CK_CohortComplaint_Status", "\"Status\" IN ('Open', 'UnderReview', 'NeedsInformation', 'Resolved', 'Rejected', 'Withdrawn')"); - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.CohortComplaintEvent", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(40) - .HasColumnType("character varying(40)"); - - b.Property("ActorId") - .HasColumnType("integer"); - - b.Property("ActorRole") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("ComplaintId") - .HasColumnType("integer"); - - b.Property("Detail") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("EvidenceUrl") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.HasKey("Id"); - - b.HasIndex("ComplaintId", "Id"); - - b.ToTable("CohortComplaintEvents", (string)null); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.CohortEnrollmentEntitlement", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ConsumedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("ConsumedByCourseId") - .HasColumnType("integer"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("EntitlementReference") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ExpiresAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("GrantedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("GrantedById") - .HasColumnType("integer"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("LearnerId") - .HasColumnType("integer"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("PlanId") - .HasColumnType("integer"); - - b.Property("RevocationReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RevokedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("RevokedById") - .HasColumnType("integer"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(40) - .HasColumnType("character varying(40)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(24) - .HasColumnType("character varying(24)"); - - b.Property("StudyCohortId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("EntitlementReference") - .IsUnique(); - - b.HasIndex("LearnerId"); - - b.HasIndex("PlanId"); - - b.HasIndex("StudyCohortId", "LearnerId") - .IsUnique() - .HasFilter("\"Status\" = 'Active' AND \"IsDeleted\" = false"); - - b.ToTable("CohortEnrollmentEntitlements", null, t => - { - t.HasCheckConstraint("CK_CohortEnrollmentEntitlement_NoCredit", "\"SourceType\" NOT IN ('ConsultationCredit', 'Credit1on1', 'OneOnOneCredit')"); - - t.HasCheckConstraint("CK_CohortEnrollmentEntitlement_Status", "\"Status\" IN ('Active', 'Consumed', 'Revoked', 'Expired')"); - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.CohortLearningFeedback", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CourseId") - .HasColumnType("integer"); - - b.Property("CourseSessionId") - .HasColumnType("integer"); - - b.Property("CreatedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("EvidenceUrl") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("IdempotencyKey") - .HasColumnType("uuid"); - - b.Property("LearnerId") - .HasColumnType("integer"); - - b.Property("MentorId") - .HasColumnType("integer"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("RespondedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("RespondedById") - .HasColumnType("integer"); - - b.Property("Response") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("Revision") - .IsConcurrencyToken() - .HasColumnType("integer"); - - b.Property("Topic") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.HasIndex("CourseSessionId"); - - b.HasIndex("MentorId"); - - b.HasIndex("RespondedById"); - - b.HasIndex("LearnerId", "IdempotencyKey") - .IsUnique(); - - b.ToTable("CohortLearningFeedback", (string)null); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.CohortMentorReview", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CohortId") - .HasColumnType("integer"); - - b.Property("Comment") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("CourseId") - .HasColumnType("integer"); - - b.Property("CreatedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("IsHidden") - .HasColumnType("boolean"); - - b.Property("LearnerId") - .HasColumnType("integer"); - - b.Property("MentorId") - .HasColumnType("integer"); - - b.Property("Rating") - .HasColumnType("integer"); - - b.Property("UpdatedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.HasKey("Id"); - - b.HasIndex("CohortId"); - - b.HasIndex("LearnerId"); - - b.HasIndex("CourseId", "MentorId") - .IsUnique(); - - b.HasIndex("MentorId", "IsHidden", "CreatedAtUtc"); - - b.ToTable("CohortMentorReviews", null, t => - { - t.HasCheckConstraint("CK_CohortMentorReview_Rating", "\"Rating\" BETWEEN 1 AND 5"); - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.CohortScheduleRequest", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CohortId") - .HasColumnType("integer"); - - b.Property("CohortRevisionSnapshot") - .HasColumnType("integer"); - - b.Property("CreatedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("DecisionNote") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("IdempotencyKey") - .HasColumnType("uuid"); - - b.Property("ImpactSnapshot") - .IsRequired() - .HasColumnType("text"); - - b.Property("Kind") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("Reason") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RequestedById") - .HasColumnType("integer"); - - b.Property("RequestedByRole") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReviewedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("ReviewedById") - .HasColumnType("integer"); - - b.Property("Revision") - .IsConcurrencyToken() - .HasColumnType("integer"); - - b.Property("ShiftWeeks") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("Id"); - - b.HasIndex("CohortId") - .IsUnique() - .HasDatabaseName("IX_CohortScheduleRequests_PendingCohort") - .HasFilter("\"Status\" = 'Pending'"); - - b.HasIndex("ReviewedById"); - - b.HasIndex("CohortId", "Id"); - - b.HasIndex("RequestedById", "IdempotencyKey") - .IsUnique(); - - b.HasIndex("Status", "CreatedAtUtc"); - - b.ToTable("CohortScheduleRequests", null, t => - { - t.HasCheckConstraint("CK_CohortScheduleRequest_Decision", "(\"Status\" NOT IN ('Approved', 'Rejected') OR (\"ReviewedById\" IS NOT NULL AND \"ReviewedAtUtc\" IS NOT NULL)) AND (\"Status\" <> 'Rejected' OR (\"DecisionNote\" IS NOT NULL AND length(btrim(\"DecisionNote\")) > 0))"); - - t.HasCheckConstraint("CK_CohortScheduleRequest_Kind", "\"Kind\" IN ('ShiftWeeks', 'CancelEmptyCohort')"); - - t.HasCheckConstraint("CK_CohortScheduleRequest_Reason", "length(btrim(\"Reason\")) BETWEEN 10 AND 1000"); - - t.HasCheckConstraint("CK_CohortScheduleRequest_ShiftWeeks", "(\"Kind\" = 'ShiftWeeks' AND \"ShiftWeeks\" BETWEEN 1 AND 8) OR (\"Kind\" = 'CancelEmptyCohort' AND \"ShiftWeeks\" IS NULL)"); - - t.HasCheckConstraint("CK_CohortScheduleRequest_Status", "\"Status\" IN ('Pending', 'Approved', 'Rejected', 'Withdrawn')"); - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.CohortScheduleRequestEvent", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(40) - .HasColumnType("character varying(40)"); - - b.Property("ActorId") - .HasColumnType("integer"); - - b.Property("ActorRole") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("Detail") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("RequestId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("RequestId", "Id"); - - b.ToTable("CohortScheduleRequestEvents", (string)null); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.CohortTransferRequest", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("DecisionNote") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("DestinationCourseId") - .HasColumnType("integer"); - - b.Property("EligibilitySnapshot") - .HasColumnType("text"); - - b.Property("EvidenceUrl") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("IdempotencyKey") - .HasColumnType("uuid"); - - b.Property("LearnerId") - .HasColumnType("integer"); - - b.Property("PolicyId") - .HasColumnType("integer"); - - b.Property("PolicyVersionSnapshot") - .HasColumnType("integer"); - - b.Property("Reason") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RequestedTargetCohortId") - .HasColumnType("integer"); - - b.Property("ReviewedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("ReviewedById") - .HasColumnType("integer"); - - b.Property("Revision") - .IsConcurrencyToken() - .HasColumnType("integer"); - - b.Property("SourceCohortId") - .HasColumnType("integer"); - - b.Property("SourceCourseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetCohortId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("DestinationCourseId") - .IsUnique() - .HasFilter("\"DestinationCourseId\" IS NOT NULL"); - - b.HasIndex("PolicyId"); - - b.HasIndex("RequestedTargetCohortId"); - - b.HasIndex("ReviewedById"); - - b.HasIndex("SourceCohortId"); - - b.HasIndex("SourceCourseId") - .IsUnique() - .HasDatabaseName("IX_CohortTransferRequests_PendingSource") - .HasFilter("\"Status\" = 'Pending'"); - - b.HasIndex("TargetCohortId"); - - b.HasIndex("LearnerId", "IdempotencyKey") - .IsUnique(); - - b.HasIndex("Status", "CreatedAtUtc"); - - b.ToTable("CohortTransferRequests", null, t => - { - t.HasCheckConstraint("CK_CohortTransferRequest_Decision", "(\"Status\" <> 'Approved' OR (\"TargetCohortId\" IS NOT NULL AND \"DestinationCourseId\" IS NOT NULL AND \"ReviewedById\" IS NOT NULL)) AND (\"Status\" <> 'Rejected' OR (\"DecisionNote\" IS NOT NULL AND length(btrim(\"DecisionNote\")) > 0 AND \"ReviewedById\" IS NOT NULL))"); - - t.HasCheckConstraint("CK_CohortTransferRequest_Status", "\"Status\" IN ('Pending', 'Approved', 'Rejected', 'Withdrawn')"); - - t.HasCheckConstraint("CK_CohortTransferRequest_Target", "\"TargetCohortId\" IS NULL OR \"TargetCohortId\" <> \"SourceCohortId\""); - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.CohortTransferRequestEvent", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(40) - .HasColumnType("character varying(40)"); - - b.Property("ActorId") - .HasColumnType("integer"); - - b.Property("ActorRole") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("Detail") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("RequestId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("RequestId", "Id"); - - b.ToTable("CohortTransferRequestEvents", (string)null); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.ContentAiReview", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ContentId") - .HasColumnType("integer"); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ErrorCount") - .HasColumnType("integer"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("IssuesJson") - .IsRequired() - .HasColumnType("text"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("RequestedByUserId") - .HasColumnType("integer"); - - b.Property("ReviewedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("Summary") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("Verdict") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("WarningCount") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("ContentType", "ContentId", "ReviewedAt"); - - b.ToTable("ContentAiReviews"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.ContentApprovalRequest", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Action") - .HasColumnType("integer"); - - b.Property("AiProvenanceJson") - .HasColumnType("jsonb"); - - b.Property("BatchId") - .HasColumnType("uuid"); - - b.Property("CertificateLevelId") - .HasColumnType("integer"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("DiffSummaryJson") - .HasColumnType("text"); - - b.Property("EntityType") - .HasColumnType("integer"); - - b.Property("IdempotencyKey") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("LanguageSkillId") - .HasColumnType("integer"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("PayloadJson") - .IsRequired() - .HasColumnType("text"); - - b.Property("ReviewHistoryJson") - .HasColumnType("jsonb"); - - b.Property("ReviewNote") - .HasColumnType("text"); - - b.Property("ReviewedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ReviewedByName") - .HasColumnType("text"); - - b.Property("RightsConfirmed") - .HasColumnType("boolean"); - - b.Property("RightsStatus") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("RowKey") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("SourceFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("SourceReference") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("SourceRowNumber") - .HasColumnType("integer"); - - b.Property("SourceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(40) - .HasColumnType("character varying(40)") - .HasDefaultValue("ImportExcel"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("SubmittedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("SubmittedByUserId") - .HasColumnType("integer"); - - b.Property("TargetEntityId") - .HasColumnType("integer"); - - b.Property("ValidationSummaryJson") - .HasColumnType("jsonb"); - - b.HasKey("Id"); - - b.HasIndex("BatchId"); - - b.HasIndex("SubmittedByUserId"); - - b.HasIndex("EntityType", "Status"); - - b.HasIndex("SubmittedByUserId", "IdempotencyKey") - .IsUnique() - .HasFilter("\"IdempotencyKey\" IS NOT NULL"); - - b.ToTable("ContentApprovalRequests"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.ContentAudioTranscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AttemptCount") - .HasColumnType("integer"); - - b.Property("AudioUrl") - .IsRequired() - .HasMaxLength(2048) - .HasColumnType("character varying(2048)"); - - b.Property("AudioUrlHash") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("CompletedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("Confidence") - .HasColumnType("double precision"); - - b.Property("CreatedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedByUserId") - .HasColumnType("integer"); - - b.Property("ErrorCode") - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("ErrorMessage") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("LanguageCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("LeaseExpiresAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("LeaseId") - .HasColumnType("uuid"); - - b.Property("NextAttemptAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("RawTranscriptJson") - .HasColumnType("jsonb"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Transcript") - .HasColumnType("text"); - - b.Property("UpdatedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("AudioUrlHash") - .IsUnique(); - - b.HasIndex("CreatedByUserId"); - - b.HasIndex("Status", "NextAttemptAtUtc", "LeaseExpiresAtUtc"); - - b.ToTable("ContentAudioTranscriptions", null, t => - { - t.HasCheckConstraint("CK_ContentAudioTranscription_Attempts", "\"AttemptCount\" >= 0"); - - t.HasCheckConstraint("CK_ContentAudioTranscription_Language", "\"LanguageCode\" = 'ja-JP'"); - - t.HasCheckConstraint("CK_ContentAudioTranscription_Status", "\"Status\" IN ('Pending', 'Processing', 'Completed', 'Failed')"); - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.ContentBankItem", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("EntityType") - .HasColumnType("integer"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("LatestBatchId") - .HasColumnType("uuid"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("NaturalKey") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("OwnerUserId") - .HasColumnType("integer"); - - b.Property("PayloadJson") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("TargetEntityId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("EntityType", "TargetEntityId"); - - b.HasIndex("OwnerUserId", "EntityType", "NaturalKey") - .IsUnique() - .HasFilter("\"IsDeleted\" = false"); - - b.ToTable("ContentBankItems"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.ContentLevelMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CertificateLevelId") - .HasColumnType("integer") - .HasColumnName("CertificationLevelId"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("GrammarPatternId") - .HasColumnType("integer"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("KanjiId") - .HasColumnType("integer"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("VocabularyId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("GrammarPatternId"); - - b.HasIndex("KanjiId"); - - b.HasIndex("VocabularyId"); - - b.HasIndex("CertificateLevelId", "GrammarPatternId") - .IsUnique() - .HasFilter("\"GrammarPatternId\" IS NOT NULL AND \"IsDeleted\" = false"); - - b.HasIndex("CertificateLevelId", "KanjiId") - .IsUnique() - .HasFilter("\"KanjiId\" IS NOT NULL AND \"IsDeleted\" = false"); - - b.HasIndex("CertificateLevelId", "VocabularyId") - .IsUnique() - .HasFilter("\"VocabularyId\" IS NOT NULL AND \"IsDeleted\" = false"); - - b.ToTable("ContentLevelMappings", t => - { - t.HasCheckConstraint("CK_ContentLevelMappings_ExactlyOneContent", "(CASE WHEN \"KanjiId\" IS NOT NULL THEN 1 ELSE 0 END) + (CASE WHEN \"VocabularyId\" IS NOT NULL THEN 1 ELSE 0 END) + (CASE WHEN \"GrammarPatternId\" IS NOT NULL THEN 1 ELSE 0 END) = 1"); - }); - - b.HasData( - new - { - Id = 920001, - CertificateLevelId = 1, - CreatedDate = new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc), - IsDeleted = false, - KanjiId = 910001 - }, - new - { - Id = 920002, - CertificateLevelId = 1, - CreatedDate = new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc), - IsDeleted = false, - KanjiId = 910002 - }, - new - { - Id = 920003, - CertificateLevelId = 1, - CreatedDate = new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc), - IsDeleted = false, - KanjiId = 910003 - }, - new - { - Id = 920004, - CertificateLevelId = 1, - CreatedDate = new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc), - IsDeleted = false, - KanjiId = 910004 - }, - new - { - Id = 920005, - CertificateLevelId = 1, - CreatedDate = new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc), - IsDeleted = false, - KanjiId = 910005 - }, - new - { - Id = 920006, - CertificateLevelId = 1, - CreatedDate = new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc), - IsDeleted = false, - KanjiId = 910006 - }, - new - { - Id = 920007, - CertificateLevelId = 1, - CreatedDate = new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc), - IsDeleted = false, - KanjiId = 910007 - }, - new - { - Id = 920008, - CertificateLevelId = 1, - CreatedDate = new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc), - IsDeleted = false, - KanjiId = 910008 - }, - new - { - Id = 920009, - CertificateLevelId = 1, - CreatedDate = new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc), - IsDeleted = false, - KanjiId = 910009 - }, - new - { - Id = 920010, - CertificateLevelId = 1, - CreatedDate = new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc), - IsDeleted = false, - KanjiId = 910010 - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.ContentPassage", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AiProvenanceJson") - .HasColumnType("jsonb"); - - b.Property("AudioTranscript") - .HasColumnType("text"); - - b.Property("AudioUrl") - .HasColumnType("text"); - - b.Property("ContentFingerprint") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ImageUrl") - .HasColumnType("text"); - - b.Property("Instructions") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("IsArchivedVersion") - .HasColumnType("boolean"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("ListeningSection") - .HasMaxLength(120) - .HasColumnType("character varying(120)"); - - b.Property("MockTestSectionId") - .HasColumnType("integer"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ParentPassageId") - .HasColumnType("integer"); - - b.Property("PassageCode") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("PassageIdentity") - .HasColumnType("uuid"); - - b.Property("PassageText") - .HasColumnType("text"); - - b.Property("PlaybackPolicyJson") - .HasColumnType("jsonb"); - - b.Property("PublishStatus") - .HasColumnType("integer"); - - b.Property("PublishedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("SourceReference") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("Version") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("ContentFingerprint"); - - b.HasIndex("MockTestSectionId"); - - b.HasIndex("PassageIdentity"); - - b.ToTable("ContentPassages"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.CourseAuditEntry", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Action") - .IsRequired() - .HasColumnType("text"); - - b.Property("ActorId") - .HasColumnType("integer"); - - b.Property("At") - .HasColumnType("timestamp without time zone"); - - b.Property("CourseId") - .HasColumnType("integer"); - - b.Property("Detail") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.ToTable("CourseAuditEntries", (string)null); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.CourseRetakeRequest", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CourseId") - .HasColumnType("integer"); - - b.Property("EligibilitySnapshot") - .HasColumnType("text"); - - b.Property("EvidenceUrl") - .IsRequired() - .HasColumnType("text"); - - b.Property("ExamDate") - .HasColumnType("timestamp without time zone"); - - b.Property("MentorSupportPlan") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("MentorSupportPlanAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("MentorSupportPlanById") - .HasColumnType("integer"); - - b.Property("Reason") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Response") - .HasColumnType("text"); - - b.Property("ResultPublishedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ReviewedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ReviewedById") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubmittedAt") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("CourseId") - .IsUnique() - .HasFilter("\"Status\" = 'Pending'"); - - b.ToTable("CourseRetakeRequests", (string)null); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.CourseScheduleRequest", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CourseId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("Kind") - .IsRequired() - .HasColumnType("text"); - - b.Property("Reason") - .IsRequired() - .HasColumnType("text"); - - b.Property("RequestedById") - .HasColumnType("integer"); - - b.Property("Response") - .HasColumnType("text"); - - b.Property("ReviewedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ReviewedById") - .HasColumnType("integer"); - - b.Property("SessionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsConcurrencyToken() - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CourseId", "SessionId") - .IsUnique() - .HasFilter("\"Status\" = 'Pending'"); - - b.ToTable("CourseScheduleRequests", (string)null); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.EmailVerification", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ExpiresAt") - .HasColumnType("timestamp without time zone"); - - b.Property("IsUsed") - .HasColumnType("boolean"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("VerificationCode") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("EmailVerifications"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.Feature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccessMode") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasDefaultValue("FREE"); - - b.Property("Category") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(40) - .HasColumnType("character varying(40)") - .HasDefaultValue("general"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("CreditFeatureKey") - .HasMaxLength(40) - .HasColumnType("character varying(40)"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("IsCoreFree") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RoutePrefixesJson") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.HasKey("Id"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("Features"); - - b.HasData( - new - { - Id = 1, - AccessMode = "PLAN_REQUIRED", - Category = "self_study", - Code = "LESSONS_CONTENT", - CreatedDate = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Description = "Truy cập kho bài học JLPT đầy đủ theo cấp độ kèm nghe hiểu, đọc hiểu và lưu tiến độ.", - IsCoreFree = false, - IsDeleted = false, - Name = "Thư viện bài học JLPT", - RoutePrefixesJson = "[\"/lessons\",\"/lesson-player\",\"/riki/listening\",\"/riki/reading\"]", - SortOrder = 10 - }, - new - { - Id = 2, - AccessMode = "FREE", - Category = "core_tools", - Code = "JAPANESE_LIBRARY", - CreatedDate = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Description = "Tra cứu ngữ pháp, luyện viết Hiragana, Katakana và Kanji theo thứ tự nét miễn phí.", - IsCoreFree = true, - IsDeleted = false, - Name = "Thư viện Kana, Kanji & Ngữ pháp", - RoutePrefixesJson = "[\"/grammar\",\"/kanji-writing\",\"/vocabulary-detail\"]", - SortOrder = 3 - }, - new - { - Id = 3, - AccessMode = "FREE", - Category = "practice_exam", - Code = "PRACTICE_EXERCISES", - CreatedDate = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Description = "Làm bài luyện tập củng cố kỹ năng và bộ đề theo cấp độ JLPT.", - IsCoreFree = false, - IsDeleted = false, - Name = "Bài luyện tập theo kỹ năng", - RoutePrefixesJson = "[\"/lesson-practice\",\"/practice-sets\"]", - SortOrder = 20 - }, - new - { - Id = 4, - AccessMode = "FREE", - Category = "practice_exam", - Code = "MOCK_TESTS", - CreatedDate = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Description = "Luyện đề thi thử JLPT mô phỏng đầy đủ 4 kỹ năng và theo dõi kết quả.", - IsCoreFree = false, - IsDeleted = false, - Name = "Đề thi thử JLPT", - RoutePrefixesJson = "[\"/mock-test\",\"/mock-tests\",\"/exam-result\"]", - SortOrder = 21 - }, - new - { - Id = 5, - AccessMode = "FREE", - Category = "self_study", - Code = "STANDARD_ROADMAP", - CreatedDate = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Description = "Xem lộ trình học JLPT tiêu chuẩn theo mục tiêu, kết quả đánh giá năng lực và tiến độ học.", - IsCoreFree = false, - IsDeleted = false, - Name = "Lộ trình tiêu chuẩn & Tiến độ học", - RoutePrefixesJson = "[\"/roadmap\"]", - SortOrder = 11 - }, - new - { - Id = 6, - AccessMode = "CREDIT_REQUIRED", - Category = "ai_services", - Code = "AI_MOCK_EXPLANATION", - CreatedDate = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), - CreditFeatureKey = "mock_test_explanation", - Description = "Nhận phân tích chi tiết đáp án đề thi thử từ trợ lý AI.", - IsCoreFree = false, - IsDeleted = false, - Name = "Giải thích câu hỏi bằng AI", - SortOrder = 33 - }, - new - { - Id = 7, - AccessMode = "DISABLED", - Category = "mentor_legacy", - Code = "MENTOR_1ON1_LEGACY", - CreatedDate = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Description = "Gói cũ bao gồm 12 buổi ôn luyện trực tiếp 1-1 với Mentor (đã thay bằng lớp học nhóm).", - IsCoreFree = false, - IsDeleted = false, - Name = "12 buổi meeting 1-1 với Mentor", - SortOrder = 90 - }, - new - { - Id = 8, - AccessMode = "DISABLED", - Category = "mentor_legacy", - Code = "MENTOR_ROOM_LEGACY", - CreatedDate = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Description = "Cấu hình lịch 1-1 cũ (lớp học nhóm dùng cơ chế ghi danh khóa học riêng).", - IsCoreFree = false, - IsDeleted = false, - Name = "Đặt lịch và phòng học trực tuyến", - SortOrder = 91 - }, - new - { - Id = 9, - AccessMode = "FREE", - Category = "core_tools", - Code = "PERSONAL_NOTEBOOK", - CreatedDate = new DateTime(2026, 11, 23, 0, 0, 0, 0, DateTimeKind.Utc), - Description = "Tạo thư mục, tệp ghi chú, trang bài học, highlight và mục đã lưu cá nhân miễn phí.", - IsCoreFree = true, - IsDeleted = false, - Name = "Sổ tay cá nhân & Mini Notebook", - RoutePrefixesJson = "[\"/kanji-notebook\"]", - SortOrder = 1 - }, - new - { - Id = 10, - AccessMode = "FREE", - Category = "core_tools", - Code = "SRS_STUDY", - CreatedDate = new DateTime(2026, 11, 23, 0, 0, 0, 0, DateTimeKind.Utc), - Description = "Ôn thẻ đến hạn, 4 chế độ ôn tự do, quản lý thẻ cá nhân và thư viện thẻ mẫu miễn phí.", - IsCoreFree = true, - IsDeleted = false, - Name = "Ôn tập SRS & Thư viện thẻ mẫu", - RoutePrefixesJson = "[\"/daily-srs\"]", - SortOrder = 2 - }, - new - { - Id = 11, - AccessMode = "FREE", - Category = "practice_exam", - Code = "PLACEMENT_TEST", - CreatedDate = new DateTime(2026, 11, 23, 0, 0, 0, 0, DateTimeKind.Utc), - Description = "Làm bài đánh giá trình độ JLPT đầu vào để xác định cấp độ học phù hợp.", - IsCoreFree = false, - IsDeleted = false, - Name = "Đánh giá năng lực đầu vào", - RoutePrefixesJson = "[\"/placement\"]", - SortOrder = 19 - }, - new - { - Id = 12, - AccessMode = "CREDIT_REQUIRED", - Category = "ai_services", - Code = "AI_LEARNING_PATH", - CreatedDate = new DateTime(2026, 11, 23, 0, 0, 0, 0, DateTimeKind.Utc), - CreditFeatureKey = "learning_path", - Description = "Tạo kế hoạch học tập chi tiết theo ngày bằng AI dựa trên điểm đánh giá và ngày thi.", - IsCoreFree = false, - IsDeleted = false, - Name = "Lộ trình học cá nhân hóa bằng AI", - SortOrder = 30 - }, - new - { - Id = 13, - AccessMode = "CREDIT_REQUIRED", - Category = "ai_services", - Code = "AI_SPEAKING", - CreatedDate = new DateTime(2026, 11, 23, 0, 0, 0, 0, DateTimeKind.Utc), - CreditFeatureKey = "speaking", - Description = "Thu âm tiếng Nhật và nhận điểm phát âm, ngữ điệu cùng nhận xét chi tiết từ AI.", - IsCoreFree = false, - IsDeleted = false, - Name = "Luyện nói & Chấm phát âm AI", - RoutePrefixesJson = "[\"/riki/speaking\",\"/speech\"]", - SortOrder = 31 - }, - new - { - Id = 14, - AccessMode = "CREDIT_REQUIRED", - Category = "ai_services", - Code = "AI_WRITING", - CreatedDate = new DateTime(2026, 11, 23, 0, 0, 0, 0, DateTimeKind.Utc), - CreditFeatureKey = "writing", - Description = "Viết câu và bài luận tiếng Nhật, nhận sửa lỗi ngữ pháp và chấm điểm từ AI.", - IsCoreFree = false, - IsDeleted = false, - Name = "Luyện viết & Chấm bài luận AI", - RoutePrefixesJson = "[\"/riki/essay\",\"/sentence-studio\"]", - SortOrder = 32 - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.GradingResult", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("FeedbackJson") - .IsRequired() - .HasColumnType("text"); - - b.Property("GradedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("HomeworkSubmissionId") - .HasColumnType("integer"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("OverallScore") - .HasColumnType("double precision"); - - b.Property("PracticeSubmissionId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("HomeworkSubmissionId") - .IsUnique(); - - b.HasIndex("PracticeSubmissionId") - .IsUnique(); - - b.ToTable("GradingResults"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.GrammarPattern", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ExampleSentence") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ExampleSentenceMeaning") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ImageUrl") - .HasColumnType("text"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Published"); - - b.Property("Structure") - .IsRequired() - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("UnpublishedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("UnpublishedReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UsageNotes") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("UserAccountId") - .HasColumnType("integer"); - - b.Property("Version") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(1); - - b.HasKey("Id"); - - b.HasIndex("Status"); - - b.HasIndex("Title"); - - b.HasIndex("UserAccountId"); - - b.ToTable("GrammarPatterns"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.HomeworkAssignment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AiDraftFeedback") - .HasMaxLength(4000) - .HasColumnType("character varying(4000)"); - - b.Property("AiDraftGeneratedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("AiDraftScore") - .HasColumnType("double precision"); - - b.Property("AiDraftUnavailableReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("AssignmentScope") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(30) - .HasColumnType("character varying(30)") - .HasDefaultValue("Booking1on1"); - - b.Property("AuthoredDefinitionJson") - .HasColumnType("text"); - - b.Property("CohortAssignmentGroupKey") - .HasColumnType("uuid"); - - b.Property("CohortId") - .HasColumnType("integer"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("DueAt") - .HasColumnType("timestamp without time zone"); - - b.Property("Instructions") - .HasColumnType("text"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("LearnerId") - .HasColumnType("integer"); - - b.Property("MentorBookingId") - .HasColumnType("integer"); - - b.Property("MentorFeedback") - .HasMaxLength(4000) - .HasColumnType("character varying(4000)"); - - b.Property("MentorId") - .HasColumnType("integer"); - - b.Property("MentorScore") - .HasColumnType("double precision"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Passed") - .HasColumnType("boolean"); - - b.Property("PublishedByMentorId") - .HasColumnType("integer"); - - b.Property("PublishedFeedbackAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("StudyCourseId") - .HasColumnType("integer"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.HasKey("Id"); - - b.HasIndex("MentorBookingId"); - - b.HasIndex("MentorId"); - - b.HasIndex("StudyCourseId"); - - b.HasIndex("CohortId", "LearnerId"); - - b.HasIndex("LearnerId", "DueAt"); - - b.ToTable("HomeworkAssignments"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.HomeworkAssignmentExercise", b => - { - b.Property("HomeworkAssignmentId") - .HasColumnType("integer"); - - b.Property("PracticeExerciseId") - .HasColumnType("integer"); - - b.HasKey("HomeworkAssignmentId", "PracticeExerciseId"); - - b.HasIndex("PracticeExerciseId"); - - b.ToTable("HomeworkAssignmentExercises", (string)null); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.HomeworkAssignmentLesson", b => - { - b.Property("HomeworkAssignmentId") - .HasColumnType("integer"); - - b.Property("LessonId") - .HasColumnType("integer"); - - b.HasKey("HomeworkAssignmentId", "LessonId"); - - b.HasIndex("LessonId"); - - b.ToTable("HomeworkAssignmentLessons"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.HomeworkSubmission", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("FileUrl") - .HasColumnType("text"); - - b.Property("HomeworkAssignmentId") - .HasColumnType("integer"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("LastRevisedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("LearnerId") - .HasColumnType("integer"); - - b.Property("LessonId") - .HasColumnType("integer"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("PrivateAudioReference") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("PrivateScanReference") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("RevisionCount") - .HasColumnType("integer"); - - b.Property("ScanStorageUrl") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("SelectedOptionsJson") - .HasColumnType("text"); - - b.Property("SubmittedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("TextContent") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("HomeworkAssignmentId") - .IsUnique(); - - b.HasIndex("LearnerId"); - - b.HasIndex("LessonId"); - - b.ToTable("HomeworkSubmissions"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.JlptExamSchedule", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ExamDate") - .HasColumnType("date"); - - b.Property("ImportedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("Location") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ReviewNote") - .HasColumnType("text"); - - b.Property("ReviewedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ReviewedById") - .HasColumnType("integer"); - - b.Property("SourceKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SourceUrl") - .IsRequired() - .HasColumnType("text"); - - b.Property("Status") - .IsConcurrencyToken() - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("SourceKey") - .IsUnique(); - - b.ToTable("JlptExamSchedules", (string)null); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.JlptLevelPayCoefficient", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CertificateLevelId") - .HasColumnType("integer"); - - b.Property("Coefficient") - .HasPrecision(10, 4) - .HasColumnType("numeric(10,4)"); - - b.Property("ConfiguredByAdminId") - .HasColumnType("integer"); - - b.Property("CreatedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFromUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveUntilUtc") - .HasColumnType("timestamp with time zone"); - - b.HasKey("Id"); - - b.HasIndex("ConfiguredByAdminId"); - - b.HasIndex("CertificateLevelId", "EffectiveFromUtc") - .IsUnique(); - - b.ToTable("JlptLevelPayCoefficients", t => - { - t.HasCheckConstraint("CK_JlptLevelPayCoefficient_Positive", "\"Coefficient\" > 0"); - - t.HasCheckConstraint("CK_JlptLevelPayCoefficient_Range", "\"EffectiveUntilUtc\" IS NULL OR \"EffectiveUntilUtc\" > \"EffectiveFromUtc\""); - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.KanaCharacter", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AudioUrl") - .HasColumnType("text"); - - b.Property("Character") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Romaji") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StrokeCount") - .HasColumnType("integer"); - - b.Property("StrokeOrderImageUrl") - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("Id"); - - b.HasIndex("Character", "Type") - .IsUnique(); - - b.ToTable("KanaCharacters"); - - b.HasData( - new - { - Id = 1, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/2/22/Ja-a.ogg", - Character = "あ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1757), - IsDeleted = false, - Romaji = "a", - StrokeCount = 3, - Type = "Hiragana" - }, - new - { - Id = 2, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/2/28/Ja-i.ogg", - Character = "い", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1766), - IsDeleted = false, - Romaji = "i", - StrokeCount = 2, - Type = "Hiragana" - }, - new - { - Id = 3, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/a/a2/Ja-u.ogg", - Character = "う", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1768), - IsDeleted = false, - Romaji = "u", - StrokeCount = 2, - Type = "Hiragana" - }, - new - { - Id = 4, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/2/21/Ja-e.ogg", - Character = "え", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1770), - IsDeleted = false, - Romaji = "e", - StrokeCount = 2, - Type = "Hiragana" - }, - new - { - Id = 5, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/d/df/Ja-o.ogg", - Character = "お", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1771), - IsDeleted = false, - Romaji = "o", - StrokeCount = 3, - Type = "Hiragana" - }, - new - { - Id = 6, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/2/2e/Ja-ka.ogg", - Character = "か", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1774), - IsDeleted = false, - Romaji = "ka", - StrokeCount = 3, - Type = "Hiragana" - }, - new - { - Id = 7, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/8/87/Ja-ki.ogg", - Character = "き", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1775), - IsDeleted = false, - Romaji = "ki", - StrokeCount = 4, - Type = "Hiragana" - }, - new - { - Id = 8, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/a/a3/Ja-ku.ogg", - Character = "く", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1776), - IsDeleted = false, - Romaji = "ku", - StrokeCount = 1, - Type = "Hiragana" - }, - new - { - Id = 9, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/b/b3/Ja-ke.ogg", - Character = "け", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1830), - IsDeleted = false, - Romaji = "ke", - StrokeCount = 3, - Type = "Hiragana" - }, - new - { - Id = 10, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/1/18/Ja-ko.ogg", - Character = "こ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1832), - IsDeleted = false, - Romaji = "ko", - StrokeCount = 2, - Type = "Hiragana" - }, - new - { - Id = 11, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/a/a9/Ja-sa.ogg", - Character = "さ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1833), - IsDeleted = false, - Romaji = "sa", - StrokeCount = 3, - Type = "Hiragana" - }, - new - { - Id = 12, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/8/80/Ja-shi.ogg", - Character = "し", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1834), - IsDeleted = false, - Romaji = "shi", - StrokeCount = 1, - Type = "Hiragana" - }, - new - { - Id = 13, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/a/a7/Ja-su.ogg", - Character = "す", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1835), - IsDeleted = false, - Romaji = "su", - StrokeCount = 2, - Type = "Hiragana" - }, - new - { - Id = 14, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/a/a8/Ja-se.ogg", - Character = "せ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1836), - IsDeleted = false, - Romaji = "se", - StrokeCount = 3, - Type = "Hiragana" - }, - new - { - Id = 15, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/0/00/Ja-so.ogg", - Character = "そ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1837), - IsDeleted = false, - Romaji = "so", - StrokeCount = 1, - Type = "Hiragana" - }, - new - { - Id = 16, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/d/d2/Ja-ta.ogg", - Character = "た", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1838), - IsDeleted = false, - Romaji = "ta", - StrokeCount = 4, - Type = "Hiragana" - }, - new - { - Id = 17, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/3/38/Ja-chi.ogg", - Character = "ち", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1838), - IsDeleted = false, - Romaji = "chi", - StrokeCount = 2, - Type = "Hiragana" - }, - new - { - Id = 18, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/3/32/Ja-tsu.ogg", - Character = "つ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1840), - IsDeleted = false, - Romaji = "tsu", - StrokeCount = 1, - Type = "Hiragana" - }, - new - { - Id = 19, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/1/10/Ja-te.ogg", - Character = "て", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1841), - IsDeleted = false, - Romaji = "te", - StrokeCount = 1, - Type = "Hiragana" - }, - new - { - Id = 20, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/a/a5/Ja-to.ogg", - Character = "と", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1842), - IsDeleted = false, - Romaji = "to", - StrokeCount = 2, - Type = "Hiragana" - }, - new - { - Id = 21, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/9/92/Ja-na.ogg", - Character = "な", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1843), - IsDeleted = false, - Romaji = "na", - StrokeCount = 4, - Type = "Hiragana" - }, - new - { - Id = 22, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/b/b7/Ja-ni.ogg", - Character = "に", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1844), - IsDeleted = false, - Romaji = "ni", - StrokeCount = 3, - Type = "Hiragana" - }, - new - { - Id = 23, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/b/b1/Ja-nu.ogg", - Character = "ぬ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1845), - IsDeleted = false, - Romaji = "nu", - StrokeCount = 2, - Type = "Hiragana" - }, - new - { - Id = 24, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/8/86/Ja-ne.ogg", - Character = "ね", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1845), - IsDeleted = false, - Romaji = "ne", - StrokeCount = 2, - Type = "Hiragana" - }, - new - { - Id = 25, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/5/54/Ja-no.ogg", - Character = "の", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1846), - IsDeleted = false, - Romaji = "no", - StrokeCount = 1, - Type = "Hiragana" - }, - new - { - Id = 26, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/0/08/Ja-ha.ogg", - Character = "は", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1847), - IsDeleted = false, - Romaji = "ha", - StrokeCount = 3, - Type = "Hiragana" - }, - new - { - Id = 27, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/9/99/Ja-hi.ogg", - Character = "ひ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1848), - IsDeleted = false, - Romaji = "hi", - StrokeCount = 1, - Type = "Hiragana" - }, - new - { - Id = 28, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/7/70/Ja-fu.ogg", - Character = "ふ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1849), - IsDeleted = false, - Romaji = "fu", - StrokeCount = 4, - Type = "Hiragana" - }, - new - { - Id = 29, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/2/2a/Ja-he.ogg", - Character = "へ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1849), - IsDeleted = false, - Romaji = "he", - StrokeCount = 1, - Type = "Hiragana" - }, - new - { - Id = 30, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/a/a4/Ja-ho.ogg", - Character = "ほ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1850), - IsDeleted = false, - Romaji = "ho", - StrokeCount = 4, - Type = "Hiragana" - }, - new - { - Id = 31, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/0/0d/Ja-ma.ogg", - Character = "ま", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1851), - IsDeleted = false, - Romaji = "ma", - StrokeCount = 3, - Type = "Hiragana" - }, - new - { - Id = 32, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/1/16/Ja-mi.ogg", - Character = "み", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1852), - IsDeleted = false, - Romaji = "mi", - StrokeCount = 2, - Type = "Hiragana" - }, - new - { - Id = 33, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/e/eb/Ja-mu.ogg", - Character = "む", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1852), - IsDeleted = false, - Romaji = "mu", - StrokeCount = 3, - Type = "Hiragana" - }, - new - { - Id = 34, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/8/8b/Ja-me.ogg", - Character = "め", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1913), - IsDeleted = false, - Romaji = "me", - StrokeCount = 2, - Type = "Hiragana" - }, - new - { - Id = 35, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/c/c1/Ja-mo.ogg", - Character = "も", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1915), - IsDeleted = false, - Romaji = "mo", - StrokeCount = 3, - Type = "Hiragana" - }, - new - { - Id = 36, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/e/e8/Ja-ya.ogg", - Character = "や", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1915), - IsDeleted = false, - Romaji = "ya", - StrokeCount = 3, - Type = "Hiragana" - }, - new - { - Id = 37, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/7/7b/Ja-yu.ogg", - Character = "ゆ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1916), - IsDeleted = false, - Romaji = "yu", - StrokeCount = 2, - Type = "Hiragana" - }, - new - { - Id = 38, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/c/c9/Ja-yo.ogg", - Character = "よ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1917), - IsDeleted = false, - Romaji = "yo", - StrokeCount = 2, - Type = "Hiragana" - }, - new - { - Id = 39, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/0/04/Ja-ra.ogg", - Character = "ら", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1918), - IsDeleted = false, - Romaji = "ra", - StrokeCount = 2, - Type = "Hiragana" - }, - new - { - Id = 40, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/7/76/Ja-ri.ogg", - Character = "り", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1919), - IsDeleted = false, - Romaji = "ri", - StrokeCount = 2, - Type = "Hiragana" - }, - new - { - Id = 41, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/5/56/Ja-ru.ogg", - Character = "る", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1920), - IsDeleted = false, - Romaji = "ru", - StrokeCount = 1, - Type = "Hiragana" - }, - new - { - Id = 42, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/5/57/Ja-re.ogg", - Character = "れ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1920), - IsDeleted = false, - Romaji = "re", - StrokeCount = 2, - Type = "Hiragana" - }, - new - { - Id = 43, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/e/ed/Ja-ro.ogg", - Character = "ろ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1922), - IsDeleted = false, - Romaji = "ro", - StrokeCount = 1, - Type = "Hiragana" - }, - new - { - Id = 44, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/f/f2/Ja-wa.ogg", - Character = "わ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1922), - IsDeleted = false, - Romaji = "wa", - StrokeCount = 2, - Type = "Hiragana" - }, - new - { - Id = 45, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/7/77/Ja-wo.ogg", - Character = "を", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1923), - IsDeleted = false, - Romaji = "wo", - StrokeCount = 3, - Type = "Hiragana" - }, - new - { - Id = 46, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/0/0c/Ja-n.ogg", - Character = "ん", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1924), - IsDeleted = false, - Romaji = "n", - StrokeCount = 1, - Type = "Hiragana" - }, - new - { - Id = 47, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/2/22/Ja-a.ogg", - Character = "ア", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1955), - IsDeleted = false, - Romaji = "a", - StrokeCount = 2, - Type = "Katakana" - }, - new - { - Id = 48, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/2/28/Ja-i.ogg", - Character = "イ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1958), - IsDeleted = false, - Romaji = "i", - StrokeCount = 2, - Type = "Katakana" - }, - new - { - Id = 49, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/a/a2/Ja-u.ogg", - Character = "ウ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1959), - IsDeleted = false, - Romaji = "u", - StrokeCount = 3, - Type = "Katakana" - }, - new - { - Id = 50, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/2/21/Ja-e.ogg", - Character = "エ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1960), - IsDeleted = false, - Romaji = "e", - StrokeCount = 3, - Type = "Katakana" - }, - new - { - Id = 51, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/d/df/Ja-o.ogg", - Character = "オ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1961), - IsDeleted = false, - Romaji = "o", - StrokeCount = 3, - Type = "Katakana" - }, - new - { - Id = 52, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/2/2e/Ja-ka.ogg", - Character = "カ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1961), - IsDeleted = false, - Romaji = "ka", - StrokeCount = 2, - Type = "Katakana" - }, - new - { - Id = 53, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/8/87/Ja-ki.ogg", - Character = "キ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1962), - IsDeleted = false, - Romaji = "ki", - StrokeCount = 3, - Type = "Katakana" - }, - new - { - Id = 54, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/a/a3/Ja-ku.ogg", - Character = "ク", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1963), - IsDeleted = false, - Romaji = "ku", - StrokeCount = 2, - Type = "Katakana" - }, - new - { - Id = 55, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/b/b3/Ja-ke.ogg", - Character = "ケ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(1964), - IsDeleted = false, - Romaji = "ke", - StrokeCount = 3, - Type = "Katakana" - }, - new - { - Id = 56, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/1/18/Ja-ko.ogg", - Character = "コ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2006), - IsDeleted = false, - Romaji = "ko", - StrokeCount = 2, - Type = "Katakana" - }, - new - { - Id = 57, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/a/a9/Ja-sa.ogg", - Character = "サ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2009), - IsDeleted = false, - Romaji = "sa", - StrokeCount = 3, - Type = "Katakana" - }, - new - { - Id = 58, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/8/80/Ja-shi.ogg", - Character = "シ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2010), - IsDeleted = false, - Romaji = "shi", - StrokeCount = 3, - Type = "Katakana" - }, - new - { - Id = 59, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/a/a7/Ja-su.ogg", - Character = "ス", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2011), - IsDeleted = false, - Romaji = "su", - StrokeCount = 2, - Type = "Katakana" - }, - new - { - Id = 60, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/a/a8/Ja-se.ogg", - Character = "セ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2012), - IsDeleted = false, - Romaji = "se", - StrokeCount = 2, - Type = "Katakana" - }, - new - { - Id = 61, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/0/00/Ja-so.ogg", - Character = "ソ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2014), - IsDeleted = false, - Romaji = "so", - StrokeCount = 2, - Type = "Katakana" - }, - new - { - Id = 62, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/d/d2/Ja-ta.ogg", - Character = "タ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2015), - IsDeleted = false, - Romaji = "ta", - StrokeCount = 3, - Type = "Katakana" - }, - new - { - Id = 63, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/3/38/Ja-chi.ogg", - Character = "チ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2016), - IsDeleted = false, - Romaji = "chi", - StrokeCount = 3, - Type = "Katakana" - }, - new - { - Id = 64, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/3/32/Ja-tsu.ogg", - Character = "ツ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2017), - IsDeleted = false, - Romaji = "tsu", - StrokeCount = 3, - Type = "Katakana" - }, - new - { - Id = 65, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/1/10/Ja-te.ogg", - Character = "テ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2019), - IsDeleted = false, - Romaji = "te", - StrokeCount = 3, - Type = "Katakana" - }, - new - { - Id = 66, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/a/a5/Ja-to.ogg", - Character = "ト", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2022), - IsDeleted = false, - Romaji = "to", - StrokeCount = 2, - Type = "Katakana" - }, - new - { - Id = 67, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/9/92/Ja-na.ogg", - Character = "ナ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2023), - IsDeleted = false, - Romaji = "na", - StrokeCount = 2, - Type = "Katakana" - }, - new - { - Id = 68, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/b/b7/Ja-ni.ogg", - Character = "ニ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2024), - IsDeleted = false, - Romaji = "ni", - StrokeCount = 2, - Type = "Katakana" - }, - new - { - Id = 69, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/b/b1/Ja-nu.ogg", - Character = "ヌ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2026), - IsDeleted = false, - Romaji = "nu", - StrokeCount = 2, - Type = "Katakana" - }, - new - { - Id = 70, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/8/86/Ja-ne.ogg", - Character = "ネ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2027), - IsDeleted = false, - Romaji = "ne", - StrokeCount = 4, - Type = "Katakana" - }, - new - { - Id = 71, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/5/54/Ja-no.ogg", - Character = "ノ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2028), - IsDeleted = false, - Romaji = "no", - StrokeCount = 1, - Type = "Katakana" - }, - new - { - Id = 72, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/0/08/Ja-ha.ogg", - Character = "ハ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2029), - IsDeleted = false, - Romaji = "ha", - StrokeCount = 2, - Type = "Katakana" - }, - new - { - Id = 73, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/9/99/Ja-hi.ogg", - Character = "ヒ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2030), - IsDeleted = false, - Romaji = "hi", - StrokeCount = 2, - Type = "Katakana" - }, - new - { - Id = 74, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/7/70/Ja-fu.ogg", - Character = "フ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2032), - IsDeleted = false, - Romaji = "fu", - StrokeCount = 1, - Type = "Katakana" - }, - new - { - Id = 75, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/2/2a/Ja-he.ogg", - Character = "ヘ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2033), - IsDeleted = false, - Romaji = "he", - StrokeCount = 1, - Type = "Katakana" - }, - new - { - Id = 76, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/a/a4/Ja-ho.ogg", - Character = "ホ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2034), - IsDeleted = false, - Romaji = "ho", - StrokeCount = 4, - Type = "Katakana" - }, - new - { - Id = 77, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/0/0d/Ja-ma.ogg", - Character = "マ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2036), - IsDeleted = false, - Romaji = "ma", - StrokeCount = 2, - Type = "Katakana" - }, - new - { - Id = 78, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/1/16/Ja-mi.ogg", - Character = "ミ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2037), - IsDeleted = false, - Romaji = "mi", - StrokeCount = 3, - Type = "Katakana" - }, - new - { - Id = 79, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/e/eb/Ja-mu.ogg", - Character = "ム", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2038), - IsDeleted = false, - Romaji = "mu", - StrokeCount = 2, - Type = "Katakana" - }, - new - { - Id = 80, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/8/8b/Ja-me.ogg", - Character = "メ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2039), - IsDeleted = false, - Romaji = "me", - StrokeCount = 2, - Type = "Katakana" - }, - new - { - Id = 81, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/c/c1/Ja-mo.ogg", - Character = "モ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2086), - IsDeleted = false, - Romaji = "mo", - StrokeCount = 3, - Type = "Katakana" - }, - new - { - Id = 82, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/e/e8/Ja-ya.ogg", - Character = "ヤ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2087), - IsDeleted = false, - Romaji = "ya", - StrokeCount = 2, - Type = "Katakana" - }, - new - { - Id = 83, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/7/7b/Ja-yu.ogg", - Character = "ユ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2088), - IsDeleted = false, - Romaji = "yu", - StrokeCount = 2, - Type = "Katakana" - }, - new - { - Id = 84, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/c/c9/Ja-yo.ogg", - Character = "ヨ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2089), - IsDeleted = false, - Romaji = "yo", - StrokeCount = 3, - Type = "Katakana" - }, - new - { - Id = 85, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/0/04/Ja-ra.ogg", - Character = "ラ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2090), - IsDeleted = false, - Romaji = "ra", - StrokeCount = 2, - Type = "Katakana" - }, - new - { - Id = 86, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/7/76/Ja-ri.ogg", - Character = "リ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2092), - IsDeleted = false, - Romaji = "ri", - StrokeCount = 2, - Type = "Katakana" - }, - new - { - Id = 87, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/5/56/Ja-ru.ogg", - Character = "ル", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2093), - IsDeleted = false, - Romaji = "ru", - StrokeCount = 2, - Type = "Katakana" - }, - new - { - Id = 88, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/5/57/Ja-re.ogg", - Character = "レ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2094), - IsDeleted = false, - Romaji = "re", - StrokeCount = 1, - Type = "Katakana" - }, - new - { - Id = 89, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/e/ed/Ja-ro.ogg", - Character = "ロ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2096), - IsDeleted = false, - Romaji = "ro", - StrokeCount = 3, - Type = "Katakana" - }, - new - { - Id = 90, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/f/f2/Ja-wa.ogg", - Character = "ワ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2097), - IsDeleted = false, - Romaji = "wa", - StrokeCount = 2, - Type = "Katakana" - }, - new - { - Id = 91, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/7/77/Ja-wo.ogg", - Character = "ヲ", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2098), - IsDeleted = false, - Romaji = "wo", - StrokeCount = 3, - Type = "Katakana" - }, - new - { - Id = 92, - AudioUrl = "https://upload.wikimedia.org/wikipedia/commons/0/0c/Ja-n.ogg", - Character = "ン", - CreatedDate = new DateTime(2026, 10, 26, 16, 6, 11, 768, DateTimeKind.Utc).AddTicks(2099), - IsDeleted = false, - Romaji = "n", - StrokeCount = 2, - Type = "Katakana" - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.KanaWritingPracticeCard", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("EaseFactor") - .HasColumnType("double precision"); - - b.Property("IntervalDays") - .HasColumnType("integer"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("KanaCharacterId") - .HasColumnType("integer"); - - b.Property("LastReviewedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("NextReviewDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Repetitions") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("KanaCharacterId"); - - b.HasIndex("UserId", "KanaCharacterId") - .IsUnique(); - - b.HasIndex("UserId", "NextReviewDate"); - - b.ToTable("KanaWritingPracticeCards"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.KanaWritingPracticeHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("KanaWritingPracticeCardId") - .HasColumnType("integer"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Quality") - .HasColumnType("integer"); - - b.Property("Rating") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReviewedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("TotalMistakes") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("KanaWritingPracticeCardId"); - - b.ToTable("KanaWritingPracticeHistories"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.Kanji", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AudioUrl") - .HasColumnType("text"); - - b.Property("Character") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ImageUrl") - .HasColumnType("text"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("KunYomi") - .HasColumnType("text"); - - b.Property("Meaning") - .IsRequired() - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("OnYomi") - .HasColumnType("text"); - - b.Property("SinoVietnamese") - .HasColumnType("text"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Published"); - - b.Property("StrokeCount") - .HasColumnType("integer"); - - b.Property("StrokeOrderImageUrl") - .HasColumnType("text"); - - b.Property("UnpublishedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("UnpublishedReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserAccountId") - .HasColumnType("integer"); - - b.Property("Version") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(1); - - b.HasKey("Id"); - - b.HasIndex("Character"); - - b.HasIndex("Status"); - - b.HasIndex("UserAccountId"); - - b.ToTable("Kanjis"); - - b.HasData( - new - { - Id = 910001, - Character = "日", - CreatedDate = new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc), - IsDeleted = false, - KunYomi = "ひ、か", - Meaning = "Mặt trời; ngày", - OnYomi = "ニチ、ジツ", - SinoVietnamese = "Nhật", - Status = "Published", - StrokeCount = 4, - Version = 1 - }, - new - { - Id = 910002, - Character = "月", - CreatedDate = new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc), - IsDeleted = false, - KunYomi = "つき", - Meaning = "Mặt trăng; tháng", - OnYomi = "ゲツ、ガツ", - SinoVietnamese = "Nguyệt", - Status = "Published", - StrokeCount = 4, - Version = 1 - }, - new - { - Id = 910003, - Character = "火", - CreatedDate = new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc), - IsDeleted = false, - KunYomi = "ひ、ほ", - Meaning = "Lửa", - OnYomi = "カ", - SinoVietnamese = "Hỏa", - Status = "Published", - StrokeCount = 4, - Version = 1 - }, - new - { - Id = 910004, - Character = "水", - CreatedDate = new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc), - IsDeleted = false, - KunYomi = "みず", - Meaning = "Nước", - OnYomi = "スイ", - SinoVietnamese = "Thủy", - Status = "Published", - StrokeCount = 4, - Version = 1 - }, - new - { - Id = 910005, - Character = "木", - CreatedDate = new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc), - IsDeleted = false, - KunYomi = "き、こ", - Meaning = "Cây; gỗ", - OnYomi = "モク、ボク", - SinoVietnamese = "Mộc", - Status = "Published", - StrokeCount = 4, - Version = 1 - }, - new - { - Id = 910006, - Character = "金", - CreatedDate = new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc), - IsDeleted = false, - KunYomi = "かね、かな", - Meaning = "Vàng; tiền", - OnYomi = "キン、コン", - SinoVietnamese = "Kim", - Status = "Published", - StrokeCount = 8, - Version = 1 - }, - new - { - Id = 910007, - Character = "土", - CreatedDate = new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc), - IsDeleted = false, - KunYomi = "つち", - Meaning = "Đất", - OnYomi = "ド、ト", - SinoVietnamese = "Thổ", - Status = "Published", - StrokeCount = 3, - Version = 1 - }, - new - { - Id = 910008, - Character = "山", - CreatedDate = new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc), - IsDeleted = false, - KunYomi = "やま", - Meaning = "Núi", - OnYomi = "サン", - SinoVietnamese = "Sơn", - Status = "Published", - StrokeCount = 3, - Version = 1 - }, - new - { - Id = 910009, - Character = "川", - CreatedDate = new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc), - IsDeleted = false, - KunYomi = "かわ", - Meaning = "Sông", - OnYomi = "セン", - SinoVietnamese = "Xuyên", - Status = "Published", - StrokeCount = 3, - Version = 1 - }, - new - { - Id = 910010, - Character = "人", - CreatedDate = new DateTime(2026, 10, 3, 0, 0, 0, 0, DateTimeKind.Utc), - IsDeleted = false, - KunYomi = "ひと", - Meaning = "Người", - OnYomi = "ジン、ニン", - SinoVietnamese = "Nhân", - Status = "Published", - StrokeCount = 2, - Version = 1 - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.LanguageSkill", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Code") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("Id"); - - b.HasIndex("Code") - .IsUnique() - .HasFilter("\"Code\" IS NOT NULL"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("LanguageSkills"); - - b.HasData( - new - { - Id = 1, - Code = "VOCABULARY", - CreatedDate = new DateTime(2026, 9, 29, 0, 0, 0, 0, DateTimeKind.Utc), - Description = "Japanese vocabulary learning skill.", - IsDeleted = false, - Name = "Vocabulary" - }, - new - { - Id = 2, - Code = "KANJI", - CreatedDate = new DateTime(2026, 9, 29, 0, 0, 0, 0, DateTimeKind.Utc), - Description = "Japanese kanji learning skill.", - IsDeleted = false, - Name = "Kanji" - }, - new - { - Id = 3, - Code = "GRAMMAR", - CreatedDate = new DateTime(2026, 9, 29, 0, 0, 0, 0, DateTimeKind.Utc), - Description = "Japanese grammar learning skill.", - IsDeleted = false, - Name = "Grammar" - }, - new - { - Id = 4, - Code = "LISTENING", - CreatedDate = new DateTime(2026, 9, 29, 0, 0, 0, 0, DateTimeKind.Utc), - Description = "Japanese listening comprehension skill.", - IsDeleted = false, - Name = "Listening" - }, - new - { - Id = 5, - Code = "READING", - CreatedDate = new DateTime(2026, 9, 29, 0, 0, 0, 0, DateTimeKind.Utc), - Description = "Japanese reading comprehension skill.", - IsDeleted = false, - Name = "Reading" - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.LearnerEssay", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ContentText") - .IsRequired() - .HasColumnType("text"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ImageStoragePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ImageUrl") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("OcrLanguage") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("OriginalOcrText") - .IsRequired() - .HasColumnType("text"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("UserId", "CreatedDate"); - - b.ToTable("LearnerEssays"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.LearnerFeedback", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("CreatedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("LearnerId") - .HasColumnType("integer"); - - b.Property("Rating") - .HasColumnType("integer"); - - b.Property("TargetId") - .HasColumnType("integer"); - - b.Property("TargetTitle") - .IsRequired() - .HasColumnType("text"); - - b.Property("TargetType") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("UpdatedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("UpdatedAtUtc", "Id"); - - b.HasIndex("LearnerId", "TargetType", "TargetId") - .IsUnique(); - - b.ToTable("LearnerFeedback", null, t => - { - t.HasCheckConstraint("CK_LearnerFeedback_Rating", "\"Rating\" BETWEEN 1 AND 5"); - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.LearnerHighlight", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AnchorPrefix") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AnchorSuffix") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Color") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentVersionHash") - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("EndOffset") - .HasColumnType("integer"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("LinkedNoteEntryId") - .HasColumnType("integer"); - - b.Property("LinkedReviewCardId") - .HasColumnType("integer"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Note") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("SelectedText") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("SourcePath") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("SourceTitle") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("StartOffset") - .HasColumnType("integer"); - - b.Property("TargetId") - .HasColumnType("integer"); - - b.Property("TargetKey") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("TargetType") - .IsRequired() - .HasMaxLength(40) - .HasColumnType("character varying(40)"); - - b.Property("TranslationSnapshot") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("LinkedNoteEntryId"); - - b.HasIndex("LinkedReviewCardId"); - - b.HasIndex("UserId", "CreatedDate"); - - b.HasIndex("UserId", "TargetKey"); - - b.HasIndex("UserId", "TargetType", "TargetId"); - - b.ToTable("LearnerHighlights"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.LearnerNote", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("FolderId") - .HasColumnType("integer"); - - b.Property("IsDefault") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Revision") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(1); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("FolderId"); - - b.HasIndex("UserId") - .IsUnique() - .HasDatabaseName("IX_LearnerNotes_UserId_IsDefault") - .HasFilter("\"IsDeleted\" = false AND \"IsDefault\" = true"); - - b.HasIndex("UserId", "Name"); - - b.HasIndex("UserId", "FolderId", "IsDeleted", "SortOrder"); - - b.ToTable("LearnerNotes"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.LearnerNoteEntry", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ContextSnippet") - .HasMaxLength(600) - .HasColumnType("character varying(600)"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ExampleMeaning") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ExampleSentence") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("GrammarPatternId") - .HasColumnType("integer"); - - b.Property("HighlightColor") - .HasMaxLength(24) - .HasColumnType("character varying(24)"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("IsFavorite") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ItemKind") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasDefaultValue("manual"); - - b.Property("KanjiId") - .HasColumnType("integer") - .HasColumnName("KanjiEntryId"); - - b.Property("LearnerNoteId") - .HasColumnType("integer") - .HasColumnName("VocabularyListId"); - - b.Property("ManualMeaning") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ManualReading") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ManualWord") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Note") - .HasColumnType("text"); - - b.Property("NotebookPageId") - .HasColumnType("integer"); - - b.Property("Revision") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(1); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("SourceId") - .HasColumnType("integer"); - - b.Property("SourcePath") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("SourceTitle") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceType") - .HasMaxLength(40) - .HasColumnType("character varying(40)"); - - b.Property("TagsJson") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("jsonb") - .HasDefaultValueSql("'[]'::jsonb"); - - b.Property("VocabularyId") - .HasColumnType("integer") - .HasColumnName("VocabularyEntryId"); - - b.HasKey("Id"); - - b.HasIndex("GrammarPatternId"); - - b.HasIndex("KanjiId"); - - b.HasIndex("VocabularyId"); - - b.HasIndex("LearnerNoteId", "IsDeleted"); - - b.HasIndex("NotebookPageId", "IsDeleted", "SortOrder"); - - b.ToTable("LearnerNoteEntries"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.LearnerPracticeAnswer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("IsCorrect") - .HasColumnType("boolean"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("PracticeExerciseAttemptId") - .HasColumnType("integer"); - - b.Property("PracticeQuestionId") - .HasColumnType("integer"); - - b.Property("SelectedOptionId") - .HasColumnType("integer"); - - b.Property("TextAnswer") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("PracticeQuestionId"); - - b.HasIndex("SelectedOptionId"); - - b.HasIndex("PracticeExerciseAttemptId", "PracticeQuestionId") - .IsUnique(); - - b.ToTable("LearnerPracticeAnswers"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.Lesson", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AudioUrl") - .HasColumnType("text"); - - b.Property("CertificateLevelId") - .HasColumnType("integer") - .HasColumnName("CertificationLevelId"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("EstimatedMinutes") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(15); - - b.Property("ImageUrl") - .HasColumnType("text"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("LanguageSkillId") - .HasColumnType("integer") - .HasColumnName("SkillId"); - - b.Property("LearningObjectives") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("PrerequisiteLessonId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("SourceProvenance") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Published"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("TopicId") - .HasColumnType("integer"); - - b.Property("UnpublishedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("UnpublishedReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserAccountId") - .HasColumnType("integer"); - - b.Property("Version") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(1); - - b.HasKey("Id"); - - b.HasIndex("LanguageSkillId"); - - b.HasIndex("PrerequisiteLessonId"); - - b.HasIndex("Status"); - - b.HasIndex("TopicId"); - - b.HasIndex("UserAccountId"); - - b.HasIndex("CertificateLevelId", "LanguageSkillId"); - - b.ToTable("Lessons"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.LessonGrammar", b => - { - b.Property("LessonId") - .HasColumnType("integer"); - - b.Property("GrammarPatternId") - .HasColumnType("integer") - .HasColumnName("GrammarPointId"); - - b.HasKey("LessonId", "GrammarPatternId"); - - b.HasIndex("GrammarPatternId"); - - b.ToTable("LessonGrammars"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.LessonKanji", b => - { - b.Property("LessonId") - .HasColumnType("integer"); - - b.Property("KanjiId") - .HasColumnType("integer") - .HasColumnName("KanjiEntryId"); - - b.HasKey("LessonId", "KanjiId"); - - b.HasIndex("KanjiId"); - - b.ToTable("LessonKanjis"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.LessonProgress", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CompletedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("FirstViewedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("InteractionCount") - .HasColumnType("integer"); - - b.Property("IsCompleted") - .HasColumnType("boolean"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("LastInteractedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("LastPositionSeconds") - .HasColumnType("integer"); - - b.Property("LastWatchedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("LessonId") - .HasColumnType("integer"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ProgressPercent") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("LessonId"); - - b.HasIndex("UserId", "LessonId") - .IsUnique(); - - b.ToTable("LessonProgresses"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.LessonVocabulary", b => - { - b.Property("LessonId") - .HasColumnType("integer"); - - b.Property("VocabularyId") - .HasColumnType("integer") - .HasColumnName("VocabularyEntryId"); - - b.HasKey("LessonId", "VocabularyId"); - - b.HasIndex("VocabularyId"); - - b.ToTable("LessonVocabularies"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorAbuseReport", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AdminNotes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Category") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("CreatedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("MentorBookingId") - .HasColumnType("integer"); - - b.Property("ReporterId") - .HasColumnType("integer"); - - b.Property("ReviewedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("ReviewedByAdminId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("TargetUserId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("MentorBookingId"); - - b.HasIndex("ReporterId") - .HasDatabaseName("IX_MentorAbuseReports_ReporterId"); - - b.HasIndex("Status") - .HasDatabaseName("IX_MentorAbuseReports_Status"); - - b.HasIndex("TargetUserId") - .HasDatabaseName("IX_MentorAbuseReports_TargetUserId"); - - b.ToTable("MentorAbuseReports", (string)null); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorAttendanceApproval", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ApprovedEligibleMinutes") - .HasColumnType("integer"); - - b.Property("CreatedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("DecisionReason") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("EvidenceSummary") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("MentorBookingId") - .HasColumnType("integer"); - - b.Property("RawLearnerDurationSeconds") - .HasColumnType("integer"); - - b.Property("RawMentorDurationSeconds") - .HasColumnType("integer"); - - b.Property("ReviewedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("ReviewedByAdminId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(40) - .HasColumnType("character varying(40)"); - - b.Property("UpdatedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("Version") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("Id"); - - b.HasIndex("MentorBookingId") - .IsUnique(); - - b.HasIndex("ReviewedByAdminId"); - - b.ToTable("MentorAttendanceApprovals", t => - { - t.HasCheckConstraint("CK_MentorAttendanceApproval_Minutes", "\"ApprovedEligibleMinutes\" IS NULL OR (\"ApprovedEligibleMinutes\" > 0 AND \"ApprovedEligibleMinutes\" <= 90)"); - - t.HasCheckConstraint("CK_MentorAttendanceApproval_RawDuration", "\"RawMentorDurationSeconds\" >= 0 AND \"RawLearnerDurationSeconds\" >= 0"); - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorAttendanceRecord", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CourseSessionId") - .HasColumnType("integer"); - - b.Property("CreatedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("FirstJoinedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("LastJoinedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("LastSeenAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("LeftAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("MentorBookingId") - .HasColumnType("integer"); - - b.Property("ReconnectionCount") - .HasColumnType("integer"); - - b.Property("Role") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("RoomId") - .HasColumnType("uuid"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("TotalDurationSeconds") - .HasColumnType("integer"); - - b.Property("UpdatedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("CourseSessionId"); - - b.HasIndex("RoomId") - .HasDatabaseName("IX_MentorAttendanceRecords_RoomId"); - - b.HasIndex("Status") - .HasDatabaseName("IX_MentorAttendanceRecords_Status"); - - b.HasIndex("UserId") - .HasDatabaseName("IX_MentorAttendanceRecords_UserId"); - - b.HasIndex("MentorBookingId", "UserId") - .IsUnique() - .HasDatabaseName("IX_MentorAttendanceRecords_Booking_User"); - - b.HasIndex("RoomId", "UserId") - .IsUnique() - .HasFilter("\"MentorBookingId\" IS NULL"); - - b.ToTable("MentorAttendanceRecords", null, t => - { - t.HasCheckConstraint("CK_MentorAttendanceRecord_Duration", "\"TotalDurationSeconds\" >= 0"); - - t.HasCheckConstraint("CK_MentorAttendanceRecord_Reconnection", "\"ReconnectionCount\" >= 0"); - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorAvailability", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AdminName") - .HasColumnType("text"); - - b.Property("AttendanceTrackingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BookedCount") - .HasColumnType("integer"); - - b.Property("CancelReason") - .HasColumnType("text"); - - b.Property("CancelRejectedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CancelRejectionReason") - .HasColumnType("text"); - - b.Property("CancelRequestedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ChangeRequestReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ChangeRequestedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ChangeResolution") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp without time zone"); - - b.Property("GenerationKey") - .HasMaxLength(160) - .HasColumnType("character varying(160)"); - - b.Property("GroupPolicyId") - .HasColumnType("integer"); - - b.Property("IsApproved") - .HasColumnType("boolean"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("LocalBusinessDate") - .HasColumnType("date"); - - b.Property("MaxLearners") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(1); - - b.Property("MentorId") - .HasColumnType("integer"); - - b.Property("MentorScheduleRuleId") - .HasColumnType("bigint"); - - b.Property("MentorWeeklyAvailabilityId") - .HasColumnType("integer"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("PolicyVersion") - .HasColumnType("integer"); - - b.Property("PublishedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RejectedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RejectionReason") - .HasColumnType("text"); - - b.Property("RestMinutesSnapshot") - .HasColumnType("integer"); - - b.Property("RoomId") - .HasColumnType("uuid"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("bytea"); - - b.Property("SessionMinutesSnapshot") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("timestamp without time zone"); - - b.Property("TeachingProposalId") - .HasColumnType("integer"); - - b.Property("Version") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("Id"); - - b.HasIndex("GenerationKey") - .IsUnique() - .HasFilter("\"GenerationKey\" IS NOT NULL"); - - b.HasIndex("GroupPolicyId"); - - b.HasIndex("MentorScheduleRuleId"); - - b.HasIndex("MentorWeeklyAvailabilityId"); - - b.HasIndex("RoomId") - .IsUnique(); - - b.HasIndex("TeachingProposalId") - .HasFilter("\"TeachingProposalId\" IS NOT NULL"); - - b.HasIndex("MentorId", "StartTime", "EndTime"); - - b.ToTable("MentorAvailabilities", t => - { - t.HasCheckConstraint("CK_MentorAvailability_BookedCount", "\"BookedCount\" >= 0 AND \"BookedCount\" <= \"MaxLearners\""); - - t.HasCheckConstraint("CK_MentorAvailability_GeneratedSlot", "(\"GenerationKey\" IS NULL AND \"PolicyVersion\" IS NULL AND \"MentorScheduleRuleId\" IS NULL AND \"LocalBusinessDate\" IS NULL AND \"GroupPolicyId\" IS NULL AND \"SessionMinutesSnapshot\" IS NULL AND \"RestMinutesSnapshot\" IS NULL) OR (\"GenerationKey\" IS NOT NULL AND \"PolicyVersion\" IS NOT NULL AND \"PolicyVersion\" > 0 AND (\"MentorScheduleRuleId\" IS NOT NULL OR \"TeachingProposalId\" IS NOT NULL) AND \"LocalBusinessDate\" IS NOT NULL AND ((\"GroupPolicyId\" IS NULL AND \"SessionMinutesSnapshot\" IS NULL AND \"RestMinutesSnapshot\" IS NULL AND \"MaxLearners\" = 1 AND \"EndTime\" = \"StartTime\" + INTERVAL '90 minutes') OR (\"GroupPolicyId\" IS NOT NULL AND \"SessionMinutesSnapshot\" > 0 AND \"RestMinutesSnapshot\" >= 0 AND \"MaxLearners\" BETWEEN 1 AND 50 AND \"EndTime\" = \"StartTime\" + \"SessionMinutesSnapshot\" * INTERVAL '1 minute')))"); - }); - - b.HasData( - new - { - Id = 990001, - AdminName = "Seed Demo", - AttendanceTrackingEnabled = true, - BookedCount = 1, - CreatedDate = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - EndTime = new DateTime(2026, 10, 2, 10, 0, 0, 0, DateTimeKind.Unspecified), - IsApproved = true, - IsDeleted = false, - MaxLearners = 4, - MentorId = 900002, - RoomId = new Guid("a1000000-0000-0000-0000-000000990001"), - StartTime = new DateTime(2026, 10, 2, 9, 0, 0, 0, DateTimeKind.Unspecified), - Version = 0u - }, - new - { - Id = 990002, - AdminName = "Seed Demo", - AttendanceTrackingEnabled = true, - BookedCount = 0, - CreatedDate = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - EndTime = new DateTime(2026, 10, 3, 14, 0, 0, 0, DateTimeKind.Unspecified), - IsApproved = true, - IsDeleted = false, - MaxLearners = 4, - MentorId = 900002, - RoomId = new Guid("a1000000-0000-0000-0000-000000990002"), - StartTime = new DateTime(2026, 10, 3, 13, 0, 0, 0, DateTimeKind.Unspecified), - Version = 0u - }, - new - { - Id = 990003, - AdminName = "Seed Demo", - AttendanceTrackingEnabled = true, - BookedCount = 0, - CreatedDate = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - EndTime = new DateTime(2026, 10, 4, 10, 0, 0, 0, DateTimeKind.Unspecified), - IsApproved = true, - IsDeleted = false, - MaxLearners = 4, - MentorId = 900003, - RoomId = new Guid("a1000000-0000-0000-0000-000000990003"), - StartTime = new DateTime(2026, 10, 4, 9, 0, 0, 0, DateTimeKind.Unspecified), - Version = 0u - }, - new - { - Id = 990004, - AdminName = "Seed Demo", - AttendanceTrackingEnabled = true, - BookedCount = 0, - CreatedDate = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - EndTime = new DateTime(2026, 10, 5, 14, 0, 0, 0, DateTimeKind.Unspecified), - IsApproved = true, - IsDeleted = false, - MaxLearners = 4, - MentorId = 900003, - RoomId = new Guid("a1000000-0000-0000-0000-000000990004"), - StartTime = new DateTime(2026, 10, 5, 13, 0, 0, 0, DateTimeKind.Unspecified), - Version = 0u - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorBankAccount", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumberHash") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("AccountVersion") - .HasColumnType("integer"); - - b.Property("BankCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFromUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveUntilUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("EncryptedAccountNumber") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("IsCurrent") - .HasColumnType("boolean"); - - b.Property("MaskedAccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("MentorUserId") - .HasColumnType("integer"); - - b.Property("VerificationNotes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("VerificationStatus") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("VerifiedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedByAdminId") - .HasColumnType("integer"); - - b.Property("Version") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("Id"); - - b.HasIndex("MentorUserId") - .IsUnique() - .HasDatabaseName("IX_MentorBankAccounts_MentorUserId_Current") - .HasFilter("\"IsCurrent\" = TRUE"); - - b.HasIndex("VerifiedByAdminId"); - - b.HasIndex("MentorUserId", "AccountVersion") - .IsUnique(); - - b.ToTable("MentorBankAccounts", t => - { - t.HasCheckConstraint("CK_MentorBankAccount_Version", "\"AccountVersion\" >= 1"); - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorBooking", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AttendedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CancellationReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("CancelledAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("CancelledByRole") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CancelledByUserId") - .HasColumnType("integer"); - - b.Property("CompensationCurrency") - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("CompensationFormulaVersion") - .HasColumnType("integer"); - - b.Property("CompensationLevelId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("CreditGrantId") - .HasColumnType("bigint"); - - b.Property("ExceptionApproved") - .HasColumnType("boolean"); - - b.Property("ExceptionReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ExceptionRequested") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("FrozenHourlyRate") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("FrozenLevelCoefficient") - .HasPrecision(10, 4) - .HasColumnType("numeric(10,4)"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("LearnerId") - .HasColumnType("integer"); - - b.Property("MeetingLink") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("MentorAvailabilityId") - .HasColumnType("integer"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("PracticeFeedback") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("PracticeFeedbackAt") - .HasColumnType("timestamp without time zone"); - - b.Property("PracticeScore") - .HasColumnType("integer"); - - b.Property("Question") - .HasColumnType("text"); - - b.Property("ScheduledAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ScheduledCompensationAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UserSubscriptionId") - .HasColumnType("integer"); - - b.Property("Version") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("Id"); - - b.HasIndex("CompensationLevelId"); - - b.HasIndex("CreditGrantId"); - - b.HasIndex("MentorAvailabilityId", "LearnerId") - .IsUnique() - .HasFilter("\"MentorAvailabilityId\" IS NOT NULL AND \"LearnerId\" IS NOT NULL AND NOT \"IsDeleted\" AND \"Status\" <> 'Cancelled'"); - - b.HasIndex("MentorAvailabilityId", "UserSubscriptionId") - .IsUnique() - .HasFilter("NOT \"IsDeleted\" AND \"Status\" <> 'Cancelled'"); - - b.HasIndex("UserSubscriptionId", "Status"); - - b.ToTable("MentorBookings"); - - b.HasData( - new - { - Id = 990001, - CreatedDate = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - ExceptionRequested = false, - IsDeleted = false, - MeetingLink = "http://localhost:5173/mentor-meeting/a1000000-0000-0000-0000-000000990001", - MentorAvailabilityId = 990001, - Question = "Meeting demo để kiểm thử phòng họp trên frontend.", - ScheduledAt = new DateTime(2026, 10, 2, 9, 0, 0, 0, DateTimeKind.Unspecified), - Status = "Assigned", - UserSubscriptionId = 990001, - Version = 0u - }, - new - { - Id = 990002, - CreatedDate = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - ExceptionRequested = false, - IsDeleted = false, - MeetingLink = "http://localhost:5173/mentor-meeting/a1000000-0000-0000-0000-000000990001", - MentorAvailabilityId = 990001, - Question = "Em muốn nhờ Mentor giải đáp phần ngữ pháp N3 bài 5.", - ScheduledAt = new DateTime(2026, 10, 2, 9, 0, 0, 0, DateTimeKind.Unspecified), - Status = "Assigned", - UserSubscriptionId = 990002, - Version = 0u - }, - new - { - Id = 990003, - CreatedDate = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - ExceptionRequested = false, - IsDeleted = false, - MeetingLink = "http://localhost:5173/mentor-meeting/a1000000-0000-0000-0000-000000990001", - MentorAvailabilityId = 990001, - Question = "Hỏi về cách phân biệt giữa ~てくる và ~ていく.", - ScheduledAt = new DateTime(2026, 10, 2, 9, 0, 0, 0, DateTimeKind.Unspecified), - Status = "Assigned", - UserSubscriptionId = 990003, - Version = 0u - }, - new - { - Id = 990004, - CreatedDate = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - ExceptionRequested = false, - IsDeleted = false, - MeetingLink = "http://localhost:5173/mentor-meeting/a1000000-0000-0000-0000-000000990001", - MentorAvailabilityId = 990001, - Question = "Tư vấn phương pháp luyện nghe JLPT N3 hiệu quả.", - ScheduledAt = new DateTime(2026, 10, 2, 9, 0, 0, 0, DateTimeKind.Unspecified), - Status = "Assigned", - UserSubscriptionId = 990004, - Version = 0u - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorBookingDayGuard", b => - { - b.Property("MentorId") - .HasColumnType("integer"); - - b.Property("LocalBusinessDate") - .HasColumnType("date"); - - b.Property("ActiveBookingCount") - .HasColumnType("integer"); - - b.HasKey("MentorId", "LocalBusinessDate"); - - b.ToTable("MentorBookingDayGuards", null, t => - { - t.HasCheckConstraint("CK_MentorBookingDayGuard_Count", "\"ActiveBookingCount\" >= 0"); - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorBookingIntent", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("IntentKey") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("LearnerId") - .HasColumnType("integer"); - - b.Property("MentorBookingId") - .HasColumnType("integer"); - - b.Property("RequestHash") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.HasKey("Id"); - - b.HasIndex("MentorBookingId"); - - b.HasIndex("LearnerId", "IntentKey") - .IsUnique(); - - b.ToTable("MentorBookingIntents", (string)null); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorBookingReservation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("EndUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("LocalBusinessDate") - .HasColumnType("date"); - - b.Property("MentorAvailabilityId") - .HasColumnType("integer"); - - b.Property("MentorBookingId") - .HasColumnType("integer"); - - b.Property("MentorId") - .HasColumnType("integer"); - - b.Property("PolicyVersion") - .HasColumnType("integer"); - - b.Property("ReleasedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("RestProtectedUntilUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("StartUtc") - .HasColumnType("timestamp with time zone"); - - b.HasKey("Id"); - - b.HasIndex("MentorAvailabilityId") - .HasFilter("\"ReleasedAtUtc\" IS NULL"); - - b.HasIndex("MentorBookingId") - .IsUnique(); - - b.HasIndex("MentorAvailabilityId", "MentorId"); - - b.HasIndex("MentorId", "LocalBusinessDate", "ReleasedAtUtc"); - - b.ToTable("MentorBookingReservations", null, t => - { - t.HasCheckConstraint("CK_MentorBookingReservation_Interval", "\"EndUtc\" > \"StartUtc\""); - - t.HasCheckConstraint("CK_MentorBookingReservation_PolicyVersion", "\"PolicyVersion\" > 0"); - - t.HasCheckConstraint("CK_MentorBookingReservation_Rest", "\"RestProtectedUntilUtc\" >= \"EndUtc\""); - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorBookingTerms", b => - { - b.Property("MentorBookingId") - .HasColumnType("integer"); - - b.Property("ConfirmedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("MentorAvailabilityId") - .HasColumnType("integer"); - - b.Property("PolicyVersion") - .HasColumnType("integer"); - - b.Property("ScheduledEndUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("ScheduledStartUtc") - .HasColumnType("timestamp with time zone"); - - b.HasKey("MentorBookingId"); - - b.HasIndex("MentorAvailabilityId"); - - b.ToTable("MentorBookingTerms", null, t => - { - t.HasCheckConstraint("CK_MentorBookingTerms_Interval", "\"ScheduledEndUtc\" > \"ScheduledStartUtc\""); - - t.HasCheckConstraint("CK_MentorBookingTerms_PolicyVersion", "\"PolicyVersion\" > 0"); - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorCalendarConnection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("LastSyncedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("MentorId") - .HasColumnType("integer"); - - b.Property("ProtectedRefreshToken") - .HasColumnType("text"); - - b.Property("StateExpiresAt") - .HasColumnType("timestamp without time zone"); - - b.Property("StateHash") - .HasColumnType("text"); - - b.Property("SyncedEventsJson") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("MentorId") - .IsUnique(); - - b.HasIndex("StateHash") - .IsUnique(); - - b.ToTable("MentorCalendarConnections", (string)null); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorChatMessage", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("MentorBookingId") - .HasColumnType("integer"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ReadAt") - .HasColumnType("timestamp without time zone"); - - b.Property("SenderUserId") - .HasColumnType("integer"); - - b.Property("SentAt") - .HasColumnType("timestamp without time zone"); - - b.Property("Text") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.HasKey("Id"); - - b.HasIndex("SenderUserId"); - - b.HasIndex("MentorBookingId", "Id"); - - b.HasIndex("MentorBookingId", "ReadAt", "SenderUserId"); - - b.ToTable("MentorChatMessages"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorCreditEntry", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Amount") - .HasColumnType("integer"); - - b.Property("CreatedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditGrantId") - .HasColumnType("bigint"); - - b.Property("EntryType") - .HasColumnType("integer"); - - b.Property("LearnerId") - .HasColumnType("integer"); - - b.Property("MentorBookingId") - .HasColumnType("integer"); - - b.Property("OperationKey") - .IsRequired() - .HasMaxLength(160) - .HasColumnType("character varying(160)"); - - b.Property("Reason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.HasKey("Id"); - - b.HasIndex("LearnerId"); - - b.HasIndex("OperationKey") - .IsUnique(); - - b.HasIndex("CreditGrantId", "EntryType"); - - b.HasIndex("MentorBookingId", "EntryType"); - - b.ToTable("MentorCreditEntries", null, t => - { - t.HasCheckConstraint("CK_MentorCreditEntry_Amount", "\"Amount\" <> 0"); - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorCreditGrant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AvailableQuantity") - .HasColumnType("integer"); - - b.Property("CertificateLevelId") - .HasColumnType("integer"); - - b.Property("CreatedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFromUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiresAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("InitialQuantity") - .HasColumnType("integer"); - - b.Property("LearnerId") - .HasColumnType("integer"); - - b.Property("PolicyVersion") - .HasColumnType("integer"); - - b.Property("UserSubscriptionId") - .HasColumnType("integer"); - - b.Property("Version") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("Id"); - - b.HasIndex("CertificateLevelId"); - - b.HasIndex("UserSubscriptionId") - .IsUnique(); - - b.HasIndex("LearnerId", "ExpiresAtUtc"); - - b.HasIndex("LearnerId", "CertificateLevelId", "ExpiresAtUtc"); - - b.ToTable("MentorCreditGrants", null, t => - { - t.HasCheckConstraint("CK_MentorCreditGrant_PolicyVersion", "\"PolicyVersion\" > 0"); - - t.HasCheckConstraint("CK_MentorCreditGrant_Quantity", "\"InitialQuantity\" > 0 AND \"AvailableQuantity\" >= 0 AND \"AvailableQuantity\" <= \"InitialQuantity\""); - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorDispute", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AdminDecision") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("AdminNotes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Category") - .HasColumnType("integer"); - - b.Property("CreatedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("CreditRefunded") - .HasColumnType("boolean"); - - b.Property("EvidenceUrls") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("IsRefundApproved") - .HasColumnType("boolean"); - - b.Property("LearnerId") - .HasColumnType("integer"); - - b.Property("MentorBookingId") - .HasColumnType("integer"); - - b.Property("MentorId") - .HasColumnType("integer"); - - b.Property("MentorRespondedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("MentorResponse") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Reason") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RefundOperationKey") - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("ResolvedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("ResolvedByAdminId") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("UpdatedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("LearnerId") - .HasDatabaseName("IX_MentorDisputes_LearnerId"); - - b.HasIndex("MentorBookingId") - .HasDatabaseName("IX_MentorDisputes_MentorBookingId"); - - b.HasIndex("MentorId") - .HasDatabaseName("IX_MentorDisputes_MentorId"); - - b.HasIndex("ResolvedByAdminId"); - - b.HasIndex("Status") - .HasDatabaseName("IX_MentorDisputes_Status"); - - b.ToTable("MentorDisputes", (string)null); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorDisputeHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("ActorId") - .HasColumnType("integer"); - - b.Property("ActorRole") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("CreatedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("DisputeId") - .HasColumnType("integer"); - - b.Property("NewStatus") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("PreviousStatus") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("DisputeId") - .HasDatabaseName("IX_MentorDisputeHistories_DisputeId"); - - b.ToTable("MentorDisputeHistories", (string)null); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorEarningEntry", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ApprovedEligibleMinutes") - .HasColumnType("integer"); - - b.Property("AttendanceApprovalId") - .HasColumnType("bigint"); - - b.Property("CertificateLevelId") - .HasColumnType("integer"); - - b.Property("CreatedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedByAdminId") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("FormulaVersion") - .HasColumnType("integer"); - - b.Property("FrozenHourlyRate") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("FrozenLevelCoefficient") - .HasPrecision(10, 4) - .HasColumnType("numeric(10,4)"); - - b.Property("GrossAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("JlptLevelCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("MentorBookingId") - .HasColumnType("integer"); - - b.Property("MentorUserId") - .HasColumnType("integer"); - - b.Property("OperationKey") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PayrollPeriodId") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.HasKey("Id"); - - b.HasIndex("AttendanceApprovalId") - .IsUnique(); - - b.HasIndex("CertificateLevelId"); - - b.HasIndex("CreatedByAdminId"); - - b.HasIndex("MentorBookingId") - .IsUnique(); - - b.HasIndex("OperationKey") - .IsUnique(); - - b.HasIndex("PayrollPeriodId"); - - b.HasIndex("MentorUserId", "Status"); - - b.ToTable("MentorEarningEntries", t => - { - t.HasCheckConstraint("CK_MentorEarningEntry_Positive", "\"FrozenHourlyRate\" > 0 AND \"FrozenLevelCoefficient\" > 0 AND \"ApprovedEligibleMinutes\" > 0 AND \"ApprovedEligibleMinutes\" <= 90 AND \"GrossAmount\" > 0"); - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorGroupPolicy", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CancellationLeadHours") - .HasColumnType("integer"); - - b.Property("CheckoutHoldMinutes") - .HasColumnType("integer"); - - b.Property("CreatedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedByAdminId") - .HasColumnType("integer"); - - b.Property("DeletedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedByAdminId") - .HasColumnType("integer"); - - b.Property("EffectiveFromUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("HomeworkDeadlineDays") - .HasColumnType("integer"); - - b.Property("IsActive") - .HasColumnType("boolean"); - - b.Property("IsArchivedRevision") - .HasColumnType("boolean"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("KpiReportingPeriodDays") - .HasColumnType("integer"); - - b.Property("LastAppliedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("LastAppliedByAdminId") - .HasColumnType("integer"); - - b.Property("LearnerTransferEnabled") - .HasColumnType("boolean"); - - b.Property("MaxLearners") - .HasColumnType("integer"); - - b.Property("MentorReplacementEnabled") - .HasColumnType("boolean"); - - b.Property("MentorReplacementLeadHours") - .HasColumnType("integer"); - - b.Property("MinimumPreparationDays") - .HasColumnType("integer"); - - b.Property("MinimumPublishedEnrollmentDays") - .HasColumnType("integer"); - - b.Property("PlacementAttemptLimit") - .HasColumnType("integer"); - - b.Property("RemediationCompletionThresholdPercent") - .HasPrecision(5, 2) - .HasColumnType("numeric(5,2)"); - - b.Property("RemediationThresholdComparison") - .IsRequired() - .HasMaxLength(2) - .HasColumnType("character varying(2)"); - - b.Property("RequireAdminRemediationReview") - .HasColumnType("boolean"); - - b.Property("RequireOfficialExamEvidence") - .HasColumnType("boolean"); - - b.Property("ReschedulingLeadHours") - .HasColumnType("integer"); - - b.Property("RestMinutes") - .HasColumnType("integer"); - - b.Property("Revision") - .IsConcurrencyToken() - .HasColumnType("integer"); - - b.Property("SessionMinutes") - .HasColumnType("integer"); - - b.Property("TransferAllowedAfterSourceStart") - .HasColumnType("boolean"); - - b.Property("TuitionPerSessionN2") - .HasPrecision(18) - .HasColumnType("numeric(18,0)"); - - b.Property("TuitionPerSessionN3") - .HasPrecision(18) - .HasColumnType("numeric(18,0)"); - - b.Property("TuitionPerSessionN4") - .HasPrecision(18) - .HasColumnType("numeric(18,0)"); - - b.Property("TuitionPerSessionN5") - .HasPrecision(18) - .HasColumnType("numeric(18,0)"); - - b.Property("UpdatedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedByAdminId") - .HasColumnType("integer"); - - b.Property("Version") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("CreatedByAdminId"); - - b.HasIndex("DeletedByAdminId"); - - b.HasIndex("EffectiveFromUtc"); - - b.HasIndex("IsActive") - .IsUnique() - .HasDatabaseName("IX_MentorGroupPolicies_SingleActive") - .HasFilter("\"IsActive\" = TRUE"); - - b.HasIndex("LastAppliedByAdminId"); - - b.HasIndex("UpdatedByAdminId"); - - b.HasIndex("Version") - .IsUnique() - .HasDatabaseName("IX_MentorGroupPolicies_LiveVersion") - .HasFilter("\"IsArchivedRevision\" = FALSE"); - - b.ToTable("MentorGroupPolicies", null, t => - { - t.HasCheckConstraint("CK_MentorGroupPolicy_Capacity", "\"MaxLearners\" BETWEEN 1 AND 50"); - - t.HasCheckConstraint("CK_MentorGroupPolicy_CheckoutHold", "\"CheckoutHoldMinutes\" BETWEEN 1 AND 60"); - - t.HasCheckConstraint("CK_MentorGroupPolicy_Comparison", "\"RemediationThresholdComparison\" IN ('>', '>=')"); - - t.HasCheckConstraint("CK_MentorGroupPolicy_EnrollmentDays", "\"MinimumPublishedEnrollmentDays\" BETWEEN 1 AND 180"); - - t.HasCheckConstraint("CK_MentorGroupPolicy_Evidence", "\"RequireOfficialExamEvidence\" AND \"RequireAdminRemediationReview\""); - - t.HasCheckConstraint("CK_MentorGroupPolicy_Positive", "\"Version\" > 0 AND \"SessionMinutes\" > 0 AND \"RestMinutes\" >= 0 AND \"MinimumPreparationDays\" >= 1 AND \"CancellationLeadHours\" >= 0 AND \"ReschedulingLeadHours\" >= 0 AND \"HomeworkDeadlineDays\" > 0 AND \"PlacementAttemptLimit\" > 0 AND \"KpiReportingPeriodDays\" > 0"); - - t.HasCheckConstraint("CK_MentorGroupPolicy_Remediation", "\"RemediationCompletionThresholdPercent\" > 0 AND \"RemediationCompletionThresholdPercent\" <= 100"); - - t.HasCheckConstraint("CK_MentorGroupPolicy_ReplacementLead", "\"MentorReplacementLeadHours\" BETWEEN 0 AND 720"); - - t.HasCheckConstraint("CK_MentorGroupPolicy_State", "\"Revision\" > 0 AND NOT (\"IsActive\" AND (\"IsArchivedRevision\" OR \"IsDeleted\"))"); - - t.HasCheckConstraint("CK_MentorGroupPolicy_TransferAfterStart", "\"LearnerTransferEnabled\" OR NOT \"TransferAllowedAfterSourceStart\""); - - t.HasCheckConstraint("CK_MentorGroupPolicy_Tuition", "\"TuitionPerSessionN5\" >= 0 AND \"TuitionPerSessionN4\" >= 0 AND \"TuitionPerSessionN3\" >= 0 AND \"TuitionPerSessionN2\" >= 0"); - }); - - b.HasData( - new - { - Id = 1, - CancellationLeadHours = 24, - CheckoutHoldMinutes = 10, - CreatedAtUtc = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - EffectiveFromUtc = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - HomeworkDeadlineDays = 7, - IsActive = true, - IsArchivedRevision = false, - IsDeleted = false, - KpiReportingPeriodDays = 30, - LastAppliedAtUtc = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - LearnerTransferEnabled = true, - MaxLearners = 4, - MentorReplacementEnabled = true, - MentorReplacementLeadHours = 24, - MinimumPreparationDays = 1, - MinimumPublishedEnrollmentDays = 7, - PlacementAttemptLimit = 2, - RemediationCompletionThresholdPercent = 90m, - RemediationThresholdComparison = ">", - RequireAdminRemediationReview = true, - RequireOfficialExamEvidence = true, - ReschedulingLeadHours = 24, - RestMinutes = 15, - Revision = 1, - SessionMinutes = 90, - TransferAllowedAfterSourceStart = false, - TuitionPerSessionN2 = 110000m, - TuitionPerSessionN3 = 90000m, - TuitionPerSessionN4 = 75000m, - TuitionPerSessionN5 = 60000m, - Version = 1 - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorHourlyRate", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AmountPerHour") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ConfiguredByAdminId") - .HasColumnType("integer"); - - b.Property("CreatedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFromUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveUntilUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("MentorUserId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("ConfiguredByAdminId"); - - b.HasIndex("MentorUserId", "EffectiveFromUtc") - .IsUnique(); - - b.ToTable("MentorHourlyRates", t => - { - t.HasCheckConstraint("CK_MentorHourlyRate_Positive", "\"AmountPerHour\" > 0"); - - t.HasCheckConstraint("CK_MentorHourlyRate_Range", "\"EffectiveUntilUtc\" IS NULL OR \"EffectiveUntilUtc\" > \"EffectiveFromUtc\""); - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorOutboxEvent", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AggregateId") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("AggregateType") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("Attempts") - .HasColumnType("integer"); - - b.Property("AvailableAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("DeliveredAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("EventKey") - .IsRequired() - .HasMaxLength(160) - .HasColumnType("character varying(160)"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("EventVersion") - .HasColumnType("integer"); - - b.Property("PayloadJson") - .IsRequired() - .HasColumnType("jsonb"); - - b.HasKey("Id"); - - b.HasIndex("EventKey") - .IsUnique(); - - b.HasIndex("DeliveredAtUtc", "AvailableAtUtc", "CreatedAtUtc"); - - b.ToTable("MentorOutboxEvents", null, t => - { - t.HasCheckConstraint("CK_MentorOutbox_Attempts", "\"Attempts\" >= 0"); - - t.HasCheckConstraint("CK_MentorOutbox_EventVersion", "\"EventVersion\" > 0"); - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorPayoutAttempt", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("AttemptNumber") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("CompletedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedByAdminId") - .HasColumnType("integer"); - - b.Property("CreatedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ErrorCode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ErrorMessage") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("EvidenceNotes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("EvidenceStorageKey") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ExecutionMethod") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("IdempotencyKey") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("InitiatedByAdminId") - .HasColumnType("integer"); - - b.Property("InternalStatus") - .IsRequired() - .HasMaxLength(40) - .HasColumnType("character varying(40)"); - - b.Property("LockedBankAccountId") - .HasColumnType("bigint"); - - b.Property("PayoutObligationId") - .HasColumnType("bigint"); - - b.Property("ProviderPayoutId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ProviderStatus") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("TransferReference") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("ConfirmedByAdminId"); - - b.HasIndex("IdempotencyKey") - .IsUnique(); - - b.HasIndex("InitiatedByAdminId"); - - b.HasIndex("LockedBankAccountId"); - - b.HasIndex("PayoutObligationId") - .IsUnique() - .HasDatabaseName("IX_MentorPayoutAttempts_OneSucceededPerObligation") - .HasFilter("\"InternalStatus\" = 'Succeeded'"); - - b.HasIndex("TransferReference") - .IsUnique() - .HasDatabaseName("IX_MentorPayoutAttempts_SucceededTransferReference") - .HasFilter("\"TransferReference\" IS NOT NULL AND \"InternalStatus\" = 'Succeeded'"); - - b.HasIndex("PayoutObligationId", "AttemptNumber") - .IsUnique(); - - b.ToTable("MentorPayoutAttempts", t => - { - t.HasCheckConstraint("CK_MentorPayoutAttempt_ManualEvidence", "(\"ExecutionMethod\" <> 'ManualBankTransfer' OR \"InternalStatus\" <> 'Succeeded') OR (\"TransferReference\" IS NOT NULL AND \"EvidenceStorageKey\" IS NOT NULL)"); - - t.HasCheckConstraint("CK_MentorPayoutAttempt_Positive", "\"Amount\" > 0 AND \"AttemptNumber\" >= 1"); - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorPayoutObligation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ActiveAttemptId") - .HasColumnType("bigint"); - - b.Property("ApprovedByAdminId") - .HasColumnType("integer"); - - b.Property("CreatedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("LockedBankAccountId") - .HasColumnType("bigint"); - - b.Property("MentorUserId") - .HasColumnType("integer"); - - b.Property("OrganizationPayoutAccountId") - .HasColumnType("bigint"); - - b.Property("PayableAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollPeriodId") - .HasColumnType("bigint"); - - b.Property("SelectedMethod") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("SettledAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("SettledAttemptId") - .HasColumnType("bigint"); - - b.Property("SettledReference") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(40) - .HasColumnType("character varying(40)"); - - b.Property("UpdatedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("Version") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("Id"); - - b.HasIndex("ApprovedByAdminId"); - - b.HasIndex("LockedBankAccountId"); - - b.HasIndex("MentorUserId"); - - b.HasIndex("OrganizationPayoutAccountId"); - - b.HasIndex("PayrollPeriodId") - .IsUnique(); - - b.ToTable("MentorPayoutObligations", t => - { - t.HasCheckConstraint("CK_MentorPayoutObligation_Positive", "\"PayableAmount\" > 0"); - - t.HasCheckConstraint("CK_MentorPayoutObligation_Settlement", "(\"Status\" <> 'Paid') OR (\"SettledAttemptId\" IS NOT NULL AND \"SettledReference\" IS NOT NULL AND \"SettledAtUtc\" IS NOT NULL)"); - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorPayrollAdjustment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ApprovedByAdminId") - .HasColumnType("integer"); - - b.Property("CreatedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("OperationKey") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PayrollPeriodId") - .HasColumnType("bigint"); - - b.Property("Reason") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RelatedBookingId") - .HasColumnType("integer"); - - b.Property("RelatedEarningEntryId") - .HasColumnType("bigint"); - - b.Property("SignedAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("Id"); - - b.HasIndex("ApprovedByAdminId"); - - b.HasIndex("OperationKey") - .IsUnique(); - - b.HasIndex("PayrollPeriodId"); - - b.ToTable("MentorPayrollAdjustments", t => - { - t.HasCheckConstraint("CK_MentorPayrollAdjustment_NonZero", "\"SignedAmount\" <> 0"); - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorPayrollLine", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ApprovedEligibleMinutes") - .HasColumnType("integer"); - - b.Property("CreatedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("EarningEntryId") - .HasColumnType("bigint"); - - b.Property("FrozenHourlyRate") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("FrozenLevelCoefficient") - .HasPrecision(10, 4) - .HasColumnType("numeric(10,4)"); - - b.Property("LineAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("MentorBookingId") - .HasColumnType("integer"); - - b.Property("PayrollPeriodId") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("EarningEntryId") - .IsUnique(); - - b.HasIndex("MentorBookingId") - .IsUnique(); - - b.HasIndex("PayrollPeriodId"); - - b.ToTable("MentorPayrollLines", t => - { - t.HasCheckConstraint("CK_MentorPayrollLine_Positive", "\"LineAmount\" > 0 AND \"ApprovedEligibleMinutes\" > 0"); - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorPayrollPeriod", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ApprovalNotes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ApprovedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedByAdminId") - .HasColumnType("integer"); - - b.Property("ClosedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("GrossPayableAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("MentorUserId") - .HasColumnType("integer"); - - b.Property("Month") - .HasColumnType("integer"); - - b.Property("PreparedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("PreparedByAdminId") - .HasColumnType("integer"); - - b.Property("SequenceNumber") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("SupplementalReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("TotalAdjustmentsAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("TotalEarningsAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Version") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("ApprovedByAdminId"); - - b.HasIndex("PreparedByAdminId"); - - b.HasIndex("MentorUserId", "Year", "Month", "SequenceNumber", "Currency") - .IsUnique(); - - b.ToTable("MentorPayrollPeriods", t => - { - t.HasCheckConstraint("CK_MentorPayrollPeriod_Payable", "\"TotalEarningsAmount\" >= 0 AND \"GrossPayableAmount\" >= 0"); - - t.HasCheckConstraint("CK_MentorPayrollPeriod_Period", "\"Year\" >= 2020 AND \"Year\" <= 2100 AND \"Month\" >= 1 AND \"Month\" <= 12 AND \"SequenceNumber\" >= 1"); - - t.HasCheckConstraint("CK_MentorPayrollPeriod_Supplemental", "\"SequenceNumber\" = 1 OR (\"SupplementalReason\" IS NOT NULL AND length(trim(\"SupplementalReason\")) > 0)"); - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorProfile", b => - { - b.Property("MentorId") - .HasColumnType("integer"); - - b.Property("Bio") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Expertise") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("IntroductionVideoUrl") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("JlptLevel") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ReviewNotes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ReviewedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ReviewedByAdminName") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SubmittedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("VerificationDocumentUrl") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("VerificationStatus") - .IsConcurrencyToken() - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("Workplace") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("YearsOfExperience") - .HasColumnType("integer"); - - b.HasKey("MentorId"); - - b.ToTable("MentorProfiles", (string)null); - - b.HasData( - new - { - MentorId = 900002, - Bio = "Chuyên gia tiếng Nhật với 8 năm kinh nghiệm giảng dạy JLPT N1, N2 và tiếng Nhật doanh nghiệp.", - CreatedDate = new DateTime(2026, 9, 28, 0, 0, 0, 0, DateTimeKind.Utc), - Expertise = "Luyện thi JLPT N1-N2, Tiếng Nhật thương mại, Phỏng vấn xin việc", - IsDeleted = false, - JlptLevel = "N1", - ReviewedAt = new DateTime(2026, 9, 28, 0, 0, 0, 0, DateTimeKind.Utc), - ReviewedByAdminName = "Admin System", - SubmittedAt = new DateTime(2026, 9, 28, 0, 0, 0, 0, DateTimeKind.Utc), - VerificationStatus = "Approved", - Workplace = "Riki Nihongo Academy", - YearsOfExperience = 8 - }, - new - { - MentorId = 900003, - Bio = "Giảng viên tiếng Nhật bản xứ, chuyên sâu về phát âm và giao tiếp Kaiwa thực tế.", - CreatedDate = new DateTime(2026, 9, 28, 0, 0, 0, 0, DateTimeKind.Utc), - Expertise = "Giao tiếp Kaiwa tự nhiên, Luyện phát âm chuẩn Tokyo, JLPT N3-N2", - IsDeleted = false, - JlptLevel = "N1", - ReviewedAt = new DateTime(2026, 9, 28, 0, 0, 0, 0, DateTimeKind.Utc), - ReviewedByAdminName = "Admin System", - SubmittedAt = new DateTime(2026, 9, 28, 0, 0, 0, 0, DateTimeKind.Utc), - VerificationStatus = "Approved", - Workplace = "Riki Nihongo Academy", - YearsOfExperience = 5 - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorReview", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("CreatedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("IsPublic") - .HasColumnType("boolean"); - - b.Property("LearnerId") - .HasColumnType("integer"); - - b.Property("MentorBookingId") - .HasColumnType("integer"); - - b.Property("MentorId") - .HasColumnType("integer"); - - b.Property("MentorRepliedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("MentorReply") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ModerationStatus") - .HasColumnType("integer"); - - b.Property("Rating") - .HasColumnType("integer"); - - b.Property("UpdatedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("LearnerId") - .HasDatabaseName("IX_MentorReviews_LearnerId"); - - b.HasIndex("MentorBookingId") - .IsUnique() - .HasDatabaseName("IX_MentorReviews_MentorBookingId"); - - b.HasIndex("MentorId", "IsPublic", "ModerationStatus") - .HasDatabaseName("IX_MentorReviews_Mentor_Public_Status"); - - b.ToTable("MentorReviews", null, t => - { - t.HasCheckConstraint("CK_MentorReview_Rating_Range", "\"Rating\" >= 1 AND \"Rating\" <= 5"); - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorSchedule", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AutoPublish") - .HasColumnType("boolean"); - - b.Property("CreatedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("date"); - - b.Property("GeneratedThrough") - .HasColumnType("date"); - - b.Property("MentorId") - .HasColumnType("integer"); - - b.Property("PolicyVersion") - .HasColumnType("integer"); - - b.Property("TimeZoneId") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.HasKey("Id"); - - b.HasIndex("MentorId", "PolicyVersion") - .IsUnique(); - - b.ToTable("MentorSchedules", null, t => - { - t.HasCheckConstraint("CK_MentorSchedule_PolicyVersion", "\"PolicyVersion\" > 0"); - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorScheduleRule", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("DaypartCode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("EffectiveFrom") - .HasColumnType("date"); - - b.Property("EffectiveTo") - .HasColumnType("date"); - - b.Property("LocalEnd") - .HasColumnType("time without time zone"); - - b.Property("LocalStart") - .HasColumnType("time without time zone"); - - b.Property("ScheduleId") - .HasColumnType("bigint"); - - b.Property("Weekday") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("ScheduleId", "Weekday", "DaypartCode", "EffectiveFrom") - .IsUnique(); - - b.ToTable("MentorScheduleRules", null, t => - { - t.HasCheckConstraint("CK_MentorScheduleRule_Daypart", "\"DaypartCode\" IN ('Morning', 'Noon', 'Afternoon', 'Evening')"); - - t.HasCheckConstraint("CK_MentorScheduleRule_Time", "\"LocalEnd\" > \"LocalStart\""); - - t.HasCheckConstraint("CK_MentorScheduleRule_Weekday", "\"Weekday\" BETWEEN 0 AND 6"); - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorTeachingProposal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CertificateLevelId") - .HasColumnType("integer"); - - b.Property("CourseDurationWeeks") - .HasColumnType("integer"); - - b.Property("CourseObjective") - .HasMaxLength(1500) - .HasColumnType("character varying(1500)"); - - b.Property("CoursePlanId") - .HasColumnType("integer"); - - b.Property("CourseTitle") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpectedStartDate") - .HasColumnType("date"); - - b.Property("GroupPolicyId") - .HasColumnType("integer"); - - b.Property("HiddenFromMentorAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("IsHiddenFromMentorHistory") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("LastSavedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("MentorId") - .HasColumnType("integer"); - - b.Property("OpenEnrollmentIdempotencyKey") - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("OpenedClassAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("OptionalAttachmentsJson") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("OptionalNotes") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("PolicyVersionSnapshot") - .HasColumnType("integer"); - - b.Property("ProgramType") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("ReviewReason") - .HasMaxLength(1500) - .HasColumnType("character varying(1500)"); - - b.Property("ReviewedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("ReviewedByAdminId") - .HasColumnType("integer"); - - b.Property("Revision") - .IsConcurrencyToken() - .HasColumnType("integer"); - - b.Property("SessionDurationMinutes") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("SubmissionIdempotencyKey") - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("SubmittedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("WeeklySessionsJson") - .IsRequired() - .HasColumnType("jsonb"); - - b.HasKey("Id"); - - b.HasIndex("CertificateLevelId"); - - b.HasIndex("CoursePlanId"); - - b.HasIndex("GroupPolicyId"); - - b.HasIndex("ReviewedByAdminId"); - - b.HasIndex("MentorId", "OpenEnrollmentIdempotencyKey") - .IsUnique() - .HasDatabaseName("IX_MentorTeachingProposals_MentorId_OpenEnrollmentIdempotencyKey") - .HasFilter("\"OpenEnrollmentIdempotencyKey\" IS NOT NULL"); - - b.HasIndex("MentorId", "SubmissionIdempotencyKey") - .IsUnique() - .HasDatabaseName("IX_MentorTeachingProposals_MentorId_SubmissionIdempotencyKey") - .HasFilter("\"SubmissionIdempotencyKey\" IS NOT NULL"); - - b.HasIndex("Status", "SubmittedAtUtc"); - - b.HasIndex("MentorId", "Status", "UpdatedAtUtc"); - - b.ToTable("MentorTeachingProposals", null, t => - { - t.HasCheckConstraint("CK_MentorTeachingProposal_Duration", "\"CourseDurationWeeks\" BETWEEN 1 AND 104 AND \"SessionDurationMinutes\" BETWEEN 30 AND 240"); - - t.HasCheckConstraint("CK_MentorTeachingProposal_ProgramType", "\"ProgramType\" IN ('StandardJlpt', 'IntensiveJlpt', 'ExamPrepJlpt', 'CustomJlpt')"); - - t.HasCheckConstraint("CK_MentorTeachingProposal_Revision", "\"Revision\" > 0"); - - t.HasCheckConstraint("CK_MentorTeachingProposal_Status", "\"Status\" IN ('Draft', 'PendingReview', 'ChangesRequested', 'Approved', 'OpenedClass', 'Rejected', 'Withdrawn')"); - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorTeachingProposalEvent", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(48) - .HasColumnType("character varying(48)"); - - b.Property("ActorRole") - .IsRequired() - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("ActorUserId") - .HasColumnType("integer"); - - b.Property("CreatedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("FromStatus") - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("ProposalId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1500) - .HasColumnType("character varying(1500)"); - - b.Property("RevisionAfter") - .HasColumnType("integer"); - - b.Property("SnapshotJson") - .HasColumnType("jsonb"); - - b.Property("ToStatus") - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.HasKey("Id"); - - b.HasIndex("ProposalId", "CreatedAtUtc"); - - b.ToTable("MentorTeachingProposalEvents", null, t => - { - t.HasCheckConstraint("CK_MentorTeachingProposalEvent_RevisionAfter", "\"RevisionAfter\" > 0"); - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorTeachingQualification", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CertificateLevelId") - .HasColumnType("integer"); - - b.Property("IsActive") - .HasColumnType("boolean"); - - b.Property("MentorUserId") - .HasColumnType("integer"); - - b.Property("RevokedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedByAdminId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("CertificateLevelId"); - - b.HasIndex("VerifiedByAdminId"); - - b.HasIndex("MentorUserId", "CertificateLevelId") - .IsUnique() - .HasFilter("\"IsActive\" = TRUE"); - - b.ToTable("MentorTeachingQualifications", t => - { - t.HasCheckConstraint("CK_MentorTeachingQualification_Revoked", "\"RevokedAtUtc\" IS NULL OR \"RevokedAtUtc\" >= \"VerifiedAtUtc\""); - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorWeeklyAvailability", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Date") - .HasColumnType("date"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("MentorId") - .HasColumnType("integer"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Period") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Version") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("Id"); - - b.HasIndex("MentorId", "Date", "Period") - .IsUnique() - .HasFilter("NOT \"IsDeleted\""); - - b.ToTable("MentorWeeklyAvailabilities", t => - { - t.HasCheckConstraint("CK_MentorWeeklyAvailability_Period", "\"Period\" IN ('Morning', 'Afternoon', 'Evening')"); - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MockQuestion", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AiProvenanceJson") - .HasColumnType("jsonb"); - - b.Property("AnswerKeyJson") - .HasColumnType("jsonb"); - - b.Property("AudioTranscript") - .HasColumnType("text"); - - b.Property("AudioUrl") - .HasColumnType("text"); - - b.Property("CertificateLevelId") - .HasColumnType("integer"); - - b.Property("ContentFingerprint") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Difficulty") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("Explanation") - .HasColumnType("text"); - - b.Property("GroupSortOrder") - .HasColumnType("integer"); - - b.Property("ImageUrl") - .HasColumnType("text"); - - b.Property("InteractionDataJson") - .HasColumnType("jsonb"); - - b.Property("IsArchivedVersion") - .HasColumnType("boolean"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("LanguageSkillId") - .HasColumnType("integer"); - - b.Property("MockTestSectionId") - .HasColumnType("integer") - .HasColumnName("PracticeTestSectionId"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("OptionsJson") - .HasColumnType("jsonb"); - - b.Property("ParentQuestionId") - .HasColumnType("integer"); - - b.Property("PassageId") - .HasColumnType("integer"); - - b.Property("PlaybackPolicyJson") - .HasColumnType("jsonb"); - - b.Property("PublishStatus") - .HasColumnType("integer"); - - b.Property("PublishedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("QuestionGroupTitle") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("QuestionIdentity") - .HasColumnType("uuid"); - - b.Property("QuestionText") - .IsRequired() - .HasColumnType("text"); - - b.Property("QuestionType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(40) - .HasColumnType("character varying(40)") - .HasDefaultValue("SingleChoice"); - - b.Property("QuestionVersion") - .HasColumnType("integer"); - - b.Property("RightsStatus") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SkillMetadataJson") - .HasColumnType("jsonb"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("SourceQuestionId") - .HasColumnType("integer"); - - b.Property("SourceReference") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("SourceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(40) - .HasColumnType("character varying(40)") - .HasDefaultValue("Manual"); - - b.Property("TagsJson") - .HasColumnType("jsonb"); - - b.Property("TemplateKind") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("Topic") - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.HasKey("Id"); - - b.HasIndex("ContentFingerprint"); - - b.HasIndex("LanguageSkillId"); - - b.HasIndex("PassageId"); - - b.HasIndex("QuestionIdentity"); - - b.HasIndex("SourceQuestionId"); - - b.HasIndex("MockTestSectionId", "IsArchivedVersion"); - - b.HasIndex("CertificateLevelId", "LanguageSkillId", "PublishStatus", "IsArchivedVersion"); - - b.ToTable("MockQuestions"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MockQuestionOption", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Explanation") - .HasColumnType("text"); - - b.Property("ImageUrl") - .HasColumnType("text"); - - b.Property("IsCorrect") - .HasColumnType("boolean"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("MockQuestionId") - .HasColumnType("integer") - .HasColumnName("PracticeQuestionId"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("OptionText") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("MockQuestionId"); - - b.ToTable("MockQuestionOptions"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MockTest", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AiProvenanceJson") - .HasColumnType("jsonb"); - - b.Property("BlueprintPolicyJson") - .HasColumnType("jsonb"); - - b.Property("CertificateLevelId") - .HasColumnType("integer") - .HasColumnName("CertificationLevelId"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("ExamKind") - .HasColumnType("integer"); - - b.Property("FocusSkillId") - .HasColumnType("integer"); - - b.Property("IncludedSkillsJson") - .HasColumnType("jsonb"); - - b.Property("IsArchivedVersion") - .HasColumnType("boolean"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("IsManagedWorkflow") - .HasColumnType("boolean"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ParentExamId") - .HasColumnType("integer"); - - b.Property("PublishStatus") - .HasColumnType("integer"); - - b.Property("PublishedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RightsStatus") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SourceReference") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("SourceType") - .HasMaxLength(40) - .HasColumnType("character varying(40)"); - - b.Property("TagsJson") - .HasColumnType("jsonb"); - - b.Property("TimeLimitMinutes") - .HasColumnType("integer"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("UserAccountId") - .HasColumnType("integer"); - - b.Property("Version") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("CertificateLevelId"); - - b.HasIndex("UserAccountId"); - - b.ToTable("MockTests"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MockTestAnswer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AiExplanationGeneratedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("AiExplanationInputJson") - .HasColumnType("jsonb"); - - b.Property("AiExplanationJson") - .HasColumnType("jsonb"); - - b.Property("AiExplanationVersion") - .HasColumnType("integer"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("IsCorrect") - .HasColumnType("boolean"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("MockQuestionId") - .HasColumnType("integer") - .HasColumnName("PracticeQuestionId"); - - b.Property("MockTestAttemptId") - .HasColumnType("integer") - .HasColumnName("PracticeTestAttemptId"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ResponseJson") - .HasColumnType("jsonb"); - - b.Property("SelectedOptionId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("MockQuestionId"); - - b.HasIndex("SelectedOptionId"); - - b.HasIndex("MockTestAttemptId", "MockQuestionId") - .IsUnique(); - - b.ToTable("MockTestAnswers"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MockTestAttempt", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AttemptKind") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ExpiresAt") - .HasColumnType("timestamp without time zone"); - - b.Property("IsCompleted") - .HasColumnType("boolean"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("IsPlacementAssessment") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("QuestionSnapshotJson") - .HasColumnType("text"); - - b.Property("StartedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("SubmittedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("TotalScore") - .HasColumnType("double precision"); - - b.Property("UserAccountId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("StartedAt"); - - b.HasIndex("UserAccountId"); - - b.HasIndex("UserId"); - - b.HasIndex("UserId", "AttemptKind") - .IsUnique() - .HasFilter("\"AttemptKind\" = 1 AND \"IsCompleted\" = false AND \"IsDeleted\" = false"); - - b.ToTable("MockTestAttempts"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MockTestSection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CertificateSectionId") - .HasColumnType("integer") - .HasColumnName("CertificationSectionId"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("DurationMinutes") - .HasColumnType("integer"); - - b.Property("Instructions") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("LanguageSkillId") - .HasColumnType("integer") - .HasColumnName("SkillId"); - - b.Property("MockTestId") - .HasColumnType("integer") - .HasColumnName("MockTestId"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("SectionPolicyJson") - .HasColumnType("jsonb"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("CertificateSectionId"); - - b.HasIndex("LanguageSkillId"); - - b.HasIndex("MockTestId", "CertificateSectionId"); - - b.ToTable("MockTestSections"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MockTestSectionResult", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CorrectCount") - .HasColumnType("integer"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("MockTestAttemptId") - .HasColumnType("integer") - .HasColumnName("MockTestAttemptId"); - - b.Property("MockTestSectionId") - .HasColumnType("integer") - .HasColumnName("MockTestSectionId"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ScorePercent") - .HasColumnType("double precision"); - - b.Property("TotalCount") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("MockTestSectionId"); - - b.HasIndex("MockTestAttemptId", "MockTestSectionId") - .IsUnique(); - - b.ToTable("MockTestSectionResults"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.Note", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AnsweredAt") - .HasColumnType("timestamp without time zone"); - - b.Property("AuthorRole") - .IsRequired() - .HasColumnType("text"); - - b.Property("Content") - .HasColumnType("text"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("MentorBookingId") - .HasColumnType("integer"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("MentorBookingId") - .IsUnique(); - - b.HasIndex("UserId"); - - b.ToTable("Notes"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.NotebookFolder", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("IsDefault") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(120) - .HasColumnType("character varying(120)"); - - b.Property("NormalizedName") - .IsRequired() - .HasMaxLength(120) - .HasColumnType("character varying(120)"); - - b.Property("Revision") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(1); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("UserId") - .IsUnique() - .HasDatabaseName("IX_NotebookFolders_UserId_IsDefault") - .HasFilter("\"IsDeleted\" = false AND \"IsDefault\" = true"); - - b.HasIndex("UserId", "NormalizedName") - .IsUnique() - .HasFilter("\"IsDeleted\" = false"); - - b.HasIndex("UserId", "IsDeleted", "SortOrder"); - - b.ToTable("NotebookFolders", (string)null); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.NotebookPage", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ChecklistCompletedCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("ChecklistTotalCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("ContentFormatVersion") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(1); - - b.Property("ContentJson") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("jsonb") - .HasDefaultValueSql("'{\"type\":\"doc\",\"version\":1,\"blocks\":[]}'::jsonb"); - - b.Property("ContentPlainText") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("text") - .HasDefaultValue(""); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("FavoritedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("IsDefault") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("IsFavorite") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("LastAutosavedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("LearnerNoteId") - .HasColumnType("integer"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Revision") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(1); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("SourceId") - .HasColumnType("integer"); - - b.Property("SourcePath") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("SourceTitle") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceType") - .HasMaxLength(40) - .HasColumnType("character varying(40)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("UserId") - .IsUnique() - .HasDatabaseName("IX_NotebookPages_UserId_IsDefault") - .HasFilter("\"IsDeleted\" = false AND \"IsDefault\" = true"); - - b.HasIndex("LearnerNoteId", "IsDeleted", "SortOrder"); - - b.HasIndex("UserId", "IsDeleted", "IsFavorite"); - - b.ToTable("NotebookPages", (string)null); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.Notification", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("DeliveredTokens") - .HasColumnType("text"); - - b.Property("IdempotencyKey") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("IsRead") - .HasColumnType("boolean"); - - b.Property("LinkUrl") - .HasColumnType("text"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("IdempotencyKey") - .IsUnique() - .HasFilter("\"IdempotencyKey\" IS NOT NULL"); - - b.HasIndex("UserId", "IsRead"); - - b.ToTable("Notifications"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.OrganizationPayoutAccount", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BankCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ChannelCode") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfiguredByAdminId") - .HasColumnType("integer"); - - b.Property("CreatedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("IsActive") - .HasColumnType("boolean"); - - b.Property("IsVerified") - .HasColumnType("boolean"); - - b.Property("MaskedAccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ProviderAccountReference") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ProviderType") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("VerifiedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.HasKey("Id"); - - b.HasIndex("ChannelCode") - .IsUnique(); - - b.HasIndex("ConfiguredByAdminId"); - - b.ToTable("OrganizationPayoutAccounts"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.PracticeExercise", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CertificateLevelId") - .HasColumnType("integer"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("ImageUrl") - .HasColumnType("text"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("LanguageSkillId") - .HasColumnType("integer"); - - b.Property("LessonId") - .HasColumnType("integer"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("PassingScorePercent") - .ValueGeneratedOnAdd() - .HasColumnType("double precision") - .HasDefaultValue(70.0); - - b.Property("Scope") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(30) - .HasColumnType("character varying(30)") - .HasDefaultValue("LessonQuickCheck"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("TopicId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("CertificateLevelId"); - - b.HasIndex("LanguageSkillId"); - - b.HasIndex("TopicId"); - - b.HasIndex("LessonId", "LanguageSkillId"); - - b.HasIndex("Scope", "CertificateLevelId"); - - b.HasIndex("Scope", "TopicId"); - - b.ToTable("PracticeExercises"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.PracticeExerciseAttempt", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("HomeworkAssignmentId") - .HasColumnType("integer"); - - b.Property("IsCompleted") - .HasColumnType("boolean"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("PracticeExerciseId") - .HasColumnType("integer"); - - b.Property("ScorePercent") - .HasColumnType("double precision"); - - b.Property("StartedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("SubmittedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("PracticeExerciseId"); - - b.HasIndex("HomeworkAssignmentId", "PracticeExerciseId") - .IsUnique(); - - b.HasIndex("UserId", "PracticeExerciseId", "StartedAt"); - - b.ToTable("PracticeExerciseAttempts"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.PracticeQuestion", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Explanation") - .HasColumnType("text"); - - b.Property("ImageUrl") - .HasColumnType("text"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("PracticeExerciseId") - .HasColumnType("integer"); - - b.Property("QuestionText") - .IsRequired() - .HasColumnType("text"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("PracticeExerciseId"); - - b.ToTable("PracticeQuestions"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.PracticeQuestionOption", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ImageUrl") - .HasColumnType("text"); - - b.Property("IsCorrect") - .HasColumnType("boolean"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("OptionText") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("PracticeQuestionId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("PracticeQuestionId"); - - b.ToTable("PracticeQuestionOptions"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.PracticeSubmission", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AudioUrl") - .HasColumnType("text"); - - b.Property("CertificateLevelId") - .HasColumnType("integer") - .HasColumnName("CertificationLevelId"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ImageUrl") - .HasColumnType("text"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("SubmittedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("TextContent") - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("CertificateLevelId"); - - b.HasIndex("UserId", "Type", "SubmittedAt"); - - b.ToTable("PracticeSubmissions"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.RecommendedLearningPath", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("BaseActivePathId") - .HasColumnType("integer"); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("IsViewed") - .HasColumnType("boolean"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("PreviewExpiresAt") - .HasColumnType("timestamp without time zone"); - - b.Property("StartingCertificateLevelId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SuggestionJson") - .IsRequired() - .HasColumnType("text"); - - b.Property("Summary") - .HasColumnType("text"); - - b.Property("TargetCertificateLevelId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Version") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("UserId") - .IsUnique() - .HasFilter("\"Status\" = 'Active'"); - - b.HasIndex("UserId", "GeneratedAt"); - - b.HasIndex("UserId", "Version") - .IsUnique(); - - b.ToTable("RecommendedLearningPaths"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.ReviewCard", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AcceptedReadingsJson") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("ArchivedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("AudioUrl") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("BackText") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)") - .HasDefaultValue(""); - - b.Property("CardType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(30) - .HasColumnType("character varying(30)") - .HasDefaultValue("Vocabulary"); - - b.Property("ContextSnippet") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("CorrectCount") - .HasColumnType("integer"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("EaseFactor") - .HasColumnType("double precision"); - - b.Property("ExampleMeaning") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ExampleSentence") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("FrontText") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasDefaultValue(""); - - b.Property("GrammarPatternId") - .HasColumnType("integer") - .HasColumnName("GrammarPointId"); - - b.Property("IncorrectCount") - .HasColumnType("integer"); - - b.Property("IntervalDays") - .HasColumnType("integer"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("JlptLevel") - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("KanjiId") - .HasColumnType("integer") - .HasColumnName("KanjiEntryId"); - - b.Property("Lapses") - .HasColumnType("integer"); - - b.Property("LastReviewedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("LearnerNoteEntryId") - .HasColumnType("integer") - .HasColumnName("VocabularyNoteEntryId"); - - b.Property("LearningState") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("New"); - - b.Property("LessonId") - .HasColumnType("integer"); - - b.Property("MasteredAt") - .HasColumnType("timestamp without time zone"); - - b.Property("Meaning") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Mode") - .HasColumnType("integer"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("NextReviewDate") - .HasColumnType("timestamp without time zone"); - - b.Property("NormalizedContentKey") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(300) - .HasColumnType("character varying(300)") - .HasDefaultValue(""); - - b.Property("PersonalNote") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Reading") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("Repetitions") - .HasColumnType("integer"); - - b.Property("Revision") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(1); - - b.Property("SourceId") - .HasColumnType("integer"); - - b.Property("SourceLabel") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("SourceLinksJson") - .HasMaxLength(4000) - .HasColumnType("character varying(4000)"); - - b.Property("SourceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(40) - .HasColumnType("character varying(40)") - .HasDefaultValue("Manual"); - - b.Property("SourceVersion") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(1); - - b.Property("SrsCardTemplateId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SuspendedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("SynonymsJson") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("VocabularyId") - .HasColumnType("integer"); - - b.Property("WritingCorrectStrokeCount") - .HasColumnType("integer"); - - b.Property("WritingPracticeMode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WritingScore") - .HasColumnType("integer"); - - b.Property("WritingScoreUpdatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("WritingTotalStrokeCount") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("GrammarPatternId"); - - b.HasIndex("KanjiId"); - - b.HasIndex("LearnerNoteEntryId"); - - b.HasIndex("LessonId"); - - b.HasIndex("SrsCardTemplateId"); - - b.HasIndex("VocabularyId"); - - b.HasIndex("UserId", "NextReviewDate"); - - b.HasIndex("UserId", "GrammarPatternId", "Mode") - .IsUnique() - .HasFilter("\"GrammarPointId\" IS NOT NULL"); - - b.HasIndex("UserId", "KanjiId", "Mode") - .IsUnique() - .HasFilter("\"KanjiEntryId\" IS NOT NULL"); - - b.HasIndex("UserId", "NormalizedContentKey", "Mode") - .IsUnique() - .HasFilter("\"NormalizedContentKey\" <> '' AND \"IsDeleted\" = false"); - - b.HasIndex("UserId", "VocabularyId", "Mode") - .IsUnique() - .HasFilter("\"VocabularyId\" IS NOT NULL"); - - b.HasIndex("UserId", "Status", "LearningState", "NextReviewDate"); - - b.ToTable("ReviewCards"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.ReviewHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("IdempotencyKey") - .HasMaxLength(120) - .HasColumnType("character varying(120)"); - - b.Property("IsCorrect") - .HasColumnType("boolean"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("NewEaseFactor") - .ValueGeneratedOnAdd() - .HasColumnType("double precision") - .HasDefaultValue(2.5); - - b.Property("NewIntervalDays") - .HasColumnType("integer"); - - b.Property("NewState") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Learning"); - - b.Property("PreviousEaseFactor") - .ValueGeneratedOnAdd() - .HasColumnType("double precision") - .HasDefaultValue(2.5); - - b.Property("PreviousIntervalDays") - .HasColumnType("integer"); - - b.Property("PreviousState") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("New"); - - b.Property("Quality") - .HasColumnType("integer"); - - b.Property("Rating") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ResponseTimeMs") - .HasColumnType("integer"); - - b.Property("ReviewCardId") - .HasColumnType("integer") - .HasColumnName("ReviewItemId"); - - b.Property("ReviewedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("SessionReference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("StudyMode") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("flip"); - - b.Property("UserAnswer") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.HasKey("Id"); - - b.HasIndex("SessionReference"); - - b.HasIndex("ReviewCardId", "IdempotencyKey") - .IsUnique() - .HasFilter("\"IdempotencyKey\" IS NOT NULL"); - - b.HasIndex("ReviewCardId", "ReviewedAt"); - - b.ToTable("ReviewHistories"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.SrsCardTemplate", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AcceptedReadingsJson") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("AudioUrl") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("BackText") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("CardType") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CertificateLevelId") - .HasColumnType("integer"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ExampleMeaning") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ExampleSentence") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("FrontText") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("GrammarPatternId") - .HasColumnType("integer"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("JlptLevel") - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("KanjiId") - .HasColumnType("integer"); - - b.Property("LessonId") - .HasColumnType("integer"); - - b.Property("Meaning") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("NormalizedContentKey") - .IsRequired() - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("Reading") - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("ReviewNote") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ReviewedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("ReviewedByAdminId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(24) - .HasColumnType("character varying(24)"); - - b.Property("SubmittedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("SubmittedByUserId") - .HasColumnType("integer"); - - b.Property("SynonymsJson") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("UnpublishedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("UnpublishedReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UsageNotes") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("Version") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(1); - - b.Property("VocabularyId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("CertificateLevelId"); - - b.HasIndex("GrammarPatternId"); - - b.HasIndex("KanjiId"); - - b.HasIndex("LessonId"); - - b.HasIndex("NormalizedContentKey"); - - b.HasIndex("ReviewedByAdminId"); - - b.HasIndex("VocabularyId"); - - b.HasIndex("SubmittedByUserId", "Status"); - - b.HasIndex("Status", "JlptLevel", "CardType"); - - b.ToTable("SrsCardTemplates"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.SrsReviewSession", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CompletedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("CompletedCardIdsJson") - .IsRequired() - .HasMaxLength(8000) - .HasColumnType("character varying(8000)"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("DeadlineAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("FilterCardType") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FilterJlptLevel") - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("FilterLearningState") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("FilterSourceType") - .HasMaxLength(40) - .HasColumnType("character varying(40)"); - - b.Property("ForgotCount") - .HasColumnType("integer"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("LastActivityAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ProcessedStepKeysJson") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(8000) - .HasColumnType("character varying(8000)") - .HasDefaultValue("[]"); - - b.Property("QueueCardIdsJson") - .IsRequired() - .HasMaxLength(8000) - .HasColumnType("character varying(8000)"); - - b.Property("RememberedCount") - .HasColumnType("integer"); - - b.Property("RequestedCount") - .HasColumnType("integer"); - - b.Property("RetryCardIdsJson") - .IsRequired() - .HasMaxLength(8000) - .HasColumnType("character varying(8000)"); - - b.Property("ReviewedCount") - .HasColumnType("integer"); - - b.Property("SelectionScope") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("SessionKey") - .HasColumnType("uuid"); - - b.Property("SessionKind") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Scheduled"); - - b.Property("ShuffleEnabled") - .HasColumnType("boolean"); - - b.Property("StartedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StudyMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TimeLimitMinutes") - .HasColumnType("integer"); - - b.Property("TotalInitialCards") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("SessionKey") - .IsUnique(); - - b.HasIndex("UserId", "Status", "LastActivityAtUtc"); - - b.HasIndex("UserId", "SessionKind", "Status", "LastActivityAtUtc"); - - b.ToTable("SrsReviewSessions"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.StudyCohort", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CancellationReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("CancelledAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("Capacity") - .HasColumnType("integer"); - - b.Property("CapacitySnapshot") - .HasColumnType("integer"); - - b.Property("CourseDurationWeeks") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(1); - - b.Property("CreatedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("EndsAt") - .HasColumnType("timestamp without time zone"); - - b.Property("EnrollmentClosedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("EnrollmentClosesAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("EnrollmentOpensAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("GroupPolicyId") - .HasColumnType("integer"); - - b.Property("MentorId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlanId") - .HasColumnType("integer"); - - b.Property("PolicyVersionSnapshot") - .HasColumnType("integer"); - - b.Property("Revision") - .IsConcurrencyToken() - .HasColumnType("integer"); - - b.Property("SourceProposalId") - .HasColumnType("integer"); - - b.Property("StartsAt") - .HasColumnType("timestamp without time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("TotalTuitionSnapshot") - .HasPrecision(18) - .HasColumnType("numeric(18,0)"); - - b.Property("TuitionPerSessionSnapshot") - .HasPrecision(18) - .HasColumnType("numeric(18,0)"); - - b.Property("TuitionPolicyVersionSnapshot") - .HasColumnType("integer"); - - b.Property("TuitionSnapshotAtUtc") - .HasColumnType("timestamp with time zone"); - - b.HasKey("Id"); - - b.HasIndex("GroupPolicyId"); - - b.HasIndex("MentorId"); - - b.HasIndex("PlanId"); - - b.HasIndex("SourceProposalId") - .IsUnique() - .HasFilter("\"SourceProposalId\" IS NOT NULL"); - - b.ToTable("StudyCohorts", null, t => - { - t.HasCheckConstraint("CK_StudyCohort_Capacity", "\"Capacity\" > 0"); - - t.HasCheckConstraint("CK_StudyCohort_DurationWeeks", "\"CourseDurationWeeks\" >= 1"); - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.StudyCohortMentorAssignment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AffectedSessionCount") - .HasColumnType("integer"); - - b.Property("AssignedById") - .HasColumnType("integer"); - - b.Property("CohortId") - .HasColumnType("integer"); - - b.Property("CreatedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFromSessionNumber") - .HasColumnType("integer"); - - b.Property("EffectiveFromUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("IdempotencyKey") - .HasColumnType("uuid"); - - b.Property("ImpactSnapshot") - .IsRequired() - .HasColumnType("text"); - - b.Property("MentorId") - .HasColumnType("integer"); - - b.Property("PolicyId") - .HasColumnType("integer"); - - b.Property("PolicyVersionSnapshot") - .HasColumnType("integer"); - - b.Property("PreviousMentorId") - .HasColumnType("integer"); - - b.Property("Reason") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.HasKey("Id"); - - b.HasIndex("AssignedById"); - - b.HasIndex("IdempotencyKey") - .IsUnique(); - - b.HasIndex("MentorId"); - - b.HasIndex("PolicyId"); - - b.HasIndex("PreviousMentorId"); - - b.HasIndex("CohortId", "Id"); - - b.ToTable("StudyCohortMentorAssignments", null, t => - { - t.HasCheckConstraint("CK_StudyCohortMentorAssignment_DifferentMentor", "\"MentorId\" <> \"PreviousMentorId\""); - - t.HasCheckConstraint("CK_StudyCohortMentorAssignment_Reason", "length(btrim(\"Reason\")) > 0"); - - t.HasCheckConstraint("CK_StudyCohortMentorAssignment_Sessions", "\"EffectiveFromSessionNumber\" > 0 AND \"AffectedSessionCount\" > 0"); - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.StudyCohortSession", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ActualEndedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("AvailabilityId") - .HasColumnType("integer"); - - b.Property("CohortId") - .HasColumnType("integer"); - - b.Property("Number") - .HasColumnType("integer"); - - b.Property("Status") - .IsConcurrencyToken() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("Id"); - - b.HasIndex("AvailabilityId") - .IsUnique(); - - b.HasIndex("CohortId", "Number") - .IsUnique(); - - b.ToTable("StudyCohortSessions", (string)null); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.StudyCourse", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Amount") - .HasPrecision(18) - .HasColumnType("numeric(18,0)"); - - b.Property("CancellationReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("CancelledAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("CapacitySnapshot") - .HasColumnType("integer"); - - b.Property("CertificateLevelId") - .HasColumnType("integer"); - - b.Property("CheckoutUrl") - .HasColumnType("text"); - - b.Property("CohortId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("DurationMonths") - .HasColumnType("integer"); - - b.Property("EndsAt") - .HasColumnType("timestamp without time zone"); - - b.Property("GroupPolicyId") - .HasColumnType("integer"); - - b.Property("LearnerId") - .HasColumnType("integer"); - - b.Property("MaximumAbsencePercent") - .HasColumnType("integer"); - - b.Property("MentorId") - .HasColumnType("integer"); - - b.Property("MinimumHomeworkPercent") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OrderSnapshot") - .HasColumnType("text"); - - b.Property("PaymentConfirmedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("PaymentExpiresAt") - .HasColumnType("timestamp without time zone"); - - b.Property("PaymentReference") - .HasColumnType("text"); - - b.Property("PaymentReviewReason") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PaymentStatus") - .IsRequired() - .HasColumnType("text"); - - b.Property("PlanId") - .HasColumnType("integer"); - - b.Property("PlanRevision") - .HasColumnType("integer"); - - b.Property("PolicyVersionSnapshot") - .HasColumnType("integer"); - - b.Property("ProviderPaymentReference") - .HasMaxLength(120) - .HasColumnType("character varying(120)"); - - b.Property("PurchaseKey") - .HasColumnType("uuid"); - - b.Property("RefundedAmount") - .HasPrecision(18) - .HasColumnType("numeric(18,0)"); - - b.Property("RefundedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("RetakeClaimDays") - .HasColumnType("integer"); - - b.Property("RetakeOfId") - .HasColumnType("integer"); - - b.Property("SessionMinutes") - .HasColumnType("integer"); - - b.Property("SessionType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("text") - .HasDefaultValue("Individual"); - - b.Property("SessionsPerWeek") - .HasColumnType("integer"); - - b.Property("StartsAt") - .HasColumnType("timestamp without time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("TargetExamDate") - .HasColumnType("timestamp without time zone"); - - b.Property("TotalSessions") - .HasColumnType("integer"); - - b.Property("TransferredAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("TransferredFromCourseId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("CertificateLevelId"); - - b.HasIndex("CohortId"); - - b.HasIndex("GroupPolicyId"); - - b.HasIndex("MentorId"); - - b.HasIndex("PlanId"); - - b.HasIndex("ProviderPaymentReference") - .IsUnique() - .HasDatabaseName("IX_StudyCourses_ProviderPaymentReference") - .HasFilter("\"ProviderPaymentReference\" IS NOT NULL"); - - b.HasIndex("RetakeOfId") - .IsUnique(); - - b.HasIndex("TransferredFromCourseId") - .IsUnique() - .HasFilter("\"TransferredFromCourseId\" IS NOT NULL"); - - b.HasIndex("CohortId", "LearnerId") - .IsUnique() - .HasDatabaseName("IX_StudyCourses_Cohort_ActiveLearner") - .HasFilter("\"CohortId\" IS NOT NULL AND \"Status\" = 'Active'"); - - b.HasIndex("LearnerId", "PurchaseKey") - .IsUnique(); - - b.ToTable("StudyCourses", null, t => - { - t.HasCheckConstraint("CK_StudyCourses_RefundedAmount", "\"RefundedAmount\" >= 0 AND \"RefundedAmount\" <= \"Amount\""); - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.StudyCourseHomework", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CourseId") - .HasColumnType("integer"); - - b.Property("DueAt") - .HasColumnType("timestamp without time zone"); - - b.Property("Feedback") - .HasColumnType("text"); - - b.Property("Instructions") - .IsRequired() - .HasColumnType("text"); - - b.Property("Passed") - .HasColumnType("boolean"); - - b.Property("Required") - .HasColumnType("boolean"); - - b.Property("ReviewedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("Submission") - .HasMaxLength(20000) - .HasColumnType("character varying(20000)"); - - b.Property("SubmittedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("CourseId"); - - b.ToTable("StudyCourseHomework", (string)null); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.StudyCoursePlan", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Capacity") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(1); - - b.Property("CertificateLevelId") - .HasColumnType("integer"); - - b.Property("DurationMonths") - .HasColumnType("integer"); - - b.Property("IsPublished") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Price") - .HasPrecision(18) - .HasColumnType("numeric(18,0)"); - - b.Property("RetakeClaimDays") - .HasColumnType("integer"); - - b.Property("Revision") - .IsConcurrencyToken() - .HasColumnType("integer"); - - b.Property("SessionMinutes") - .HasColumnType("integer"); - - b.Property("SessionType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("text") - .HasDefaultValue("Individual"); - - b.Property("SessionsPerWeek") - .HasColumnType("integer"); - - b.Property("TargetExamDate") - .HasColumnType("timestamp without time zone"); - - b.Property("TotalSessions") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("CertificateLevelId"); - - b.ToTable("StudyCoursePlans", (string)null); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.StudyCourseSession", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("Attempt") - .HasColumnType("integer"); - - b.Property("AvailabilityId") - .HasColumnType("integer"); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ConfirmedById") - .HasColumnType("integer"); - - b.Property("CourseId") - .HasColumnType("integer"); - - b.Property("MeetingUrl") - .HasColumnType("text"); - - b.Property("Note") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Number") - .HasColumnType("integer"); - - b.Property("ScheduledAt") - .HasColumnType("timestamp without time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.HasKey("Id"); - - b.HasIndex("AvailabilityId"); - - b.HasIndex("CourseId", "Number", "Attempt") - .IsUnique(); - - b.ToTable("StudyCourseSessions", (string)null); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.SubscriptionPlan", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AiGradingQuota") - .HasColumnType("integer"); - - b.Property("CertificateLevelId") - .HasColumnType("integer"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("DurationDays") - .HasColumnType("integer"); - - b.Property("IsActive") - .HasColumnType("boolean"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("IsPopular") - .HasColumnType("boolean"); - - b.Property("IsTrial") - .HasColumnType("boolean"); - - b.Property("MeetingSessionCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlanCategory") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(32) - .HasColumnType("character varying(32)") - .HasDefaultValue("self_study"); - - b.Property("Price") - .HasColumnType("decimal(18,0)"); - - b.Property("Revision") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(1); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("CertificateLevelId"); - - b.ToTable("SubscriptionPlans", t => - { - t.HasCheckConstraint("CK_SubscriptionPlans_AiGradingQuota", "\"AiGradingQuota\" >= 0"); - - t.HasCheckConstraint("CK_SubscriptionPlans_DurationDays", "\"DurationDays\" >= 0"); - - t.HasCheckConstraint("CK_SubscriptionPlans_Price", "\"Price\" >= 0"); - - t.HasCheckConstraint("CK_SubscriptionPlans_SortOrder", "\"SortOrder\" >= 0"); - }); - - b.HasData( - new - { - Id = 1, - AiGradingQuota = 1, - CreatedDate = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Description = "Truy cập nội dung ôn luyện các chứng chỉ tiếng Nhật trong 1 tuần.", - DurationDays = 7, - IsActive = true, - IsDeleted = false, - IsPopular = false, - IsTrial = false, - MeetingSessionCount = 0, - Name = "Tự học tiếng Nhật - 1 tuần", - PlanCategory = "self_study", - Price = 1000m, - Revision = 1, - SortOrder = 6 - }, - new - { - Id = 2, - AiGradingQuota = 2, - CreatedDate = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Description = "Truy cập nội dung ôn luyện các chứng chỉ tiếng Nhật trong 2 tuần.", - DurationDays = 14, - IsActive = true, - IsDeleted = false, - IsPopular = false, - IsTrial = false, - MeetingSessionCount = 0, - Name = "Tự học tiếng Nhật - 2 tuần", - PlanCategory = "self_study", - Price = 1000m, - Revision = 1, - SortOrder = 5 - }, - new - { - Id = 3, - AiGradingQuota = 3, - CreatedDate = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Description = "Truy cập nội dung ôn luyện các chứng chỉ tiếng Nhật trong 3 tuần.", - DurationDays = 21, - IsActive = true, - IsDeleted = false, - IsPopular = false, - IsTrial = false, - MeetingSessionCount = 0, - Name = "Tự học tiếng Nhật - 3 tuần", - PlanCategory = "self_study", - Price = 2000m, - Revision = 1, - SortOrder = 4 - }, - new - { - Id = 4, - AiGradingQuota = 5, - CreatedDate = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Description = "Truy cập nội dung ôn luyện các chứng chỉ tiếng Nhật trong 1 tháng.", - DurationDays = 30, - IsActive = true, - IsDeleted = false, - IsPopular = true, - IsTrial = false, - MeetingSessionCount = 0, - Name = "Tự học tiếng Nhật - 1 tháng", - PlanCategory = "self_study", - Price = 2000m, - Revision = 1, - SortOrder = 3 - }, - new - { - Id = 5, - AiGradingQuota = 10, - CreatedDate = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Description = "Truy cập nội dung ôn luyện các chứng chỉ tiếng Nhật trong 2 tháng.", - DurationDays = 60, - IsActive = true, - IsDeleted = false, - IsPopular = false, - IsTrial = false, - MeetingSessionCount = 0, - Name = "Tự học tiếng Nhật - 2 tháng", - PlanCategory = "self_study", - Price = 3000m, - Revision = 1, - SortOrder = 2 - }, - new - { - Id = 6, - AiGradingQuota = 15, - CreatedDate = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Description = "Truy cập nội dung ôn luyện các chứng chỉ tiếng Nhật trong 3 tháng.", - DurationDays = 90, - IsActive = true, - IsDeleted = false, - IsPopular = false, - IsTrial = false, - MeetingSessionCount = 0, - Name = "Tự học tiếng Nhật - 3 tháng", - PlanCategory = "self_study", - Price = 3000m, - Revision = 1, - SortOrder = 1 - }, - new - { - Id = 7, - AiGradingQuota = 0, - CreatedDate = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Description = "Gói demo gồm 12 buổi ôn luyện 1-1 với Mentor, thời hạn 90 ngày. Dữ liệu thanh toán demo được seed để kiểm thử đặt lịch trên frontend.", - DurationDays = 90, - IsActive = true, - IsDeleted = false, - IsPopular = false, - IsTrial = false, - MeetingSessionCount = 12, - Name = "Meeting 1-1 với Mentor - 12 buổi", - PlanCategory = "mentor_legacy", - Price = 1000m, - Revision = 1, - SortOrder = 7 - }, - new - { - Id = 8101, - AiGradingQuota = 1, - CreatedDate = new DateTime(2026, 11, 23, 0, 0, 0, 0, DateTimeKind.Utc), - Description = "Một lượt luyện nói và chấm phát âm tiếng Nhật bằng AI.", - DurationDays = 0, - IsActive = true, - IsDeleted = false, - IsPopular = false, - IsTrial = false, - MeetingSessionCount = 0, - Name = "Luyện nói AI - 1 lượt", - PlanCategory = "speaking", - Price = 1000m, - Revision = 1, - SortOrder = 10 - }, - new - { - Id = 8102, - AiGradingQuota = 1, - CreatedDate = new DateTime(2026, 11, 23, 0, 0, 0, 0, DateTimeKind.Utc), - Description = "Một lượt chấm bài viết tiếng Nhật bằng AI.", - DurationDays = 0, - IsActive = true, - IsDeleted = false, - IsPopular = false, - IsTrial = false, - MeetingSessionCount = 0, - Name = "Luyện viết AI - 1 lượt", - PlanCategory = "writing", - Price = 1000m, - Revision = 1, - SortOrder = 11 - }, - new - { - Id = 8103, - AiGradingQuota = 1, - CreatedDate = new DateTime(2026, 11, 23, 0, 0, 0, 0, DateTimeKind.Utc), - Description = "Một lượt giải thích chi tiết đáp án đề thi thử bằng AI.", - DurationDays = 0, - IsActive = true, - IsDeleted = false, - IsPopular = false, - IsTrial = false, - MeetingSessionCount = 0, - Name = "Giải thích đáp án AI - 1 lượt", - PlanCategory = "ai_grading", - Price = 1000m, - Revision = 1, - SortOrder = 12 - }, - new - { - Id = 8104, - AiGradingQuota = 1, - CreatedDate = new DateTime(2026, 11, 23, 0, 0, 0, 0, DateTimeKind.Utc), - Description = "Một lượt tạo lộ trình học cá nhân hóa bằng AI.", - DurationDays = 0, - IsActive = true, - IsDeleted = false, - IsPopular = false, - IsTrial = false, - MeetingSessionCount = 0, - Name = "Lộ trình học AI - 1 lượt", - PlanCategory = "learning_path", - Price = 1000m, - Revision = 1, - SortOrder = 13 - }, - new - { - Id = 8105, - AiGradingQuota = 0, - CreatedDate = new DateTime(2026, 11, 23, 0, 0, 0, 0, DateTimeKind.Utc), - Description = "Một buổi ôn luyện với mentor.", - DurationDays = 30, - IsActive = true, - IsDeleted = false, - IsPopular = false, - IsTrial = false, - MeetingSessionCount = 1, - Name = "Mentor - 1 buổi", - PlanCategory = "mentor_legacy", - Price = 1000m, - Revision = 1, - SortOrder = 14 - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.Topic", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CertificateLevelId") - .HasColumnType("integer"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Description") - .HasColumnType("text"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("LearningObjectives") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("StageCode") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.HasKey("Id"); - - b.HasIndex("CertificateLevelId", "SortOrder"); - - b.ToTable("Topics"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.UserAccount", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AssessedCertificateLevelId") - .HasColumnType("integer"); - - b.Property("AvatarUrl") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("CurrentStreak") - .HasColumnType("integer"); - - b.Property("DailyStudyMinutes") - .HasColumnType("integer"); - - b.Property("DailyStudyMinutesMax") - .HasColumnType("integer"); - - b.Property("DailyStudyMinutesMin") - .HasColumnType("integer"); - - b.Property("DeclaredJlptCertificateCode") - .HasColumnType("text"); - - b.Property("Email") - .HasColumnType("text"); - - b.Property("EmailNotificationsEnabled") - .HasColumnType("boolean"); - - b.Property("FirebaseUid") - .HasColumnType("text"); - - b.Property("FirstName") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("GoogleSubject") - .IsConcurrencyToken() - .HasMaxLength(255) - .HasColumnType("character varying(255)"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("IsEmailVerified") - .HasColumnType("boolean"); - - b.Property("IsPhoneVerified") - .HasColumnType("boolean"); - - b.Property("LastName") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("LastStudyDate") - .HasColumnType("timestamp without time zone"); - - b.Property("LearningGoalVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("LearningMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("LongestStreak") - .HasColumnType("integer"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("NotificationPreferencesJson") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("PasswordHash") - .IsRequired() - .HasColumnType("bytea"); - - b.Property("PasswordSalt") - .IsRequired() - .HasColumnType("bytea"); - - b.Property("PendingEmail") - .HasMaxLength(255) - .HasColumnType("character varying(255)"); - - b.Property("PendingEmailRequestedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("PhoneNumber") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("PlacementDecision") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Role") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SelfDeclaredCertificateLevelId") - .HasColumnType("integer"); - - b.Property("StartingCertificateLevelId") - .HasColumnType("integer"); - - b.Property("StudyTimePreference") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("SystemNotificationsEnabled") - .HasColumnType("boolean"); - - b.Property("TargetCertificateLevelId") - .HasColumnType("integer") - .HasColumnName("TargetCertificationLevelId"); - - b.Property("TargetExamDate") - .HasColumnType("timestamp without time zone"); - - b.Property("TokenVersion") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(1); - - b.HasKey("Id"); - - b.HasIndex("AssessedCertificateLevelId"); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("GoogleSubject") - .IsUnique(); - - b.HasIndex("SelfDeclaredCertificateLevelId"); - - b.HasIndex("StartingCertificateLevelId"); - - b.HasIndex("TargetCertificateLevelId"); - - b.ToTable("Users"); - - b.HasData( - new - { - Id = 900001, - CreatedDate = new DateTime(2026, 9, 28, 0, 0, 0, 0, DateTimeKind.Utc), - CurrentStreak = 0, - DailyStudyMinutes = 30, - Email = "admin@rikipath.local", - EmailNotificationsEnabled = true, - FirstName = "Admin", - IsDeleted = false, - IsEmailVerified = true, - IsPhoneVerified = false, - LastName = "System", - LearningGoalVersion = 0, - LearningMode = "Standard", - LongestStreak = 0, - PasswordHash = new byte[] { 91, 215, 217, 54, 239, 206, 181, 216, 143, 33, 82, 211, 9, 70, 197, 173, 197, 0, 72, 71, 59, 150, 46, 114, 96, 137, 52, 174, 137, 29, 196, 61, 50, 254, 249, 101, 114, 92, 149, 32, 55, 127, 205, 126, 216, 147, 197, 192, 248, 173, 158, 92, 104, 42, 195, 107, 150, 15, 3, 74, 103, 104, 3, 229 }, - PasswordSalt = new byte[] { 61, 240, 150, 172, 239, 48, 224, 17, 192, 54, 50, 58, 91, 100, 55, 168, 18, 69, 137, 112, 110, 59, 180, 37, 201, 241, 143, 238, 139, 33, 128, 70, 87, 158, 235, 219, 229, 184, 94, 72, 41, 160, 160, 197, 158, 217, 128, 188, 156, 255, 147, 13, 151, 37, 133, 164, 9, 252, 175, 124, 21, 15, 152, 196 }, - PlacementDecision = "NotTaken", - Role = "Admin", - SystemNotificationsEnabled = true, - TokenVersion = 1 - }, - new - { - Id = 900002, - CreatedDate = new DateTime(2026, 9, 28, 0, 0, 0, 0, DateTimeKind.Utc), - CurrentStreak = 0, - DailyStudyMinutes = 30, - Email = "mentor1@rikipath.local", - EmailNotificationsEnabled = true, - FirstName = "Mentor", - IsDeleted = false, - IsEmailVerified = true, - IsPhoneVerified = false, - LastName = "One", - LearningGoalVersion = 0, - LearningMode = "Standard", - LongestStreak = 0, - PasswordHash = new byte[] { 17, 253, 106, 25, 89, 176, 204, 31, 142, 252, 245, 31, 64, 101, 213, 135, 164, 116, 40, 46, 173, 175, 8, 0, 69, 101, 65, 4, 90, 25, 176, 223, 153, 237, 220, 94, 55, 133, 227, 181, 70, 97, 155, 122, 50, 139, 216, 136, 88, 52, 76, 98, 250, 64, 52, 71, 146, 221, 225, 137, 106, 6, 178, 239 }, - PasswordSalt = new byte[] { 233, 77, 244, 252, 171, 97, 38, 140, 50, 138, 10, 54, 122, 165, 186, 85, 129, 82, 49, 10, 98, 44, 165, 57, 50, 7, 238, 166, 142, 224, 94, 49, 134, 226, 247, 110, 154, 139, 99, 204, 95, 39, 171, 235, 212, 26, 217, 87, 139, 118, 253, 125, 241, 255, 57, 22, 140, 171, 11, 168, 174, 202, 32, 17 }, - PlacementDecision = "NotTaken", - Role = "Mentor", - SystemNotificationsEnabled = true, - TokenVersion = 1 - }, - new - { - Id = 900003, - CreatedDate = new DateTime(2026, 9, 28, 0, 0, 0, 0, DateTimeKind.Utc), - CurrentStreak = 0, - DailyStudyMinutes = 30, - Email = "mentor2@rikipath.local", - EmailNotificationsEnabled = true, - FirstName = "Mentor", - IsDeleted = false, - IsEmailVerified = true, - IsPhoneVerified = false, - LastName = "Two", - LearningGoalVersion = 0, - LearningMode = "Standard", - LongestStreak = 0, - PasswordHash = new byte[] { 93, 130, 109, 171, 238, 187, 245, 15, 202, 89, 247, 220, 95, 192, 246, 138, 5, 75, 250, 28, 208, 28, 51, 79, 127, 28, 214, 237, 93, 221, 108, 26, 152, 66, 73, 65, 11, 147, 154, 102, 113, 49, 51, 24, 51, 197, 248, 254, 22, 98, 87, 249, 250, 104, 131, 74, 16, 18, 179, 200, 3, 3, 79, 47 }, - PasswordSalt = new byte[] { 240, 155, 254, 183, 129, 162, 74, 247, 41, 9, 67, 242, 128, 8, 226, 85, 5, 104, 104, 72, 101, 75, 130, 95, 47, 101, 116, 89, 207, 23, 119, 178, 38, 180, 185, 145, 58, 115, 14, 30, 85, 216, 169, 133, 94, 115, 11, 117, 96, 87, 227, 240, 204, 48, 51, 144, 170, 248, 167, 56, 175, 194, 253, 135 }, - PlacementDecision = "NotTaken", - Role = "Mentor", - SystemNotificationsEnabled = true, - TokenVersion = 1 - }, - new - { - Id = 900004, - CreatedDate = new DateTime(2026, 9, 28, 0, 0, 0, 0, DateTimeKind.Utc), - CurrentStreak = 0, - DailyStudyMinutes = 30, - Email = "author1@rikipath.local", - EmailNotificationsEnabled = true, - FirstName = "Content", - IsDeleted = false, - IsEmailVerified = true, - IsPhoneVerified = false, - LastName = "Author One", - LearningGoalVersion = 0, - LearningMode = "Standard", - LongestStreak = 0, - PasswordHash = new byte[] { 168, 249, 82, 144, 178, 145, 94, 164, 34, 152, 2, 74, 204, 105, 84, 145, 96, 199, 153, 136, 110, 82, 114, 113, 22, 139, 117, 143, 50, 239, 197, 4, 51, 189, 137, 48, 175, 14, 104, 164, 218, 249, 148, 217, 33, 44, 202, 128, 237, 183, 110, 228, 185, 36, 209, 254, 183, 182, 55, 1, 78, 16, 234, 50 }, - PasswordSalt = new byte[] { 19, 216, 84, 143, 3, 184, 50, 39, 209, 137, 149, 82, 224, 206, 6, 240, 237, 242, 172, 27, 55, 92, 242, 101, 149, 76, 104, 38, 176, 43, 40, 8, 102, 202, 146, 224, 62, 43, 147, 132, 2, 158, 81, 170, 29, 103, 76, 248, 101, 105, 213, 205, 32, 51, 59, 39, 221, 11, 135, 250, 193, 8, 78, 219 }, - PlacementDecision = "NotTaken", - Role = "ContentAuthor", - SystemNotificationsEnabled = true, - TokenVersion = 1 - }, - new - { - Id = 900005, - CreatedDate = new DateTime(2026, 9, 28, 0, 0, 0, 0, DateTimeKind.Utc), - CurrentStreak = 0, - DailyStudyMinutes = 30, - Email = "author2@rikipath.local", - EmailNotificationsEnabled = true, - FirstName = "Content", - IsDeleted = false, - IsEmailVerified = true, - IsPhoneVerified = false, - LastName = "Author Two", - LearningGoalVersion = 0, - LearningMode = "Standard", - LongestStreak = 0, - PasswordHash = new byte[] { 189, 121, 9, 1, 230, 137, 43, 239, 79, 56, 195, 196, 66, 116, 42, 1, 137, 55, 54, 249, 55, 231, 79, 224, 182, 182, 199, 133, 100, 39, 138, 5, 223, 215, 48, 46, 60, 214, 49, 88, 42, 186, 232, 116, 237, 89, 55, 144, 4, 78, 215, 231, 237, 220, 96, 225, 202, 97, 61, 165, 246, 28, 126, 198 }, - PasswordSalt = new byte[] { 66, 178, 77, 56, 234, 206, 29, 78, 136, 190, 160, 142, 226, 249, 14, 17, 26, 101, 167, 36, 193, 55, 150, 94, 239, 81, 69, 54, 81, 171, 80, 22, 208, 38, 242, 2, 55, 171, 64, 38, 48, 224, 36, 216, 133, 132, 147, 100, 174, 32, 65, 134, 128, 35, 50, 138, 204, 59, 167, 96, 11, 128, 101, 102 }, - PlacementDecision = "NotTaken", - Role = "ContentAuthor", - SystemNotificationsEnabled = true, - TokenVersion = 1 - }, - new - { - Id = 900006, - CreatedDate = new DateTime(2026, 9, 28, 0, 0, 0, 0, DateTimeKind.Utc), - CurrentStreak = 0, - DailyStudyMinutes = 30, - Email = "learner.meeting@rikipath.local", - EmailNotificationsEnabled = true, - FirstName = "Meeting", - IsDeleted = false, - IsEmailVerified = true, - IsPhoneVerified = false, - LastName = "Test Learner", - LearningGoalVersion = 0, - LearningMode = "Standard", - LongestStreak = 0, - PasswordHash = new byte[] { 9, 206, 219, 58, 155, 234, 107, 145, 121, 174, 134, 51, 96, 253, 64, 216, 157, 114, 92, 36, 123, 206, 67, 217, 207, 166, 54, 71, 254, 251, 156, 200, 185, 110, 198, 135, 221, 146, 243, 40, 237, 229, 16, 133, 163, 161, 156, 79, 138, 103, 85, 25, 114, 81, 99, 182, 25, 73, 212, 198, 212, 192, 54, 129 }, - PasswordSalt = new byte[] { 231, 202, 97, 95, 11, 9, 242, 47, 62, 77, 67, 36, 170, 78, 120, 81, 56, 69, 47, 36, 209, 212, 107, 244, 15, 34, 189, 110, 57, 66, 205, 213, 224, 19, 245, 192, 104, 146, 130, 44, 54, 107, 2, 15, 109, 136, 118, 220, 228, 44, 110, 219, 31, 100, 161, 164, 63, 231, 196, 79, 120, 106, 181, 71 }, - PlacementDecision = "NotTaken", - Role = "Learner", - SystemNotificationsEnabled = true, - TokenVersion = 1 - }, - new - { - Id = 900007, - CreatedDate = new DateTime(2026, 9, 28, 0, 0, 0, 0, DateTimeKind.Utc), - CurrentStreak = 0, - DailyStudyMinutes = 30, - Email = "learner2.meeting@rikipath.local", - EmailNotificationsEnabled = true, - FirstName = "Linh", - IsDeleted = false, - IsEmailVerified = true, - IsPhoneVerified = false, - LastName = "Nguyen", - LearningGoalVersion = 0, - LearningMode = "Standard", - LongestStreak = 0, - PasswordHash = new byte[] { 217, 79, 50, 159, 85, 88, 67, 15, 23, 182, 103, 80, 220, 85, 86, 173, 204, 186, 57, 67, 183, 165, 253, 243, 150, 250, 150, 190, 122, 252, 55, 169, 85, 236, 69, 106, 19, 219, 244, 42, 239, 30, 189, 176, 52, 47, 30, 28, 125, 31, 162, 255, 61, 3, 238, 201, 168, 88, 161, 42, 216, 86, 172, 219 }, - PasswordSalt = new byte[] { 85, 97, 108, 158, 219, 70, 81, 106, 73, 23, 205, 163, 105, 159, 117, 19, 175, 147, 178, 99, 112, 116, 163, 243, 109, 178, 129, 229, 245, 175, 91, 174, 66, 198, 122, 88, 80, 68, 160, 64, 85, 118, 105, 41, 135, 89, 49, 160, 120, 13, 116, 148, 255, 27, 157, 207, 106, 203, 127, 74, 19, 61, 148, 120 }, - PlacementDecision = "NotTaken", - Role = "Learner", - SystemNotificationsEnabled = true, - TokenVersion = 1 - }, - new - { - Id = 900008, - CreatedDate = new DateTime(2026, 9, 28, 0, 0, 0, 0, DateTimeKind.Utc), - CurrentStreak = 0, - DailyStudyMinutes = 30, - Email = "learner3.meeting@rikipath.local", - EmailNotificationsEnabled = true, - FirstName = "Minh", - IsDeleted = false, - IsEmailVerified = true, - IsPhoneVerified = false, - LastName = "Tran", - LearningGoalVersion = 0, - LearningMode = "Standard", - LongestStreak = 0, - PasswordHash = new byte[] { 84, 97, 164, 196, 63, 151, 182, 39, 139, 242, 152, 22, 179, 33, 174, 113, 0, 236, 253, 114, 234, 242, 209, 76, 196, 162, 143, 195, 180, 3, 178, 193, 205, 230, 18, 114, 49, 151, 198, 217, 254, 21, 94, 176, 146, 214, 235, 122, 28, 241, 164, 161, 4, 161, 209, 38, 102, 179, 31, 107, 157, 25, 35, 63 }, - PasswordSalt = new byte[] { 26, 188, 78, 205, 57, 115, 100, 129, 148, 135, 165, 205, 148, 203, 245, 36, 244, 177, 9, 104, 120, 140, 21, 164, 36, 75, 122, 51, 115, 69, 174, 180, 120, 155, 62, 37, 97, 227, 212, 134, 200, 7, 66, 255, 219, 10, 140, 149, 67, 86, 164, 170, 142, 165, 181, 103, 47, 100, 238, 24, 178, 29, 171, 226 }, - PlacementDecision = "NotTaken", - Role = "Learner", - SystemNotificationsEnabled = true, - TokenVersion = 1 - }, - new - { - Id = 900009, - CreatedDate = new DateTime(2026, 9, 28, 0, 0, 0, 0, DateTimeKind.Utc), - CurrentStreak = 0, - DailyStudyMinutes = 30, - Email = "learner4.meeting@rikipath.local", - EmailNotificationsEnabled = true, - FirstName = "Hoang", - IsDeleted = false, - IsEmailVerified = true, - IsPhoneVerified = false, - LastName = "Pham", - LearningGoalVersion = 0, - LearningMode = "Standard", - LongestStreak = 0, - PasswordHash = new byte[] { 42, 30, 236, 129, 234, 192, 63, 84, 148, 163, 154, 246, 107, 147, 189, 95, 33, 141, 196, 67, 181, 51, 157, 136, 93, 228, 237, 165, 164, 49, 4, 146, 87, 84, 9, 47, 28, 59, 33, 130, 37, 63, 43, 229, 8, 178, 123, 74, 61, 159, 235, 68, 217, 51, 225, 29, 201, 104, 44, 152, 53, 255, 199, 28 }, - PasswordSalt = new byte[] { 83, 214, 138, 3, 142, 91, 229, 97, 238, 61, 48, 237, 80, 82, 112, 249, 166, 81, 53, 95, 170, 120, 13, 87, 113, 159, 60, 37, 75, 229, 226, 107, 229, 89, 60, 57, 109, 196, 235, 81, 145, 154, 110, 120, 141, 13, 142, 77, 41, 132, 58, 80, 154, 57, 226, 168, 176, 251, 113, 167, 242, 139, 7, 177 }, - PlacementDecision = "NotTaken", - Role = "Learner", - SystemNotificationsEnabled = true, - TokenVersion = 1 - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.UserDeviceToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("CreatedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp with time zone"); - - b.Property("DeviceIdentifier") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("FcmToken") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("IsActive") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("LastSeenAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Platform") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAtUtc") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("FcmToken") - .HasDatabaseName("IX_UserDeviceTokens_FcmToken"); - - b.HasIndex("UserId", "DeviceIdentifier") - .HasDatabaseName("IX_UserDeviceTokens_UserId_DeviceIdentifier"); - - b.HasIndex("UserId", "IsActive") - .HasDatabaseName("IX_UserDeviceTokens_UserId_IsActive"); - - b.ToTable("UserDeviceTokens", (string)null); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.UserSrsPreference", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AutoEnrollAfterLesson") - .HasColumnType("boolean"); - - b.Property("AutoPlayAudio") - .HasColumnType("boolean"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("DailyNewLimit") - .HasColumnType("integer"); - - b.Property("DailyReminderEnabled") - .HasColumnType("boolean"); - - b.Property("DailyReviewLimit") - .HasColumnType("integer"); - - b.Property("EmailReminderEnabled") - .HasColumnType("boolean"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("LastReminderSentAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("LastReminderSentLocalDate") - .HasColumnType("date"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("PreferredLocale") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("PreferredReviewMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReminderDaysJson") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ReminderFrequency") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("ReminderHour") - .HasColumnType("integer"); - - b.Property("ReminderMinute") - .HasColumnType("integer"); - - b.Property("ShowFuriganaHint") - .HasColumnType("boolean"); - - b.Property("TimezoneId") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("DailyReminderEnabled", "LastReminderSentLocalDate"); - - b.ToTable("UserSrsPreferences"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.UserSubscription", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AiGradingQuota") - .HasColumnType("integer"); - - b.Property("AiGradingUsedCount") - .HasColumnType("integer"); - - b.Property("AmountPaid") - .HasColumnType("decimal(18,2)"); - - b.Property("CertificateLevelId") - .HasColumnType("integer"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("DurationDaysSnapshot") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp without time zone"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("MeetingSessionsIncluded") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("MeetingSessionsUsed") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("MentorId") - .HasColumnType("integer"); - - b.Property("MentorPracticeOutcomeJson") - .HasColumnType("text"); - - b.Property("MentorReviewCompletedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("MentorReviewPlan") - .HasMaxLength(6000) - .HasColumnType("character varying(6000)"); - - b.Property("MentorReviewSessionAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("PaymentExpiresAt") - .HasColumnType("timestamp without time zone"); - - b.Property("PaymentStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("PaymentTransactionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PendingMentorAvailabilityId") - .HasColumnType("integer"); - - b.Property("PendingMentorQuestion") - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("PlanCategorySnapshot") - .HasMaxLength(32) - .HasColumnType("character varying(32)"); - - b.Property("PlanNameSnapshot") - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlanRevisionSnapshot") - .HasColumnType("integer"); - - b.Property("PurchasedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("StartDate") - .HasColumnType("timestamp without time zone"); - - b.Property("SubscriptionPlanId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Version") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("Id"); - - b.HasIndex("CertificateLevelId"); - - b.HasIndex("MentorId"); - - b.HasIndex("PendingMentorAvailabilityId"); - - b.HasIndex("SubscriptionPlanId"); - - b.HasIndex("UserId", "PaymentStatus", "EndDate"); - - b.ToTable("UserSubscriptions"); - - b.HasData( - new - { - Id = 990001, - AiGradingQuota = 0, - AiGradingUsedCount = 0, - AmountPaid = 459000m, - CreatedDate = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - DurationDaysSnapshot = 90, - EndDate = new DateTime(2099, 12, 31, 23, 59, 59, 0, DateTimeKind.Unspecified), - IsDeleted = false, - MeetingSessionsIncluded = 12, - MeetingSessionsUsed = 0, - PaymentStatus = "Paid", - PaymentTransactionId = "DEMO-MENTOR-12-SESSIONS", - PlanCategorySnapshot = "mentor_legacy", - PlanNameSnapshot = "Meeting 1-1 với Mentor - 12 buổi", - PlanRevisionSnapshot = 1, - PurchasedAt = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - StartDate = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - SubscriptionPlanId = 7, - UserId = 900006, - Version = 0u - }, - new - { - Id = 990002, - AiGradingQuota = 0, - AiGradingUsedCount = 0, - AmountPaid = 459000m, - CreatedDate = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - EndDate = new DateTime(2026, 12, 30, 23, 59, 59, 0, DateTimeKind.Unspecified), - IsDeleted = false, - MeetingSessionsIncluded = 12, - MeetingSessionsUsed = 1, - PaymentStatus = "Paid", - PaymentTransactionId = "DEMO-MENTOR-12-SESSIONS-2", - PurchasedAt = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - StartDate = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - SubscriptionPlanId = 7, - UserId = 900007, - Version = 0u - }, - new - { - Id = 990003, - AiGradingQuota = 0, - AiGradingUsedCount = 0, - AmountPaid = 459000m, - CreatedDate = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - EndDate = new DateTime(2026, 12, 30, 23, 59, 59, 0, DateTimeKind.Unspecified), - IsDeleted = false, - MeetingSessionsIncluded = 12, - MeetingSessionsUsed = 1, - PaymentStatus = "Paid", - PaymentTransactionId = "DEMO-MENTOR-12-SESSIONS-3", - PurchasedAt = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - StartDate = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - SubscriptionPlanId = 7, - UserId = 900008, - Version = 0u - }, - new - { - Id = 990004, - AiGradingQuota = 0, - AiGradingUsedCount = 0, - AmountPaid = 459000m, - CreatedDate = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - EndDate = new DateTime(2026, 12, 30, 23, 59, 59, 0, DateTimeKind.Unspecified), - IsDeleted = false, - MeetingSessionsIncluded = 12, - MeetingSessionsUsed = 1, - PaymentStatus = "Paid", - PaymentTransactionId = "DEMO-MENTOR-12-SESSIONS-4", - PurchasedAt = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - StartDate = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - SubscriptionPlanId = 7, - UserId = 900009, - Version = 0u - }, - new - { - Id = 990005, - AiGradingQuota = 15, - AiGradingUsedCount = 0, - AmountPaid = 3000m, - CreatedDate = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - DurationDaysSnapshot = 90, - EndDate = new DateTime(2099, 12, 31, 23, 59, 59, 0, DateTimeKind.Unspecified), - IsDeleted = false, - MeetingSessionsIncluded = 0, - MeetingSessionsUsed = 0, - PaymentStatus = "Paid", - PaymentTransactionId = "DEMO-FULL-ACCESS-SELF-STUDY", - PlanCategorySnapshot = "self_study", - PlanNameSnapshot = "Tự học tiếng Nhật - 3 tháng", - PlanRevisionSnapshot = 1, - PurchasedAt = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - StartDate = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - SubscriptionPlanId = 6, - UserId = 900006, - Version = 0u - }, - new - { - Id = 990006, - AiGradingQuota = 1, - AiGradingUsedCount = 0, - AmountPaid = 1000m, - CreatedDate = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - DurationDaysSnapshot = 0, - IsDeleted = false, - MeetingSessionsIncluded = 0, - MeetingSessionsUsed = 0, - PaymentStatus = "Paid", - PaymentTransactionId = "DEMO-FULL-ACCESS-LEARNING-PATH", - PlanCategorySnapshot = "learning_path", - PlanNameSnapshot = "Mua 1 lượt AI đề xuất lộ trình", - PlanRevisionSnapshot = 1, - PurchasedAt = new DateTime(2026, 10, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - SubscriptionPlanId = 8104, - UserId = 900006, - Version = 0u - }); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.Vocabulary", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("AudioUrl") - .HasColumnType("text"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ExampleSentence") - .HasColumnType("text"); - - b.Property("ExampleSentenceMeaning") - .HasColumnType("text"); - - b.Property("ImageUrl") - .HasColumnType("text"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("Meaning") - .IsRequired() - .HasMaxLength(300) - .HasColumnType("character varying(300)"); - - b.Property("ModifiedBy") - .HasColumnType("uuid"); - - b.Property("ModifiedDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Reading") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Published"); - - b.Property("UnpublishedAtUtc") - .HasColumnType("timestamp without time zone"); - - b.Property("UnpublishedReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserAccountId") - .HasColumnType("integer"); - - b.Property("Version") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(1); - - b.Property("Word") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("Status"); - - b.HasIndex("UserAccountId"); - - b.HasIndex("Word", "Reading"); - - b.ToTable("Vocabularies"); - }); - - modelBuilder.Entity("FeatureSubscriptionPlan", b => - { - b.HasOne("RikiPath.Domain.Entities.Feature", null) - .WithMany() - .HasForeignKey("FeaturesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.SubscriptionPlan", null) - .WithMany() - .HasForeignKey("SubscriptionPlansId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.AiCreditTopUp", b => - { - b.HasOne("RikiPath.Domain.Entities.UserAccount", "UserAccount") - .WithMany("AiCreditTopUps") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("UserAccount"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.CertificateLevel", b => - { - b.HasOne("RikiPath.Domain.Entities.CertificateType", "CertificateType") - .WithMany("Levels") - .HasForeignKey("CertificateTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CertificateType"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.CertificateSection", b => - { - b.HasOne("RikiPath.Domain.Entities.CertificateLevel", "CertificateLevel") - .WithMany() - .HasForeignKey("CertificateLevelId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CertificateLevel"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.CohortComplaint", b => - { - b.HasOne("RikiPath.Domain.Entities.StudyCohort", "Cohort") - .WithMany() - .HasForeignKey("CohortId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.StudyCourse", "Course") - .WithMany() - .HasForeignKey("CourseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.StudyCourseSession", "CourseSession") - .WithMany() - .HasForeignKey("CourseSessionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", null) - .WithMany() - .HasForeignKey("DecidedById") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "Learner") - .WithMany() - .HasForeignKey("LearnerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "Mentor") - .WithMany() - .HasForeignKey("MentorId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Cohort"); - - b.Navigation("Course"); - - b.Navigation("CourseSession"); - - b.Navigation("Learner"); - - b.Navigation("Mentor"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.CohortComplaintEvent", b => - { - b.HasOne("RikiPath.Domain.Entities.CohortComplaint", "Complaint") - .WithMany("History") - .HasForeignKey("ComplaintId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Complaint"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.CohortEnrollmentEntitlement", b => - { - b.HasOne("RikiPath.Domain.Entities.UserAccount", "Learner") - .WithMany() - .HasForeignKey("LearnerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.StudyCoursePlan", "Plan") - .WithMany() - .HasForeignKey("PlanId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.StudyCohort", "StudyCohort") - .WithMany() - .HasForeignKey("StudyCohortId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Learner"); - - b.Navigation("Plan"); - - b.Navigation("StudyCohort"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.CohortLearningFeedback", b => - { - b.HasOne("RikiPath.Domain.Entities.StudyCourse", "Course") - .WithMany() - .HasForeignKey("CourseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.StudyCourseSession", "CourseSession") - .WithMany() - .HasForeignKey("CourseSessionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "Learner") - .WithMany() - .HasForeignKey("LearnerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "Mentor") - .WithMany() - .HasForeignKey("MentorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", null) - .WithMany() - .HasForeignKey("RespondedById") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Course"); - - b.Navigation("CourseSession"); - - b.Navigation("Learner"); - - b.Navigation("Mentor"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.CohortMentorReview", b => - { - b.HasOne("RikiPath.Domain.Entities.StudyCohort", "Cohort") - .WithMany() - .HasForeignKey("CohortId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.StudyCourse", "Course") - .WithMany() - .HasForeignKey("CourseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "Learner") - .WithMany() - .HasForeignKey("LearnerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "Mentor") - .WithMany() - .HasForeignKey("MentorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Cohort"); - - b.Navigation("Course"); - - b.Navigation("Learner"); - - b.Navigation("Mentor"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.CohortScheduleRequest", b => - { - b.HasOne("RikiPath.Domain.Entities.StudyCohort", "Cohort") - .WithMany() - .HasForeignKey("CohortId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "RequestedBy") - .WithMany() - .HasForeignKey("RequestedById") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", null) - .WithMany() - .HasForeignKey("ReviewedById") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Cohort"); - - b.Navigation("RequestedBy"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.CohortScheduleRequestEvent", b => - { - b.HasOne("RikiPath.Domain.Entities.CohortScheduleRequest", "Request") - .WithMany("History") - .HasForeignKey("RequestId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Request"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.CohortTransferRequest", b => - { - b.HasOne("RikiPath.Domain.Entities.StudyCourse", "DestinationCourse") - .WithMany() - .HasForeignKey("DestinationCourseId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "Learner") - .WithMany() - .HasForeignKey("LearnerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.MentorGroupPolicy", null) - .WithMany() - .HasForeignKey("PolicyId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.StudyCohort", "RequestedTargetCohort") - .WithMany() - .HasForeignKey("RequestedTargetCohortId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", null) - .WithMany() - .HasForeignKey("ReviewedById") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.StudyCohort", "SourceCohort") - .WithMany() - .HasForeignKey("SourceCohortId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.StudyCourse", "SourceCourse") - .WithMany() - .HasForeignKey("SourceCourseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.StudyCohort", "TargetCohort") - .WithMany() - .HasForeignKey("TargetCohortId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("DestinationCourse"); - - b.Navigation("Learner"); - - b.Navigation("RequestedTargetCohort"); - - b.Navigation("SourceCohort"); - - b.Navigation("SourceCourse"); - - b.Navigation("TargetCohort"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.CohortTransferRequestEvent", b => - { - b.HasOne("RikiPath.Domain.Entities.CohortTransferRequest", "Request") - .WithMany("History") - .HasForeignKey("RequestId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Request"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.ContentApprovalRequest", b => - { - b.HasOne("RikiPath.Domain.Entities.UserAccount", "SubmittedBy") - .WithMany() - .HasForeignKey("SubmittedByUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("SubmittedBy"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.ContentAudioTranscription", b => - { - b.HasOne("RikiPath.Domain.Entities.UserAccount", "CreatedByUser") - .WithMany() - .HasForeignKey("CreatedByUserId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("CreatedByUser"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.ContentBankItem", b => - { - b.HasOne("RikiPath.Domain.Entities.UserAccount", "Owner") - .WithMany() - .HasForeignKey("OwnerUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Owner"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.ContentLevelMapping", b => - { - b.HasOne("RikiPath.Domain.Entities.CertificateLevel", "CertificateLevel") - .WithMany("ContentLevelMappings") - .HasForeignKey("CertificateLevelId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.GrammarPattern", "GrammarPattern") - .WithMany("ContentLevelMappings") - .HasForeignKey("GrammarPatternId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("RikiPath.Domain.Entities.Kanji", "Kanji") - .WithMany("ContentLevelMappings") - .HasForeignKey("KanjiId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("RikiPath.Domain.Entities.Vocabulary", "Vocabulary") - .WithMany("ContentLevelMappings") - .HasForeignKey("VocabularyId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("CertificateLevel"); - - b.Navigation("GrammarPattern"); - - b.Navigation("Kanji"); - - b.Navigation("Vocabulary"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.ContentPassage", b => - { - b.HasOne("RikiPath.Domain.Entities.MockTestSection", "MockTestSection") - .WithMany("Passages") - .HasForeignKey("MockTestSectionId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("MockTestSection"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.CourseAuditEntry", b => - { - b.HasOne("RikiPath.Domain.Entities.StudyCourse", "Course") - .WithMany("Audit") - .HasForeignKey("CourseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Course"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.CourseRetakeRequest", b => - { - b.HasOne("RikiPath.Domain.Entities.StudyCourse", "Course") - .WithMany("RetakeRequests") - .HasForeignKey("CourseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Course"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.CourseScheduleRequest", b => - { - b.HasOne("RikiPath.Domain.Entities.StudyCourse", "Course") - .WithMany() - .HasForeignKey("CourseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Course"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.EmailVerification", b => - { - b.HasOne("RikiPath.Domain.Entities.UserAccount", "User") - .WithMany("EmailVerifications") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.GradingResult", b => - { - b.HasOne("RikiPath.Domain.Entities.HomeworkSubmission", "HomeworkSubmission") - .WithOne("GradingResult") - .HasForeignKey("RikiPath.Domain.Entities.GradingResult", "HomeworkSubmissionId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("RikiPath.Domain.Entities.PracticeSubmission", "PracticeSubmission") - .WithOne("GradingResult") - .HasForeignKey("RikiPath.Domain.Entities.GradingResult", "PracticeSubmissionId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("HomeworkSubmission"); - - b.Navigation("PracticeSubmission"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.GrammarPattern", b => - { - b.HasOne("RikiPath.Domain.Entities.UserAccount", null) - .WithMany("AuthoredGrammarPatterns") - .HasForeignKey("UserAccountId"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.HomeworkAssignment", b => - { - b.HasOne("RikiPath.Domain.Entities.StudyCohort", "Cohort") - .WithMany() - .HasForeignKey("CohortId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "Learner") - .WithMany() - .HasForeignKey("LearnerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.MentorBooking", "MentorBooking") - .WithMany() - .HasForeignKey("MentorBookingId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "Mentor") - .WithMany() - .HasForeignKey("MentorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.StudyCourse", "StudyCourse") - .WithMany() - .HasForeignKey("StudyCourseId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Cohort"); - - b.Navigation("Learner"); - - b.Navigation("Mentor"); - - b.Navigation("MentorBooking"); - - b.Navigation("StudyCourse"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.HomeworkAssignmentExercise", b => - { - b.HasOne("RikiPath.Domain.Entities.HomeworkAssignment", "HomeworkAssignment") - .WithMany("Exercises") - .HasForeignKey("HomeworkAssignmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.PracticeExercise", "PracticeExercise") - .WithMany() - .HasForeignKey("PracticeExerciseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("HomeworkAssignment"); - - b.Navigation("PracticeExercise"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.HomeworkAssignmentLesson", b => - { - b.HasOne("RikiPath.Domain.Entities.HomeworkAssignment", "HomeworkAssignment") - .WithMany("HomeworkAssignmentLessons") - .HasForeignKey("HomeworkAssignmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.Lesson", "Lesson") - .WithMany("HomeworkAssignmentLessons") - .HasForeignKey("LessonId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("HomeworkAssignment"); - - b.Navigation("Lesson"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.HomeworkSubmission", b => - { - b.HasOne("RikiPath.Domain.Entities.HomeworkAssignment", "HomeworkAssignment") - .WithOne("Submission") - .HasForeignKey("RikiPath.Domain.Entities.HomeworkSubmission", "HomeworkAssignmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "Learner") - .WithMany() - .HasForeignKey("LearnerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.Lesson", "Lesson") - .WithMany() - .HasForeignKey("LessonId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("HomeworkAssignment"); - - b.Navigation("Learner"); - - b.Navigation("Lesson"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.JlptLevelPayCoefficient", b => - { - b.HasOne("RikiPath.Domain.Entities.CertificateLevel", "CertificateLevel") - .WithMany() - .HasForeignKey("CertificateLevelId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "ConfiguredByAdmin") - .WithMany() - .HasForeignKey("ConfiguredByAdminId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CertificateLevel"); - - b.Navigation("ConfiguredByAdmin"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.KanaWritingPracticeCard", b => - { - b.HasOne("RikiPath.Domain.Entities.KanaCharacter", "KanaCharacter") - .WithMany("PracticeCards") - .HasForeignKey("KanaCharacterId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "UserAccount") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("KanaCharacter"); - - b.Navigation("UserAccount"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.KanaWritingPracticeHistory", b => - { - b.HasOne("RikiPath.Domain.Entities.KanaWritingPracticeCard", "Card") - .WithMany("Histories") - .HasForeignKey("KanaWritingPracticeCardId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Card"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.Kanji", b => - { - b.HasOne("RikiPath.Domain.Entities.UserAccount", null) - .WithMany("AuthoredKanjis") - .HasForeignKey("UserAccountId"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.LearnerEssay", b => - { - b.HasOne("RikiPath.Domain.Entities.UserAccount", "UserAccount") - .WithMany("LearnerEssays") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("UserAccount"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.LearnerFeedback", b => - { - b.HasOne("RikiPath.Domain.Entities.UserAccount", "Learner") - .WithMany() - .HasForeignKey("LearnerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Learner"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.LearnerHighlight", b => - { - b.HasOne("RikiPath.Domain.Entities.LearnerNoteEntry", "LinkedNoteEntry") - .WithMany() - .HasForeignKey("LinkedNoteEntryId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("RikiPath.Domain.Entities.ReviewCard", "LinkedReviewCard") - .WithMany() - .HasForeignKey("LinkedReviewCardId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "UserAccount") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("LinkedNoteEntry"); - - b.Navigation("LinkedReviewCard"); - - b.Navigation("UserAccount"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.LearnerNote", b => - { - b.HasOne("RikiPath.Domain.Entities.NotebookFolder", "Folder") - .WithMany("Files") - .HasForeignKey("FolderId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "UserAccount") - .WithMany("LearnerNotes") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Folder"); - - b.Navigation("UserAccount"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.LearnerNoteEntry", b => - { - b.HasOne("RikiPath.Domain.Entities.GrammarPattern", "GrammarPattern") - .WithMany() - .HasForeignKey("GrammarPatternId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.Kanji", "Kanji") - .WithMany("LearnerNoteEntries") - .HasForeignKey("KanjiId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.LearnerNote", "LearnerNote") - .WithMany("LearnerNoteEntries") - .HasForeignKey("LearnerNoteId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.NotebookPage", "NotebookPage") - .WithMany("SavedItems") - .HasForeignKey("NotebookPageId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.Vocabulary", "Vocabulary") - .WithMany("LearnerNoteEntries") - .HasForeignKey("VocabularyId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("GrammarPattern"); - - b.Navigation("Kanji"); - - b.Navigation("LearnerNote"); - - b.Navigation("NotebookPage"); - - b.Navigation("Vocabulary"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.LearnerPracticeAnswer", b => - { - b.HasOne("RikiPath.Domain.Entities.PracticeExerciseAttempt", "PracticeExerciseAttempt") - .WithMany("Answers") - .HasForeignKey("PracticeExerciseAttemptId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.PracticeQuestion", "PracticeQuestion") - .WithMany("Answers") - .HasForeignKey("PracticeQuestionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.PracticeQuestionOption", "SelectedOption") - .WithMany() - .HasForeignKey("SelectedOptionId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("PracticeExerciseAttempt"); - - b.Navigation("PracticeQuestion"); - - b.Navigation("SelectedOption"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.Lesson", b => - { - b.HasOne("RikiPath.Domain.Entities.CertificateLevel", "CertificateLevel") - .WithMany("Lessons") - .HasForeignKey("CertificateLevelId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.LanguageSkill", "LanguageSkill") - .WithMany("Lessons") - .HasForeignKey("LanguageSkillId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.Lesson", "PrerequisiteLesson") - .WithMany() - .HasForeignKey("PrerequisiteLessonId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("RikiPath.Domain.Entities.Topic", "Topic") - .WithMany("Lessons") - .HasForeignKey("TopicId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", null) - .WithMany("AuthoredLessons") - .HasForeignKey("UserAccountId"); - - b.Navigation("CertificateLevel"); - - b.Navigation("LanguageSkill"); - - b.Navigation("PrerequisiteLesson"); - - b.Navigation("Topic"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.LessonGrammar", b => - { - b.HasOne("RikiPath.Domain.Entities.GrammarPattern", "GrammarPattern") - .WithMany("LessonGrammars") - .HasForeignKey("GrammarPatternId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.Lesson", "Lesson") - .WithMany("LessonGrammars") - .HasForeignKey("LessonId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrammarPattern"); - - b.Navigation("Lesson"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.LessonKanji", b => - { - b.HasOne("RikiPath.Domain.Entities.Kanji", "Kanji") - .WithMany("LessonKanjis") - .HasForeignKey("KanjiId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.Lesson", "Lesson") - .WithMany("LessonKanjis") - .HasForeignKey("LessonId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Kanji"); - - b.Navigation("Lesson"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.LessonProgress", b => - { - b.HasOne("RikiPath.Domain.Entities.Lesson", "Lesson") - .WithMany("LessonProgresses") - .HasForeignKey("LessonId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "UserAccount") - .WithMany("LessonProgresses") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Lesson"); - - b.Navigation("UserAccount"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.LessonVocabulary", b => - { - b.HasOne("RikiPath.Domain.Entities.Lesson", "Lesson") - .WithMany("LessonVocabularies") - .HasForeignKey("LessonId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.Vocabulary", "Vocabulary") - .WithMany("LessonVocabularies") - .HasForeignKey("VocabularyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Lesson"); - - b.Navigation("Vocabulary"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorAbuseReport", b => - { - b.HasOne("RikiPath.Domain.Entities.MentorBooking", "MentorBooking") - .WithMany() - .HasForeignKey("MentorBookingId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "Reporter") - .WithMany() - .HasForeignKey("ReporterId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "TargetUser") - .WithMany() - .HasForeignKey("TargetUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("MentorBooking"); - - b.Navigation("Reporter"); - - b.Navigation("TargetUser"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorAttendanceApproval", b => - { - b.HasOne("RikiPath.Domain.Entities.MentorBooking", "MentorBooking") - .WithMany() - .HasForeignKey("MentorBookingId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "ReviewedByAdmin") - .WithMany() - .HasForeignKey("ReviewedByAdminId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("MentorBooking"); - - b.Navigation("ReviewedByAdmin"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorAttendanceRecord", b => - { - b.HasOne("RikiPath.Domain.Entities.StudyCourseSession", "CourseSession") - .WithMany() - .HasForeignKey("CourseSessionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.MentorBooking", "MentorBooking") - .WithMany() - .HasForeignKey("MentorBookingId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "UserAccount") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CourseSession"); - - b.Navigation("MentorBooking"); - - b.Navigation("UserAccount"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorAvailability", b => - { - b.HasOne("RikiPath.Domain.Entities.MentorGroupPolicy", "GroupPolicy") - .WithMany() - .HasForeignKey("GroupPolicyId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "Mentor") - .WithMany("MentorAvailabilities") - .HasForeignKey("MentorId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.MentorScheduleRule", "ScheduleRule") - .WithMany() - .HasForeignKey("MentorScheduleRuleId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.MentorWeeklyAvailability", "WeeklyAvailability") - .WithMany("Slots") - .HasForeignKey("MentorWeeklyAvailabilityId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.MentorTeachingProposal", "TeachingProposal") - .WithMany("GeneratedAvailabilities") - .HasForeignKey("TeachingProposalId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("GroupPolicy"); - - b.Navigation("Mentor"); - - b.Navigation("ScheduleRule"); - - b.Navigation("TeachingProposal"); - - b.Navigation("WeeklyAvailability"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorBankAccount", b => - { - b.HasOne("RikiPath.Domain.Entities.UserAccount", "MentorUser") - .WithMany() - .HasForeignKey("MentorUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "VerifiedByAdmin") - .WithMany() - .HasForeignKey("VerifiedByAdminId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("MentorUser"); - - b.Navigation("VerifiedByAdmin"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorBooking", b => - { - b.HasOne("RikiPath.Domain.Entities.CertificateLevel", "CompensationLevel") - .WithMany() - .HasForeignKey("CompensationLevelId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.MentorCreditGrant", "CreditGrant") - .WithMany() - .HasForeignKey("CreditGrantId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.MentorAvailability", "MentorAvailability") - .WithMany("MentorBookings") - .HasForeignKey("MentorAvailabilityId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.UserSubscription", "UserSubscription") - .WithMany("MentorBookings") - .HasForeignKey("UserSubscriptionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CompensationLevel"); - - b.Navigation("CreditGrant"); - - b.Navigation("MentorAvailability"); - - b.Navigation("UserSubscription"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorBookingDayGuard", b => - { - b.HasOne("RikiPath.Domain.Entities.UserAccount", "Mentor") - .WithMany() - .HasForeignKey("MentorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Mentor"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorBookingIntent", b => - { - b.HasOne("RikiPath.Domain.Entities.UserAccount", "Learner") - .WithMany() - .HasForeignKey("LearnerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.MentorBooking", "MentorBooking") - .WithMany() - .HasForeignKey("MentorBookingId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Learner"); - - b.Navigation("MentorBooking"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorBookingReservation", b => - { - b.HasOne("RikiPath.Domain.Entities.MentorBooking", "MentorBooking") - .WithMany() - .HasForeignKey("MentorBookingId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "Mentor") - .WithMany() - .HasForeignKey("MentorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.MentorAvailability", "MentorAvailability") - .WithMany() - .HasForeignKey("MentorAvailabilityId", "MentorId") - .HasPrincipalKey("Id", "MentorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Mentor"); - - b.Navigation("MentorAvailability"); - - b.Navigation("MentorBooking"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorBookingTerms", b => - { - b.HasOne("RikiPath.Domain.Entities.MentorAvailability", "MentorAvailability") - .WithMany() - .HasForeignKey("MentorAvailabilityId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.MentorBooking", "MentorBooking") - .WithOne() - .HasForeignKey("RikiPath.Domain.Entities.MentorBookingTerms", "MentorBookingId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("MentorAvailability"); - - b.Navigation("MentorBooking"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorCalendarConnection", b => - { - b.HasOne("RikiPath.Domain.Entities.UserAccount", "Mentor") - .WithMany() - .HasForeignKey("MentorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Mentor"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorChatMessage", b => - { - b.HasOne("RikiPath.Domain.Entities.MentorBooking", "MentorBooking") - .WithMany() - .HasForeignKey("MentorBookingId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "Sender") - .WithMany() - .HasForeignKey("SenderUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("MentorBooking"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorCreditEntry", b => - { - b.HasOne("RikiPath.Domain.Entities.MentorCreditGrant", "CreditGrant") - .WithMany("Entries") - .HasForeignKey("CreditGrantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "Learner") - .WithMany() - .HasForeignKey("LearnerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.MentorBooking", "MentorBooking") - .WithMany() - .HasForeignKey("MentorBookingId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("CreditGrant"); - - b.Navigation("Learner"); - - b.Navigation("MentorBooking"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorCreditGrant", b => - { - b.HasOne("RikiPath.Domain.Entities.CertificateLevel", "CertificateLevel") - .WithMany() - .HasForeignKey("CertificateLevelId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "Learner") - .WithMany() - .HasForeignKey("LearnerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserSubscription", "UserSubscription") - .WithMany() - .HasForeignKey("UserSubscriptionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CertificateLevel"); - - b.Navigation("Learner"); - - b.Navigation("UserSubscription"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorDispute", b => - { - b.HasOne("RikiPath.Domain.Entities.UserAccount", "Learner") - .WithMany() - .HasForeignKey("LearnerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.MentorBooking", "MentorBooking") - .WithMany() - .HasForeignKey("MentorBookingId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "Mentor") - .WithMany() - .HasForeignKey("MentorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "ResolvedByAdmin") - .WithMany() - .HasForeignKey("ResolvedByAdminId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Learner"); - - b.Navigation("Mentor"); - - b.Navigation("MentorBooking"); - - b.Navigation("ResolvedByAdmin"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorDisputeHistory", b => - { - b.HasOne("RikiPath.Domain.Entities.MentorDispute", "Dispute") - .WithMany("Histories") - .HasForeignKey("DisputeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Dispute"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorEarningEntry", b => - { - b.HasOne("RikiPath.Domain.Entities.MentorAttendanceApproval", "AttendanceApproval") - .WithMany() - .HasForeignKey("AttendanceApprovalId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.CertificateLevel", "CertificateLevel") - .WithMany() - .HasForeignKey("CertificateLevelId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "CreatedByAdmin") - .WithMany() - .HasForeignKey("CreatedByAdminId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.MentorBooking", "MentorBooking") - .WithMany() - .HasForeignKey("MentorBookingId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "MentorUser") - .WithMany() - .HasForeignKey("MentorUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.MentorPayrollPeriod", "PayrollPeriod") - .WithMany() - .HasForeignKey("PayrollPeriodId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("AttendanceApproval"); - - b.Navigation("CertificateLevel"); - - b.Navigation("CreatedByAdmin"); - - b.Navigation("MentorBooking"); - - b.Navigation("MentorUser"); - - b.Navigation("PayrollPeriod"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorGroupPolicy", b => - { - b.HasOne("RikiPath.Domain.Entities.UserAccount", "CreatedByAdmin") - .WithMany() - .HasForeignKey("CreatedByAdminId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "DeletedByAdmin") - .WithMany() - .HasForeignKey("DeletedByAdminId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "LastAppliedByAdmin") - .WithMany() - .HasForeignKey("LastAppliedByAdminId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "UpdatedByAdmin") - .WithMany() - .HasForeignKey("UpdatedByAdminId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("CreatedByAdmin"); - - b.Navigation("DeletedByAdmin"); - - b.Navigation("LastAppliedByAdmin"); - - b.Navigation("UpdatedByAdmin"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorHourlyRate", b => - { - b.HasOne("RikiPath.Domain.Entities.UserAccount", "ConfiguredByAdmin") - .WithMany() - .HasForeignKey("ConfiguredByAdminId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "MentorUser") - .WithMany() - .HasForeignKey("MentorUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("ConfiguredByAdmin"); - - b.Navigation("MentorUser"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorPayoutAttempt", b => - { - b.HasOne("RikiPath.Domain.Entities.UserAccount", "ConfirmedByAdmin") - .WithMany() - .HasForeignKey("ConfirmedByAdminId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "InitiatedByAdmin") - .WithMany() - .HasForeignKey("InitiatedByAdminId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.MentorBankAccount", "LockedBankAccount") - .WithMany() - .HasForeignKey("LockedBankAccountId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.MentorPayoutObligation", "PayoutObligation") - .WithMany("Attempts") - .HasForeignKey("PayoutObligationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("ConfirmedByAdmin"); - - b.Navigation("InitiatedByAdmin"); - - b.Navigation("LockedBankAccount"); - - b.Navigation("PayoutObligation"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorPayoutObligation", b => - { - b.HasOne("RikiPath.Domain.Entities.UserAccount", "ApprovedByAdmin") - .WithMany() - .HasForeignKey("ApprovedByAdminId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.MentorBankAccount", "LockedBankAccount") - .WithMany() - .HasForeignKey("LockedBankAccountId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "MentorUser") - .WithMany() - .HasForeignKey("MentorUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.OrganizationPayoutAccount", "OrganizationPayoutAccount") - .WithMany() - .HasForeignKey("OrganizationPayoutAccountId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.MentorPayrollPeriod", "PayrollPeriod") - .WithMany() - .HasForeignKey("PayrollPeriodId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("ApprovedByAdmin"); - - b.Navigation("LockedBankAccount"); - - b.Navigation("MentorUser"); - - b.Navigation("OrganizationPayoutAccount"); - - b.Navigation("PayrollPeriod"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorPayrollAdjustment", b => - { - b.HasOne("RikiPath.Domain.Entities.UserAccount", "ApprovedByAdmin") - .WithMany() - .HasForeignKey("ApprovedByAdminId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.MentorPayrollPeriod", "PayrollPeriod") - .WithMany("Adjustments") - .HasForeignKey("PayrollPeriodId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("ApprovedByAdmin"); - - b.Navigation("PayrollPeriod"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorPayrollLine", b => - { - b.HasOne("RikiPath.Domain.Entities.MentorEarningEntry", "EarningEntry") - .WithMany() - .HasForeignKey("EarningEntryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.MentorBooking", "MentorBooking") - .WithMany() - .HasForeignKey("MentorBookingId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.MentorPayrollPeriod", "PayrollPeriod") - .WithMany("Lines") - .HasForeignKey("PayrollPeriodId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EarningEntry"); - - b.Navigation("MentorBooking"); - - b.Navigation("PayrollPeriod"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorPayrollPeriod", b => - { - b.HasOne("RikiPath.Domain.Entities.UserAccount", "ApprovedByAdmin") - .WithMany() - .HasForeignKey("ApprovedByAdminId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "MentorUser") - .WithMany() - .HasForeignKey("MentorUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "PreparedByAdmin") - .WithMany() - .HasForeignKey("PreparedByAdminId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("ApprovedByAdmin"); - - b.Navigation("MentorUser"); - - b.Navigation("PreparedByAdmin"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorProfile", b => - { - b.HasOne("RikiPath.Domain.Entities.UserAccount", "Mentor") - .WithOne("MentorProfile") - .HasForeignKey("RikiPath.Domain.Entities.MentorProfile", "MentorId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Mentor"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorReview", b => - { - b.HasOne("RikiPath.Domain.Entities.UserAccount", "Learner") - .WithMany() - .HasForeignKey("LearnerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.MentorBooking", "MentorBooking") - .WithMany() - .HasForeignKey("MentorBookingId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "Mentor") - .WithMany() - .HasForeignKey("MentorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Learner"); - - b.Navigation("Mentor"); - - b.Navigation("MentorBooking"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorSchedule", b => - { - b.HasOne("RikiPath.Domain.Entities.UserAccount", "Mentor") - .WithMany() - .HasForeignKey("MentorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Mentor"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorScheduleRule", b => - { - b.HasOne("RikiPath.Domain.Entities.MentorSchedule", "Schedule") - .WithMany("Rules") - .HasForeignKey("ScheduleId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Schedule"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorTeachingProposal", b => - { - b.HasOne("RikiPath.Domain.Entities.CertificateLevel", "CertificateLevel") - .WithMany() - .HasForeignKey("CertificateLevelId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.StudyCoursePlan", "CoursePlan") - .WithMany() - .HasForeignKey("CoursePlanId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.MentorGroupPolicy", "GroupPolicy") - .WithMany() - .HasForeignKey("GroupPolicyId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "Mentor") - .WithMany() - .HasForeignKey("MentorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "ReviewedByAdmin") - .WithMany() - .HasForeignKey("ReviewedByAdminId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("CertificateLevel"); - - b.Navigation("CoursePlan"); - - b.Navigation("GroupPolicy"); - - b.Navigation("Mentor"); - - b.Navigation("ReviewedByAdmin"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorTeachingProposalEvent", b => - { - b.HasOne("RikiPath.Domain.Entities.MentorTeachingProposal", "Proposal") - .WithMany("Events") - .HasForeignKey("ProposalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Proposal"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorTeachingQualification", b => - { - b.HasOne("RikiPath.Domain.Entities.CertificateLevel", "CertificateLevel") - .WithMany() - .HasForeignKey("CertificateLevelId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "MentorUser") - .WithMany() - .HasForeignKey("MentorUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "VerifiedByAdmin") - .WithMany() - .HasForeignKey("VerifiedByAdminId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CertificateLevel"); - - b.Navigation("MentorUser"); - - b.Navigation("VerifiedByAdmin"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorWeeklyAvailability", b => - { - b.HasOne("RikiPath.Domain.Entities.UserAccount", "Mentor") - .WithMany() - .HasForeignKey("MentorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Mentor"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MockQuestion", b => - { - b.HasOne("RikiPath.Domain.Entities.CertificateLevel", null) - .WithMany() - .HasForeignKey("CertificateLevelId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.LanguageSkill", null) - .WithMany() - .HasForeignKey("LanguageSkillId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.MockTestSection", "MockTestSection") - .WithMany("Questions") - .HasForeignKey("MockTestSectionId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("RikiPath.Domain.Entities.ContentPassage", "Passage") - .WithMany("Questions") - .HasForeignKey("PassageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("RikiPath.Domain.Entities.MockQuestion", null) - .WithMany() - .HasForeignKey("SourceQuestionId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("MockTestSection"); - - b.Navigation("Passage"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MockQuestionOption", b => - { - b.HasOne("RikiPath.Domain.Entities.MockQuestion", "MockQuestion") - .WithMany("Options") - .HasForeignKey("MockQuestionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("MockQuestion"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MockTest", b => - { - b.HasOne("RikiPath.Domain.Entities.CertificateLevel", "CertificateLevel") - .WithMany("MockTests") - .HasForeignKey("CertificateLevelId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", null) - .WithMany("AuthoredMockTests") - .HasForeignKey("UserAccountId"); - - b.Navigation("CertificateLevel"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MockTestAnswer", b => - { - b.HasOne("RikiPath.Domain.Entities.MockQuestion", "MockQuestion") - .WithMany("Answers") - .HasForeignKey("MockQuestionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.MockTestAttempt", "MockTestAttempt") - .WithMany("Answers") - .HasForeignKey("MockTestAttemptId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.MockQuestionOption", "SelectedOption") - .WithMany() - .HasForeignKey("SelectedOptionId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("MockQuestion"); - - b.Navigation("MockTestAttempt"); - - b.Navigation("SelectedOption"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MockTestAttempt", b => - { - b.HasOne("RikiPath.Domain.Entities.UserAccount", null) - .WithMany("MockTestAttempts") - .HasForeignKey("UserAccountId"); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "UserAccount") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("UserAccount"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MockTestSection", b => - { - b.HasOne("RikiPath.Domain.Entities.CertificateSection", "CertificateSection") - .WithMany("MockTestSections") - .HasForeignKey("CertificateSectionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.LanguageSkill", "LanguageSkill") - .WithMany("MockTestSections") - .HasForeignKey("LanguageSkillId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.MockTest", "MockTest") - .WithMany("Sections") - .HasForeignKey("MockTestId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CertificateSection"); - - b.Navigation("LanguageSkill"); - - b.Navigation("MockTest"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MockTestSectionResult", b => - { - b.HasOne("RikiPath.Domain.Entities.MockTestAttempt", "MockTestAttempt") - .WithMany("SectionResults") - .HasForeignKey("MockTestAttemptId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.MockTestSection", "MockTestSection") - .WithMany("SectionResults") - .HasForeignKey("MockTestSectionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("MockTestAttempt"); - - b.Navigation("MockTestSection"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.Note", b => - { - b.HasOne("RikiPath.Domain.Entities.MentorBooking", "MentorBooking") - .WithOne("Note") - .HasForeignKey("RikiPath.Domain.Entities.Note", "MentorBookingId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "UserAccount") - .WithMany("Notes") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("MentorBooking"); - - b.Navigation("UserAccount"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.NotebookFolder", b => - { - b.HasOne("RikiPath.Domain.Entities.UserAccount", "UserAccount") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("UserAccount"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.NotebookPage", b => - { - b.HasOne("RikiPath.Domain.Entities.LearnerNote", "LearnerNote") - .WithMany("Pages") - .HasForeignKey("LearnerNoteId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "UserAccount") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("LearnerNote"); - - b.Navigation("UserAccount"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.Notification", b => - { - b.HasOne("RikiPath.Domain.Entities.UserAccount", "UserAccount") - .WithMany("Notifications") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("UserAccount"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.OrganizationPayoutAccount", b => - { - b.HasOne("RikiPath.Domain.Entities.UserAccount", "ConfiguredByAdmin") - .WithMany() - .HasForeignKey("ConfiguredByAdminId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("ConfiguredByAdmin"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.PracticeExercise", b => - { - b.HasOne("RikiPath.Domain.Entities.CertificateLevel", "CertificateLevel") - .WithMany() - .HasForeignKey("CertificateLevelId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("RikiPath.Domain.Entities.LanguageSkill", "LanguageSkill") - .WithMany() - .HasForeignKey("LanguageSkillId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.Lesson", "Lesson") - .WithMany() - .HasForeignKey("LessonId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("RikiPath.Domain.Entities.Topic", "Topic") - .WithMany() - .HasForeignKey("TopicId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("CertificateLevel"); - - b.Navigation("LanguageSkill"); - - b.Navigation("Lesson"); - - b.Navigation("Topic"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.PracticeExerciseAttempt", b => - { - b.HasOne("RikiPath.Domain.Entities.HomeworkAssignment", "HomeworkAssignment") - .WithMany() - .HasForeignKey("HomeworkAssignmentId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("RikiPath.Domain.Entities.PracticeExercise", "PracticeExercise") - .WithMany("Attempts") - .HasForeignKey("PracticeExerciseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "UserAccount") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("HomeworkAssignment"); - - b.Navigation("PracticeExercise"); - - b.Navigation("UserAccount"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.PracticeQuestion", b => - { - b.HasOne("RikiPath.Domain.Entities.PracticeExercise", "PracticeExercise") - .WithMany("Questions") - .HasForeignKey("PracticeExerciseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PracticeExercise"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.PracticeQuestionOption", b => - { - b.HasOne("RikiPath.Domain.Entities.PracticeQuestion", "PracticeQuestion") - .WithMany("Options") - .HasForeignKey("PracticeQuestionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PracticeQuestion"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.PracticeSubmission", b => - { - b.HasOne("RikiPath.Domain.Entities.CertificateLevel", "CertificateLevel") - .WithMany("PracticeSubmissions") - .HasForeignKey("CertificateLevelId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "UserAccount") - .WithMany("PracticeSubmissions") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CertificateLevel"); - - b.Navigation("UserAccount"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.RecommendedLearningPath", b => - { - b.HasOne("RikiPath.Domain.Entities.UserAccount", "UserAccount") - .WithMany("RecommendedLearningPaths") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("UserAccount"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.ReviewCard", b => - { - b.HasOne("RikiPath.Domain.Entities.GrammarPattern", "GrammarPattern") - .WithMany("ReviewCards") - .HasForeignKey("GrammarPatternId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.Kanji", "Kanji") - .WithMany("ReviewCards") - .HasForeignKey("KanjiId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.LearnerNoteEntry", "LearnerNoteEntry") - .WithMany("ReviewCards") - .HasForeignKey("LearnerNoteEntryId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("RikiPath.Domain.Entities.Lesson", "Lesson") - .WithMany() - .HasForeignKey("LessonId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("RikiPath.Domain.Entities.SrsCardTemplate", "SrsCardTemplate") - .WithMany() - .HasForeignKey("SrsCardTemplateId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "UserAccount") - .WithMany("ReviewCards") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.Vocabulary", "Vocabulary") - .WithMany() - .HasForeignKey("VocabularyId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("GrammarPattern"); - - b.Navigation("Kanji"); - - b.Navigation("LearnerNoteEntry"); - - b.Navigation("Lesson"); - - b.Navigation("SrsCardTemplate"); - - b.Navigation("UserAccount"); - - b.Navigation("Vocabulary"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.ReviewHistory", b => - { - b.HasOne("RikiPath.Domain.Entities.ReviewCard", "ReviewCard") - .WithMany("ReviewHistories") - .HasForeignKey("ReviewCardId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ReviewCard"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.SrsCardTemplate", b => - { - b.HasOne("RikiPath.Domain.Entities.CertificateLevel", "CertificateLevel") - .WithMany() - .HasForeignKey("CertificateLevelId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("RikiPath.Domain.Entities.GrammarPattern", "GrammarPattern") - .WithMany() - .HasForeignKey("GrammarPatternId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("RikiPath.Domain.Entities.Kanji", "Kanji") - .WithMany() - .HasForeignKey("KanjiId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("RikiPath.Domain.Entities.Lesson", "Lesson") - .WithMany() - .HasForeignKey("LessonId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "ReviewedByAdmin") - .WithMany() - .HasForeignKey("ReviewedByAdminId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "SubmittedByUser") - .WithMany() - .HasForeignKey("SubmittedByUserId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("RikiPath.Domain.Entities.Vocabulary", "Vocabulary") - .WithMany() - .HasForeignKey("VocabularyId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("CertificateLevel"); - - b.Navigation("GrammarPattern"); - - b.Navigation("Kanji"); - - b.Navigation("Lesson"); - - b.Navigation("ReviewedByAdmin"); - - b.Navigation("SubmittedByUser"); - - b.Navigation("Vocabulary"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.SrsReviewSession", b => - { - b.HasOne("RikiPath.Domain.Entities.UserAccount", "UserAccount") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("UserAccount"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.StudyCohort", b => - { - b.HasOne("RikiPath.Domain.Entities.MentorGroupPolicy", "GroupPolicy") - .WithMany() - .HasForeignKey("GroupPolicyId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "Mentor") - .WithMany() - .HasForeignKey("MentorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.StudyCoursePlan", "Plan") - .WithMany() - .HasForeignKey("PlanId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.MentorTeachingProposal", "SourceProposal") - .WithMany() - .HasForeignKey("SourceProposalId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("GroupPolicy"); - - b.Navigation("Mentor"); - - b.Navigation("Plan"); - - b.Navigation("SourceProposal"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.StudyCohortMentorAssignment", b => - { - b.HasOne("RikiPath.Domain.Entities.UserAccount", null) - .WithMany() - .HasForeignKey("AssignedById") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.StudyCohort", "Cohort") - .WithMany() - .HasForeignKey("CohortId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", null) - .WithMany() - .HasForeignKey("MentorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.MentorGroupPolicy", null) - .WithMany() - .HasForeignKey("PolicyId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", null) - .WithMany() - .HasForeignKey("PreviousMentorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Cohort"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.StudyCohortSession", b => - { - b.HasOne("RikiPath.Domain.Entities.MentorAvailability", "Availability") - .WithMany() - .HasForeignKey("AvailabilityId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.StudyCohort", "Cohort") - .WithMany("Sessions") - .HasForeignKey("CohortId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Availability"); - - b.Navigation("Cohort"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.StudyCourse", b => - { - b.HasOne("RikiPath.Domain.Entities.CertificateLevel", "CertificateLevel") - .WithMany() - .HasForeignKey("CertificateLevelId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.StudyCohort", "Cohort") - .WithMany("Enrollments") - .HasForeignKey("CohortId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.MentorGroupPolicy", "GroupPolicy") - .WithMany() - .HasForeignKey("GroupPolicyId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "Learner") - .WithMany() - .HasForeignKey("LearnerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "Mentor") - .WithMany() - .HasForeignKey("MentorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.StudyCoursePlan", "Plan") - .WithMany() - .HasForeignKey("PlanId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.StudyCourse", "RetakeOf") - .WithMany() - .HasForeignKey("RetakeOfId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.StudyCourse", null) - .WithMany() - .HasForeignKey("TransferredFromCourseId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("CertificateLevel"); - - b.Navigation("Cohort"); - - b.Navigation("GroupPolicy"); - - b.Navigation("Learner"); - - b.Navigation("Mentor"); - - b.Navigation("Plan"); - - b.Navigation("RetakeOf"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.StudyCourseHomework", b => - { - b.HasOne("RikiPath.Domain.Entities.StudyCourse", "Course") - .WithMany("Homework") - .HasForeignKey("CourseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Course"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.StudyCoursePlan", b => - { - b.HasOne("RikiPath.Domain.Entities.CertificateLevel", "CertificateLevel") - .WithMany() - .HasForeignKey("CertificateLevelId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CertificateLevel"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.StudyCourseSession", b => - { - b.HasOne("RikiPath.Domain.Entities.MentorAvailability", "Availability") - .WithMany() - .HasForeignKey("AvailabilityId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.StudyCourse", "Course") - .WithMany("Sessions") - .HasForeignKey("CourseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Availability"); - - b.Navigation("Course"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.SubscriptionPlan", b => - { - b.HasOne("RikiPath.Domain.Entities.CertificateLevel", "CertificateLevel") - .WithMany() - .HasForeignKey("CertificateLevelId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("CertificateLevel"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.Topic", b => - { - b.HasOne("RikiPath.Domain.Entities.CertificateLevel", "CertificateLevel") - .WithMany() - .HasForeignKey("CertificateLevelId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("CertificateLevel"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.UserAccount", b => - { - b.HasOne("RikiPath.Domain.Entities.CertificateLevel", "AssessedCertificateLevel") - .WithMany() - .HasForeignKey("AssessedCertificateLevelId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("RikiPath.Domain.Entities.CertificateLevel", "SelfDeclaredCertificateLevel") - .WithMany() - .HasForeignKey("SelfDeclaredCertificateLevelId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("RikiPath.Domain.Entities.CertificateLevel", "StartingCertificateLevel") - .WithMany() - .HasForeignKey("StartingCertificateLevelId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("RikiPath.Domain.Entities.CertificateLevel", "TargetCertificateLevel") - .WithMany("LearnersTargeting") - .HasForeignKey("TargetCertificateLevelId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("AssessedCertificateLevel"); - - b.Navigation("SelfDeclaredCertificateLevel"); - - b.Navigation("StartingCertificateLevel"); - - b.Navigation("TargetCertificateLevel"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.UserDeviceToken", b => - { - b.HasOne("RikiPath.Domain.Entities.UserAccount", "UserAccount") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("UserAccount"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.UserSrsPreference", b => - { - b.HasOne("RikiPath.Domain.Entities.UserAccount", "UserAccount") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("UserAccount"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.UserSubscription", b => - { - b.HasOne("RikiPath.Domain.Entities.CertificateLevel", "CertificateLevel") - .WithMany() - .HasForeignKey("CertificateLevelId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "Mentor") - .WithMany() - .HasForeignKey("MentorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.MentorAvailability", "PendingMentorAvailability") - .WithMany() - .HasForeignKey("PendingMentorAvailabilityId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("RikiPath.Domain.Entities.SubscriptionPlan", "SubscriptionPlan") - .WithMany("UserSubscriptions") - .HasForeignKey("SubscriptionPlanId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("RikiPath.Domain.Entities.UserAccount", "UserAccount") - .WithMany("UserSubscriptions") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CertificateLevel"); - - b.Navigation("Mentor"); - - b.Navigation("PendingMentorAvailability"); - - b.Navigation("SubscriptionPlan"); - - b.Navigation("UserAccount"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.Vocabulary", b => - { - b.HasOne("RikiPath.Domain.Entities.UserAccount", null) - .WithMany("AuthoredVocabularies") - .HasForeignKey("UserAccountId"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.CertificateLevel", b => - { - b.Navigation("ContentLevelMappings"); - - b.Navigation("LearnersTargeting"); - - b.Navigation("Lessons"); - - b.Navigation("MockTests"); - - b.Navigation("PracticeSubmissions"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.CertificateSection", b => - { - b.Navigation("MockTestSections"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.CertificateType", b => - { - b.Navigation("Levels"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.CohortComplaint", b => - { - b.Navigation("History"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.CohortScheduleRequest", b => - { - b.Navigation("History"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.CohortTransferRequest", b => - { - b.Navigation("History"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.ContentPassage", b => - { - b.Navigation("Questions"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.GrammarPattern", b => - { - b.Navigation("ContentLevelMappings"); - - b.Navigation("LessonGrammars"); - - b.Navigation("ReviewCards"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.HomeworkAssignment", b => - { - b.Navigation("Exercises"); - - b.Navigation("HomeworkAssignmentLessons"); - - b.Navigation("Submission"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.HomeworkSubmission", b => - { - b.Navigation("GradingResult"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.KanaCharacter", b => - { - b.Navigation("PracticeCards"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.KanaWritingPracticeCard", b => - { - b.Navigation("Histories"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.Kanji", b => - { - b.Navigation("ContentLevelMappings"); - - b.Navigation("LearnerNoteEntries"); - - b.Navigation("LessonKanjis"); - - b.Navigation("ReviewCards"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.LanguageSkill", b => - { - b.Navigation("Lessons"); - - b.Navigation("MockTestSections"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.LearnerNote", b => - { - b.Navigation("LearnerNoteEntries"); - - b.Navigation("Pages"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.LearnerNoteEntry", b => - { - b.Navigation("ReviewCards"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.Lesson", b => - { - b.Navigation("HomeworkAssignmentLessons"); - - b.Navigation("LessonGrammars"); - - b.Navigation("LessonKanjis"); - - b.Navigation("LessonProgresses"); - - b.Navigation("LessonVocabularies"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorAvailability", b => - { - b.Navigation("MentorBookings"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorBooking", b => - { - b.Navigation("Note"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorCreditGrant", b => - { - b.Navigation("Entries"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorDispute", b => - { - b.Navigation("Histories"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorPayoutObligation", b => - { - b.Navigation("Attempts"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorPayrollPeriod", b => - { - b.Navigation("Adjustments"); - - b.Navigation("Lines"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorSchedule", b => - { - b.Navigation("Rules"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorTeachingProposal", b => - { - b.Navigation("Events"); - - b.Navigation("GeneratedAvailabilities"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MentorWeeklyAvailability", b => - { - b.Navigation("Slots"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MockQuestion", b => - { - b.Navigation("Answers"); - - b.Navigation("Options"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MockTest", b => - { - b.Navigation("Sections"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MockTestAttempt", b => - { - b.Navigation("Answers"); - - b.Navigation("SectionResults"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.MockTestSection", b => - { - b.Navigation("Passages"); - - b.Navigation("Questions"); - - b.Navigation("SectionResults"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.NotebookFolder", b => - { - b.Navigation("Files"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.NotebookPage", b => - { - b.Navigation("SavedItems"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.PracticeExercise", b => - { - b.Navigation("Attempts"); - - b.Navigation("Questions"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.PracticeExerciseAttempt", b => - { - b.Navigation("Answers"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.PracticeQuestion", b => - { - b.Navigation("Answers"); - - b.Navigation("Options"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.PracticeSubmission", b => - { - b.Navigation("GradingResult"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.ReviewCard", b => - { - b.Navigation("ReviewHistories"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.StudyCohort", b => - { - b.Navigation("Enrollments"); - - b.Navigation("Sessions"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.StudyCourse", b => - { - b.Navigation("Audit"); - - b.Navigation("Homework"); - - b.Navigation("RetakeRequests"); - - b.Navigation("Sessions"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.SubscriptionPlan", b => - { - b.Navigation("UserSubscriptions"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.Topic", b => - { - b.Navigation("Lessons"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.UserAccount", b => - { - b.Navigation("AiCreditTopUps"); - - b.Navigation("AuthoredGrammarPatterns"); - - b.Navigation("AuthoredKanjis"); - - b.Navigation("AuthoredLessons"); - - b.Navigation("AuthoredMockTests"); - - b.Navigation("AuthoredVocabularies"); - - b.Navigation("EmailVerifications"); - - b.Navigation("LearnerEssays"); - - b.Navigation("LearnerNotes"); - - b.Navigation("LessonProgresses"); - - b.Navigation("MentorAvailabilities"); - - b.Navigation("MentorProfile"); - - b.Navigation("MockTestAttempts"); - - b.Navigation("Notes"); - - b.Navigation("Notifications"); - - b.Navigation("PracticeSubmissions"); - - b.Navigation("RecommendedLearningPaths"); - - b.Navigation("ReviewCards"); - - b.Navigation("UserSubscriptions"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.UserSubscription", b => - { - b.Navigation("MentorBookings"); - }); - - modelBuilder.Entity("RikiPath.Domain.Entities.Vocabulary", b => - { - b.Navigation("ContentLevelMappings"); - - b.Navigation("LearnerNoteEntries"); - - b.Navigation("LessonVocabularies"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/RikiPath.Infrastructure/Migrations/20261130013913_AlignMockQuestionSectionIndex.cs b/RikiPath.Infrastructure/Migrations/20261130013913_AlignMockQuestionSectionIndex.cs deleted file mode 100644 index 172e9d1..0000000 --- a/RikiPath.Infrastructure/Migrations/20261130013913_AlignMockQuestionSectionIndex.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace RikiPath.Infrastructure.Migrations -{ - /// - public partial class AlignMockQuestionSectionIndex : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_MockQuestions_PracticeTestSectionId", - table: "MockQuestions"); - - migrationBuilder.CreateIndex( - name: "IX_MockQuestions_PracticeTestSectionId_IsArchivedVersion", - table: "MockQuestions", - columns: new[] { "PracticeTestSectionId", "IsArchivedVersion" }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_MockQuestions_PracticeTestSectionId_IsArchivedVersion", - table: "MockQuestions"); - - migrationBuilder.CreateIndex( - name: "IX_MockQuestions_PracticeTestSectionId", - table: "MockQuestions", - column: "PracticeTestSectionId"); - } - } -} diff --git a/RikiPath.Infrastructure/Services/ContentAudioTranscriptionService.cs b/RikiPath.Infrastructure/Services/ContentAudioTranscriptionService.cs index ad02387..dfb88ed 100644 --- a/RikiPath.Infrastructure/Services/ContentAudioTranscriptionService.cs +++ b/RikiPath.Infrastructure/Services/ContentAudioTranscriptionService.cs @@ -81,6 +81,35 @@ public async Task QueuePayloadAsync(JsonElement payload, int authorId, Cancellat await QueueAsync(url, authorId, ct); } + public async Task QueuePayloadsAsync(IReadOnlyList payloadJsons, int authorId, CancellationToken ct) + { + var urls = new HashSet(StringComparer.Ordinal); + foreach (var payloadJson in payloadJsons) + { + using var document = JsonDocument.Parse(payloadJson); + foreach (var reference in AudioReferences(document.RootElement)) + if (NormalizeUrl(reference) is { } normalized) urls.Add(normalized); + } + + if (urls.Count == 0) return; + var now = DateTime.UtcNow; + foreach (var chunk in urls.Chunk(500)) + { + var ids = chunk.Select(_ => Guid.NewGuid()).ToArray(); + var hashes = chunk.Select(Hash).ToArray(); + await db.Database.ExecuteSqlInterpolatedAsync($""" + INSERT INTO "ContentAudioTranscriptions" + ("Id", "AudioUrl", "AudioUrlHash", "CreatedByUserId", "Status", "LanguageCode", + "AttemptCount", "NextAttemptAtUtc", "CreatedAtUtc", "UpdatedAtUtc") + SELECT audio."Id", audio."AudioUrl", audio."AudioUrlHash", {authorId}, 'Pending', 'ja-JP', + 0, {now}, {now}, {now} + FROM unnest({ids}, {chunk}, {hashes}) AS audio("Id", "AudioUrl", "AudioUrlHash") + ON CONFLICT ("AudioUrlHash") DO NOTHING; + """, ct); + } + wakeup.Signal(); + } + private static IEnumerable AudioReferences(JsonElement value) { if (value.ValueKind == JsonValueKind.Array) diff --git a/RikiPath.WebApi/Controllers/ContentApprovalController.cs b/RikiPath.WebApi/Controllers/ContentApprovalController.cs index ac61543..41c71e3 100644 --- a/RikiPath.WebApi/Controllers/ContentApprovalController.cs +++ b/RikiPath.WebApi/Controllers/ContentApprovalController.cs @@ -1,6 +1,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; +using RikiPath.Application.Common; using RikiPath.Application.IServices; using RikiPath.Application.Requests.Content; using RikiPath.Application.Responses; @@ -45,12 +46,14 @@ public async Task GetMine(CancellationToken cancellationToken) [HttpGet("pending")] [Authorize(Roles = "Admin")] - [ProducesResponseType(typeof(ApiResponse>), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ApiResponse>), StatusCodes.Status200OK)] public async Task GetPendingApprovals( [FromQuery] ImportEntityType? entityType, - CancellationToken cancellationToken) + [FromQuery] int page = 1, + [FromQuery] int pageSize = 20, + CancellationToken cancellationToken = default) { - var result = await approvalService.GetPendingApprovalsAsync(entityType, cancellationToken); + var result = await approvalService.GetPendingApprovalsAsync(entityType, page, pageSize, cancellationToken); return StatusCode((int)result.StatusCode, result); } diff --git a/RikiPath.WebApi/Controllers/ContentImportController.cs b/RikiPath.WebApi/Controllers/ContentImportController.cs index 3560532..29a6f33 100644 --- a/RikiPath.WebApi/Controllers/ContentImportController.cs +++ b/RikiPath.WebApi/Controllers/ContentImportController.cs @@ -303,11 +303,13 @@ private static async Task HasMp3HeaderAsync(Stream audio, CancellationToke } /// - /// Lưu các dòng hợp lệ từ bản xem trước thành bản nháp của tác giả. + /// Lưu các dòng hợp lệ từ bản xem trước thành bản nháp của tác giả. Với file lớn, + /// gửi các nhóm dòng tuần tự cùng BatchId; chỉ gửi duyệt khi mọi nhóm đã lưu xong. /// /// Danh sách dòng New/Modified do Frontend gửi lên /// [HttpPost("confirm")] + [RequestSizeLimit(64L * 1024 * 1024)] [ProducesResponseType(typeof(ApiResponse), StatusCodes.Status200OK)] [ProducesResponseType(typeof(ApiResponse), StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status401Unauthorized)]