/// <summary>
        /// Checks an skill for update
        /// </summary>
        /// <param name="exportSnippet">Export Snippet</param>
        /// <param name="objectId">Object Id</param>
        /// <param name="timelineEvent">Timeline Event</param>
        /// <returns>Result of update</returns>
        private async Task <FlexFieldObject> CheckSkillForUpdate(ObjectExportSnippet exportSnippet, string objectId, TimelineEvent timelineEvent)
        {
            EvneSkill skill = await _skillDbAccess.GetFlexFieldObjectById(objectId);

            if (skill == null)
            {
                return(null);
            }

            await _timelineService.AddTimelineEntry(exportSnippet.ProjectId, timelineEvent, exportSnippet.SnippetName, skill.Name, skill.Id);

            CompareResult result = await _implementationStatusComparer.CompareSkill(skill.Id, skill);

            if (result.CompareDifference != null && result.CompareDifference.Count > 0)
            {
                skill.IsImplemented = false;
                await _skillDbAccess.UpdateFlexFieldObject(skill);
            }

            return(skill);
        }
Exemple #2
0
        public async Task <IActionResult> FlagSkillAsImplemented(string skillId)
        {
            // Check Data
            EvneSkill skill = await _skillDbAccess.GetFlexFieldObjectById(skillId);

            if (skill == null)
            {
                return(StatusCode((int)HttpStatusCode.NotFound));
            }

            // Flag skill as implemented
            skill.IsImplemented = true;
            await _skillSnapshotDbAccess.SaveSnapshot(skill);

            await _skillDbAccess.UpdateFlexFieldObject(skill);

            // Add Timeline entry
            await _timelineService.AddTimelineEntry(TimelineEvent.ImplementedSkill, skill.Id, skill.Name);

            return(Ok());
        }
