add UserRendererService and improve errors
This commit is contained in:
parent
6114f384a0
commit
f674d059fd
14 changed files with 607 additions and 25 deletions
|
@ -1,18 +1,19 @@
|
|||
using System.Diagnostics;
|
||||
using Foxnouns.Backend.Database;
|
||||
using Foxnouns.Backend.Middleware;
|
||||
using Foxnouns.Backend.Services;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Foxnouns.Backend.Controllers;
|
||||
|
||||
[Route("/api/v2/users")]
|
||||
public class UsersController(DatabaseContext db) : ApiControllerBase
|
||||
public class UsersController(DatabaseContext db, UserRendererService userRendererService) : ApiControllerBase
|
||||
{
|
||||
[HttpGet("{userRef}")]
|
||||
public async Task<IActionResult> GetUser(string userRef)
|
||||
{
|
||||
var user = await db.ResolveUserAsync(userRef);
|
||||
return Ok(user);
|
||||
return Ok(await userRendererService.RenderUserAsync(user));
|
||||
}
|
||||
|
||||
[HttpGet("@me")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue