Changeset b373fea for ChapterX.Application/Comment/Commands
- Timestamp:
- 06/23/26 15:20:39 (13 days ago)
- Branches:
- main
- Children:
- 0b502c2
- Parents:
- d300631
- Location:
- ChapterX.Application/Comment/Commands
- Files:
-
- 5 edited
-
AddRequest.cs (modified) (1 diff)
-
DeleteHandler.cs (modified) (1 diff)
-
DeleteRequest.cs (modified) (1 diff)
-
UpdateHandler.cs (modified) (1 diff)
-
UpdateRequest.cs (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ChapterX.Application/Comment/Commands/AddRequest.cs
rd300631 rb373fea 1 1 using MediatR; 2 using System.ComponentModel.DataAnnotations; 2 3 3 4 namespace ChapterX.Application.Comment.Commands 4 5 { 5 public record AddRequest(string Content, int UserId, int StoryId) : IRequest<AddResponse>; 6 public record AddRequest( 7 [Required][MaxLength(2000)] string Content, 8 int UserId, 9 int StoryId 10 ) : IRequest<AddResponse>; 6 11 } -
ChapterX.Application/Comment/Commands/DeleteHandler.cs
rd300631 rb373fea 22 22 return new DeleteResponse(false); 23 23 24 if (comment.UserId != request.CallerId) 25 throw new UnauthorizedAccessException("You do not own this comment."); 26 24 27 await _commentRepository.DeleteAsync(comment, cancellationToken); 25 28 -
ChapterX.Application/Comment/Commands/DeleteRequest.cs
rd300631 rb373fea 3 3 namespace ChapterX.Application.Comment.Commands 4 4 { 5 public record DeleteRequest(int Id ) : IRequest<DeleteResponse>;5 public record DeleteRequest(int Id, int CallerId) : IRequest<DeleteResponse>; 6 6 } -
ChapterX.Application/Comment/Commands/UpdateHandler.cs
rd300631 rb373fea 22 22 return new UpdateResponse(false); 23 23 24 if (comment.UserId != request.CallerId) 25 throw new UnauthorizedAccessException("You do not own this comment."); 26 24 27 comment.Content = request.Content; 25 28 comment.UpdatedAt = DateTime.UtcNow; -
ChapterX.Application/Comment/Commands/UpdateRequest.cs
rd300631 rb373fea 3 3 namespace ChapterX.Application.Comment.Commands 4 4 { 5 public record UpdateRequest(int Id, string Content ) : IRequest<UpdateResponse>;5 public record UpdateRequest(int Id, string Content, int CallerId = 0) : IRequest<UpdateResponse>; 6 6 }
Note:
See TracChangeset
for help on using the changeset viewer.
