mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
Excluded some entities from data cleanup.
This commit is contained in:
parent
12236b1edd
commit
bc9221e054
@ -89,25 +89,6 @@ namespace Remotely_Server.Data
|
||||
});
|
||||
}
|
||||
|
||||
public void CleanupEmptyOrganizations()
|
||||
{
|
||||
var emptyOrgs = RemotelyContext.Organizations
|
||||
.Include(x => x.RemotelyUsers)
|
||||
.Include(x => x.CommandContexts)
|
||||
.Include(x => x.InviteLinks)
|
||||
.Include(x => x.Devices)
|
||||
.Include(x => x.SharedFiles)
|
||||
.Include(x => x.PermissionGroups)
|
||||
.Include(x => x.EventLogs)
|
||||
.Where(x => x.RemotelyUsers.Count == 0);
|
||||
|
||||
foreach (var emptyOrg in emptyOrgs)
|
||||
{
|
||||
RemotelyContext.Remove(emptyOrg);
|
||||
}
|
||||
RemotelyContext.SaveChanges();
|
||||
}
|
||||
|
||||
public bool DoesUserExist(string userName)
|
||||
{
|
||||
if (userName == null)
|
||||
@ -477,13 +458,6 @@ namespace Remotely_Server.Data
|
||||
{
|
||||
RemotelyContext.Remove(x);
|
||||
}).Wait();
|
||||
|
||||
RemotelyContext.Devices
|
||||
.Where(x => DateTime.Now - x.LastOnline > TimeSpan.FromDays(AppConfig.DataRetentionInDays))
|
||||
.ForEachAsync(x =>
|
||||
{
|
||||
RemotelyContext.Remove(x);
|
||||
}).Wait();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -216,7 +216,6 @@ namespace Remotely_Server
|
||||
dataService.WriteEvent(ex);
|
||||
}
|
||||
dataService.SetAllDevicesNotOnline();
|
||||
dataService.CleanupEmptyOrganizations();
|
||||
dataService.CleanupOldRecords();
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user