public async Task <IActionResult> SubmitQueueItem([FromBody] QueueItemSubmitDto projectitem) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var item = await _context.Projectitem.FindAsync(projectitem.ProjectItemId); if (item == null) { return(BadRequest($"ProjectItem does not exist with Id: {projectitem.ProjectItemId}")); } if (!await _accessValidation.IfQueueItemAssignedToUser(item.ProjectId, projectitem.ProjectItemId)) { return(BadRequest($"Forbidden to edit item which not assigned to you: {projectitem.ProjectItemId}")); } var cIds = await _redis.ConvertCategoryNames(item.ProjectId, projectitem.CategoryNames); var scIds = await _redis.ConvertSubcategoryNames(item.ProjectId, projectitem.SubcategoryNames); var userId = _accessValidation.GetUserSubId(); var tevent = new TaggedEvent { TeamId = _accessValidation.GetUserTeamId(), ProjectId = item.ProjectId, ProjectItemId = projectitem.ProjectItemId, TaggedUserId = userId, CategoryIds = cIds, SubcategoryIds = scIds, Keywords = projectitem.Keywords }; await _redis.PublishTaggedItem(tevent); await _redis.SetUserSubmitted(item.ProjectId, userId, true); return(Ok()); }
public async Task PublishTaggedItem(TaggedEvent submission) { await RedisHelper.PublishAsync(TAGGIE_CHANNEL_TAGGED, JsonConvert.SerializeObject(submission)); }