2026-05-21 16:45:56 +08:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
|
|
|
2026-05-22 14:29:22 +08:00
|
|
|
|
namespace FileShare_EFCore.Models
|
2026-05-21 16:45:56 +08:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 扫描入库的可在线查看文件。
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[Comment("文件库文件记录")]
|
|
|
|
|
|
[Table("managed-file-record")]
|
|
|
|
|
|
public class ManagedFileRecord
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>主键 ID。</summary>
|
|
|
|
|
|
[Key]
|
|
|
|
|
|
[Column("id")]
|
|
|
|
|
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
|
|
|
|
public int Id { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>所属根目录 ID。</summary>
|
|
|
|
|
|
[Column("library-root-id")]
|
|
|
|
|
|
public int LibraryRootId { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>文件名。</summary>
|
|
|
|
|
|
[Column("file-name")]
|
|
|
|
|
|
[MaxLength(260)]
|
|
|
|
|
|
public string FileName { get; set; } = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>相对根目录路径。</summary>
|
|
|
|
|
|
[Column("relative-path")]
|
|
|
|
|
|
[MaxLength(1024)]
|
|
|
|
|
|
public string RelativePath { get; set; } = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>服务器本机绝对路径。</summary>
|
|
|
|
|
|
[Column("absolute-path")]
|
|
|
|
|
|
[MaxLength(2048)]
|
|
|
|
|
|
public string AbsolutePath { get; set; } = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>扩展名,小写并包含点。</summary>
|
|
|
|
|
|
[Column("extension")]
|
|
|
|
|
|
[MaxLength(32)]
|
|
|
|
|
|
public string Extension { get; set; } = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>文件大小,字节。</summary>
|
|
|
|
|
|
[Column("size-bytes")]
|
|
|
|
|
|
public long SizeBytes { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>文件最后修改时间 UTC。</summary>
|
|
|
|
|
|
[Column("last-write-time-utc")]
|
|
|
|
|
|
public DateTime LastWriteTimeUtc { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>媒体类型:text、video、audio。</summary>
|
|
|
|
|
|
[Column("media-type")]
|
|
|
|
|
|
[MaxLength(20)]
|
|
|
|
|
|
public string MediaType { get; set; } = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>MIME 类型。</summary>
|
|
|
|
|
|
[Column("content-type")]
|
|
|
|
|
|
[MaxLength(100)]
|
|
|
|
|
|
public string ContentType { get; set; } = "application/octet-stream";
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>文件是否仍存在。</summary>
|
|
|
|
|
|
[Column("exists")]
|
|
|
|
|
|
public bool Exists { get; set; } = true;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>最近扫描时间。</summary>
|
|
|
|
|
|
[Column("last-seen-at")]
|
|
|
|
|
|
public DateTime LastSeenAt { get; set; } = DateTime.UtcNow;
|
|
|
|
|
|
|
2026-05-22 17:01:49 +08:00
|
|
|
|
/// <summary>视频缩略图路径(相对于 wwwroot)。</summary>
|
|
|
|
|
|
[Column("thumbnail-id")]
|
|
|
|
|
|
public int? ThumbnailId { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>视频时长(秒)。</summary>
|
|
|
|
|
|
[Column("video-duration")]
|
|
|
|
|
|
public double? VideoDuration { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>最近一次播放时间 UTC。</summary>
|
|
|
|
|
|
[Column("last-played-at")]
|
|
|
|
|
|
public DateTime? LastPlayedAt { get; set; }
|
|
|
|
|
|
|
2026-05-21 16:45:56 +08:00
|
|
|
|
/// <summary>创建时间。</summary>
|
|
|
|
|
|
[Column("created-at")]
|
|
|
|
|
|
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>更新时间。</summary>
|
|
|
|
|
|
[Column("updated-at")]
|
|
|
|
|
|
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>所属根目录。</summary>
|
|
|
|
|
|
public ManagedLibraryRoot? LibraryRoot { get; set; }
|
2026-05-22 17:01:49 +08:00
|
|
|
|
|
2026-05-22 17:11:11 +08:00
|
|
|
|
/// <summary>缩略图映射记录。</summary>
|
2026-05-22 17:01:49 +08:00
|
|
|
|
public ManagedThumbnailMap? Thumbnail { get; set; }
|
2026-05-21 16:45:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|