Пример #1
0
        public async Task CheckForCompoundImageRequestFromCompoundImage(CompoundImageTagData compoundImageTagData)
        {
            if (await _tagsAnalyser.AnalyseTagConfidence(compoundImageTagData.Tags) == TagAnalysisAction.RequestCompoundImage)
            {
                var images = await _compoundImageMappingsRepository.GetImageIdsByCompoundImageId(compoundImageTagData.CompoundImageId);

                await _imagesService.CreateNewCompoundImage(compoundImageTagData.MapId, images);
            }
        }
Пример #2
0
        public async Task <IActionResult> SubmitMapCompoundImageTags([FromBody] CompoundImageTagData compoundImageTagData)
        {
            if (!await _tagsService.ValidateCompoundImageTagDataKey(compoundImageTagData))
            {
                return(Unauthorized());
            }

            await _tagsValidator.ValidateCompoundImageTagData(compoundImageTagData.Tags, compoundImageTagData.CompoundImageId);

            await _tagsService.ProcessCompoundImageTags(compoundImageTagData.CompoundImageId, compoundImageTagData.Tags);

            await _imagesService.CompleteCompoundImageProcessing(compoundImageTagData.CompoundImageId);

            await _tagsService.CheckForCompoundImageRequestFromCompoundImage(compoundImageTagData);

            return(Ok());
        }
Пример #3
0
        public async Task <bool> ValidateCompoundImageTagDataKey(CompoundImageTagData compoundImageTagData)
        {
            if (string.IsNullOrEmpty(compoundImageTagData.Key))
            {
                return(false);
            }

            var keyParts = compoundImageTagData.Key.SplitInParts(32).ToList();

            var imageIds = await _compoundImageMappingsRepository.GetImageIdsByCompoundImageId(compoundImageTagData.CompoundImageId);

            var imageKeys = new List <string>();

            foreach (var imageId in imageIds)
            {
                imageKeys.Add(await _imagesRepository.GetImageKeyById(imageId));
            }

            return(imageKeys.Count == keyParts.Count && imageKeys.All(keyParts.Contains));
        }