Add swagger support

This commit is contained in:
jvyden 2022-02-01 00:18:14 -05:00
parent 219e02d6cb
commit 097b2b9445
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
13 changed files with 83 additions and 54 deletions

View file

@ -0,0 +1,26 @@
#nullable enable
using System.Threading.Tasks;
using LBPUnion.ProjectLighthouse.Types;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace LBPUnion.ProjectLighthouse.Controllers.Api;
public class UserEndpoints : ApiEndpointController
{
private readonly Database database;
public UserEndpoints(Database database)
{
this.database = database;
}
[HttpGet("user/{id:int}")]
public async Task<IActionResult> GetUser(int id)
{
User? user = await this.database.Users.FirstOrDefaultAsync(u => u.UserId == id);
if (user == null) return this.NotFound();
return this.Ok(user);
}
}