mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-24 18:02:27 +00:00
Add user status api endpoint
This commit is contained in:
parent
8fdd464e2e
commit
2b521be45c
6 changed files with 83 additions and 22 deletions
|
@ -1,10 +1,13 @@
|
|||
#nullable enable
|
||||
using System.Threading.Tasks;
|
||||
using LBPUnion.ProjectLighthouse.Types;
|
||||
using LBPUnion.ProjectLighthouse.Types.Profiles;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
// ReSharper disable RouteTemplates.ActionRoutePrefixCanBeExtractedToControllerRoute
|
||||
|
||||
namespace LBPUnion.ProjectLighthouse.Controllers.Api;
|
||||
|
||||
/// <summary>
|
||||
|
@ -36,4 +39,21 @@ public class UserEndpoints : ApiEndpointController
|
|||
|
||||
return this.Ok(user);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a user and their information from the database.
|
||||
/// </summary>
|
||||
/// <param name="id">The ID of the user</param>
|
||||
/// <returns>The user's status</returns>
|
||||
/// <response code="200">The user's status, if successful.</response>
|
||||
/// <response code="404">The user could not be found.</response>
|
||||
[HttpGet("user/{id:int}/status")]
|
||||
[ProducesResponseType(typeof(UserStatus), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public async Task<IActionResult> GetUserStatus(int id)
|
||||
{
|
||||
UserStatus userStatus = new(this.database, id);
|
||||
|
||||
return this.Ok(userStatus);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue