fix master relations not being set

This commit is contained in:
Christian Werner 2025-10-29 13:40:13 +01:00
parent e3467605b5
commit 88c6857e24

View File

@ -131,6 +131,7 @@ public class InitService
Name = "Master", Name = "Master",
IsMaster = true, IsMaster = true,
OwnerId = housemasterUser.Id!.Value, OwnerId = housemasterUser.Id!.Value,
Subjects = [housemasterUser]
}; };
_applicationContext.Tenants.Add(masterTenant); _applicationContext.Tenants.Add(masterTenant);
@ -141,21 +142,14 @@ public class InitService
Visibility = EntityVisibility.Active, Visibility = EntityVisibility.Active,
TenantId = masterTenant.Id!.Value, TenantId = masterTenant.Id!.Value,
Name = "Master", Name = "Master",
BaseAddress = baseAddress BaseAddress = baseAddress,
Tenant = masterTenant,
Subjects = [housemasterUser]
}; };
_applicationContext.Apps.Add(masterApp); _applicationContext.Apps.Add(masterApp);
await _applicationContext.SaveChangesAsync(); await _applicationContext.SaveChangesAsync();
var appSubjectRelation = new AppSubjectRelationEntity
{
AppId = masterApp.Id!.Value,
SubjectId = housemasterUser.Id!.Value
};
_applicationContext.AppSubjectRelations.Add(appSubjectRelation);
await _applicationContext.SaveChangesAsync();
_logger.LogInformation($""" _logger.LogInformation($"""
----- Housemaster initial login information ----- ----- Housemaster initial login information -----
username: {housemasterUser.Name} username: {housemasterUser.Name}