public async Task <ReportViewModel> CommentReport(CreateCommentReportRequest request) { var currentUser = Feature.CurrentUser(httpContextAccessor, userRepository); var comment = await commentRepository.GetByIdAsync(ObjectId.Parse(request.CommentId)); var data = new Report() { AuthorId = currentUser.OId, Reason = request.Reason.ToList(), ObjectId = request.CommentId, ObjectType = Feature.GetTypeName(comment) }; await fcmRepository.AddToGroup( new AddUserToGroupRequest { GroupName = comment.AuthorId, Type = Feature.GetTypeName(currentUser), UserIds = new List <string> { comment.AuthorId } } ); await reportRepository.AddAsync(data); var notificationDetail = new Noftication() { AuthorId = currentUser.OId, OwnerId = currentUser.OId, ObjectId = comment.OId, ObjectThumbnail = comment.Content }; //Bài viết của bạn đã bị báo cáo. await fcmRepository.PushNotify(comment.AuthorId, notificationDetail, NotificationContent.CommentReportNotification, "Bình luận của bạn đã bị báo cáo. "); return(mapper.Map <ReportViewModel>(data)); }
public async Task <IActionResult> ReportComment(CreateCommentReportRequest request) { var data = await reportServices.CommentReport(request); return(Ok(new ApiOkResponse(data))); }