Add user status api endpoint

This commit is contained in:
jvyden 2022-02-16 20:24:57 -05:00
parent 8fdd464e2e
commit 2b521be45c
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
6 changed files with 83 additions and 22 deletions

View file

@ -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);
}
}