feat: started working on replys in comments, changes IDs to GETs

Signed-off-by: limited_dev <loginakkisativ@gmail.com>
This commit is contained in:
limited_dev 2023-03-18 00:49:50 +01:00
parent 5ee623b295
commit 396edeefde
9 changed files with 207 additions and 11 deletions

View file

@ -31,6 +31,19 @@ public static class CommentsRepository
.FirstOrDefaultAsync();
}
public static async Task<CommentData> getCommentByGETAsync(string board, int get)
{
await using var db = new AppDBContext();
return await db.Comments
.Where(comment => comment.GET == get)
.Where(comment => comment.Board == board)
.Include(comment => comment.Image)
.Include(comment => comment.Post)
.Include(comment => comment.User)
.Include(comment => comment.Report)
.FirstOrDefaultAsync();
}
/*public static async Task<PostData> getPostByIdAsync(int postId)
{
await using var db = new AppDBContext();

View file

@ -32,6 +32,19 @@ public static class PostsRepository
.FirstOrDefaultAsync();
//return await db.Posts.FirstOrDefaultAsync(post => post.PostID == postId);
}
public static async Task<PostData> getPostByGETAsync(string board, int get)
{
await using var db = new AppDBContext();
return await db.Posts
.Where(post => post.GET == get)
.Where(post => post.Board == board)
.Include(post => post.Image)
.Include(post => post.Comments)
.Include(post => post.User)
.FirstOrDefaultAsync();
//return await db.Posts.FirstOrDefaultAsync(post => post.PostID == postId);
}
public static async Task<int> createPostAsync(PostData postToCreate)
{