chat: add initial GuildsController

This commit is contained in:
sam 2024-05-21 20:14:52 +02:00
parent 7b4cbd4fb7
commit 727f2f6ba2
23 changed files with 248 additions and 38 deletions

View file

@ -9,12 +9,12 @@ using Microsoft.AspNetCore.Mvc;
namespace Foxchat.Identity.Controllers.Oauth;
[ApiController]
[Authenticate]
[ClientAuthenticate]
[Route("/_fox/ident/oauth/apps")]
public class AppsController(ILogger logger, IdentityContext db) : ControllerBase
{
[HttpPost]
public async Task<IActionResult> CreateApplication([FromBody] Apps.CreateRequest req)
public async Task<IActionResult> CreateApplication([FromBody] AppsApi.CreateRequest req)
{
var app = Application.Create(req.Name, req.Scopes, req.RedirectUris);
db.Add(app);
@ -22,7 +22,7 @@ public class AppsController(ILogger logger, IdentityContext db) : ControllerBase
logger.Information("Created new application {Name} with ID {Id} and client ID {ClientId}", app.Name, app.Id, app.ClientId);
return Ok(new Apps.CreateResponse(
return Ok(new AppsApi.CreateResponse(
app.Id, app.ClientId, app.ClientSecret, app.Name, app.Scopes, app.RedirectUris
));
}
@ -32,7 +32,7 @@ public class AppsController(ILogger logger, IdentityContext db) : ControllerBase
{
var app = HttpContext.GetApplicationOrThrow();
return Ok(new Apps.GetSelfResponse(
return Ok(new AppsApi.GetSelfResponse(
app.Id,
app.ClientId,
withSecret ? app.ClientSecret : null,

View file

@ -11,7 +11,7 @@ using Microsoft.EntityFrameworkCore;
namespace Foxchat.Identity.Controllers.Oauth;
[ApiController]
[Authenticate]
[ClientAuthenticate]
[Route("/_fox/ident/oauth/password")]
public class PasswordAuthController(ILogger logger, IdentityContext db, IClock clock) : ControllerBase
{