Initial implementation of recent activity

DB migrations intentionally left out since they aren't finalized
This commit is contained in:
Slendy 2023-07-20 19:38:37 -05:00
commit 23cb1bef1c
No known key found for this signature in database
GPG key ID: 7288D68361B91428
86 changed files with 1542 additions and 93 deletions

View file

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