Identity
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
using Nashel.Modules.Identity.Application.Commands;
|
||||
|
||||
namespace Nashel.Modules.Identity.Presentation.Endpoints;
|
||||
|
||||
public static class IdentityEndpoints
|
||||
{
|
||||
public static void MapIdentityEndpoints(this IEndpointRouteBuilder app)
|
||||
{
|
||||
var authGroup = app.MapGroup("/api/auth").WithTags("Auth");
|
||||
|
||||
authGroup.MapPost("/register", async (RegisterUserCommand command, ISender sender) =>
|
||||
{
|
||||
var result = await sender.Send(command);
|
||||
return Results.Ok(result);
|
||||
});
|
||||
|
||||
authGroup.MapPost("/login", async (LoginCommand command, ISender sender) =>
|
||||
{
|
||||
var token = await sender.Send(command);
|
||||
return Results.Ok(new { Token = token });
|
||||
});
|
||||
|
||||
var profileGroup = app.MapGroup("/api/profile").WithTags("Profile").RequireAuthorization();
|
||||
|
||||
profileGroup.MapPost("/become-performer", async (ISender sender) =>
|
||||
{
|
||||
await sender.Send(new BecomePerformerCommand());
|
||||
return Results.Ok();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Nashel.Modules.Identity.Application\Nashel.Modules.Identity.Application.csproj" />
|
||||
<ProjectReference Include="..\Application\Nashel.Modules.Identity.Application.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<RootNamespace>Nashel.Modules.Identity.Presentation</RootNamespace>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
<ItemGroup>
|
||||
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user