This commit is contained in:
2026-03-30 11:07:30 +08:00
parent 2c44b3a4b2
commit d4a8e71733
74 changed files with 1751 additions and 421 deletions

View File

@@ -0,0 +1,31 @@
using Microsoft.AspNetCore.Mvc;
using StopShopping.FileApi.Extensions;
using StopShopping.FileApi.Services;
namespace StopShopping.FileApi;
public static class Routes
{
public static void MapRoutes(WebApplication app)
{
app.MapGroup("")
.MapRoutes()
.WithInternalOnly();
}
public static RouteGroupBuilder MapRoutes(this RouteGroupBuilder routes)
{
routes.MapPost("/upload", UploadAsync)
.DisableAntiforgery()
.WithDescription("上传文件对外接口自己实现anti-forgery重要");
return routes;
}
private static async Task<ApiResponse<FileUploadResp>> UploadAsync(
[FromForm] UploadParams payload,
IFileService fileService)
{
return await fileService.UploadFileAsync(payload);
}
}