|
|
using FreeSql.DataAnnotations; |
|
|
|
|
|
namespace ToolHub.Models; |
|
|
|
|
|
[Table(Name = "UserToolAccesses")] |
|
|
public class UserToolAccess |
|
|
{ |
|
|
[Column(IsIdentity = true, IsPrimary = true)] |
|
|
public int Id { get; set; } |
|
|
|
|
|
public int? UserId { get; set; } |
|
|
|
|
|
public int ToolId { get; set; } |
|
|
|
|
|
[Column(StringLength = 50)] |
|
|
public string? SessionId { get; set; } |
|
|
|
|
|
[Column(StringLength = 45)] |
|
|
public string? IpAddress { get; set; } |
|
|
|
|
|
[Column(StringLength = 500)] |
|
|
public string? UserAgent { get; set; } |
|
|
|
|
|
[Column(StringLength = 100)] |
|
|
public string? Referer { get; set; } |
|
|
|
|
|
[Column(StringLength = 20)] |
|
|
public string AccessType { get; set; } = "view"; |
|
|
|
|
|
public int Duration { get; set; } = 0; |
|
|
|
|
|
public DateTime CreatedAt { get; set; } = DateTime.Now; |
|
|
|
|
|
|
|
|
[Navigate(nameof(UserId))] |
|
|
public User? User { get; set; } |
|
|
|
|
|
[Navigate(nameof(ToolId))] |
|
|
public Tool Tool { get; set; } = null!; |
|
|
} |
|
|
|