Skip to content

Override RegisterAsync In AccountController #24568

@walrusix

Description

@walrusix

I'm working on a solution using ABP. When I run the application, Swagger correctly displays all the endpoints. I want to customize the Register action in AccountController, but I found that overriding it directly causes issues in Swagger.

Is there a recommended way in ABP to modify the behavior of the Register endpoint without breaking Swagger? Any guidance would be greatly appreciated.

using Microsoft.AspNetCore.Mvc;
using System;
using System.Threading.Tasks;
using Volo.Abp.Account;
using Volo.Abp.Account.Web.Areas.Account.Controllers;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Identity;

[Route("api/account")]
public class CustomAccountController : Volo.Abp.Account.AccountController
{
    public CustomAccountController(IAccountAppService accountAppService) : base(accountAppService)
    {
    }

    [HttpPost("register")]
    public Task<IdentityUserDto> RegisterAsync([FromBody] RegisterDto model)
    {
        return Task.FromResult(new IdentityUserDto
        {
            Id = Guid.NewGuid(),
            UserName = model.UserName
        });
    }
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions