mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-24 18:02:27 +00:00
Add swagger support
This commit is contained in:
parent
219e02d6cb
commit
097b2b9445
13 changed files with 83 additions and 54 deletions
26
ProjectLighthouse/Controllers/Api/UserEndpoints.cs
Normal file
26
ProjectLighthouse/Controllers/Api/UserEndpoints.cs
Normal 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);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue