2026-05-21 16:45:56 +08:00
|
|
|
using System.Text.Json.Serialization;
|
|
|
|
|
|
2026-05-22 14:29:22 +08:00
|
|
|
namespace FileShare_Services.Services.FileLibrary
|
2026-05-21 16:45:56 +08:00
|
|
|
{
|
2026-05-22 14:45:07 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// 添加文件库根目录的请求。
|
|
|
|
|
/// </summary>
|
2026-05-21 16:45:56 +08:00
|
|
|
public sealed record AddLibraryRootRequest(
|
2026-05-22 14:45:07 +08:00
|
|
|
[property: JsonPropertyName("path")]
|
|
|
|
|
string? Path,
|
|
|
|
|
|
|
|
|
|
[property: JsonPropertyName("displayName")]
|
|
|
|
|
string? DisplayName = null,
|
|
|
|
|
|
|
|
|
|
[property: JsonPropertyName("scanIntervalMinutes")]
|
|
|
|
|
int? ScanIntervalMinutes = null);
|
2026-05-21 16:45:56 +08:00
|
|
|
|
2026-05-22 14:45:07 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// 更新文件库根目录启用状态的请求。
|
|
|
|
|
/// </summary>
|
2026-05-21 16:45:56 +08:00
|
|
|
public sealed record UpdateLibraryRootRequest(
|
|
|
|
|
[property: JsonPropertyName("id")] int Id,
|
|
|
|
|
[property: JsonPropertyName("isEnabled")] bool IsEnabled);
|
|
|
|
|
|
2026-05-22 14:45:07 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// 触发文件库根目录立即扫描的请求。
|
|
|
|
|
/// </summary>
|
2026-05-21 16:45:56 +08:00
|
|
|
public sealed record ScanLibraryRootRequest(
|
|
|
|
|
[property: JsonPropertyName("id")] int Id);
|
|
|
|
|
|
2026-05-22 14:45:07 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// 删除文件库根目录的请求。
|
|
|
|
|
/// </summary>
|
2026-05-21 16:45:56 +08:00
|
|
|
public sealed record DeleteLibraryRootRequest(
|
|
|
|
|
[property: JsonPropertyName("id")] int Id);
|
|
|
|
|
|
2026-05-22 14:45:07 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// 查询服务器子目录的请求。
|
|
|
|
|
/// </summary>
|
2026-05-22 11:18:47 +08:00
|
|
|
public sealed record DirectoryQueryRequest(
|
|
|
|
|
[property: JsonPropertyName("path")] string? Path);
|
|
|
|
|
|
2026-05-22 14:45:07 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// 根据 ID 查询文件的请求。
|
|
|
|
|
/// </summary>
|
2026-05-22 11:18:47 +08:00
|
|
|
public sealed record FileQueryRequest(
|
|
|
|
|
[property: JsonPropertyName("id")] int Id);
|
|
|
|
|
|
2026-05-22 17:01:49 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// 获取最近文件的请求。
|
|
|
|
|
/// </summary>
|
|
|
|
|
public sealed record RecentFilesRequest(
|
|
|
|
|
[property: JsonPropertyName("type")] string Type = "added",
|
|
|
|
|
[property: JsonPropertyName("count")] int Count = 12);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 标记文件已播放的请求。
|
|
|
|
|
/// </summary>
|
|
|
|
|
public sealed record MarkFilePlayedRequest(
|
|
|
|
|
[property: JsonPropertyName("id")] int Id);
|
|
|
|
|
|
2026-05-22 17:44:04 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// 保存文件播放进度的请求。
|
|
|
|
|
/// </summary>
|
|
|
|
|
public sealed record SaveFileProgressRequest(
|
|
|
|
|
[property: JsonPropertyName("id")] int Id,
|
2026-05-23 11:03:51 +08:00
|
|
|
[property: JsonPropertyName("position")] double? Position);
|
2026-05-22 17:44:04 +08:00
|
|
|
|
2026-05-22 14:45:07 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// 分页搜索已扫描文件的请求。
|
|
|
|
|
/// </summary>
|
2026-05-22 11:18:47 +08:00
|
|
|
public sealed record SearchFilesRequest(
|
|
|
|
|
[property: JsonPropertyName("page")] int Page = 1,
|
|
|
|
|
[property: JsonPropertyName("pageSize")] int PageSize = 24,
|
|
|
|
|
[property: JsonPropertyName("mediaType")] string? MediaType = null,
|
|
|
|
|
[property: JsonPropertyName("keyword")] string? Keyword = null,
|
2026-05-23 11:03:51 +08:00
|
|
|
[property: JsonPropertyName("rootId")] int RootId = 0,
|
|
|
|
|
[property: JsonPropertyName("sortBy")] string? SortBy = null,
|
|
|
|
|
[property: JsonPropertyName("sortDirection")] string? SortDirection = null);
|
2026-05-22 11:18:47 +08:00
|
|
|
|
2026-05-22 14:45:07 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// 磁盘驱动器信息。
|
|
|
|
|
/// </summary>
|
2026-05-21 16:45:56 +08:00
|
|
|
public sealed record DriveDto(
|
|
|
|
|
string Name,
|
|
|
|
|
string DisplayName,
|
|
|
|
|
string RootDirectory,
|
|
|
|
|
string DriveType,
|
|
|
|
|
long? TotalSize,
|
|
|
|
|
long? AvailableFreeSpace,
|
|
|
|
|
bool IsReady);
|
|
|
|
|
|
2026-05-22 14:45:07 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// 服务器子目录信息。
|
|
|
|
|
/// </summary>
|
2026-05-21 16:45:56 +08:00
|
|
|
public sealed record DirectoryDto(
|
|
|
|
|
string Name,
|
|
|
|
|
string FullPath);
|
|
|
|
|
|
2026-05-22 14:45:07 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// 文件库根目录信息,包含扫描状态与文件数量。
|
|
|
|
|
/// </summary>
|
2026-05-21 16:45:56 +08:00
|
|
|
public sealed record LibraryRootDto(
|
|
|
|
|
int Id,
|
|
|
|
|
string Path,
|
|
|
|
|
string DisplayName,
|
|
|
|
|
bool IsEnabled,
|
|
|
|
|
bool IsAvailable,
|
|
|
|
|
int ScanIntervalMinutes,
|
|
|
|
|
DateTime? LastScanStartedAt,
|
|
|
|
|
DateTime? LastScanCompletedAt,
|
|
|
|
|
string? LastScanError,
|
|
|
|
|
int FileCount);
|
|
|
|
|
|
2026-05-22 14:45:07 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// 已扫描文件的记录信息,包含媒体类型与流式访问 URL。
|
|
|
|
|
/// </summary>
|
2026-05-21 16:45:56 +08:00
|
|
|
public sealed record FileRecordDto(
|
|
|
|
|
int Id,
|
|
|
|
|
int LibraryRootId,
|
|
|
|
|
string FileName,
|
|
|
|
|
string RelativePath,
|
|
|
|
|
string Extension,
|
|
|
|
|
long SizeBytes,
|
|
|
|
|
DateTime LastWriteTimeUtc,
|
2026-05-23 11:03:51 +08:00
|
|
|
DateTime? FileCreationTimeUtc,
|
2026-05-21 16:45:56 +08:00
|
|
|
string MediaType,
|
|
|
|
|
string ContentType,
|
|
|
|
|
string StreamUrl,
|
|
|
|
|
string? TextUrl,
|
2026-05-22 17:01:49 +08:00
|
|
|
bool BrowserPlayable,
|
|
|
|
|
string? ThumbnailUrl = null,
|
|
|
|
|
double? VideoDuration = null,
|
2026-05-22 17:44:04 +08:00
|
|
|
DateTime? LastPlayedAt = null,
|
|
|
|
|
double? PlaybackPosition = null);
|
2026-05-21 16:45:56 +08:00
|
|
|
|
2026-05-22 14:45:07 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// 浏览文件库目录结构的请求。
|
|
|
|
|
/// </summary>
|
2026-05-22 11:59:45 +08:00
|
|
|
public sealed record BrowseDirectoryRequest(
|
|
|
|
|
[property: JsonPropertyName("rootId")] int RootId = 0,
|
2026-05-23 11:03:51 +08:00
|
|
|
[property: JsonPropertyName("path")] string? Path = null,
|
|
|
|
|
[property: JsonPropertyName("page")] int Page = 1,
|
|
|
|
|
[property: JsonPropertyName("pageSize")] int PageSize = 48,
|
|
|
|
|
[property: JsonPropertyName("mediaType")] string? MediaType = null,
|
|
|
|
|
[property: JsonPropertyName("sortBy")] string? SortBy = "name",
|
|
|
|
|
[property: JsonPropertyName("sortDirection")] string? SortDirection = "asc");
|
2026-05-22 11:59:45 +08:00
|
|
|
|
2026-05-22 14:45:07 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// 浏览文件库目录的响应,包含当前路径、子目录列表和文件列表。
|
|
|
|
|
/// </summary>
|
2026-05-22 11:59:45 +08:00
|
|
|
public sealed record BrowseDirectoryResponse(
|
|
|
|
|
string CurrentPath,
|
|
|
|
|
List<string> Subdirectories,
|
2026-05-23 11:03:51 +08:00
|
|
|
List<FileRecordDto> Files,
|
|
|
|
|
int Total,
|
|
|
|
|
int Page,
|
|
|
|
|
int PageSize,
|
|
|
|
|
int TotalPages);
|
2026-05-22 11:59:45 +08:00
|
|
|
|
2026-05-22 14:45:07 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// 文本文件预览内容,支持截断标记。
|
|
|
|
|
/// </summary>
|
2026-05-21 16:45:56 +08:00
|
|
|
public sealed record TextPreviewDto(
|
|
|
|
|
int Id,
|
|
|
|
|
string FileName,
|
|
|
|
|
string Content,
|
|
|
|
|
bool Truncated);
|
|
|
|
|
}
|