Excluded some entities from data cleanup.

This commit is contained in:
Jared Goodwin 2019-06-01 16:50:20 -07:00
parent 12236b1edd
commit bc9221e054
2 changed files with 0 additions and 27 deletions

View File

@ -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();
}
}

View File

@ -216,7 +216,6 @@ namespace Remotely_Server
dataService.WriteEvent(ex);
}
dataService.SetAllDevicesNotOnline();
dataService.CleanupEmptyOrganizations();
dataService.CleanupOldRecords();
}