using StopShopping.Services; using StopShopping.Services.Models.Req; using StopShopping.Services.Models.Resp; namespace StopShopping.AdminApi.Routes; public static class Category { public static RouteGroupBuilder MapCategory(this RouteGroupBuilder routes) { routes.MapGet("/category/list", GetTree) .WithTags(OpenApiTags.分类.ToString()); routes.MapPost("/category/edit", EditCategoryAsync) .WithTags(OpenApiTags.分类.ToString()); routes.MapPost("/category/resort", ResortCategoryAsync) .WithTags(OpenApiTags.分类.ToString()); routes.MapPost("/category/delete", DeleteCategoryAsync) .WithTags(OpenApiTags.分类.ToString()); return routes; } private static ApiResponse> GetTree( ICategoryService categoryService ) { return categoryService.GetCategoriesTree(); } private static async Task> EditCategoryAsync( EditCategoryParams model, ICategoryService categoryService) { return await categoryService.EditCategoryAsync(model); } private static async Task ResortCategoryAsync( ResortCategoryParams model, ICategoryService categoryService) { return await categoryService.ResortCategoryAsync(model); } private static async Task DeleteCategoryAsync( CategoryIdParams model, ICategoryService categoryService ) { return await categoryService.DeleteCategoryAsync(model); } }