/// <summary> /// Resolves wiki page names /// </summary> /// <param name="pageIds">Page Ids to resolve</param> /// <param name="differences">Differences to fill</param> private async Task ResolveWikiPageNames(List <string> pageIds, List <CompareDifference> differences) { pageIds = pageIds.Distinct().ToList(); List <KirjaPage> pages = await _pageDbAccess.ResolveNames(pageIds); Dictionary <string, string> pageLookup = pages.ToDictionary(i => i.Id, i => i.Name); FillObjectNames(differences, pageLookup, CompareDifferenceValue.ValueResolveType.ResolveWikiPageName, "WikiPageWasDeleted"); }
public async Task <IActionResult> ValidateVersionReferences(string versionId) { KirjaPageVersion version = await _pageVersionDbAccess.GetPageVersionById(versionId); if (version == null) { return(NotFound()); } PageVersionReferenceValidationResult validationResult = new PageVersionReferenceValidationResult(); validationResult.MissingNpcs = new List <string>(); if (version.MentionedNpcs != null) { List <KortistoNpc> npcs = await _npcDbAccess.ResolveFlexFieldObjectNames(version.MentionedNpcs); validationResult.MissingNpcs = version.MentionedNpcs.Where(n => !npcs.Any(npc => npc.Id.ToLowerInvariant() == n.ToLowerInvariant())).ToList(); } validationResult.MissingItems = new List <string>(); if (version.MentionedItems != null) { List <StyrItem> items = await _itemDbAccess.ResolveFlexFieldObjectNames(version.MentionedItems); validationResult.MissingItems = version.MentionedItems.Where(n => !items.Any(item => item.Id.ToLowerInvariant() == n.ToLowerInvariant())).ToList(); } validationResult.MissingSkills = new List <string>(); if (version.MentionedSkills != null) { List <EvneSkill> skills = await _skillDbAccess.ResolveFlexFieldObjectNames(version.MentionedSkills); validationResult.MissingSkills = version.MentionedSkills.Where(n => !skills.Any(skill => skill.Id.ToLowerInvariant() == n.ToLowerInvariant())).ToList(); } validationResult.MissingQuests = new List <string>(); if (version.MentionedQuests != null) { List <AikaQuest> quests = await _questDbAccess.ResolveQuestNames(version.MentionedQuests); validationResult.MissingQuests = version.MentionedQuests.Where(n => !quests.Any(quest => quest.Id.ToLowerInvariant() == n.ToLowerInvariant())).ToList(); } validationResult.MissingPages = new List <string>(); if (version.MentionedKirjaPages != null) { List <KirjaPage> pages = await _pageDbAccess.ResolveNames(version.MentionedKirjaPages); validationResult.MissingPages = version.MentionedKirjaPages.Where(n => !pages.Any(page => page.Id.ToLowerInvariant() == n.ToLowerInvariant())).ToList(); } return(Ok(validationResult)); }