84 lines
3.4 KiB
C#
84 lines
3.4 KiB
C#
using FluentValidation;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using zero.Core.Api;
|
|
using zero.Core.Entities;
|
|
using zero.Core.Extensions;
|
|
using zero.Core.Options;
|
|
using zero.Core.Plugins;
|
|
using zero.Core.Validation;
|
|
using zero.Web.Mapper;
|
|
using zero.Web.Sections;
|
|
|
|
namespace zero.Web.Defaults
|
|
{
|
|
internal class ZeroBackofficePlugin : IZeroPlugin
|
|
{
|
|
public void ConfigureServices(IServiceCollection services)
|
|
{
|
|
services.AddAll(typeof(IValidator<>), ServiceLifetime.Scoped);
|
|
//services.AddAll(typeof(IValidator), ServiceLifetime.Scoped);
|
|
|
|
services.AddTransient<IApplication, Application>();
|
|
//services.AddTransient<IValidator<IApplication>, ApplicationValidator>();
|
|
services.AddTransient<ICountry, Country>();
|
|
services.AddTransient<ILanguage, Language>();
|
|
services.AddTransient<ITranslation, Translation>();
|
|
services.AddTransient<IPage, Page>();
|
|
services.AddTransient<IRecycledEntity, RecycledEntity>();
|
|
services.AddTransient<IMedia, Media>();
|
|
services.AddTransient<IMediaFolder, MediaFolder>();
|
|
services.AddTransient<IPreview, Preview>();
|
|
|
|
services.AddTransient<IApplicationsApi, ApplicationsApi>();
|
|
services.AddTransient<ICountriesApi, CountriesApi>();
|
|
services.AddTransient<ILanguagesApi, LanguagesApi>();
|
|
services.AddTransient<ITranslationsApi, TranslationsApi>();
|
|
services.AddTransient<IUserApi, UserApi>();
|
|
services.AddTransient<IPagesApi, PagesApi>();
|
|
services.AddTransient<IPageTreeApi, PageTreeApi>();
|
|
services.AddTransient<IPreviewApi, PreviewApi>();
|
|
|
|
services.AddTransient<ISetupApi, SetupApi>();
|
|
services.AddTransient<ISectionsApi, SectionsApi>();
|
|
services.AddTransient<ISettingsApi, SettingsApi>();
|
|
services.AddTransient<IAuthenticationApi, AuthenticationApi>();
|
|
services.AddTransient<IUserRolesApi, UserRolesApi>();
|
|
services.AddTransient<IToken, Token>();
|
|
services.AddTransient<ISpacesApi, SpacesApi>();
|
|
services.AddTransient<IPermissionsApi, PermissionsApi>();
|
|
services.AddTransient<IRevisionsApi, RevisionsApi>();
|
|
services.AddTransient<IMediaApi, MediaApi>();
|
|
services.AddTransient<IMediaFolderApi, MediaFolderApi>();
|
|
services.AddTransient<IModulesApi, ModulesApi>();
|
|
services.AddTransient<IRecycleBinApi, RecycleBinApi>();
|
|
}
|
|
|
|
public void Configure(IZeroPluginOptions plugin, IZeroOptions zero)
|
|
{
|
|
plugin.Name = "zero.Defaults";
|
|
plugin.LocalizationPaths.Add("~/Resources/Localization/zero.{lang}.json");
|
|
|
|
zero.Sections.Add<DashboardSection>();
|
|
zero.Sections.Add<PagesSection>();
|
|
zero.Sections.Add<SpacesSection>();
|
|
zero.Sections.Add<MediaSection>();
|
|
zero.Sections.Add<SettingsSection>();
|
|
|
|
zero.Settings.AddGroup<SystemSettings>();
|
|
zero.Settings.AddGroup<PluginSettings>();
|
|
|
|
zero.Mapper.Add<UserMapperConfig>();
|
|
zero.Mapper.Add<CountryMapperConfig>();
|
|
zero.Mapper.Add<TranslationMapperConfig>();
|
|
zero.Mapper.Add<LanguageMapperConfig>();
|
|
zero.Mapper.Add<ApplicationMapperConfig>();
|
|
zero.Mapper.Add<MediaMapperConfig>();
|
|
zero.Mapper.Add<SpaceMapperConfig>();
|
|
|
|
zero.Permissions.AddCollection<SectionPermissions>();
|
|
zero.Permissions.AddCollection<ModulePermissions>();
|
|
zero.Permissions.AddCollection<SettingsPermissions>();
|
|
zero.Permissions.AddCollection<SpacePermissions>();
|
|
}
|
|
}
|
|
} |