Example #1
0
 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);
     }
 }
Example #2
0
 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
         });
     }
 }
Example #3
0
        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);
        }
Example #4
0
        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);
        }
Example #5
0
        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());
        }
Example #6
0
        private async Task ProcessSingleImageTags(ImageTagData imageTagData)
        {
            await _tagsService.ProcessImageTags(imageTagData);

            await _imagesService.CompleteImageProcessing(imageTagData.ImageId);
        }