Support for third party modules, improved error handling, standardardized enum naming, reorganized interface definitions, support for DB script upgrades, added Settings entity

This commit is contained in:
Shaun Walker
2019-08-14 09:34:35 -04:00
parent 916109015f
commit b71f007981
78 changed files with 809 additions and 261 deletions

View File

@ -0,0 +1,19 @@
using Oqtane.Models;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Oqtane.Services
{
public interface IAliasService
{
Task<List<Alias>> GetAliasesAsync();
Task<Alias> GetAliasAsync(int AliasId);
Task<Alias> AddAliasAsync(Alias Alias);
Task<Alias> UpdateAliasAsync(Alias Alias);
Task DeleteAliasAsync(int AliasId);
}
}

View File

@ -0,0 +1,12 @@
using Oqtane.Models;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Oqtane.Services
{
public interface IInstallationService
{
Task<GenericResponse> IsInstalled();
Task<GenericResponse> Install(string connectionstring);
}
}

View File

@ -0,0 +1,11 @@
using Oqtane.Models;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Oqtane.Services
{
public interface IModuleDefinitionService
{
Task<List<ModuleDefinition>> GetModuleDefinitionsAsync();
}
}

View File

@ -0,0 +1,16 @@
using Oqtane.Models;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Oqtane.Services
{
public interface IModuleService
{
Task<List<Module>> GetModulesAsync(int PageId);
Task<List<Module>> GetModulesAsync(int SiteId, string ModuleDefinitionName);
Task<Module> GetModuleAsync(int ModuleId);
Task<Module> AddModuleAsync(Module Module);
Task<Module> UpdateModuleAsync(Module Module);
Task DeleteModuleAsync(int ModuleId);
}
}

View File

@ -0,0 +1,15 @@
using Oqtane.Models;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Oqtane.Services
{
public interface IPageModuleService
{
Task<List<PageModule>> GetPageModulesAsync();
Task<PageModule> GetPageModuleAsync(int PageModuleId);
Task<PageModule> AddPageModuleAsync(PageModule PageModule);
Task<PageModule> UpdatePageModuleAsync(PageModule PageModule);
Task DeletePageModuleAsync(int PageModuleId);
}
}

View File

@ -0,0 +1,15 @@
using Oqtane.Models;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Oqtane.Services
{
public interface IPageService
{
Task<List<Page>> GetPagesAsync(int SiteId);
Task<Page> GetPageAsync(int PageId);
Task<Page> AddPageAsync(Page Page);
Task<Page> UpdatePageAsync(Page Page);
Task DeletePageAsync(int PageId);
}
}

View File

@ -0,0 +1,27 @@
using Oqtane.Models;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Oqtane.Services
{
public interface ISettingService
{
Task<List<Setting>> GetModuleSettingsAsync(int ModuleId);
Task<Setting> UpdateModuleSettingsAsync(List<Setting> ModuleSettings, int ModuleId, string SettingName, string SettingValue);
Task<List<Setting>> GetSettingsAsync(string EntityName, int EntityId);
Task<Setting> GetSettingAsync(int SettingId);
Task<Setting> AddSettingAsync(Setting Setting);
Task<Setting> UpdateSettingAsync(Setting Setting);
Task DeleteSettingAsync(int SettingId);
string GetSetting(List<Setting> Settings, string SettingName, string DefaultValue);
}
}

View File

@ -0,0 +1,19 @@
using Oqtane.Models;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Oqtane.Services
{
public interface ISiteService
{
Task<List<Site>> GetSitesAsync();
Task<Site> GetSiteAsync(int SiteId);
Task<Site> AddSiteAsync(Site Site);
Task<Site> UpdateSiteAsync(Site Site);
Task DeleteSiteAsync(int SiteId);
}
}

View File

@ -0,0 +1,13 @@
using Oqtane.Models;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Oqtane.Services
{
public interface ITenantService
{
Task<List<Tenant>> GetTenantsAsync();
Task<Tenant> GetTenantAsync();
}
}

View File

@ -0,0 +1,14 @@
using Oqtane.Models;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Oqtane.Services
{
public interface IThemeService
{
Task<List<Theme>> GetThemesAsync();
Dictionary<string, string> GetThemeTypes(List<Theme> themes);
Dictionary<string, string> GetPaneLayoutTypes(List<Theme> themes);
Dictionary<string, string> GetContainerTypes(List<Theme> themes);
}
}

View File

@ -0,0 +1,29 @@
using Oqtane.Models;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Oqtane.Services
{
public interface IUserService
{
Task<List<User>> GetUsersAsync();
Task<User> GetUserAsync(int UserId);
Task<User> GetUserAsync(string Username);
Task<User> AddUserAsync(User User);
Task<User> UpdateUserAsync(User User);
Task DeleteUserAsync(int UserId);
Task<User> GetCurrentUserAsync();
Task<User> LoginUserAsync(User User);
Task LogoutUserAsync();
bool IsAuthorized(User User, string AccessControlList);
}
}

View File

@ -0,0 +1,39 @@
using Oqtane.Models;
using System.Threading.Tasks;
using System.Net.Http;
using System.Linq;
using Microsoft.AspNetCore.Components;
using System.Collections.Generic;
using Oqtane.Shared;
namespace Oqtane.Services
{
public class InstallationService : ServiceBase, IInstallationService
{
private readonly HttpClient http;
private readonly SiteState sitestate;
private readonly IUriHelper urihelper;
public InstallationService(HttpClient http, SiteState sitestate, IUriHelper urihelper)
{
this.http = http;
this.sitestate = sitestate;
this.urihelper = urihelper;
}
private string apiurl
{
get { return CreateApiUrl(sitestate.Alias, urihelper.GetAbsoluteUri(), "Installation"); }
}
public async Task<GenericResponse> IsInstalled()
{
return await http.GetJsonAsync<GenericResponse>(apiurl + "/installed");
}
public async Task<GenericResponse> Install(string connectionstring)
{
return await http.PostJsonAsync<GenericResponse>(apiurl, connectionstring);
}
}
}