luoqian d84bbb3a18 feat: 二维码访问功能,统一端点管道增强,端点迁移至 Services 层
- 新增二维码生成端点,自动检测局域网 IP,前端扫一扫即可打开网站
  - 提取 IApiResponse 接口,ServiceRequestBinder 支持强类型请求 DTO 绑定
  - FileStream 端点迁移至 AppEndpoints 统一注册,管道支持 FileStreamResponse 原始文件返回
  - 文件库端点全面使用 MapGet<TService, TRequest> 泛型注册
  - 移除 Avalonia-API/Extensions 中的业务端点文件,统一由 Services 层管理
2026-05-22 11:18:47 +08:00

78 lines
2.4 KiB
C#

using System.Text.Json.Serialization;
namespace Avalonia_Services.Services.FileLibrary
{
public sealed record AddLibraryRootRequest(
[property: JsonPropertyName("path")] string? Path,
[property: JsonPropertyName("displayName")] string? DisplayName = null,
[property: JsonPropertyName("scanIntervalMinutes")] int? ScanIntervalMinutes = null);
public sealed record UpdateLibraryRootRequest(
[property: JsonPropertyName("id")] int Id,
[property: JsonPropertyName("isEnabled")] bool IsEnabled);
public sealed record ScanLibraryRootRequest(
[property: JsonPropertyName("id")] int Id);
public sealed record DeleteLibraryRootRequest(
[property: JsonPropertyName("id")] int Id);
public sealed record DirectoryQueryRequest(
[property: JsonPropertyName("path")] string? Path);
public sealed record FileQueryRequest(
[property: JsonPropertyName("id")] int Id);
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,
[property: JsonPropertyName("rootId")] int RootId = 0);
public sealed record DriveDto(
string Name,
string DisplayName,
string RootDirectory,
string DriveType,
long? TotalSize,
long? AvailableFreeSpace,
bool IsReady);
public sealed record DirectoryDto(
string Name,
string FullPath);
public sealed record LibraryRootDto(
int Id,
string Path,
string DisplayName,
bool IsEnabled,
bool IsAvailable,
int ScanIntervalMinutes,
DateTime? LastScanStartedAt,
DateTime? LastScanCompletedAt,
string? LastScanError,
int FileCount);
public sealed record FileRecordDto(
int Id,
int LibraryRootId,
string FileName,
string RelativePath,
string Extension,
long SizeBytes,
DateTime LastWriteTimeUtc,
string MediaType,
string ContentType,
string StreamUrl,
string? TextUrl,
bool BrowserPlayable);
public sealed record TextPreviewDto(
int Id,
string FileName,
string Content,
bool Truncated);
}