This commit is contained in:
2026-01-08 15:18:34 +01:00
parent d385119ca2
commit 33a0b77bf1
111 changed files with 85489 additions and 24 deletions

View File

@@ -0,0 +1,50 @@
using EonaCat.Json;
using Microsoft.AspNetCore.Mvc.Rendering;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json;
namespace LogCentral.Server.Models;
public class LogEntry
{
public string Id { get; set; } = Guid.NewGuid().ToString();
public DateTime Timestamp { get; set; }
public string ApplicationName { get; set; } = default!;
public string ApplicationVersion { get; set; } = default!;
public string Environment { get; set; } = default!;
public string MachineName { get; set; } = default!;
public int Level { get; set; }
public string Category { get; set; } = default!;
public string Message { get; set; } = default!;
public string? Exception { get; set; }
public string? StackTrace { get; set; }
[Column(TypeName = "TEXT")]
public string? PropertiesJson { get; set; }
[NotMapped]
public Dictionary<string, object>? Properties
{
get => string.IsNullOrEmpty(PropertiesJson)
? null
: JsonHelper.ToObject<Dictionary<string, object>>(PropertiesJson);
set => PropertiesJson = value == null ? null : JsonHelper.ToJson(value);
}
public string? UserId { get; set; }
public string? SessionId { get; set; }
public string? RequestId { get; set; }
public string? CorrelationId { get; set; }
}
public class Application
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public string ApiKey { get; set; } = Guid.NewGuid().ToString();
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public bool IsActive { get; set; } = true;
}