public async Task <bool> Handle(ToggleLikePostCommand request, CancellationToken cancellationToken) { var userId = Guid.Parse(_httpContextAccessor.HttpContext.User.FindFirst(ClaimTypes.NameIdentifier)?.Value); var command = new ToggleUserLikePostCommand { UserId = userId, PostId = request.PostId }; return(await _mediator.Send(command)); }
//[Authorize(Policy = "AdminOnly")] public async Task <ActionResult <bool> > UserLikePostAsync([FromBody] ToggleUserLikePostCommand command) { var result = await _mediator.Send(command); return(Ok(ResponseWrapper.CreateOkResponseWrapper(result))); }