mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-10-04 15:19:43 +00:00
Initial implementation of recent activity
DB migrations intentionally left out since they aren't finalized
This commit is contained in:
parent
605f9e68c5
commit
23cb1bef1c
86 changed files with 1542 additions and 93 deletions
|
@ -9,7 +9,7 @@ using LBPUnion.ProjectLighthouse.Types.Entities.Token;
|
|||
using LBPUnion.ProjectLighthouse.Types.Filter;
|
||||
using LBPUnion.ProjectLighthouse.Types.Levels;
|
||||
using LBPUnion.ProjectLighthouse.Types.Logging;
|
||||
using LBPUnion.ProjectLighthouse.Types.Serialization;
|
||||
using LBPUnion.ProjectLighthouse.Types.Serialization.Comment;
|
||||
using LBPUnion.ProjectLighthouse.Types.Users;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
@ -44,6 +44,20 @@ public class CommentController : ControllerBase
|
|||
return this.Ok();
|
||||
}
|
||||
|
||||
[HttpGet("userComment/{username}")]
|
||||
[HttpGet("comment/{slotType}/{slotId:int}")]
|
||||
public async Task<IActionResult> GetSingleComment(string? username, string? slotType, int? slotId, int commentId)
|
||||
{
|
||||
GameTokenEntity token = this.GetToken();
|
||||
|
||||
if (username == null == (SlotHelper.IsTypeInvalid(slotType) || slotId == null)) return this.BadRequest();
|
||||
|
||||
CommentEntity? comment = await this.database.Comments.FindAsync(commentId);
|
||||
if (comment == null) return this.NotFound();
|
||||
|
||||
return this.Ok(GameComment.CreateFromEntity(comment, token.UserId));
|
||||
}
|
||||
|
||||
[HttpGet("comments/{slotType}/{slotId:int}")]
|
||||
[HttpGet("userComments/{username}")]
|
||||
public async Task<IActionResult> GetComments(string? username, string? slotType, int slotId)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue