- 新增 VideoThumbnailService,基于 ffmpeg 截取视频缩略图,ffprobe 提取时长
- 新增 ManagedThumbnailMap 模型及多数据库迁移,存储缩略图元数据
- 新增 /api/thumbnails/{id} 缩略图流端点
- 新增最近添加/最近播放 API 与前端面板,支持列表/网格双视图切换
- FileRecordDto 扩展 thumbnailUrl、videoDuration、lastPlayedAt 字段
- 前端新增文件库 Tab 导航、卡片网格视图、视频海报与时长信息栏
- 添加文件库目录不再同步全量扫描,改为后台异步自动扫描
445 lines
17 KiB
C#
445 lines
17 KiB
C#
// <auto-generated />
|
|
using System;
|
|
using FileShare_EFCore.Database;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
|
|
#nullable disable
|
|
|
|
namespace FileShare_EFCore.Migrations.MySQL
|
|
{
|
|
[DbContext(typeof(MySqlAppDataContext))]
|
|
[Migration("20260522084325_AddThumbnailMap")]
|
|
partial class AddThumbnailMap
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
{
|
|
#pragma warning disable 612, 618
|
|
modelBuilder
|
|
.HasAnnotation("ProductVersion", "10.0.7")
|
|
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
|
|
|
modelBuilder.Entity("FileShare_EFCore.Models.ApiRefreshTokenEntity", b =>
|
|
{
|
|
b.Property<long>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("bigint")
|
|
.HasColumnName("id");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)")
|
|
.HasColumnName("created-at");
|
|
|
|
b.Property<string>("Device")
|
|
.HasMaxLength(200)
|
|
.HasColumnType("varchar(200)")
|
|
.HasColumnName("device");
|
|
|
|
b.Property<DateTime>("ExpiresAt")
|
|
.HasColumnType("datetime(6)")
|
|
.HasColumnName("expires-at");
|
|
|
|
b.Property<string>("IpAddress")
|
|
.HasMaxLength(64)
|
|
.HasColumnType("varchar(64)")
|
|
.HasColumnName("ip-address");
|
|
|
|
b.Property<string>("ReplacedByTokenHash")
|
|
.HasMaxLength(128)
|
|
.HasColumnType("varchar(128)")
|
|
.HasColumnName("replaced-by-token-hash");
|
|
|
|
b.Property<DateTime?>("RevokedAt")
|
|
.HasColumnType("datetime(6)")
|
|
.HasColumnName("revoked-at");
|
|
|
|
b.Property<string>("TokenHash")
|
|
.IsRequired()
|
|
.HasMaxLength(128)
|
|
.HasColumnType("varchar(128)")
|
|
.HasColumnName("token-hash");
|
|
|
|
b.Property<int>("UserId")
|
|
.HasColumnType("int")
|
|
.HasColumnName("user-id");
|
|
|
|
b.HasKey("Id")
|
|
.HasName("pk-api-refresh-token");
|
|
|
|
b.HasIndex("TokenHash")
|
|
.IsUnique()
|
|
.HasDatabaseName("idx-api-refresh-token-hash");
|
|
|
|
b.HasIndex("UserId")
|
|
.HasDatabaseName("idx-api-refresh-token-user-id");
|
|
|
|
b.ToTable("api-refresh-token", t =>
|
|
{
|
|
t.HasComment("API refresh token");
|
|
});
|
|
});
|
|
|
|
modelBuilder.Entity("FileShare_EFCore.Models.ManagedFileRecord", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int")
|
|
.HasColumnName("id");
|
|
|
|
b.Property<string>("AbsolutePath")
|
|
.IsRequired()
|
|
.HasMaxLength(2048)
|
|
.HasColumnType("varchar(2048)")
|
|
.HasColumnName("absolute-path");
|
|
|
|
b.Property<string>("ContentType")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("varchar(100)")
|
|
.HasColumnName("content-type");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)")
|
|
.HasColumnName("created-at");
|
|
|
|
b.Property<bool>("Exists")
|
|
.HasColumnType("tinyint(1)")
|
|
.HasColumnName("exists");
|
|
|
|
b.Property<string>("Extension")
|
|
.IsRequired()
|
|
.HasMaxLength(32)
|
|
.HasColumnType("varchar(32)")
|
|
.HasColumnName("extension");
|
|
|
|
b.Property<string>("FileName")
|
|
.IsRequired()
|
|
.HasMaxLength(260)
|
|
.HasColumnType("varchar(260)")
|
|
.HasColumnName("file-name");
|
|
|
|
b.Property<DateTime?>("LastPlayedAt")
|
|
.HasColumnType("datetime(6)")
|
|
.HasColumnName("last-played-at");
|
|
|
|
b.Property<DateTime>("LastSeenAt")
|
|
.HasColumnType("datetime(6)")
|
|
.HasColumnName("last-seen-at");
|
|
|
|
b.Property<DateTime>("LastWriteTimeUtc")
|
|
.HasColumnType("datetime(6)")
|
|
.HasColumnName("last-write-time-utc");
|
|
|
|
b.Property<int>("LibraryRootId")
|
|
.HasColumnType("int")
|
|
.HasColumnName("library-root-id");
|
|
|
|
b.Property<string>("MediaType")
|
|
.IsRequired()
|
|
.HasMaxLength(20)
|
|
.HasColumnType("varchar(20)")
|
|
.HasColumnName("media-type");
|
|
|
|
b.Property<string>("RelativePath")
|
|
.IsRequired()
|
|
.HasMaxLength(1024)
|
|
.HasColumnType("varchar(1024)")
|
|
.HasColumnName("relative-path");
|
|
|
|
b.Property<long>("SizeBytes")
|
|
.HasColumnType("bigint")
|
|
.HasColumnName("size-bytes");
|
|
|
|
b.Property<int?>("ThumbnailId")
|
|
.HasColumnType("int")
|
|
.HasColumnName("thumbnail-id");
|
|
|
|
b.Property<DateTime>("UpdatedAt")
|
|
.HasColumnType("datetime(6)")
|
|
.HasColumnName("updated-at");
|
|
|
|
b.Property<double?>("VideoDuration")
|
|
.HasColumnType("double")
|
|
.HasColumnName("video-duration");
|
|
|
|
b.HasKey("Id")
|
|
.HasName("pk-managed-file-record");
|
|
|
|
b.HasIndex("AbsolutePath")
|
|
.IsUnique()
|
|
.HasDatabaseName("idx-managed-file-record-absolute-path");
|
|
|
|
b.HasIndex("LastPlayedAt")
|
|
.HasDatabaseName("idx-managed-file-record-last-played-at");
|
|
|
|
b.HasIndex("LibraryRootId")
|
|
.HasDatabaseName("idx-managed-file-record-root-id");
|
|
|
|
b.HasIndex("ThumbnailId")
|
|
.HasDatabaseName("idx-managed-file-record-thumbnail-id");
|
|
|
|
b.HasIndex("MediaType", "Exists")
|
|
.HasDatabaseName("idx-managed-file-record-media-type-exists");
|
|
|
|
b.ToTable("managed-file-record", t =>
|
|
{
|
|
t.HasComment("文件库文件记录");
|
|
});
|
|
});
|
|
|
|
modelBuilder.Entity("FileShare_EFCore.Models.ManagedLibraryRoot", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int")
|
|
.HasColumnName("id");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)")
|
|
.HasColumnName("created-at");
|
|
|
|
b.Property<string>("DisplayName")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("varchar(200)")
|
|
.HasColumnName("display-name");
|
|
|
|
b.Property<bool>("IsAvailable")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("tinyint(1)")
|
|
.HasDefaultValue(true)
|
|
.HasColumnName("is-available");
|
|
|
|
b.Property<bool>("IsEnabled")
|
|
.HasColumnType("tinyint(1)")
|
|
.HasColumnName("is-enabled");
|
|
|
|
b.Property<DateTime?>("LastScanCompletedAt")
|
|
.HasColumnType("datetime(6)")
|
|
.HasColumnName("last-scan-completed-at");
|
|
|
|
b.Property<string>("LastScanError")
|
|
.HasMaxLength(2000)
|
|
.HasColumnType("varchar(2000)")
|
|
.HasColumnName("last-scan-error");
|
|
|
|
b.Property<DateTime?>("LastScanStartedAt")
|
|
.HasColumnType("datetime(6)")
|
|
.HasColumnName("last-scan-started-at");
|
|
|
|
b.Property<string>("Path")
|
|
.IsRequired()
|
|
.HasMaxLength(1024)
|
|
.HasColumnType("varchar(1024)")
|
|
.HasColumnName("path");
|
|
|
|
b.Property<int>("ScanIntervalMinutes")
|
|
.HasColumnType("int")
|
|
.HasColumnName("scan-interval-minutes");
|
|
|
|
b.Property<DateTime>("UpdatedAt")
|
|
.HasColumnType("datetime(6)")
|
|
.HasColumnName("updated-at");
|
|
|
|
b.HasKey("Id")
|
|
.HasName("pk-managed-library-root");
|
|
|
|
b.HasIndex("Path")
|
|
.IsUnique()
|
|
.HasDatabaseName("idx-managed-library-root-path");
|
|
|
|
b.ToTable("managed-library-root", t =>
|
|
{
|
|
t.HasComment("文件库根目录");
|
|
});
|
|
});
|
|
|
|
modelBuilder.Entity("FileShare_EFCore.Models.ManagedThumbnailMap", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int")
|
|
.HasColumnName("id");
|
|
|
|
b.Property<string>("ContentType")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("varchar(100)")
|
|
.HasColumnName("content-type");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)")
|
|
.HasColumnName("created-at");
|
|
|
|
b.Property<int>("LibraryRootId")
|
|
.HasColumnType("int")
|
|
.HasColumnName("library-root-id");
|
|
|
|
b.Property<string>("RelativePath")
|
|
.IsRequired()
|
|
.HasMaxLength(1024)
|
|
.HasColumnType("varchar(1024)")
|
|
.HasColumnName("relative-path");
|
|
|
|
b.Property<DateTime>("UpdatedAt")
|
|
.HasColumnType("datetime(6)")
|
|
.HasColumnName("updated-at");
|
|
|
|
b.HasKey("Id")
|
|
.HasName("pk-managed-thumbnail-map");
|
|
|
|
b.HasIndex("LibraryRootId")
|
|
.HasDatabaseName("idx-managed-thumbnail-map-root-id");
|
|
|
|
b.HasIndex("RelativePath")
|
|
.IsUnique()
|
|
.HasDatabaseName("idx-managed-thumbnail-map-relative-path");
|
|
|
|
b.ToTable("managed-thumbnail-map", t =>
|
|
{
|
|
t.HasComment("文件缩略图映射记录");
|
|
});
|
|
});
|
|
|
|
modelBuilder.Entity("FileShare_EFCore.Models.UserEntity", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int")
|
|
.HasColumnName("id")
|
|
.HasComment("用户主键");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)")
|
|
.HasColumnName("created-at")
|
|
.HasComment("创建时间");
|
|
|
|
b.Property<string>("Email")
|
|
.HasMaxLength(200)
|
|
.HasColumnType("varchar(200)")
|
|
.HasColumnName("email")
|
|
.HasComment("用户邮箱");
|
|
|
|
b.Property<string>("Name")
|
|
.HasMaxLength(100)
|
|
.HasColumnType("varchar(100)")
|
|
.HasColumnName("name")
|
|
.HasComment("用户名称");
|
|
|
|
b.Property<string>("PasswordHash")
|
|
.HasMaxLength(200)
|
|
.HasColumnType("varchar(200)")
|
|
.HasColumnName("password-hash")
|
|
.HasComment("密码哈希值");
|
|
|
|
b.Property<string>("PhoneNumber")
|
|
.HasMaxLength(50)
|
|
.HasColumnType("varchar(50)")
|
|
.HasColumnName("phone-number")
|
|
.HasComment("电话号码");
|
|
|
|
b.Property<DateTime>("UpdatedAt")
|
|
.HasColumnType("datetime(6)")
|
|
.HasColumnName("updated-at")
|
|
.HasComment("更新时间");
|
|
|
|
b.HasKey("Id")
|
|
.HasName("pk-user");
|
|
|
|
b.ToTable("user", t =>
|
|
{
|
|
t.HasComment("用户实体,演示数据库 CRUD 操作");
|
|
});
|
|
});
|
|
|
|
modelBuilder.Entity("FileShare_EFCore.Models.WeatherForecastEntity", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int")
|
|
.HasColumnName("id")
|
|
.HasComment("天气预报主键");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)")
|
|
.HasColumnName("created-at")
|
|
.HasComment("创建时间");
|
|
|
|
b.Property<DateOnly>("Date")
|
|
.HasColumnType("date")
|
|
.HasColumnName("date")
|
|
.HasComment("预报日期");
|
|
|
|
b.Property<string>("Summary")
|
|
.HasMaxLength(200)
|
|
.HasColumnType("varchar(200)")
|
|
.HasColumnName("summary")
|
|
.HasComment("天气摘要");
|
|
|
|
b.Property<int>("TemperatureC")
|
|
.HasColumnType("int")
|
|
.HasColumnName("temperature-c")
|
|
.HasComment("摄氏温度");
|
|
|
|
b.Property<DateTime>("UpdatedAt")
|
|
.HasColumnType("datetime(6)")
|
|
.HasColumnName("updated-at")
|
|
.HasComment("更新时间");
|
|
|
|
b.HasKey("Id")
|
|
.HasName("pk-weather-forecast");
|
|
|
|
b.ToTable("weather-forecast", t =>
|
|
{
|
|
t.HasComment("天气预报数据实体");
|
|
});
|
|
});
|
|
|
|
modelBuilder.Entity("FileShare_EFCore.Models.ManagedFileRecord", b =>
|
|
{
|
|
b.HasOne("FileShare_EFCore.Models.ManagedLibraryRoot", "LibraryRoot")
|
|
.WithMany("Files")
|
|
.HasForeignKey("LibraryRootId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.HasOne("FileShare_EFCore.Models.ManagedThumbnailMap", "Thumbnail")
|
|
.WithMany("Files")
|
|
.HasForeignKey("ThumbnailId")
|
|
.OnDelete(DeleteBehavior.SetNull);
|
|
|
|
b.Navigation("LibraryRoot");
|
|
|
|
b.Navigation("Thumbnail");
|
|
});
|
|
|
|
modelBuilder.Entity("FileShare_EFCore.Models.ManagedThumbnailMap", b =>
|
|
{
|
|
b.HasOne("FileShare_EFCore.Models.ManagedLibraryRoot", "LibraryRoot")
|
|
.WithMany("Thumbnails")
|
|
.HasForeignKey("LibraryRootId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("LibraryRoot");
|
|
});
|
|
|
|
modelBuilder.Entity("FileShare_EFCore.Models.ManagedLibraryRoot", b =>
|
|
{
|
|
b.Navigation("Files");
|
|
|
|
b.Navigation("Thumbnails");
|
|
});
|
|
|
|
modelBuilder.Entity("FileShare_EFCore.Models.ManagedThumbnailMap", b =>
|
|
{
|
|
b.Navigation("Files");
|
|
});
|
|
#pragma warning restore 612, 618
|
|
}
|
|
}
|
|
}
|