- 前端 Header 新增搜索栏,接入已有 SearchFiles API,结果支持列表/网格视图 - 新增 PlaybackPosition 数据库列与 /api/files/progress 端点,播放进度存服务端 - 播放中每 5 秒自动保存进度,再次打开视频时弹出"继续播放"提示 - 目录浏览新增媒体类型过滤条(全部/视频/音频/文本),前端即时过滤 - 新增 4 种数据库迁移(AddPlaybackPosition)
101 lines
3.4 KiB
C#
101 lines
3.4 KiB
C#
using Microsoft.EntityFrameworkCore;
|
||
using System.ComponentModel.DataAnnotations;
|
||
using System.ComponentModel.DataAnnotations.Schema;
|
||
|
||
namespace FileShare_EFCore.Models
|
||
{
|
||
/// <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;
|
||
|
||
/// <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; }
|
||
|
||
/// <summary>视频播放位置(秒)。</summary>
|
||
[Column("playback-position")]
|
||
public double? PlaybackPosition { get; set; }
|
||
|
||
/// <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; }
|
||
|
||
/// <summary>缩略图映射记录。</summary>
|
||
public ManagedThumbnailMap? Thumbnail { get; set; }
|
||
}
|
||
}
|