forked from gongxuegit/tiku-backend.net
feat: add platform public question bank workspace
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Tiku.Application.Security;
|
||||
using Tiku.Domain.Common;
|
||||
using Tiku.Domain.Operations;
|
||||
using Tiku.Domain.Platform;
|
||||
using Tiku.Domain.Tenancy;
|
||||
@@ -124,6 +125,21 @@ public sealed class BuiltinBackofficeCatalogSeeder(TikuDbContext dbContext)
|
||||
|
||||
public async Task SeedAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
var platformOwnedTenant = await dbContext.Tenants
|
||||
.SingleOrDefaultAsync(item => item.Mode == TenantMode.PlatformOwned, cancellationToken);
|
||||
if (platformOwnedTenant is null)
|
||||
{
|
||||
dbContext.Tenants.Add(new Tenant
|
||||
{
|
||||
Slug = "platform-public-content",
|
||||
Name = "平台公共内容",
|
||||
Status = TenantStatus.Active,
|
||||
Mode = TenantMode.PlatformOwned,
|
||||
BillingStatus = BillingStatus.Active,
|
||||
Metadata = JsonDefaults.Object()
|
||||
});
|
||||
}
|
||||
|
||||
var featureCodes = Features.Select(item => item.Code).ToArray();
|
||||
var existingFeatureCodes = await dbContext.SaasFeatures.AsNoTracking()
|
||||
.Where(item => featureCodes.Contains(item.Code))
|
||||
|
||||
Reference in New Issue
Block a user