Skip to content

Commit

Permalink
fix create new theme on import app
Browse files Browse the repository at this point in the history
  • Loading branch information
nhathoang989 committed Nov 9, 2023
1 parent fa2184a commit 7269f0b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ private async Task ImportSchema(string schemaFolder, CancellationToken cancellat
if (Directory.Exists(schemaFolder))
{
var schema = await _importService.LoadSchema(schemaFolder);
schema.ThemeId = CurrentTenant.Themes.FirstOrDefault().Id;
if (schema != null && schema.IsValid)
{
await _importService.ImportSelectedItemsAsync(schema);
Expand Down
3 changes: 3 additions & 0 deletions src/platform/mix.library/Services/MixTenantService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public sealed class MixTenantService : IMixTenantService
public List<MixTenantSystemModel> AllTenants { get; set; }

public List<MixCulture> AllCultures { get; set; }
public List<MixTheme> AllThemes { get; set; }

public MixTenantService(DatabaseService databaseService)
{
Expand All @@ -29,6 +30,7 @@ public async Task Reload(CancellationToken cancellationToken = default)

var domains = await dbContext.MixDomain.Where(p => tenantIds.Contains(p.MixTenantId)).ToListAsync(cancellationToken);
AllCultures = await dbContext.MixCulture.ToListAsync(cancellationToken);
AllThemes = await dbContext.MixTheme.ToListAsync(cancellationToken);

var tenants = mixTenants
.Select(p => new MixTenantSystemModel
Expand All @@ -41,6 +43,7 @@ public async Task Reload(CancellationToken cancellationToken = default)
Configurations = new TenantConfigService(p.SystemName).AppSettings,
Domains = domains.Where(d => d.MixTenantId == p.Id).ToList(),
Cultures = AllCultures.Where(c => c.MixTenantId == p.Id).ToList(),
Themes = AllThemes.Where(c => c.MixTenantId == p.Id).ToList(),
})
.ToList();

Expand Down
1 change: 1 addition & 0 deletions src/platform/mix.service/Models/MixTenantSystemModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class MixTenantSystemModel
public List<MixDomain> Domains { get; set; }

public List<MixCulture> Cultures { get; set; } = new();
public List<MixTheme> Themes { get; set; } = new();

public TenantConfigurationModel Configurations { get; set; }
}
Expand Down

0 comments on commit 7269f0b

Please sign in to comment.