feat: 新增永久删除文件接口和前端删除按钮
后端新增 POST api/files/delete 接口,同时删除物理文件、缩略图和数据库记录。 前端在 FileCard 和 FileListItem 中增加 hover 可见的删除按钮,点击后弹出确认提示。
This commit is contained in:
@@ -113,6 +113,14 @@ namespace FileShare_Services.Services.FileLibrary
|
||||
return ResponseHelper.Succeed();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IApiResponse> DeleteFileAsync(DeleteFileRequest request)
|
||||
{
|
||||
ValidateFileId(request.Id);
|
||||
await fileLibrary.DeleteFileAsync(request.Id);
|
||||
return ResponseHelper.Succeed("文件已永久删除。");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证文件 ID 是否有效,无效时抛出 <see cref="ArgumentException"/>。
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user