ql_apimanager_backend/Apimanager_backend/Models/OperationLog.cs

62 lines
1.7 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Microsoft.AspNetCore.Antiforgery;
using System.ComponentModel.DataAnnotations;
namespace Apimanager_backend.Models
{
public class OperationLog
{
/// <summary>
/// 主键,自增
/// </summary>
public int Id { get; set; }
/// <summary>
/// 操作人ID操作者的用户ID通常是管理员
/// </summary>
public int UserId { get; set; }
/// <summary>
/// 操作类型,描述操作的具体内容
/// </summary>
[Required]
[MaxLength(20)]
public string Operation { get; set; } // varchar(20)
/// <summary>
/// 目标类型,操作的对象类型
/// </summary>
[Required]
[MaxLength(50)]
public string TargetType { get; set; } // varchar(50)
/// <summary>
/// 目标对象ID操作对象的具体ID
/// </summary>
public int TargetId { get; set; }
/// <summary>
/// 操作时间,操作发生时间
/// </summary>
public DateTime CreatedAt { get; set; } = DateTime.UtcNow; // timestamp
/// <summary>
/// 操作来源IP
/// </summary>
[MaxLength(45)]
public string IpAddress { get; set; } // varchar(45)
/// <summary>
/// 操作设备信息
/// </summary>
public string UserAgent { get; set; } // varchar(255)
/// <summary>
/// 操作描述,可选的详细说明,解释操作原因等
/// </summary>
public string Description { get; set; } // varchar(255)
//导航属性
public User? User { get; set; }
}
}