public async Task <ReportViewModel> ReplyReport(CreateReplyReportRequest request) { User currentUser = Feature.CurrentUser(httpContextAccessor, userRepository); ReplyComment comment = await replyCommentRepository.GetByIdAsync(ObjectId.Parse(request.ReplyId)); Report data = new Report() { AuthorId = currentUser.OId, Reason = request.Reason.ToList(), ObjectId = request.ReplyId, 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, "Phản hồi của bạn đã bị báo cáo. "); return(mapper.Map <ReportViewModel>(data)); }
public async Task <IActionResult> ReportReply(CreateReplyReportRequest request) { var data = await reportServices.ReplyReport(request); return(Ok(new ApiOkResponse(data))); }