diff --git a/src/Umbraco.Cms.Api.Management/Controllers/Document/GetAuditLogDocumentController.cs b/src/Umbraco.Cms.Api.Management/Controllers/Document/GetAuditLogDocumentController.cs index 206d2d2252d8..a22841850e44 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/Document/GetAuditLogDocumentController.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/Document/GetAuditLogDocumentController.cs @@ -35,7 +35,7 @@ public GetAuditLogDocumentController( [MapToApiVersion("1.0")] [HttpGet("{id:guid}/audit-log")] [ProducesResponseType(typeof(PagedViewModel), StatusCodes.Status200OK)] - public async Task GetAuditLog(CancellationToken cancellationToken, Guid id, Direction orderDirection = Direction.Descending, DateTime? sinceDate = null, int skip = 0, int take = 100) + public async Task GetAuditLog(CancellationToken cancellationToken, Guid id, Direction orderDirection = Direction.Descending, DateTimeOffset? sinceDate = null, int skip = 0, int take = 100) { AuthorizationResult authorizationResult = await _authorizationService.AuthorizeResourceAsync( User, diff --git a/src/Umbraco.Cms.Api.Management/Controllers/LogViewer/AllLogViewerController.cs b/src/Umbraco.Cms.Api.Management/Controllers/LogViewer/AllLogViewerController.cs index 1a93a60da2ab..d341361da264 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/LogViewer/AllLogViewerController.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/LogViewer/AllLogViewerController.cs @@ -48,8 +48,8 @@ public async Task AllLogs( Direction orderDirection = Direction.Descending, string? filterExpression = null, [FromQuery(Name = "logLevel")] LogLevel[]? logLevels = null, - DateTime? startDate = null, - DateTime? endDate = null) + DateTimeOffset? startDate = null, + DateTimeOffset? endDate = null) { var levels = logLevels?.Select(l => l.ToString()).ToArray(); diff --git a/src/Umbraco.Cms.Api.Management/Controllers/LogViewer/AllMessageTemplateLogViewerController.cs b/src/Umbraco.Cms.Api.Management/Controllers/LogViewer/AllMessageTemplateLogViewerController.cs index faed45ca05d6..92f5c9d970da 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/LogViewer/AllMessageTemplateLogViewerController.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/LogViewer/AllMessageTemplateLogViewerController.cs @@ -40,8 +40,8 @@ public async Task AllMessageTemplates( CancellationToken cancellationToken, int skip = 0, int take = 100, - DateTime? startDate = null, - DateTime? endDate = null) + DateTimeOffset? startDate = null, + DateTimeOffset? endDate = null) { Attempt, LogViewerOperationStatus> messageTemplatesAttempt = await _logViewerService.GetMessageTemplatesAsync(startDate, endDate, skip, take); diff --git a/src/Umbraco.Cms.Api.Management/Controllers/LogViewer/LogLevelCountLogViewerController.cs b/src/Umbraco.Cms.Api.Management/Controllers/LogViewer/LogLevelCountLogViewerController.cs index 5ae69bb9014f..4e7095b9ef23 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/LogViewer/LogLevelCountLogViewerController.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/LogViewer/LogLevelCountLogViewerController.cs @@ -34,8 +34,8 @@ public LogLevelCountLogViewerController(ILogViewerService logViewerService, IUmb [ProducesResponseType(typeof(LogLevelCountsReponseModel), StatusCodes.Status200OK)] public async Task LogLevelCounts( CancellationToken cancellationToken, - DateTime? startDate = null, - DateTime? endDate = null) + DateTimeOffset? startDate = null, + DateTimeOffset? endDate = null) { Attempt logLevelCountsAttempt = await _logViewerService.GetLogLevelCountsAsync(startDate, endDate); diff --git a/src/Umbraco.Cms.Api.Management/Controllers/LogViewer/ValidateLogFileSizeLogViewerController.cs b/src/Umbraco.Cms.Api.Management/Controllers/LogViewer/ValidateLogFileSizeLogViewerController.cs index 553b3df475bf..6b42892f2dfe 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/LogViewer/ValidateLogFileSizeLogViewerController.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/LogViewer/ValidateLogFileSizeLogViewerController.cs @@ -26,8 +26,8 @@ public class ValidateLogFileSizeLogViewerController : LogViewerControllerBase [ProducesResponseType(StatusCodes.Status200OK)] public async Task CanViewLogs( CancellationToken cancellationToken, - DateTime? startDate = null, - DateTime? endDate = null) + DateTimeOffset? startDate = null, + DateTimeOffset? endDate = null) { Attempt result = await _logViewerService.CanViewLogsAsync(startDate, endDate); diff --git a/src/Umbraco.Cms.Api.Management/Controllers/Media/GetAuditLogMediaController.cs b/src/Umbraco.Cms.Api.Management/Controllers/Media/GetAuditLogMediaController.cs index 445bf86b9fbf..bd99aa27ad88 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/Media/GetAuditLogMediaController.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/Media/GetAuditLogMediaController.cs @@ -34,7 +34,7 @@ public GetAuditLogMediaController( [MapToApiVersion("1.0")] [HttpGet("{id:guid}/audit-log")] [ProducesResponseType(typeof(PagedViewModel), StatusCodes.Status200OK)] - public async Task GetAuditLog(CancellationToken cancellationToken, Guid id, Direction orderDirection = Direction.Descending, DateTime? sinceDate = null, int skip = 0, int take = 100) + public async Task GetAuditLog(CancellationToken cancellationToken, Guid id, Direction orderDirection = Direction.Descending, DateTimeOffset? sinceDate = null, int skip = 0, int take = 100) { AuthorizationResult authorizationResult = await _authorizationService.AuthorizeResourceAsync( User, diff --git a/src/Umbraco.Cms.Api.Management/ViewModels/Member/MemberResponseModel.cs b/src/Umbraco.Cms.Api.Management/ViewModels/Member/MemberResponseModel.cs index 13cff882c0c8..0125d85523ec 100644 --- a/src/Umbraco.Cms.Api.Management/ViewModels/Member/MemberResponseModel.cs +++ b/src/Umbraco.Cms.Api.Management/ViewModels/Member/MemberResponseModel.cs @@ -19,11 +19,11 @@ public class MemberResponseModel : ContentResponseModelBase Groups { get; set; } = []; } diff --git a/src/Umbraco.Core/Services/AuditService.cs b/src/Umbraco.Core/Services/AuditService.cs index 0281066dbff3..737314201324 100644 --- a/src/Umbraco.Core/Services/AuditService.cs +++ b/src/Umbraco.Core/Services/AuditService.cs @@ -242,7 +242,7 @@ public async Task> GetItemsByKeyAsync( int skip, int take, Direction orderDirection = Direction.Descending, - DateTime? sinceDate = null, + DateTimeOffset? sinceDate = null, AuditType[]? auditTypeFilter = null) { if (skip < 0) @@ -264,7 +264,7 @@ public async Task> GetItemsByKeyAsync( using (ScopeProvider.CreateCoreScope(autoComplete: true)) { IQuery query = Query().Where(x => x.Id == keyToIdAttempt.Result); - IQuery? customFilter = sinceDate.HasValue ? Query().Where(x => x.CreateDate >= sinceDate) : null; + IQuery? customFilter = sinceDate.HasValue ? Query().Where(x => x.CreateDate >= sinceDate.Value.LocalDateTime) : null; PaginationHelper.ConvertSkipTakeToPaging(skip, take, out var pageNumber, out var pageSize); IEnumerable auditItems = _auditRepository.GetPagedResultsByQuery(query, pageNumber, pageSize, out var totalRecords, orderDirection, auditTypeFilter, customFilter); diff --git a/src/Umbraco.Core/Services/IAuditService.cs b/src/Umbraco.Core/Services/IAuditService.cs index b80fdb3b3e68..e4c973ced056 100644 --- a/src/Umbraco.Core/Services/IAuditService.cs +++ b/src/Umbraco.Core/Services/IAuditService.cs @@ -99,7 +99,7 @@ Task> GetItemsByKeyAsync( int skip, int take, Direction orderDirection = Direction.Descending, - DateTime? sinceDate = null, + DateTimeOffset? sinceDate = null, AuditType[]? auditTypeFilter = null) => throw new NotImplementedException(); /// diff --git a/src/Umbraco.Core/Services/ILogViewerService.cs b/src/Umbraco.Core/Services/ILogViewerService.cs index 97907ec9728a..9e7f9feb3f85 100644 --- a/src/Umbraco.Core/Services/ILogViewerService.cs +++ b/src/Umbraco.Core/Services/ILogViewerService.cs @@ -22,8 +22,8 @@ public interface ILogViewerService : IService /// The query expression to filter on. /// The log levels for which to retrieve the log messages. Task?, LogViewerOperationStatus>> GetPagedLogsAsync( - DateTime? startDate, - DateTime? endDate, + DateTimeOffset? startDate, + DateTimeOffset? endDate, int skip, int take, Direction orderDirection = Direction.Descending, @@ -63,7 +63,7 @@ public interface ILogViewerService : IService /// The start date for the date range. /// The end date for the date range. /// The value whether or not you are able to view the logs. - Task> CanViewLogsAsync(DateTime? startDate, DateTime? endDate); + Task> CanViewLogsAsync(DateTimeOffset? startDate, DateTimeOffset? endDate); /// /// Returns a number of the different log level entries. @@ -72,7 +72,7 @@ public interface ILogViewerService : IService /// /// The start date for the date range. /// The end date for the date range. - Task> GetLogLevelCountsAsync(DateTime? startDate, DateTime? endDate); + Task> GetLogLevelCountsAsync(DateTimeOffset? startDate, DateTimeOffset? endDate); /// /// Returns a paged model of all unique message templates and their counts. @@ -83,7 +83,7 @@ public interface ILogViewerService : IService /// The end date for the date range. /// The amount of items to skip. /// The amount of items to take. - Task, LogViewerOperationStatus>> GetMessageTemplatesAsync(DateTime? startDate, DateTime? endDate, int skip, int take); + Task, LogViewerOperationStatus>> GetMessageTemplatesAsync(DateTimeOffset? startDate, DateTimeOffset? endDate, int skip, int take); /// /// Get the log level values of the global minimum and the UmbracoFile one from the config file. diff --git a/src/Umbraco.Core/Services/LogViewerService.cs b/src/Umbraco.Core/Services/LogViewerService.cs index 5f3a7d3f04c0..aa1b1478ad3c 100644 --- a/src/Umbraco.Core/Services/LogViewerService.cs +++ b/src/Umbraco.Core/Services/LogViewerService.cs @@ -32,8 +32,8 @@ public LogViewerService( /// public async Task?, LogViewerOperationStatus>> GetPagedLogsAsync( - DateTime? startDate, - DateTime? endDate, + DateTimeOffset? startDate, + DateTimeOffset? endDate, int skip, int take, Direction orderDirection = Direction.Descending, @@ -109,7 +109,7 @@ public async Task> GetSavedLogQueriesAsync(int skip, } /// - public async Task> CanViewLogsAsync(DateTime? startDate, DateTime? endDate) + public async Task> CanViewLogsAsync(DateTimeOffset? startDate, DateTimeOffset? endDate) { LogTimePeriod logTimePeriod = GetTimePeriod(startDate, endDate); bool isAllowed = CanViewLogs(logTimePeriod); @@ -123,7 +123,7 @@ public async Task> CanViewLogsAsync(Date } /// - public async Task> GetLogLevelCountsAsync(DateTime? startDate, DateTime? endDate) + public async Task> GetLogLevelCountsAsync(DateTimeOffset? startDate, DateTimeOffset? endDate) { LogTimePeriod logTimePeriod = GetTimePeriod(startDate, endDate); @@ -143,7 +143,7 @@ public async Task> CanViewLogsAsync(Date } /// - public async Task, LogViewerOperationStatus>> GetMessageTemplatesAsync(DateTime? startDate, DateTime? endDate, int skip, int take) + public async Task, LogViewerOperationStatus>> GetMessageTemplatesAsync(DateTimeOffset? startDate, DateTimeOffset? endDate, int skip, int take) { LogTimePeriod logTimePeriod = GetTimePeriod(startDate, endDate); @@ -183,7 +183,7 @@ public ReadOnlyDictionary GetLogLevelsFromSinks() /// The start date for the date range (can be null). /// The end date for the date range (can be null). /// The LogTimePeriod object used to filter logs. - private LogTimePeriod GetTimePeriod(DateTime? startDate, DateTime? endDate) + private LogTimePeriod GetTimePeriod(DateTimeOffset? startDate, DateTimeOffset? endDate) { if (startDate is null || endDate is null) { @@ -199,7 +199,7 @@ private LogTimePeriod GetTimePeriod(DateTime? startDate, DateTime? endDate) } } - return new LogTimePeriod(startDate.Value, endDate.Value); + return new LogTimePeriod(startDate.Value.LocalDateTime, endDate.Value.LocalDateTime); } ///