Exemple #3
0
        /// <summary>
        /// Deletes the modified data for the user
        /// </summary>
        /// <param name="user">User</param>
        /// <returns>Task</returns>
        private async Task DeleteModifiedData(GoNorthUser user)
        {
            List <AikaQuest> quests = await _questDbAccess.GetQuestsByModifiedUser(user.Id);

            foreach (AikaQuest curQuest in quests)
            {
                curQuest.ModifiedBy = Guid.Empty.ToString();
                curQuest.ModifiedOn = DateTimeOffset.UtcNow;
                await _questDbAccess.UpdateQuest(curQuest);
            }

            List <AikaChapterDetail> chapterDetail = await _chapterDetailDbAccess.GetChapterDetailsByModifiedUser(user.Id);

            foreach (AikaChapterDetail curChapterDetail in chapterDetail)
            {
                curChapterDetail.ModifiedBy = Guid.Empty.ToString();
                curChapterDetail.ModifiedOn = DateTimeOffset.UtcNow;
                await _chapterDetailDbAccess.UpdateChapterDetail(curChapterDetail);
            }

            List <AikaChapterOverview> chapterOverview = await _chapterOverviewDbAccess.GetChapterOverviewByModifiedUser(user.Id);

            foreach (AikaChapterOverview curOverview in chapterOverview)
            {
                curOverview.ModifiedBy = Guid.Empty.ToString();
                curOverview.ModifiedOn = DateTimeOffset.UtcNow;
                await _chapterOverviewDbAccess.UpdateChapterOverview(curOverview);
            }

            List <EvneSkill> skills = await _skillDbAccess.GetFlexFieldObjectsByModifiedUser(user.Id);

            foreach (EvneSkill curSkill in skills)
            {
                curSkill.ModifiedBy = Guid.Empty.ToString();
                curSkill.ModifiedOn = DateTimeOffset.UtcNow;
                await _skillDbAccess.UpdateFlexFieldObject(curSkill);
            }

            List <KortistoNpc> npcs = await _npcDbAccess.GetFlexFieldObjectsByModifiedUser(user.Id);

            foreach (KortistoNpc curNpc in npcs)
            {
                curNpc.ModifiedBy = Guid.Empty.ToString();
                curNpc.ModifiedOn = DateTimeOffset.UtcNow;
                await _npcDbAccess.UpdateFlexFieldObject(curNpc);
            }

            List <StyrItem> items = await _itemDbAccess.GetFlexFieldObjectsByModifiedUser(user.Id);

            foreach (StyrItem curItem in items)
            {
                curItem.ModifiedBy = Guid.Empty.ToString();
                curItem.ModifiedOn = DateTimeOffset.UtcNow;
                await _itemDbAccess.UpdateFlexFieldObject(curItem);
            }

            List <ExportTemplate> exportTemplates = await _exportTemplateDbAccess.GetExportTemplatesByModifiedUser(user.Id);

            foreach (ExportTemplate curTemplate in exportTemplates)
            {
                curTemplate.ModifiedBy = Guid.Empty.ToString();
                curTemplate.ModifiedOn = DateTimeOffset.UtcNow;
                await _exportTemplateDbAccess.UpdateTemplate(curTemplate);
            }

            List <KartaMap> maps = await _mapDbAccess.GetMapsByModifiedUser(user.Id);

            foreach (KartaMap curMap in maps)
            {
                curMap.ModifiedBy = Guid.Empty.ToString();
                curMap.ModifiedOn = DateTimeOffset.UtcNow;
                await _mapDbAccess.UpdateMap(curMap);
            }

            List <KirjaPage> pages = await _pageDbAccess.GetPagesByModifiedUser(user.Id);

            foreach (KirjaPage curPage in pages)
            {
                curPage.ModifiedBy = Guid.Empty.ToString();
                curPage.ModifiedOn = DateTimeOffset.UtcNow;
                await _pageDbAccess.UpdatePage(curPage);
            }

            List <KirjaPageVersion> pageVersions = await _pageVersionDbAccess.GetPageVersionsByModifiedUser(user.Id);

            foreach (KirjaPageVersion curVersion in pageVersions)
            {
                curVersion.ModifiedBy = Guid.Empty.ToString();
                curVersion.ModifiedOn = DateTimeOffset.UtcNow;
                await _pageVersionDbAccess.UpdatePageVersion(curVersion);
            }

            List <TaleDialog> dialogs = await _taleDbAccess.GetDialogsByModifiedUser(user.Id);

            foreach (TaleDialog curDialog in dialogs)
            {
                curDialog.ModifiedBy = Guid.Empty.ToString();
                curDialog.ModifiedOn = DateTimeOffset.UtcNow;
                await _taleDbAccess.UpdateDialog(curDialog);
            }

            List <JsonConfigEntry> jsonConfigEntries = await _projectConfigDbAccess.GetJsonConfigEntriesByModifiedUser(user.Id);

            foreach (JsonConfigEntry curConfig in jsonConfigEntries)
            {
                curConfig.ModifiedBy = Guid.Empty.ToString();
                curConfig.ModifiedOn = DateTimeOffset.UtcNow;
                await _projectConfigDbAccess.UpdateJsonConfig(curConfig);
            }

            List <MiscProjectConfig> miscConfigEntries = await _projectConfigDbAccess.GetMiscConfigEntriesByModifiedUser(user.Id);

            foreach (MiscProjectConfig curMiscConfig in miscConfigEntries)
            {
                curMiscConfig.ModifiedBy = Guid.Empty.ToString();
                curMiscConfig.ModifiedOn = DateTimeOffset.UtcNow;
                await _projectConfigDbAccess.UpdateMiscConfig(curMiscConfig);
            }

            List <TaskBoard> taskBoards = await _taskBoardDbAccess.GetTaskBoardsByModifiedUser(user.Id);

            foreach (TaskBoard curBoard in taskBoards)
            {
                if (curBoard.ModifiedBy == user.Id)
                {
                    curBoard.ModifiedBy = Guid.Empty.ToString();
                    curBoard.ModifiedOn = DateTimeOffset.UtcNow;
                }

                List <TaskGroup> modifiedGroups = curBoard.TaskGroups.Where(t => t.ModifiedBy == user.Id).ToList();
                foreach (TaskGroup curTaskGroup in modifiedGroups)
                {
                    curTaskGroup.ModifiedBy = Guid.Empty.ToString();
                    curTaskGroup.ModifiedOn = DateTimeOffset.UtcNow;
                }

                List <GoNorthTask> tasks = curBoard.TaskGroups.SelectMany(p => p.Tasks.Where(t => t.ModifiedBy == user.Id)).ToList();
                if (tasks.Count > 0)
                {
                    foreach (GoNorthTask curTask in tasks)
                    {
                        curTask.ModifiedBy = Guid.Empty.ToString();
                        curTask.ModifiedOn = DateTimeOffset.UtcNow;
                    }
                }

                await _taskBoardDbAccess.UpdateTaskBoard(curBoard);
            }

            List <GoNorthTaskType> taskGroupTypes = await _taskGroupTypeDbAccess.GetTaskTypesByModifiedUser(user.Id);

            foreach (GoNorthTaskType curType in taskGroupTypes)
            {
                curType.ModifiedBy = Guid.Empty.ToString();
                curType.ModifiedOn = DateTimeOffset.UtcNow;
                await _taskGroupTypeDbAccess.UpdateTaskType(curType);
            }

            List <GoNorthTaskType> taskTypes = await _taskTypeDbAccess.GetTaskTypesByModifiedUser(user.Id);

            foreach (GoNorthTaskType curType in taskTypes)
            {
                curType.ModifiedBy = Guid.Empty.ToString();
                curType.ModifiedOn = DateTimeOffset.UtcNow;
                await _taskTypeDbAccess.UpdateTaskType(curType);
            }
        }