mirror of
https://github.com/chylex/Minecraft-Phantom-Panel.git
synced 2025-08-18 18:24:56 +02:00
.config
.run
.workdir
Agent
Common
Controller
Phantom.Controller
Phantom.Controller.Database
Converters
Entities
AgentEntity.cs
AuditLogEntity.cs
EventLogEntity.cs
InstanceEntity.cs
PermissionEntity.cs
RoleEntity.cs
RolePermissionEntity.cs
UserEntity.cs
UserPermissionEntity.cs
UserRoleEntity.cs
Factories
Repositories
ApplicationDbContext.cs
DatabaseMigrator.cs
IDbContextProvider.cs
ILazyDbContext.cs
Phantom.Controller.Database.csproj
Phantom.Controller.Database.Postgres
Phantom.Controller.Minecraft
Phantom.Controller.Services
Docker
Utils
Web
.dockerignore
.gitattributes
.gitignore
AddMigration.bat
AddMigration.sh
Directory.Build.props
Directory.Build.targets
Dockerfile
LICENSE
Packages.props
PhantomPanel.sln
README.md
global.json
42 lines
1.4 KiB
C#
42 lines
1.4 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.Diagnostics.CodeAnalysis;
|
|
using System.Text.Json;
|
|
using Phantom.Common.Data.Web.EventLog;
|
|
|
|
namespace Phantom.Controller.Database.Entities;
|
|
|
|
[Table("EventLog", Schema = "system")]
|
|
[SuppressMessage("ReSharper", "AutoPropertyCanBeMadeGetOnly.Global")]
|
|
[SuppressMessage("ReSharper", "ClassWithVirtualMembersNeverInherited.Global")]
|
|
public sealed class EventLogEntity : IDisposable {
|
|
[Key]
|
|
public Guid EventGuid { get; set; }
|
|
|
|
public DateTime UtcTime { get; set; } // Note: Converting to UTC is not best practice, but for historical records it's good enough.
|
|
public Guid? AgentGuid { get; set; }
|
|
public EventLogEventType EventType { get; set; }
|
|
public EventLogSubjectType SubjectType { get; set; }
|
|
public string SubjectId { get; set; }
|
|
public JsonDocument? Data { get; set; }
|
|
|
|
[SuppressMessage("ReSharper", "UnusedMember.Global")]
|
|
internal EventLogEntity() {
|
|
SubjectId = string.Empty;
|
|
}
|
|
|
|
public EventLogEntity(Guid eventGuid, DateTime utcTime, Guid? agentGuid, EventLogEventType eventType, string subjectId, Dictionary<string, object?>? data) {
|
|
EventGuid = eventGuid;
|
|
UtcTime = utcTime;
|
|
AgentGuid = agentGuid;
|
|
EventType = eventType;
|
|
SubjectType = eventType.GetSubjectType();
|
|
SubjectId = subjectId;
|
|
Data = data == null ? null : JsonSerializer.SerializeToDocument(data);
|
|
}
|
|
|
|
public void Dispose() {
|
|
Data?.Dispose();
|
|
}
|
|
}
|