[FA-10] Adds user service and authentication service
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using FictionArchive.Service.AuthenticationService.Models.Requests;
|
||||
using FictionArchive.Service.AuthenticationService.Models.IntegrationEvents;
|
||||
using FictionArchive.Service.Shared.Services.EventBus;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace FictionArchive.Service.AuthenticationService.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class AuthenticationWebhookController : ControllerBase
|
||||
{
|
||||
private readonly IEventBus _eventBus;
|
||||
|
||||
public AuthenticationWebhookController(IEventBus eventBus)
|
||||
{
|
||||
_eventBus = eventBus;
|
||||
}
|
||||
|
||||
[HttpPost(nameof(UserRegistered))]
|
||||
public async Task<ActionResult> UserRegistered([FromBody] UserRegisteredWebhookPayload payload)
|
||||
{
|
||||
var authUserAddedEvent = new AuthUserAddedEvent
|
||||
{
|
||||
OAuthProviderId = payload.OAuthProviderId,
|
||||
InviterOAuthProviderId = payload.InviterOAuthProviderId,
|
||||
EventUserEmail = payload.EventUserEmail,
|
||||
EventUserUsername = payload.EventUserUsername
|
||||
};
|
||||
|
||||
await _eventBus.Publish(authUserAddedEvent);
|
||||
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user