Skip to content

Commit

Permalink
🔨设置评论接口分组
Browse files Browse the repository at this point in the history
  • Loading branch information
Deali-Axy committed Jul 17, 2023
1 parent bccfe73 commit 45ce5af
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions StarBlog.Web/Apis/AuthController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public AuthController(AuthService authService) {
/// <param name="loginUser"></param>
/// <returns></returns>
[HttpPost]
[Route("")]
[Route("[action]")]
[ProducesResponseType(typeof(ApiResponse<LoginToken>), StatusCodes.Status200OK)]
public async Task<ApiResponse> Login(LoginUser loginUser) {
var user = await _authService.GetUserByName(loginUser.Username);
Expand All @@ -42,6 +44,8 @@ public async Task<ApiResponse> Login(LoginUser loginUser) {
/// <returns></returns>
[Authorize]
[HttpGet]
[Route("")]
[Route("[action]")]
public ApiResponse<User> GetUser() {
var user = _authService.GetUser(User);
if (user == null) return ApiResponse.NotFound("找不到用户资料");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
using StarBlog.Web.ViewModels.Comments;
using StarBlog.Web.ViewModels.QueryFilters;

namespace StarBlog.Web.Apis.Blog;
namespace StarBlog.Web.Apis.Comments;

[Route("Api/[controller]")]
[ApiController]
[Route("Api/[controller]")]
[ApiExplorerSettings(GroupName = ApiGroups.Comment)]
public class CommentController : ControllerBase {
private readonly CommentService _commentService;
private readonly TempFilterService _filter;
Expand Down
2 changes: 2 additions & 0 deletions StarBlog.Web/Extensions/ConfigureSwagger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public static class ApiGroups {
public const string Admin = "admin";
public const string Auth = "auth";
public const string Blog = "blog";
public const string Comment = "comment";
public const string Common = "common";
public const string Link = "link";
public const string Test = "test";
Expand All @@ -19,6 +20,7 @@ public static class ConfigureSwagger {
new SwaggerGroup(ApiGroups.Admin, "Admin APIs", "管理员相关接口"),
new SwaggerGroup(ApiGroups.Auth, "Auth APIs", "授权接口"),
new SwaggerGroup(ApiGroups.Blog, "Blog APIs", "博客管理接口"),
new SwaggerGroup(ApiGroups.Comment, "Comment APIs", "评论接口"),
new SwaggerGroup(ApiGroups.Common, "Common APIs", "通用公共接口"),
new SwaggerGroup(ApiGroups.Link, "Link APIs", "友情链接接口"),
new SwaggerGroup(ApiGroups.Test, "Test APIs", "测试接口")
Expand Down

0 comments on commit 45ce5af

Please sign in to comment.