Removing all the meta agile and git stuff
This commit is contained in:
@@ -1,117 +0,0 @@
|
||||
using System.Net.Http.Json;
|
||||
using Model.Work.Tasks;
|
||||
|
||||
namespace Services.Development;
|
||||
|
||||
public class AgileService : IAgileService
|
||||
{
|
||||
private readonly HttpClient httpClient;
|
||||
|
||||
private bool isLoaded;
|
||||
|
||||
private event Action OnChange = default!;
|
||||
|
||||
public AgileService(HttpClient httpClient)
|
||||
{
|
||||
this.httpClient = httpClient;
|
||||
}
|
||||
|
||||
|
||||
#if NO_SQL
|
||||
public List<AgileSprintModel>? AgileSprintModels { get; set; }
|
||||
public List<AgileTaskModel>? AgileTaskModels { get; set; }
|
||||
#else
|
||||
private DatabaseContext Database { get; set; }
|
||||
public DbSet<SprintModel> SprintModels => Database.SprintModels;
|
||||
public DbSet<TaskModel> TaskModels => Database.TaskModels;
|
||||
#endif
|
||||
|
||||
|
||||
public void Subscribe(Action? action)
|
||||
{
|
||||
OnChange += action;
|
||||
}
|
||||
|
||||
public void Unsubscribe(Action? action)
|
||||
{
|
||||
OnChange -= action;
|
||||
}
|
||||
|
||||
public bool IsLoaded()
|
||||
{
|
||||
return isLoaded;
|
||||
}
|
||||
|
||||
#if NO_SQL
|
||||
public async Task Load()
|
||||
{
|
||||
if (isLoaded) return;
|
||||
|
||||
AgileSprintModels =
|
||||
(await httpClient.GetFromJsonAsync<AgileSprintModel[]>("generated/AgileSprintModels.json")
|
||||
?? Array.Empty<AgileSprintModel>()).ToList();
|
||||
AgileTaskModels =
|
||||
(await httpClient.GetFromJsonAsync<AgileTaskModel[]>("generated/AgileTaskModels.json")
|
||||
?? Array.Empty<AgileTaskModel>()).ToList();
|
||||
|
||||
SortSql();
|
||||
|
||||
isLoaded = true;
|
||||
|
||||
NotifyDataChanged();
|
||||
}
|
||||
|
||||
private void SortSql()
|
||||
{
|
||||
foreach (var agileTask in AgileTaskModels!)
|
||||
if (agileTask.AgileSprintModelId != null)
|
||||
SprintById(agileTask.AgileSprintModelId.Value)?.AgileTaskModels.Add(agileTask);
|
||||
}
|
||||
|
||||
private AgileSprintModel? SprintById(int id)
|
||||
{
|
||||
foreach (var data in AgileSprintModels!)
|
||||
if (data.Id == id)
|
||||
return data;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private AgileTaskModel? TaskById(int id)
|
||||
{
|
||||
foreach (var data in AgileTaskModels!)
|
||||
if (data.Id == id)
|
||||
return data;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
#else
|
||||
public async Task Load(DatabaseContext database) {
|
||||
Database = database;
|
||||
|
||||
if (isLoaded) {
|
||||
return;
|
||||
}
|
||||
|
||||
Database.SprintModels.AddRange(await httpClient.GetFromJsonAsync<SprintModel[]>("generated/AgileSprintModels.json"));
|
||||
Database.TaskModels.AddRange(await httpClient.GetFromJsonAsync<TaskModel[]>("generated/AgileTaskModels.json"));
|
||||
|
||||
Database.SaveChanges();
|
||||
|
||||
isLoaded = true;
|
||||
|
||||
NotifyDataChanged();
|
||||
}
|
||||
#endif
|
||||
|
||||
public void Update()
|
||||
{
|
||||
NotifyDataChanged();
|
||||
}
|
||||
|
||||
private void NotifyDataChanged()
|
||||
{
|
||||
OnChange?.Invoke();
|
||||
}
|
||||
}
|
||||
@@ -1,133 +0,0 @@
|
||||
using System.Net.Http.Json;
|
||||
using Model.Doc;
|
||||
|
||||
namespace Services.Development;
|
||||
|
||||
public class DocumentationService : IDocumentationService
|
||||
{
|
||||
private readonly HttpClient httpClient;
|
||||
private bool isLoaded;
|
||||
|
||||
public DocumentationService(HttpClient httpClient)
|
||||
{
|
||||
this.httpClient = httpClient;
|
||||
}
|
||||
|
||||
public List<DocContentModel> DocContentModels { get; set; } = new();
|
||||
|
||||
public List<DocContentModel> DocContentModelsByPageOrder { get; set; } = new();
|
||||
|
||||
public List<DocSectionModel> DocSectionModels { get; set; } = new();
|
||||
|
||||
public List<DocConnectionModel> DocConnectionModels { get; set; } = new();
|
||||
|
||||
|
||||
public void Subscribe(Action? action)
|
||||
{
|
||||
OnChange += action;
|
||||
}
|
||||
|
||||
public void Unsubscribe(Action? action)
|
||||
{
|
||||
OnChange -= action;
|
||||
}
|
||||
|
||||
public bool IsLoaded()
|
||||
{
|
||||
return isLoaded;
|
||||
}
|
||||
|
||||
|
||||
public async Task Load()
|
||||
{
|
||||
if (isLoaded) return;
|
||||
|
||||
DocContentModels =
|
||||
(await httpClient.GetFromJsonAsync<DocContentModel[]>("generated/DocContentModels.json") ??
|
||||
Array.Empty<DocContentModel>()).ToList();
|
||||
|
||||
DocConnectionModels =
|
||||
(await httpClient.GetFromJsonAsync<DocConnectionModel[]>("generated/DocConnectionModels.json") ??
|
||||
Array.Empty<DocConnectionModel>()).ToList();
|
||||
|
||||
DocSectionModels =
|
||||
(await httpClient.GetFromJsonAsync<DocSectionModel[]>("generated/DocSectionModels.json") ??
|
||||
Array.Empty<DocSectionModel>()).ToList();
|
||||
|
||||
SortSql();
|
||||
|
||||
isLoaded = true;
|
||||
|
||||
NotifyDataChanged();
|
||||
}
|
||||
|
||||
|
||||
public void Update()
|
||||
{
|
||||
NotifyDataChanged();
|
||||
}
|
||||
|
||||
private event Action? OnChange;
|
||||
|
||||
private DocContentModel? ContentById(int id)
|
||||
{
|
||||
foreach (var doc in DocContentModels!)
|
||||
if (doc.Id == id)
|
||||
return doc;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void SortSql()
|
||||
{
|
||||
foreach (var connection in DocConnectionModels)
|
||||
{
|
||||
ContentById(connection.ParentId)!.DocumentationModels.Add(ContentById(connection.ChildId));
|
||||
ContentById(connection.ChildId)!.Parent = ContentById(connection.ParentId);
|
||||
}
|
||||
|
||||
foreach (var content in DocContentModels)
|
||||
if (content.DocSectionModelId != null)
|
||||
foreach (var section in DocSectionModels)
|
||||
if (section.Id == content.DocSectionModelId)
|
||||
section.DocumentationModels.Add(content);
|
||||
|
||||
ByPageOrder();
|
||||
}
|
||||
|
||||
|
||||
private void ByPageOrder()
|
||||
{
|
||||
DocContentModelsByPageOrder = new List<DocContentModel>();
|
||||
|
||||
var order = 1;
|
||||
foreach (var documentation in DocContentModels)
|
||||
{
|
||||
if (documentation.Parent != null) continue;
|
||||
|
||||
documentation.PageOrder = order++;
|
||||
DocContentModelsByPageOrder.Add(documentation);
|
||||
|
||||
void GetAllChildren(DocContentModel docs)
|
||||
{
|
||||
foreach (var doc in docs.DocumentationModels)
|
||||
{
|
||||
doc.PageOrder = order++;
|
||||
DocContentModelsByPageOrder.Add(doc);
|
||||
|
||||
if (doc.DocumentationModels.Count > 0) GetAllChildren(doc);
|
||||
}
|
||||
}
|
||||
|
||||
GetAllChildren(documentation);
|
||||
}
|
||||
|
||||
DocContentModelsByPageOrder = DocContentModelsByPageOrder.OrderBy(docContent => docContent.PageOrder).ToList();
|
||||
}
|
||||
|
||||
|
||||
private void NotifyDataChanged()
|
||||
{
|
||||
OnChange?.Invoke();
|
||||
}
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
using System.Net.Http.Json;
|
||||
using Model.Git;
|
||||
|
||||
#if NO_SQL
|
||||
|
||||
#else
|
||||
using Contexts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
#endif
|
||||
|
||||
namespace Services.Development;
|
||||
|
||||
public class GitService : IGitService
|
||||
{
|
||||
private readonly HttpClient httpClient;
|
||||
|
||||
private bool isLoaded;
|
||||
|
||||
private event Action OnChange = default!;
|
||||
|
||||
|
||||
public GitService(HttpClient httpClient)
|
||||
{
|
||||
this.httpClient = httpClient;
|
||||
}
|
||||
|
||||
#if NO_SQL
|
||||
public List<GitChangeModel> GitChangeModels { get; set; } = default!;
|
||||
public List<GitPatchModel> GitPatchModels { get; set; } = default!;
|
||||
#else
|
||||
public DbSet<ChangeModel> ChangeModels => Database.ChangeModels;
|
||||
public DbSet<PatchModel> PatchModels => Database.PatchModels;
|
||||
public DatabaseContext Database { get; set; }
|
||||
#endif
|
||||
|
||||
|
||||
public void Subscribe(Action action)
|
||||
{
|
||||
OnChange += action;
|
||||
}
|
||||
|
||||
public void Unsubscribe(Action action)
|
||||
{
|
||||
OnChange -= action;
|
||||
}
|
||||
|
||||
public bool IsLoaded()
|
||||
{
|
||||
return isLoaded;
|
||||
}
|
||||
|
||||
|
||||
#if NO_SQL
|
||||
|
||||
public async Task Load()
|
||||
{
|
||||
if (isLoaded) return;
|
||||
|
||||
GitChangeModels = (await httpClient.GetFromJsonAsync<GitChangeModel[]>("generated/GitChangeModels.json") ??
|
||||
Array.Empty<GitChangeModel>()).ToList();
|
||||
GitPatchModels = (await httpClient.GetFromJsonAsync<GitPatchModel[]>("generated/GitPatchModels.json") ??
|
||||
Array.Empty<GitPatchModel>()).ToList();
|
||||
|
||||
|
||||
isLoaded = true;
|
||||
|
||||
NotifyDataChanged();
|
||||
}
|
||||
|
||||
#else
|
||||
public async Task Load(DatabaseContext database) {
|
||||
Database = database;
|
||||
|
||||
if (isLoaded) {
|
||||
return;
|
||||
}
|
||||
|
||||
Database.ChangeModels.AddRange(await httpClient.GetFromJsonAsync<ChangeModel[]>("generated/GitChangeModels.json"));
|
||||
Database.PatchModels.AddRange(await httpClient.GetFromJsonAsync<PatchModel[]>("generated/GitPatchModels.json"));
|
||||
Database.SaveChanges();
|
||||
|
||||
|
||||
isLoaded = true;
|
||||
|
||||
NotifyDataChanged();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
public void Update()
|
||||
{
|
||||
NotifyDataChanged();
|
||||
}
|
||||
|
||||
private void NotifyDataChanged()
|
||||
{
|
||||
OnChange?.Invoke();
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,11 @@
|
||||
using Model.BuildOrders;
|
||||
using Model.Doc;
|
||||
using Model.Economy;
|
||||
using Model.Entity;
|
||||
using Model.Feedback;
|
||||
using Model.Git;
|
||||
using Model.MemoryTester;
|
||||
using Model.Notes;
|
||||
using Model.Website;
|
||||
using Model.Website.Enums;
|
||||
using Model.Work.Tasks;
|
||||
using Services.Immortal;
|
||||
using Services.Website;
|
||||
|
||||
@@ -139,23 +136,6 @@ public interface IWebsiteService
|
||||
public bool IsLoaded();
|
||||
}
|
||||
|
||||
public interface IAgileService
|
||||
{
|
||||
#if NO_SQL
|
||||
public List<AgileSprintModel>? AgileSprintModels { get; set; }
|
||||
public List<AgileTaskModel>? AgileTaskModels { get; set; }
|
||||
#else
|
||||
public DbSet<SprintModel> SprintModels { get; }
|
||||
public DbSet<TaskModel> TaskModels { get; }
|
||||
#endif
|
||||
|
||||
public void Subscribe(Action? action);
|
||||
public void Unsubscribe(Action? action);
|
||||
public void Update();
|
||||
|
||||
public Task Load();
|
||||
public bool IsLoaded();
|
||||
}
|
||||
|
||||
public interface INoteService
|
||||
{
|
||||
@@ -169,42 +149,6 @@ public interface INoteService
|
||||
public bool IsLoaded();
|
||||
}
|
||||
|
||||
public interface IDocumentationService
|
||||
{
|
||||
public List<DocContentModel> DocContentModels { get; set; }
|
||||
public List<DocConnectionModel> DocConnectionModels { get; set; }
|
||||
public List<DocContentModel> DocContentModelsByPageOrder { get; set; }
|
||||
public List<DocSectionModel> DocSectionModels { get; set; }
|
||||
|
||||
public void Subscribe(Action? action);
|
||||
public void Unsubscribe(Action? action);
|
||||
public void Update();
|
||||
public Task Load();
|
||||
public bool IsLoaded();
|
||||
}
|
||||
|
||||
public interface IGitService
|
||||
{
|
||||
#if NO_SQL
|
||||
public List<GitChangeModel> GitChangeModels { get; set; }
|
||||
public List<GitPatchModel> GitPatchModels { get; set; }
|
||||
#else
|
||||
public DbSet<ChangeModel> ChangeModels { get; }
|
||||
public DbSet<PatchModel> PatchModels { get; }
|
||||
#endif
|
||||
|
||||
|
||||
public void Subscribe(Action action);
|
||||
public void Unsubscribe(Action action);
|
||||
public void Update();
|
||||
#if NO_SQL
|
||||
public Task Load();
|
||||
#else
|
||||
public Task Load(DatabaseContext database);
|
||||
#endif
|
||||
public bool IsLoaded();
|
||||
}
|
||||
|
||||
public interface INavigationService
|
||||
{
|
||||
public void Subscribe(Action action);
|
||||
|
||||
@@ -5,7 +5,6 @@ namespace Services.Website;
|
||||
|
||||
public class SearchService : ISearchService
|
||||
{
|
||||
private readonly IDocumentationService documentationService;
|
||||
private readonly INoteService noteService;
|
||||
|
||||
|
||||
@@ -13,14 +12,10 @@ public class SearchService : ISearchService
|
||||
|
||||
private bool isLoaded;
|
||||
|
||||
public SearchService(IWebsiteService websiteService, INoteService noteService,
|
||||
IDocumentationService documentationService)
|
||||
public SearchService(IWebsiteService websiteService, INoteService noteService)
|
||||
{
|
||||
this.websiteService = websiteService;
|
||||
this.noteService = noteService;
|
||||
this.documentationService = documentationService;
|
||||
|
||||
// All Unit Data
|
||||
}
|
||||
|
||||
public List<SearchPointModel> SearchPoints { get; set; } = new();
|
||||
@@ -47,12 +42,10 @@ public class SearchService : ISearchService
|
||||
{
|
||||
await websiteService.Load();
|
||||
await noteService.Load();
|
||||
await documentationService.Load();
|
||||
|
||||
|
||||
Searches.Add("Pages", new List<SearchPointModel>());
|
||||
Searches.Add("Notes", new List<SearchPointModel>());
|
||||
Searches.Add("Documents", new List<SearchPointModel>());
|
||||
Searches.Add("Entities", new List<SearchPointModel>());
|
||||
|
||||
foreach (var webPage in websiteService.WebPageModels)
|
||||
|
||||
Reference in New Issue
Block a user