diff --git a/BlogPlatform/Endpoints/Comment/CreateCommentEndpoint.cs b/BlogPlatform/Endpoints/Comment/CreateCommentEndpoint.cs index 38e240a..3374158 100644 --- a/BlogPlatform/Endpoints/Comment/CreateCommentEndpoint.cs +++ b/BlogPlatform/Endpoints/Comment/CreateCommentEndpoint.cs @@ -10,7 +10,6 @@ public class CreateCommentEndpoint(BlogPlatformDbContext database) : Endpoint new {x.Id}); - AllowAnonymous(); } public override async Task HandleAsync(GetCommentRequest req, CancellationToken ct) diff --git a/BlogPlatform/Endpoints/Comment/UpdateCommentEndpoint.cs b/BlogPlatform/Endpoints/Comment/UpdateCommentEndpoint.cs index 679b548..9a809d9 100644 --- a/BlogPlatform/Endpoints/Comment/UpdateCommentEndpoint.cs +++ b/BlogPlatform/Endpoints/Comment/UpdateCommentEndpoint.cs @@ -11,11 +11,11 @@ public class UpdateCommentEndpoint(BlogPlatformDbContext database) : Endpoint new {x.Id}); - AllowAnonymous(); } public override async Task HandleAsync(UpdateCommentDto req, CancellationToken ct) { + var comment = await database.Comments.FirstOrDefaultAsync(x => x.Id == req.Id, ct); var checkUser = await database.Users.SingleOrDefaultAsync(x=> x.Id == req.UserId, ct); var checkPost = await database.Posts.SingleOrDefaultAsync(x=> x.Id == req.PostId, ct); @@ -24,14 +24,11 @@ public class UpdateCommentEndpoint(BlogPlatformDbContext database) : Endpoint new {x.Id}); - AllowAnonymous(); } public override async Task HandleAsync(DeletePostRequest req, CancellationToken ct) diff --git a/BlogPlatform/Endpoints/Post/GetAllPostsEndpoint.cs b/BlogPlatform/Endpoints/Post/GetAllPostsEndpoint.cs index 31ded5e..4fa6e70 100644 --- a/BlogPlatform/Endpoints/Post/GetAllPostsEndpoint.cs +++ b/BlogPlatform/Endpoints/Post/GetAllPostsEndpoint.cs @@ -10,7 +10,6 @@ public class GetAllPostsEndpoint(BlogPlatformDbContext database) : EndpointWitho public override void Configure() { Get("/api/posts"); - AllowAnonymous(); } public override async Task HandleAsync(CancellationToken ct) diff --git a/BlogPlatform/Endpoints/Post/GetPostEndpoint.cs b/BlogPlatform/Endpoints/Post/GetPostEndpoint.cs index 87d38b5..bf136ba 100644 --- a/BlogPlatform/Endpoints/Post/GetPostEndpoint.cs +++ b/BlogPlatform/Endpoints/Post/GetPostEndpoint.cs @@ -15,7 +15,6 @@ public class GetPostEndpoint(BlogPlatformDbContext database) : Endpoint new {x.Id}); - AllowAnonymous(); } public override async Task HandleAsync(GetPostRequest req, CancellationToken ct) diff --git a/BlogPlatform/Endpoints/Post/PatchPostDecrementLikeEndpoint.cs b/BlogPlatform/Endpoints/Post/PatchPostDecrementLikeEndpoint.cs index de65147..6a1b552 100644 --- a/BlogPlatform/Endpoints/Post/PatchPostDecrementLikeEndpoint.cs +++ b/BlogPlatform/Endpoints/Post/PatchPostDecrementLikeEndpoint.cs @@ -11,7 +11,6 @@ public class PatchPostDecrementLikeEndpoint(BlogPlatformDbContext database) : En public override void Configure() { Patch("/api/posts/{@Id}/DecrementLikes", x => new {x.Id}); - AllowAnonymous(); } public override async Task HandleAsync(PatchPostDecrementLikeDto req, CancellationToken ct) diff --git a/BlogPlatform/Endpoints/Post/PatchPostIncrementLikeEndpoint.cs b/BlogPlatform/Endpoints/Post/PatchPostIncrementLikeEndpoint.cs index 44079db..b0ef649 100644 --- a/BlogPlatform/Endpoints/Post/PatchPostIncrementLikeEndpoint.cs +++ b/BlogPlatform/Endpoints/Post/PatchPostIncrementLikeEndpoint.cs @@ -11,7 +11,6 @@ public class PatchPostIncrementLikeEndpoint(BlogPlatformDbContext database) : En public override void Configure() { Patch("/api/posts/{@Id}/IncrementLikes", x => new {x.Id}); - AllowAnonymous(); } public override async Task HandleAsync(PatchPostIncrementLikeDto req, CancellationToken ct) diff --git a/BlogPlatform/Endpoints/Post/UpdatePostEndpoint.cs b/BlogPlatform/Endpoints/Post/UpdatePostEndpoint.cs index dc9ac5d..5c2d46b 100644 --- a/BlogPlatform/Endpoints/Post/UpdatePostEndpoint.cs +++ b/BlogPlatform/Endpoints/Post/UpdatePostEndpoint.cs @@ -11,7 +11,6 @@ public class UpdatePostEndpoint(BlogPlatformDbContext database) : Endpoint new {x.Id}); - AllowAnonymous(); } public override async Task HandleAsync(UpdatePostDto req, CancellationToken ct)