47 lines
1.8 KiB
C#
47 lines
1.8 KiB
C#
using System.Text.RegularExpressions;
|
|
using Tiku.Application.Content;
|
|
using Tiku.Application.QuestionBanks;
|
|
using Tiku.Application.Security;
|
|
using Tiku.Infrastructure.Persistence;
|
|
|
|
namespace Tiku.Infrastructure.Content;
|
|
|
|
internal sealed record DirectContentServiceDependencies(
|
|
TikuDbContext DbContext,
|
|
IQuestionReferenceService QuestionReferenceService,
|
|
ICurrentAccessContext CurrentAccessContext,
|
|
IFeatureAccessService FeatureAccessService);
|
|
|
|
internal abstract partial class DirectContentServiceBase(DirectContentServiceDependencies dependencies)
|
|
{
|
|
protected TikuDbContext dbContext { get; } = dependencies.DbContext;
|
|
protected IQuestionReferenceService questionReferenceService { get; } = dependencies.QuestionReferenceService;
|
|
protected ICurrentAccessContext currentAccessContext { get; } = dependencies.CurrentAccessContext;
|
|
protected IFeatureAccessService featureAccessService { get; } = dependencies.FeatureAccessService;
|
|
|
|
protected const int DefaultLimit = 100;
|
|
protected const int MaxLimit = 1000;
|
|
|
|
protected static readonly string[] ContentPermissions =
|
|
[
|
|
BackendPermissions.TenantContentManage,
|
|
BackendPermissions.TenantVocabularyManage,
|
|
BackendPermissions.TenantHandbookManage,
|
|
BackendPermissions.TenantVideoManage,
|
|
BackendPermissions.TenantScorelineManage,
|
|
BackendPermissions.TenantSiteContentManage,
|
|
BackendPermissions.TenantJobManage
|
|
];
|
|
|
|
protected static readonly Regex ScorelineFieldKeyRegex = new("^[A-Za-z][A-Za-z0-9_]{0,63}$", RegexOptions.Compiled);
|
|
|
|
protected static readonly HashSet<string> SupportedImportTypes = new(StringComparer.OrdinalIgnoreCase)
|
|
{
|
|
"questions",
|
|
"vocabulary",
|
|
"handbook",
|
|
"scoreline",
|
|
"videos"
|
|
};
|
|
}
|