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