docs: 补全 C# XML 文档注释,覆盖所有公开与内部成员
为 14 个项目中缺少 XML 注释的类、接口、方法、属性、字段、record、 枚举等成员补全中文文档注释。接口方法在接口层定义完整注释,实现类 使用 <inheritdoc /> 引用。私有辅助方法结合业务语义编写注释。 扫描结果:missing-csharp-docs.txt 缺失项归零。 构建结果:0 警告,0 错误。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -3,49 +3,61 @@ using FileShare_Services.Core;
|
||||
|
||||
namespace FileShare_Services.Services.FileLibrary
|
||||
{
|
||||
/// <summary>
|
||||
/// 文件库 HTTP 端点服务,将请求适配到 <see cref="IFileLibraryService"/> 并包装为 <see cref="IApiResponse"/>。
|
||||
/// </summary>
|
||||
public sealed class FileLibraryEndpointService(IFileLibraryService fileLibrary) : IFileLibraryEndpointService
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public async Task<IApiResponse> GetDrivesAsync(ServiceEndpointContext ctx)
|
||||
{
|
||||
return ResponseHelper.Ok(await fileLibrary.GetDrivesAsync());
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IApiResponse> GetDirectoriesAsync(DirectoryQueryRequest request)
|
||||
{
|
||||
return ResponseHelper.Ok(await fileLibrary.GetDirectoriesAsync(request.Path));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IApiResponse> GetRootsAsync(ServiceEndpointContext ctx)
|
||||
{
|
||||
return ResponseHelper.Ok(await fileLibrary.GetRootsAsync());
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IApiResponse> AddRootAsync(AddLibraryRootRequest request)
|
||||
{
|
||||
return ResponseHelper.Ok(await fileLibrary.AddRootAsync(request), "文件库目录已添加并完成扫描。");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IApiResponse> SetRootEnabledAsync(UpdateLibraryRootRequest request)
|
||||
{
|
||||
return ResponseHelper.Ok(await fileLibrary.SetRootEnabledAsync(request), "文件库目录状态已更新。");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IApiResponse> DeleteRootAsync(DeleteLibraryRootRequest request)
|
||||
{
|
||||
await fileLibrary.DeleteRootAsync(request);
|
||||
return ResponseHelper.Succeed("文件库目录已删除。");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IApiResponse> ScanRootAsync(ScanLibraryRootRequest request)
|
||||
{
|
||||
return ResponseHelper.Ok(await fileLibrary.ScanRootAsync(request.Id), "文件库目录扫描完成。");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IApiResponse> SearchFilesAsync(SearchFilesRequest request)
|
||||
{
|
||||
return await fileLibrary.SearchFilesAsync(request);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IApiResponse> GetFileAsync(FileQueryRequest request)
|
||||
{
|
||||
ValidateFileId(request.Id);
|
||||
@@ -55,6 +67,7 @@ namespace FileShare_Services.Services.FileLibrary
|
||||
: ResponseHelper.Ok(file);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IApiResponse> GetTextPreviewAsync(FileQueryRequest request)
|
||||
{
|
||||
ValidateFileId(request.Id);
|
||||
@@ -64,6 +77,7 @@ namespace FileShare_Services.Services.FileLibrary
|
||||
: ResponseHelper.Ok(preview);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IApiResponse> BrowseDirectoryAsync(BrowseDirectoryRequest request)
|
||||
{
|
||||
if (request.RootId <= 0)
|
||||
@@ -73,6 +87,11 @@ namespace FileShare_Services.Services.FileLibrary
|
||||
return ResponseHelper.Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证文件 ID 是否有效,无效时抛出 <see cref="ArgumentException"/>。
|
||||
/// </summary>
|
||||
/// <param name="id">文件记录 ID。</param>
|
||||
/// <exception cref="ArgumentException">ID 小于等于 0 时抛出。</exception>
|
||||
private static void ValidateFileId(int id)
|
||||
{
|
||||
if (id > 0)
|
||||
|
||||
Reference in New Issue
Block a user