Implement comment API endpoints - #917
Merged
Merged
Conversation
jvyden
self-requested a review
August 3, 2025 19:19
jvyden
requested changes
Aug 3, 2025
Comment on lines
+15
to
+17
| public required int YayRatings { get; set; } | ||
| public required int BooRatings { get; set; } | ||
| public required int OwnRating { get; set; } |
Member
There was a problem hiding this comment.
Should this be a statistics object?
Contributor
Author
There was a problem hiding this comment.
That might make sense, could probably reuse them for reviews later too.
| { | ||
| public required int CommentId { get; set; } | ||
| public required string Content { get; set; } | ||
| public required ApiMinimalUserResponse Poster { get; set; } |
Member
There was a problem hiding this comment.
I think Publisher is more consistent. Unless you want to change the model name too, in which case I think Author works better
Contributor
Author
There was a problem hiding this comment.
Yes Publisher is better I think.
| namespace Refresh.Interfaces.APIv3.Endpoints.DataTypes.Response.Comments; | ||
|
|
||
| [JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))] | ||
| public class ApiProfileCommentResponse : IApiResponse, IDataConvertableFrom<ApiProfileCommentResponse, GameProfileComment> |
Member
There was a problem hiding this comment.
Ditto concerns for this class as well
| } | ||
|
|
||
| [ApiV3Endpoint("profileComments/id/{id}"), Authentication(false)] | ||
| [DocSummary("Gets the profile comment specified by it's ID.")] |
Member
There was a problem hiding this comment.
Suggested change
| [DocSummary("Gets the profile comment specified by it's ID.")] | |
| [DocSummary("Gets the profile comment specified by its ID.")] |
| } | ||
|
|
||
| [ApiV3Endpoint("profileComments/id/{id}", HttpMethods.Delete)] | ||
| [DocSummary("Deletes the profile comment specified by it's ID. Fails if the user is not the comment poster or the profile owner.")] |
Member
There was a problem hiding this comment.
Suggested change
| [DocSummary("Deletes the profile comment specified by it's ID. Fails if the user is not the comment poster or the profile owner.")] | |
| [DocSummary("Deletes the profile comment specified by its ID. Fails if the user is not the comment poster or the profile owner.")] |
|
|
||
| (int skip, int count) = context.GetPageData(); | ||
|
|
||
| DatabaseList<GameLevelComment>? comments = dataContext.Database.GetLevelComments(level, count, skip); |
Member
There was a problem hiding this comment.
These shouldn't ever be null
Suggested change
| DatabaseList<GameLevelComment>? comments = dataContext.Database.GetLevelComments(level, count, skip); | |
| DatabaseList<GameLevelComment> comments = dataContext.Database.GetLevelComments(level, count, skip); |
|
|
||
| (int skip, int count) = context.GetPageData(); | ||
|
|
||
| DatabaseList<GameProfileComment>? comments = dataContext.Database.GetProfileComments(profile, count, skip); |
Member
There was a problem hiding this comment.
Suggested change
| DatabaseList<GameProfileComment>? comments = dataContext.Database.GetProfileComments(profile, count, skip); | |
| DatabaseList<GameProfileComment> comments = dataContext.Database.GetProfileComments(profile, count, skip); |
jvyden
approved these changes
Aug 4, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This implements API endpoints for getting a level/profile comment by ID, a list of them on a level/profile, deleting a comment as its poster/level publisher/profile owner, and rating comments.
Also implements a few tests for these endpoints and introduces
ApiMinimalUserResponseandApiMinimalLevelResponseto not include entire user/level objects for every single comment (and just enough to show a level/user's name and icon on the frontend).These "minimal" classes might be more efficient here, considering that lists of comments might contain the same user/level objects multiple times and the frontend probably wouldn't be able to show much about them and the user probably wouldn't want to know much about them at that point anyway. Could probably also use them for reviews and playlists later on once those get implemented and for some already implemented responses like levels and photos in APIv4 in the future, for example.
This closes issue #424