public virtual async Task <NavigationNode> GetNavigationAsync(GetNavigationDocumentInput input) { var project = await _projectRepository.GetAsync(input.ProjectId); var navigationDocument = await GetDocumentWithDetailsDtoAsync( project, project.NavigationDocumentName, input.LanguageCode, input.Version ); if (!JsonConvertExtensions.TryDeserializeObject <NavigationNode>(navigationDocument.Content, out var navigationNode)) { throw new UserFriendlyException($"Cannot validate navigation file '{project.NavigationDocumentName}' for the project {project.Name}."); } var leafs = navigationNode.Items.GetAllNodes(x => x.Items) .Where(x => !x.Path.IsNullOrWhiteSpace()) .ToList(); foreach (var leaf in leafs) { var cacheKey = CacheKeyGenerator.GenerateDocumentUpdateInfoCacheKey(project, leaf.Path, input.LanguageCode, input.Version); var documentUpdateInfo = await DocumentUpdateCache.GetAsync(cacheKey); if (documentUpdateInfo != null) { leaf.CreationTime = documentUpdateInfo.CreationTime; leaf.LastUpdatedTime = documentUpdateInfo.LastUpdatedTime; leaf.LastSignificantUpdateTime = documentUpdateInfo.LastSignificantUpdateTime; } } return(navigationNode); }
public virtual async Task <NavigationNode> GetNavigationAsync(GetNavigationDocumentInput input) { var project = await _projectRepository.GetAsync(input.ProjectId); var navigationDocument = await GetDocumentWithDetailsDtoAsync( project, project.NavigationDocumentName, input.LanguageCode, input.Version ); var navigationNode = JsonConvert.DeserializeObject <NavigationNode>(navigationDocument.Content); var leafs = navigationNode.Items.GetAllNodes(x => x.Items) .Where(x => !x.Path.IsNullOrWhiteSpace()) .ToList(); foreach (var leaf in leafs) { var cacheKey = $"DocumentUpdateInfo{project.Id}#{leaf.Path}#{input.LanguageCode}#{input.Version}"; var documentUpdateInfo = await DocumentUpdateCache.GetAsync(cacheKey); if (documentUpdateInfo != null) { leaf.CreationTime = documentUpdateInfo.CreationTime; leaf.LastUpdatedTime = documentUpdateInfo.LastUpdatedTime; } } return(navigationNode); }
public virtual async Task <DocumentWithDetailsDto> GetNavigationAsync(GetNavigationDocumentInput input) { var project = await _projectRepository.GetAsync(input.ProjectId); return(await GetDocumentWithDetailsDto( project, project.NavigationDocumentName, input.Version )); }
public virtual Task <DocumentWithDetailsDto> GetNavigationAsync(GetNavigationDocumentInput input) { return(DocumentAppService.GetNavigationAsync(input)); }
public Task <NavigationNode> GetNavigationAsync(GetNavigationDocumentInput input) { return(DocumentAppService.GetNavigationAsync(input)); }