public async Task ProcessImageTags(ImageTagData imageTagData) { foreach (var tag in imageTagData.TagData) { await _tagsRepository.InsertImageTag(imageTagData.ImageId, tag, imageTagData.MapId == Guid.Empty?(Guid?)null : imageTagData.MapId); } }
public async Task CheckForCompoundImageRequestsFromSingleMapImage(ImageTagData imageTagData) { if (await _tagsAnalyser.AnalyseTagConfidence(imageTagData.TagData) == TagAnalysisAction.RequestCompoundImage && await _mapsService.VerifyMapCompletion(imageTagData.MapId)) { await _imagesService.CreateNewCompoundImage(imageTagData.MapId, new List <Guid> { imageTagData.ImageId }); } }
private async Task ProcessSingleMapImageTags(ImageTagData imageTagData) { await _tagsValidator.ValidateImageTagData(imageTagData.TagData, imageTagData.ImageId); await _tagsService.ProcessImageTags(imageTagData); await _imagesService.CompleteImageProcessing(imageTagData.ImageId); await _tagsService.CheckForCompoundImageRequestsFromSingleMapImage(imageTagData); }
public async Task <bool> ValidateTagDataKey(ImageTagData tagData) { if (string.IsNullOrEmpty(tagData.Key)) { return(false); } var imageKey = await _imagesRepository.GetImageKeyById(tagData.ImageId); if (string.IsNullOrEmpty(imageKey)) { return(false); } return(tagData.Key == imageKey); }
public async Task <IActionResult> SubmitImageTags([FromBody] ImageTagData imageTagData) { if (!await _tagsService.ValidateTagDataKey(imageTagData)) { return(Unauthorized()); } if (imageTagData.MapId == Guid.Empty) { await ProcessSingleImageTags(imageTagData); } else { await ProcessSingleMapImageTags(imageTagData); } return(Ok()); }
private async Task ProcessSingleImageTags(ImageTagData imageTagData) { await _tagsService.ProcessImageTags(imageTagData); await _imagesService.CompleteImageProcessing(imageTagData.ImageId); }