Files: added 30 days gap
This commit is contained in:
parent
8767b227e4
commit
2a12f4ca0a
@ -105,7 +105,7 @@ public class FilesSettings : ISettings<FilesSettings>
|
||||
HideFavoritesSetting = false,
|
||||
HideTemplatesSetting = false,
|
||||
DownloadTarGzSetting = false,
|
||||
AutomaticallyCleanUpSetting = new AutoCleanUpData { IsAutoCleanUp = true, Gap = DateToAutoCleanUp.OneMonth },
|
||||
AutomaticallyCleanUpSetting = new AutoCleanUpData { IsAutoCleanUp = true, Gap = DateToAutoCleanUp.ThirtyDays },
|
||||
DefaultSharingAccessRightsSetting = null
|
||||
};
|
||||
}
|
||||
|
@ -24,26 +24,27 @@
|
||||
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
|
||||
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
|
||||
namespace ASC.Files.Core;
|
||||
namespace ASC.Files.Core;
|
||||
|
||||
public enum DateToAutoCleanUp
|
||||
{
|
||||
OneWeek = 1,
|
||||
TwoWeeks,
|
||||
OneMonth,
|
||||
TwoMonths,
|
||||
ThreeMonths
|
||||
}
|
||||
|
||||
public class AutoCleanUpData
|
||||
{
|
||||
public bool IsAutoCleanUp { get; set; }
|
||||
|
||||
public DateToAutoCleanUp Gap { get; set; }
|
||||
}
|
||||
public enum DateToAutoCleanUp
|
||||
{
|
||||
OneWeek = 1,
|
||||
TwoWeeks,
|
||||
OneMonth,
|
||||
ThirtyDays,
|
||||
TwoMonths,
|
||||
ThreeMonths
|
||||
}
|
||||
|
||||
[Scope]
|
||||
public class FileDateTime
|
||||
public class AutoCleanUpData
|
||||
{
|
||||
public bool IsAutoCleanUp { get; set; }
|
||||
|
||||
public DateToAutoCleanUp Gap { get; set; }
|
||||
}
|
||||
|
||||
[Scope]
|
||||
public class FileDateTime
|
||||
{
|
||||
private readonly TenantUtil _tenantUtil;
|
||||
|
||||
@ -51,19 +52,32 @@ public class FileDateTime
|
||||
{
|
||||
_tenantUtil = tenantUtil;
|
||||
}
|
||||
|
||||
public DateTime GetModifiedOnWithAutoCleanUp(DateTime modifiedOn, DateToAutoCleanUp date, bool utc = false)
|
||||
{
|
||||
var dateTime = modifiedOn;
|
||||
switch (date)
|
||||
{
|
||||
case DateToAutoCleanUp.OneWeek: dateTime = dateTime.AddDays(7); break;
|
||||
case DateToAutoCleanUp.TwoWeeks: dateTime = dateTime.AddDays(14); break;
|
||||
case DateToAutoCleanUp.OneMonth: dateTime = dateTime.AddMonths(1); break;
|
||||
case DateToAutoCleanUp.TwoMonths: dateTime = dateTime.AddMonths(2); break;
|
||||
case DateToAutoCleanUp.ThreeMonths: dateTime = dateTime.AddMonths(3); break;
|
||||
default: break;
|
||||
}
|
||||
return utc ? _tenantUtil.DateTimeToUtc(dateTime) : dateTime;
|
||||
}
|
||||
|
||||
public DateTime GetModifiedOnWithAutoCleanUp(DateTime modifiedOn, DateToAutoCleanUp date, bool utc = false)
|
||||
{
|
||||
var dateTime = modifiedOn;
|
||||
switch (date)
|
||||
{
|
||||
case DateToAutoCleanUp.OneWeek:
|
||||
dateTime = dateTime.AddDays(7);
|
||||
break;
|
||||
case DateToAutoCleanUp.TwoWeeks:
|
||||
dateTime = dateTime.AddDays(14);
|
||||
break;
|
||||
case DateToAutoCleanUp.OneMonth:
|
||||
dateTime = dateTime.AddMonths(1);
|
||||
break;
|
||||
case DateToAutoCleanUp.ThirtyDays:
|
||||
dateTime = dateTime.AddDays(30);
|
||||
break;
|
||||
case DateToAutoCleanUp.TwoMonths:
|
||||
dateTime = dateTime.AddMonths(2);
|
||||
break;
|
||||
case DateToAutoCleanUp.ThreeMonths:
|
||||
dateTime = dateTime.AddMonths(3);
|
||||
break;
|
||||
}
|
||||
|
||||
return utc ? _tenantUtil.DateTimeToUtc(dateTime) : dateTime;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user