Files
Umbraco-CMS/src/Umbraco.Core/Models/AuditItem.cs
Nikolaj Geisle b96302a9da V13: Audit log controller (#13842)
* Implement AuditLogByTypeViewModel

* Add GetLogs endpoint

* Implement AuditLogViewModelFactory and use it

* Remove mapping and do that in ViewModelFactory

* Add Skip take pagination to AuditService.cs

* Get entity key from repository

* Only create filter if sincedate has value

* Refactor to handle enitity not being found

* Add by type route

* Rename AuditLogViewModel.cs

* Add CreateAuditLogWithUsernameViewModel method to factory

* Rename method in factory

* Fix up controllers to use async service

* Refactor to use pagedModel

* Update sincedate query

* Add FIXME

* Move entity call in scope

* Rename methods to async

* Update src/Umbraco.Core/PaginationHelper.cs

* Refactor to use IActionResult

* Audit log in two words

* Fix up by key

* Fix routing

* Fix ByType

* Update ByType routing

* Refactor to also pass DateStamp

* Add Key to WithUserNameViewModel

* Refactor extension method to call new GetAsync method

* use new GetAsync method

* Rename models and implement base class

* Update OpenApi.json

---------

Co-authored-by: Zeegaan <nge@umbraco.dk>
Co-authored-by: Nikolaj <nikolajlauridsen@protonmail.ch>
2023-02-23 11:32:24 +01:00

40 lines
1009 B
C#

using Umbraco.Cms.Core.Models.Entities;
namespace Umbraco.Cms.Core.Models;
public sealed class AuditItem : EntityBase, IAuditItem
{
/// <summary>
/// Initializes a new instance of the <see cref="AuditItem" /> class.
/// </summary>
public AuditItem(int objectId, AuditType type, int userId, string? entityType, string? comment = null, string? parameters = null, DateTime? createDate = null)
{
DisableChangeTracking();
Id = objectId;
Comment = comment;
AuditType = type;
UserId = userId;
EntityType = entityType;
Parameters = parameters;
CreateDate = createDate ?? default;
EnableChangeTracking();
}
/// <inheritdoc />
public AuditType AuditType { get; }
/// <inheritdoc />
public string? EntityType { get; }
/// <inheritdoc />
public int UserId { get; }
/// <inheritdoc />
public string? Comment { get; }
/// <inheritdoc />
public string? Parameters { get; }
}