Example #1
0
        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));
        }
Example #2
0
        //[Authorize(Policy = "AdminOnly")]
        public async Task <ActionResult <bool> > UserLikePostAsync([FromBody] ToggleUserLikePostCommand command)
        {
            var result = await _mediator.Send(command);

            return(Ok(ResponseWrapper.CreateOkResponseWrapper(result)));
        }