refactor(architecture): harden module boundaries
Some checks failed
ci / release-gate (push) Has been cancelled

This commit is contained in:
2026-08-04 12:10:36 +08:00
parent b38f12e60b
commit 33375a38d7
218 changed files with 5124 additions and 3828 deletions

View File

@@ -15,7 +15,7 @@ internal sealed class VideoManagementService(DirectContentServiceDependencies de
AdminLimitFilter filter,
CancellationToken cancellationToken = default)
{
var query = dbContext.VideoExplanations.AsNoTracking().Where(item => item.TenantId == actor.TenantId);
var query = contentAssetPersistence.VideoExplanations.AsNoTracking().Where(item => item.TenantId == actor.TenantId);
if (filter.SubjectId.HasValue) query = query.Where(item => item.SubjectId == filter.SubjectId.Value);
if (!string.Equals(filter.Status, "all", StringComparison.OrdinalIgnoreCase))
@@ -44,7 +44,7 @@ internal sealed class VideoManagementService(DirectContentServiceDependencies de
{
ArgumentException.ThrowIfNullOrWhiteSpace(command.Title);
await AssertReferenceAsync<Subject>(actor.TenantId, command.SubjectId, "subject_not_found", cancellationToken);
var item = await ResolveByIdOrLegacyAsync(dbContext.VideoExplanations, actor.TenantId, command.Id,
var item = await ResolveByIdOrLegacyAsync(contentAssetPersistence.VideoExplanations, actor.TenantId, command.Id,
command.LegacyId, cancellationToken);
var isNew = item is null;
item ??= new VideoExplanation { Id = command.Id ?? Guid.NewGuid(), TenantId = actor.TenantId };
@@ -61,9 +61,9 @@ internal sealed class VideoManagementService(DirectContentServiceDependencies de
item.SortOrder = command.Order ?? item.SortOrder;
item.IsActive = command.IsActive ?? item.IsActive;
item.Metadata = JsonObjectOrDefault(command.Metadata);
if (isNew) dbContext.VideoExplanations.Add(item);
if (isNew) contentAssetPersistence.VideoExplanations.Add(item);
await dbContext.SaveChangesAsync(cancellationToken);
await unitOfWork.SaveChangesAsync(cancellationToken);
return new ContentManagementResult<VideoManagementItem>(ToVideoItem(item));
}
@@ -76,7 +76,7 @@ internal sealed class VideoManagementService(DirectContentServiceDependencies de
cancellationToken);
await AssertReferenceAsync<VideoExplanation>(actor.TenantId, command.VideoId, "video_not_found",
cancellationToken);
var item = await dbContext.QuestionVideos.SingleOrDefaultAsync(
var item = await contentAssetPersistence.QuestionVideos.SingleOrDefaultAsync(
link => link.TenantId == actor.TenantId && link.QuestionId == command.QuestionId &&
link.VideoId == command.VideoId,
cancellationToken);
@@ -88,13 +88,13 @@ internal sealed class VideoManagementService(DirectContentServiceDependencies de
item.VideoType = Parse(command.VideoType, QuestionVideoType.Specific, "question_video_type_invalid");
item.SortOrder = command.Order ?? item.SortOrder;
item.Metadata = JsonObjectOrDefault(command.Metadata);
if (isNew) dbContext.QuestionVideos.Add(item);
if (isNew) contentAssetPersistence.QuestionVideos.Add(item);
var question = await dbContext.Questions.SingleAsync(
var question = await questionBankPersistence.Questions.SingleAsync(
question => question.TenantId == actor.TenantId && question.Id == command.QuestionId,
cancellationToken);
question.HasVideoExplanation = true;
await dbContext.SaveChangesAsync(cancellationToken);
await unitOfWork.SaveChangesAsync(cancellationToken);
return new ContentManagementResult<QuestionVideoManagementItem>(ToQuestionVideoItem(item));
}
}