Browse Source

Merge branch 'dev' of https://github.com/abpframework/abp into dev

pull/3276/head
Alper Ebicoglu 7 years ago
parent
commit
db4b8d111b
  1. 1
      abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json
  2. 2
      abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json
  3. 3
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/LanguageSwitch/Default.cshtml
  4. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/FodyWeavers.xml
  5. 18
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs
  6. 11
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpConventionalControllerOptions.cs
  7. 25
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/ConventionalControllerSetting.cs
  8. 15
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs
  9. 7
      framework/src/Volo.Abp.Core/Volo/Abp/RemoteServiceAttribute.cs
  10. 4
      framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ApplicationApiDescriptionModel.cs
  11. 14
      framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ModuleApiDescriptionModel.cs
  12. 7
      modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/AccountRemoteServiceConsts.cs
  13. 5
      modules/account/src/Volo.Abp.Account.HttpApi.Client/Volo/Abp/Account/AbpAccountHttpApiClientModule.cs
  14. 2
      modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/AccountController.cs
  15. 2
      modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/AccountController.cs
  16. 7
      modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/BloggingRemoteServiceConsts.cs
  17. 20
      modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Blogs/BlogEto.cs
  18. 16
      modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Comments/CommentEto.cs
  19. 29
      modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Posts/PostEto.cs
  20. 20
      modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Tagging/TagEto.cs
  21. 1
      modules/blogging/src/Volo.Blogging.Domain/Volo.Blogging.Domain.csproj
  22. 19
      modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/BloggingDomainMappingProfile.cs
  23. 28
      modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/BloggingDomainModule.cs
  24. 5
      modules/blogging/src/Volo.Blogging.HttpApi.Client/Volo/Blogging/BloggingHttpApiClientModule.cs
  25. 2
      modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/BlogFilesController.cs
  26. 2
      modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/BlogsController.cs
  27. 2
      modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/CommentsController.cs
  28. 2
      modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs
  29. 2
      modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/TagsController.cs
  30. 41
      modules/docs/src/Volo.Docs.Domain.Shared/Volo/Docs/Documents/DocumentEto.cs
  31. 30
      modules/docs/src/Volo.Docs.Domain.Shared/Volo/Docs/Projects/ProjectEto.cs
  32. 1
      modules/docs/src/Volo.Docs.Domain/Volo.Docs.Domain.csproj
  33. 15
      modules/docs/src/Volo.Docs.Domain/Volo/Docs/DocsDomainMappingProfile.cs
  34. 19
      modules/docs/src/Volo.Docs.Domain/Volo/Docs/DocsDomainModule.cs
  35. 7
      modules/feature-management/src/Volo.Abp.FeatureManagement.Application.Contracts/Volo/Abp/FeatureManagement/FeatureManagementRemoteServiceConsts.cs
  36. 4
      modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi.Client/Volo/Abp/FeatureManagement/AbpFeatureManagementHttpApiClientModule.cs
  37. 2
      modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi/Volo/Abp/FeatureManagement/FeaturesController.cs
  38. 7
      modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityRemoteServiceConsts.cs
  39. 4
      modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Volo/Abp/Identity/AbpIdentityHttpApiClientModule.cs
  40. 3
      modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityRoleController.cs
  41. 2
      modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityUserController.cs
  42. 2
      modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityUserLookupController.cs
  43. 2
      modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/ProfileController.cs
  44. 20
      modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiResourceEto.cs
  45. 84
      modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientEto.cs
  46. 22
      modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Devices/DeviceFlowCodesEto.cs
  47. 24
      modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Grants/PersistedGrantEto.cs
  48. 24
      modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceEto.cs
  49. 14
      modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs
  50. 7
      modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerAutoMapperProfile.cs
  51. 7
      modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/PermissionManagementRemoteServiceConsts.cs
  52. 4
      modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi.Client/Volo/Abp/PermissionManagement/AbpPermissionManagementHttpApiClientModule.cs
  53. 2
      modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi/Volo/Abp/PermissionManagement/PermissionsController.cs
  54. 7
      modules/tenant-management/src/Volo.Abp.TenantManagement.Application.Contracts/Volo/Abp/TenantManagement/TenantManagementRemoteServiceConsts.cs
  55. 4
      modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi.Client/Volo/Abp/TenantManagement/AbpTenantManagementHttpApiClientModule.cs
  56. 2
      modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi/Volo/Abp/TenantManagement/TenantController.cs
  57. 42
      npm/ng-packs/packages/core/src/lib/services/rest.service.ts
  58. 18
      npm/ng-packs/packages/core/src/lib/tests/common-utils.spec.ts
  59. 46
      npm/ng-packs/packages/core/src/lib/tests/rest.service.spec.ts
  60. 4
      npm/ng-packs/packages/core/src/lib/utils/common-utils.ts

1
abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json

@ -81,6 +81,7 @@
"LastSeenDate": "Last seen date",
"{0}Computer{1}WillBeRemovedFromRecords": "Computer of {0} ({1}) will be removed from records",
"OrganizationDeletionWarningMessage": "Organization will be deleted",
"DeletingLastOwnerWarningMessage": "An organization must have at least one owner! Therefore you cannot remove this owner",
"This{0}AlreadyExistInThisOrganization": "This {0} already exist in this organization",
"AreYouSureYouWantToDeleteAllComputers": "Are you sure you want to delete all computers?",
"DeleteAll": "Delete all",

2
abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json

@ -29,7 +29,7 @@
"ApiKey": "API key",
"UserNameNotFound": "There is no user with username {0}",
"SuccessfullyAddedToNewsletter": "Thanks you for subscribing to our newsletter!",
"ManageProfile": "Manage your profile",
"MyProfile": "My profile",
"EmailNotValid": "Please enter a valid email address."
}
}

3
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/LanguageSwitch/Default.cshtml

@ -1,4 +1,5 @@
@using System.Linq
@using Microsoft.AspNetCore.Http.Extensions
@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Themes.Basic.Components.Toolbar.LanguageSwitch
@model LanguageSwitchViewComponentModel
@if (Model.OtherLanguages.Any())
@ -11,7 +12,7 @@
<div class="dropdown-menu dropdown-menu-right border-0 shadow-sm" aria-labelledby="dropdownMenuLink">
@foreach (var language in Model.OtherLanguages)
{
<a class="dropdown-item" href="/Abp/Languages/Switch?culture=@(language.CultureName)&uiCulture=@(language.UiCultureName)&returnUrl=@Context.Request.Path">@language.DisplayName</a>
<a class="dropdown-item" href="/Abp/Languages/Switch?culture=@(language.CultureName)&uiCulture=@(language.UiCultureName)&returnUrl=@(System.Net.WebUtility.UrlEncode(Context.Request.GetEncodedPathAndQuery()))">@language.DisplayName</a>
}
</div>
</div>

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/FodyWeavers.xml

@ -1,3 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait />
<ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers>

18
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs

@ -73,7 +73,7 @@ namespace Volo.Abp.AspNetCore.Mvc
var controllerType = apiDescription.ActionDescriptor.AsControllerActionDescriptor().ControllerTypeInfo.AsType();
var setting = FindSetting(controllerType);
var moduleModel = applicationModel.GetOrAddModule(GetRootPath(controllerType, setting));
var moduleModel = applicationModel.GetOrAddModule(GetRootPath(controllerType, setting), GetRemoteServiceName(controllerType, setting));
var controllerModel = moduleModel.GetOrAddController(controllerType.FullName, CalculateControllerName(controllerType, setting), controllerType, _modelOptions.IgnoredInterfaces);
@ -289,6 +289,22 @@ namespace Volo.Abp.AspNetCore.Mvc
return ModuleApiDescriptionModel.DefaultRootPath;
}
private string GetRemoteServiceName(Type controllerType, [CanBeNull] ConventionalControllerSetting setting)
{
if (setting != null)
{
return setting.RemoteServiceName;
}
var remoteServiceAttr = controllerType.GetCustomAttributes().OfType<RemoteServiceAttribute>().FirstOrDefault();
if (remoteServiceAttr?.Name != null)
{
return remoteServiceAttr.Name;
}
return ModuleApiDescriptionModel.DefaultRemoteServiceName;
}
[CanBeNull]
private ConventionalControllerSetting FindSetting(Type controllerType)
{

11
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpConventionalControllerOptions.cs

@ -23,9 +23,16 @@ namespace Volo.Abp.AspNetCore.Mvc.Conventions
};
}
public AbpConventionalControllerOptions Create(Assembly assembly, [CanBeNull] Action<ConventionalControllerSetting> optionsAction = null)
public AbpConventionalControllerOptions Create(
Assembly assembly,
[CanBeNull] Action<ConventionalControllerSetting> optionsAction = null)
{
var setting = new ConventionalControllerSetting(assembly, ModuleApiDescriptionModel.DefaultRootPath);
var setting = new ConventionalControllerSetting(
assembly,
ModuleApiDescriptionModel.DefaultRootPath,
ModuleApiDescriptionModel.DefaultRemoteServiceName
);
optionsAction?.Invoke(setting);
setting.Initialize();
ConventionalControllerSettings.Add(setting);

25
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/ConventionalControllerSetting.cs

@ -30,6 +30,18 @@ namespace Volo.Abp.AspNetCore.Mvc.Conventions
}
private string _rootPath;
[NotNull]
public string RemoteServiceName
{
get => _remoteServiceName;
set
{
Check.NotNull(value, nameof(value));
_remoteServiceName = value;
}
}
private string _remoteServiceName;
[CanBeNull]
public Func<Type, bool> TypePredicate { get; set; }
@ -46,15 +58,16 @@ namespace Volo.Abp.AspNetCore.Mvc.Conventions
public Action<ApiVersioningOptions> ApiVersionConfigurer { get; set; }
public ConventionalControllerSetting([NotNull] Assembly assembly, [NotNull] string rootPath)
public ConventionalControllerSetting(
[NotNull] Assembly assembly,
[NotNull] string rootPath,
[NotNull] string remoteServiceName)
{
Check.NotNull(assembly, rootPath);
Assembly = assembly;
RootPath = rootPath;
Assembly = Check.NotNull(assembly, nameof(assembly));
RootPath = Check.NotNull(rootPath, nameof(rootPath));
RemoteServiceName = Check.NotNull(remoteServiceName, nameof(remoteServiceName));
ControllerTypes = new HashSet<Type>();
ApiVersions = new List<ApiVersion>();
}

15
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GenerateProxyCommand.cs

@ -67,7 +67,8 @@ namespace Volo.Abp.Cli.Commands
var data = JObject.Parse(json);
Logger.LogInformation("Modules are combining");
var moduleList = GetCombinedModules(data, module);
var apiNameList = new Dictionary<string, string>();
var moduleList = GetCombinedModules(data, module, out apiNameList);
if (moduleList.Count < 1)
{
@ -85,6 +86,7 @@ namespace Volo.Abp.Cli.Commands
var moduleValue = JObject.Parse(moduleItem.Value);
var rootPath = moduleItem.Key;
var apiName = apiNameList.Where(p => p.Key == rootPath).Select(p => p.Value).FirstOrDefault();
Logger.LogInformation($"{rootPath} directory is creating");
@ -105,6 +107,8 @@ namespace Volo.Abp.Cli.Commands
serviceFileText.AppendLine("");
serviceFileText.AppendLine("@Injectable({providedIn: 'root'})");
serviceFileText.AppendLine("export class [controllerName]Service {");
serviceFileText.AppendLine(" apiName = '"+ apiName + "';");
serviceFileText.AppendLine("");
serviceFileText.AppendLine(" constructor(private restService: RestService) {}");
serviceFileText.AppendLine("");
@ -309,8 +313,8 @@ namespace Volo.Abp.Cli.Commands
serviceFileText.AppendLine(
url.Contains("${")
? $" return this.restService.request({{ url: `/{url}`, method: '{httpMethod}'{bodyExtra}{modelBindingExtra} }});"
: $" return this.restService.request({{ url: '/{url}', method: '{httpMethod}'{bodyExtra}{modelBindingExtra} }});");
? $" return this.restService.request({{ url: `/{url}`, method: '{httpMethod}'{bodyExtra}{modelBindingExtra} }},{{ apiName: this.apiName }});"
: $" return this.restService.request({{ url: '/{url}', method: '{httpMethod}'{bodyExtra}{modelBindingExtra} }},{{ apiName: this.apiName }});");
serviceFileText.AppendLine(" }");
@ -369,13 +373,15 @@ namespace Volo.Abp.Cli.Commands
Logger.LogInformation("Completed!");
}
private Dictionary<string, string> GetCombinedModules(JToken data, string module)
private Dictionary<string, string> GetCombinedModules(JToken data, string module, out Dictionary<string, string> apiNameList)
{
var moduleList = new Dictionary<string, string>();
apiNameList = new Dictionary<string, string>();
foreach (var moduleItem in data["modules"])
{
var rootPath = ((string)moduleItem.First["rootPath"]).ToLower();
var apiName = (string)moduleItem.First["remoteServiceName"];
if (moduleList.Any(p => p.Key == rootPath))
{
@ -385,6 +391,7 @@ namespace Volo.Abp.Cli.Commands
}
else
{
apiNameList.Add(rootPath, apiName);
moduleList.Add(rootPath, moduleItem.First["controllers"].ToString());
}
}

7
framework/src/Volo.Abp.Core/Volo/Abp/RemoteServiceAttribute.cs

@ -17,6 +17,13 @@ namespace Volo.Abp
/// </summary>
public bool IsMetadataEnabled { get; set; }
/// <summary>
/// Group name of the remote service.
/// Group names of all services of a module expected to be the same.
/// This name is also used to distinguish the service endpoint of this group.
/// </summary>
public string Name { get; set; }
public RemoteServiceAttribute(bool isEnabled = true)
{
IsEnabled = isEnabled;

4
framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ApplicationApiDescriptionModel.cs

@ -36,9 +36,9 @@ namespace Volo.Abp.Http.Modeling
return Modules[module.RootPath] = module;
}
public ModuleApiDescriptionModel GetOrAddModule(string rootPath)
public ModuleApiDescriptionModel GetOrAddModule(string rootPath, string remoteServiceName)
{
return Modules.GetOrAdd(rootPath, () => ModuleApiDescriptionModel.Create(rootPath));
return Modules.GetOrAdd(rootPath, () => ModuleApiDescriptionModel.Create(rootPath, remoteServiceName));
}
public ApplicationApiDescriptionModel CreateSubModel(string[] modules = null, string[] controllers = null, string[] actions = null)

14
framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ModuleApiDescriptionModel.cs

@ -11,10 +11,17 @@ namespace Volo.Abp.Http.Modeling
/// <summary>
/// "app".
/// </summary>
public const string DefaultRootPath = "app";
public const string DefaultRootPath = "app";
/// <summary>
/// "Default".
/// </summary>
public const string DefaultRemoteServiceName = "Default";
public string RootPath { get; set; }
public string RemoteServiceName { get; set; }
public IDictionary<string, ControllerApiDescriptionModel> Controllers { get; set; }
private ModuleApiDescriptionModel()
@ -22,11 +29,12 @@ namespace Volo.Abp.Http.Modeling
}
public static ModuleApiDescriptionModel Create(string rootPath)
public static ModuleApiDescriptionModel Create(string rootPath, string remoteServiceName)
{
return new ModuleApiDescriptionModel
{
RootPath = rootPath,
RemoteServiceName = remoteServiceName,
Controllers = new Dictionary<string, ControllerApiDescriptionModel>()
};
}
@ -48,7 +56,7 @@ namespace Volo.Abp.Http.Modeling
public ModuleApiDescriptionModel CreateSubModel(string[] controllers, string[] actions)
{
var subModel = Create(RootPath);
var subModel = Create(RootPath, RemoteServiceName);
foreach (var controller in Controllers.Values)
{

7
modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/AccountRemoteServiceConsts.cs

@ -0,0 +1,7 @@
namespace Volo.Abp.Account
{
public static class AccountRemoteServiceConsts
{
public const string RemoteServiceName = "AbpAccount";
}
}

5
modules/account/src/Volo.Abp.Account.HttpApi.Client/Volo/Abp/Account/AbpAccountHttpApiClientModule.cs

@ -9,11 +9,10 @@ namespace Volo.Abp.Account
typeof(AbpHttpClientModule))]
public class AbpAccountHttpApiClientModule : AbpModule
{
public const string RemoteServiceName = "Account";
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddHttpClientProxies(typeof(AbpAccountApplicationContractsModule).Assembly, RemoteServiceName);
context.Services.AddHttpClientProxies(typeof(AbpAccountApplicationContractsModule).Assembly,
AccountRemoteServiceConsts.RemoteServiceName);
}
}
}

2
modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/AccountController.cs

@ -5,7 +5,7 @@ using Volo.Abp.Identity;
namespace Volo.Abp.Account
{
[RemoteService]
[RemoteService(Name = AccountRemoteServiceConsts.RemoteServiceName)]
[Area("account")]
[Route("api/account")]
public class AccountController : AbpController, IAccountAppService

2
modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/AccountController.cs

@ -15,7 +15,7 @@ using IdentityUser = Volo.Abp.Identity.IdentityUser;
namespace Volo.Abp.Account.Web.Areas.Account.Controllers
{
[RemoteService]
[RemoteService(Name = AccountRemoteServiceConsts.RemoteServiceName)]
[Controller]
[ControllerName("Login")]
[Area("Account")]

7
modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/BloggingRemoteServiceConsts.cs

@ -0,0 +1,7 @@
namespace Volo.Blogging
{
public static class BloggingRemoteServiceConsts
{
public const string RemoteServiceName = "Blogging";
}
}

20
modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Blogs/BlogEto.cs

@ -0,0 +1,20 @@
using System;
using JetBrains.Annotations;
namespace Volo.Blogging.Blogs
{
[Serializable]
public class BlogEto
{
public Guid Id { get; set; }
[NotNull]
public string Name { get; set; }
[NotNull]
public string ShortName { get; set; }
[CanBeNull]
public string Description { get; set; }
}
}

16
modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Comments/CommentEto.cs

@ -0,0 +1,16 @@
using System;
namespace Volo.Blogging.Comments
{
[Serializable]
public class CommentEto
{
public Guid Id { get; set; }
public Guid PostId { get; set; }
public Guid? RepliedCommentId { get; set; }
public string Text { get; set; }
}
}

29
modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Posts/PostEto.cs

@ -0,0 +1,29 @@
using JetBrains.Annotations;
using System;
using System.Collections.Generic;
using Volo.Blogging.Tagging;
namespace Volo.Blogging.Posts
{
[Serializable]
public class PostEto
{
public Guid Id { get; set; }
public Guid BlogId { get; set; }
[NotNull]
public string Url { get; set; }
[NotNull]
public string CoverImage { get; set; }
[NotNull]
public string Title { get; set; }
[CanBeNull]
public string Content { get; set; }
public int ReadCount { get; set; }
}
}

20
modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Tagging/TagEto.cs

@ -0,0 +1,20 @@
using System;
using JetBrains.Annotations;
namespace Volo.Blogging.Tagging
{
[Serializable]
public class TagEto
{
public Guid Id { get; set; }
public Guid BlogId { get; set; }
[NotNull]
public string Name { get; set; }
public string Description { get; set; }
public int UsageCount { get; set; }
}
}

1
modules/blogging/src/Volo.Blogging.Domain/Volo.Blogging.Domain.csproj

@ -13,6 +13,7 @@
<ItemGroup>
<ProjectReference Include="..\Volo.Blogging.Domain.Shared\Volo.Blogging.Domain.Shared.csproj" />
<ProjectReference Include="..\..\..\users\src\Volo.Abp.Users.Domain\Volo.Abp.Users.Domain.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AutoMapper\Volo.Abp.AutoMapper.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.Ddd.Domain\Volo.Abp.Ddd.Domain.csproj" />
</ItemGroup>

19
modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/BloggingDomainMappingProfile.cs

@ -0,0 +1,19 @@
using AutoMapper;
using Volo.Blogging.Blogs;
using Volo.Blogging.Comments;
using Volo.Blogging.Posts;
using Volo.Blogging.Tagging;
namespace Volo.Blogging
{
public class BloggingDomainMappingProfile : Profile
{
public BloggingDomainMappingProfile()
{
CreateMap<Blog, BlogEto>();
CreateMap<Comment, CommentEto>();
CreateMap<Post, PostEto>();
CreateMap<Tag, TagEto>();
}
}
}

28
modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/BloggingDomainModule.cs

@ -1,13 +1,37 @@
using Volo.Abp.Domain;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AutoMapper;
using Volo.Abp.Domain;
using Volo.Abp.EventBus.Distributed;
using Volo.Abp.Modularity;
using Volo.Blogging.Blogs;
using Volo.Blogging.Comments;
using Volo.Blogging.Posts;
using Volo.Blogging.Tagging;
namespace Volo.Blogging
{
[DependsOn(
typeof(BloggingDomainSharedModule),
typeof(AbpDddDomainModule))]
typeof(AbpDddDomainModule),
typeof(AbpAutoMapperModule))]
public class BloggingDomainModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAutoMapperObjectMapper<BloggingDomainModule>();
Configure<AbpAutoMapperOptions>(options =>
{
options.AddProfile<BloggingDomainMappingProfile>(validate: true);
});
Configure<AbpDistributedEventBusOptions>(options =>
{
options.EtoMappings.Add<Blog, BlogEto>(typeof(BloggingDomainModule));
options.EtoMappings.Add<Comment, CommentEto>(typeof(BloggingDomainModule));
options.EtoMappings.Add<Post, PostEto>(typeof(BloggingDomainModule));
options.EtoMappings.Add<Tag, TagEto>(typeof(BloggingDomainModule));
});
}
}
}

5
modules/blogging/src/Volo.Blogging.HttpApi.Client/Volo/Blogging/BloggingHttpApiClientModule.cs

@ -9,11 +9,10 @@ namespace Volo.Blogging
typeof(AbpHttpClientModule))]
public class BloggingHttpApiClientModule : AbpModule
{
public const string RemoteServiceName = "Blogging";
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddHttpClientProxies(typeof(BloggingApplicationContractsModule).Assembly, RemoteServiceName);
context.Services.AddHttpClientProxies(typeof(BloggingApplicationContractsModule).Assembly,
BloggingRemoteServiceConsts.RemoteServiceName);
}
}

2
modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/BlogFilesController.cs

@ -10,7 +10,7 @@ using Volo.Blogging.Files;
namespace Volo.Blogging
{
[RemoteService]
[RemoteService(Name = BloggingRemoteServiceConsts.RemoteServiceName)]
[Area("blogging")]
[Route("api/blogging/files")]
public class BlogFilesController : AbpController, IFileAppService

2
modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/BlogsController.cs

@ -9,7 +9,7 @@ using Volo.Blogging.Blogs.Dtos;
namespace Volo.Blogging
{
[RemoteService]
[RemoteService(Name = BloggingRemoteServiceConsts.RemoteServiceName)]
[Area("blogging")]
[Route("api/blogging/blogs")]
public class BlogsController : AbpController, IBlogAppService

2
modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/CommentsController.cs

@ -9,7 +9,7 @@ using Volo.Blogging.Comments.Dtos;
namespace Volo.Blogging
{
[RemoteService]
[RemoteService(Name = BloggingRemoteServiceConsts.RemoteServiceName)]
[Area("blogging")]
[Route("api/blogging/comments")]
public class CommentsController : AbpController, ICommentAppService

2
modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs

@ -8,7 +8,7 @@ using Volo.Blogging.Posts;
namespace Volo.Blogging
{
[RemoteService]
[RemoteService(Name = BloggingRemoteServiceConsts.RemoteServiceName)]
[Area("blogging")]
[Route("api/blogging/posts")]
public class PostsController : AbpController, IPostAppService

2
modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/TagsController.cs

@ -9,7 +9,7 @@ using Volo.Blogging.Tagging.Dtos;
namespace Volo.Blogging
{
[RemoteService]
[RemoteService(Name = BloggingRemoteServiceConsts.RemoteServiceName)]
[Area("blogging")]
[Route("api/blogging/tags")]
public class TagsController : AbpController, ITagAppService

41
modules/docs/src/Volo.Docs.Domain.Shared/Volo/Docs/Documents/DocumentEto.cs

@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
namespace Volo.Docs.Documents
{
[Serializable]
public class DocumentEto
{
public Guid Id { get; set; }
public Guid ProjectId { get; set; }
public string Name { get; set; }
public string Version { get; set; }
public string LanguageCode { get; set; }
public string FileName { get; set; }
public string Content { get; set; }
public string Format { get; set; }
public string EditLink { get; set; }
public string RootUrl { get; set; }
public string RawRootUrl { get; set; }
public string LocalDirectory { get; set; }
public DateTime CreationTime { get; set; }
public DateTime LastUpdatedTime { get; set; }
public DateTime? LastSignificantUpdateTime { get; set; }
public DateTime LastCachedTime { get; set; }
}
}

30
modules/docs/src/Volo.Docs.Domain.Shared/Volo/Docs/Projects/ProjectEto.cs

@ -0,0 +1,30 @@
using System;
namespace Volo.Docs.Projects
{
[Serializable]
public class ProjectEto
{
public Guid Id { get; set; }
public string Name { get; set; }
public string ShortName { get; set; }
public string Format { get; set; }
public string DefaultDocumentName { get; set; }
public string NavigationDocumentName { get; set; }
public string ParametersDocumentName { get; set; }
public string MinimumVersion { get; set; }
public string DocumentStoreType { get; set; }
public string MainWebsiteUrl { get; set; }
public string LatestVersionBranchName { get; set; }
}
}

1
modules/docs/src/Volo.Docs.Domain/Volo.Docs.Domain.csproj

@ -25,6 +25,7 @@
<ProjectReference Include="..\Volo.Docs.Domain.Shared\Volo.Docs.Domain.Shared.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.Ddd.Domain\Volo.Abp.Ddd.Domain.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.Caching\Volo.Abp.Caching.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AutoMapper\Volo.Abp.AutoMapper.csproj" />
</ItemGroup>
</Project>

15
modules/docs/src/Volo.Docs.Domain/Volo/Docs/DocsDomainMappingProfile.cs

@ -0,0 +1,15 @@
using AutoMapper;
using Volo.Docs.Documents;
using Volo.Docs.Projects;
namespace Volo.Docs
{
public class DocsDomainMappingProfile : Profile
{
public DocsDomainMappingProfile()
{
CreateMap<Document, DocumentEto>();
CreateMap<Project, ProjectEto>();
}
}
}

19
modules/docs/src/Volo.Docs.Domain/Volo/Docs/DocsDomainModule.cs

@ -2,7 +2,9 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Volo.Abp;
using Volo.Abp.AutoMapper;
using Volo.Abp.Domain;
using Volo.Abp.EventBus.Distributed;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.Threading;
@ -12,17 +14,32 @@ using Volo.Docs.Documents.FullSearch.Elastic;
using Volo.Docs.FileSystem.Documents;
using Volo.Docs.GitHub.Documents;
using Volo.Docs.Localization;
using Volo.Docs.Projects;
namespace Volo.Docs
{
[DependsOn(
typeof(DocsDomainSharedModule),
typeof(AbpDddDomainModule)
typeof(AbpDddDomainModule),
typeof(AbpAutoMapperModule)
)]
public class DocsDomainModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAutoMapperObjectMapper<DocsDomainModule>();
Configure<AbpAutoMapperOptions>(options =>
{
options.AddProfile<DocsDomainMappingProfile>(validate: true);
});
Configure<AbpDistributedEventBusOptions>(options =>
{
options.EtoMappings.Add<Document, DocumentEto>(typeof(DocsDomainModule));
options.EtoMappings.Add<Project, ProjectEto>(typeof(DocsDomainModule));
});
Configure<AbpVirtualFileSystemOptions>(options =>
{
options.FileSets

7
modules/feature-management/src/Volo.Abp.FeatureManagement.Application.Contracts/Volo/Abp/FeatureManagement/FeatureManagementRemoteServiceConsts.cs

@ -0,0 +1,7 @@
namespace Volo.Abp.FeatureManagement
{
public class FeatureManagementRemoteServiceConsts
{
public const string RemoteServiceName = "FeatureManagement";
}
}

4
modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi.Client/Volo/Abp/FeatureManagement/AbpFeatureManagementHttpApiClientModule.cs

@ -9,13 +9,11 @@ namespace Volo.Abp.FeatureManagement
typeof(AbpHttpClientModule))]
public class AbpFeatureManagementHttpApiClientModule : AbpModule
{
public const string RemoteServiceName = "AbpFeatureManagement";
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddHttpClientProxies(
typeof(AbpFeatureManagementApplicationContractsModule).Assembly,
RemoteServiceName
FeatureManagementRemoteServiceConsts.RemoteServiceName
);
}
}

2
modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi/Volo/Abp/FeatureManagement/FeaturesController.cs

@ -4,7 +4,7 @@ using Volo.Abp.AspNetCore.Mvc;
namespace Volo.Abp.FeatureManagement
{
[RemoteService]
[RemoteService(Name = FeatureManagementRemoteServiceConsts.RemoteServiceName)]
[Area("abp")]
public class FeaturesController : AbpController, IFeatureAppService
{

7
modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityRemoteServiceConsts.cs

@ -0,0 +1,7 @@
namespace Volo.Abp.Identity
{
public static class IdentityRemoteServiceConsts
{
public const string RemoteServiceName = "AbpIdentity";
}
}

4
modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Volo/Abp/Identity/AbpIdentityHttpApiClientModule.cs

@ -9,13 +9,11 @@ namespace Volo.Abp.Identity
typeof(AbpHttpClientModule))]
public class AbpIdentityHttpApiClientModule : AbpModule
{
public const string RemoteServiceName = "AbpIdentity";
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddHttpClientProxies(
typeof(AbpIdentityApplicationContractsModule).Assembly,
RemoteServiceName
IdentityRemoteServiceConsts.RemoteServiceName
);
}
}

3
modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityRoleController.cs

@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.Application.Dtos;
@ -7,7 +6,7 @@ using Volo.Abp.AspNetCore.Mvc;
namespace Volo.Abp.Identity
{
[RemoteService]
[RemoteService(Name = IdentityRemoteServiceConsts.RemoteServiceName)]
[Area("identity")]
[ControllerName("Role")]
[Route("api/identity/roles")]

2
modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityUserController.cs

@ -6,7 +6,7 @@ using Volo.Abp.AspNetCore.Mvc;
namespace Volo.Abp.Identity
{
[RemoteService]
[RemoteService(Name = IdentityRemoteServiceConsts.RemoteServiceName)]
[Area("identity")]
[ControllerName("User")]
[Route("api/identity/users")]

2
modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityUserLookupController.cs

@ -6,7 +6,7 @@ using Volo.Abp.Users;
namespace Volo.Abp.Identity
{
[RemoteService]
[RemoteService(Name = IdentityRemoteServiceConsts.RemoteServiceName)]
[Area("identity")]
[ControllerName("UserLookup")]
[Route("api/identity/users/lookup")]

2
modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/ProfileController.cs

@ -4,7 +4,7 @@ using Volo.Abp.AspNetCore.Mvc;
namespace Volo.Abp.Identity
{
[RemoteService]
[RemoteService(Name = IdentityRemoteServiceConsts.RemoteServiceName)]
[Area("identity")]
[ControllerName("Profile")]
[Route("/api/identity/my-profile")]

20
modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiResourceEto.cs

@ -0,0 +1,20 @@
using System;
using JetBrains.Annotations;
namespace Volo.Abp.IdentityServer.ApiResources
{
[Serializable]
public class ApiResourceEto
{
public Guid Id { get; set; }
[NotNull]
public string Name { get; set; }
public string DisplayName { get; set; }
public string Description { get; set; }
public bool Enabled { get; set; }
}
}

84
modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientEto.cs

@ -0,0 +1,84 @@
using System;
namespace Volo.Abp.IdentityServer.Clients
{
[Serializable]
public class ClientEto
{
public Guid Id { get; set; }
public string ClientId { get; set; }
public string ClientName { get; set; }
public string Description { get; set; }
public string ClientUri { get; set; }
public string LogoUri { get; set; }
public bool Enabled { get; set; } = true;
public string ProtocolType { get; set; }
public bool RequireClientSecret { get; set; }
public bool RequireConsent { get; set; }
public bool AllowRememberConsent { get; set; }
public bool AlwaysIncludeUserClaimsInIdToken { get; set; }
public bool RequirePkce { get; set; }
public bool AllowPlainTextPkce { get; set; }
public bool AllowAccessTokensViaBrowser { get; set; }
public string FrontChannelLogoutUri { get; set; }
public bool FrontChannelLogoutSessionRequired { get; set; }
public string BackChannelLogoutUri { get; set; }
public bool BackChannelLogoutSessionRequired { get; set; }
public bool AllowOfflineAccess { get; set; }
public int IdentityTokenLifetime { get; set; }
public int AccessTokenLifetime { get; set; }
public int AuthorizationCodeLifetime { get; set; }
public int? ConsentLifetime { get; set; }
public int AbsoluteRefreshTokenLifetime { get; set; }
public int SlidingRefreshTokenLifetime { get; set; }
public int RefreshTokenUsage { get; set; }
public bool UpdateAccessTokenClaimsOnRefresh { get; set; }
public int RefreshTokenExpiration { get; set; }
public int AccessTokenType { get; set; }
public bool EnableLocalLogin { get; set; }
public bool IncludeJwtId { get; set; }
public bool AlwaysSendClientClaims { get; set; }
public string ClientClaimsPrefix { get; set; }
public string PairWiseSubjectSalt { get; set; }
public int? UserSsoLifetime { get; set; }
public string UserCodeType { get; set; }
public int DeviceCodeLifetime { get; set; }
}
}

22
modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Devices/DeviceFlowCodesEto.cs

@ -0,0 +1,22 @@
using System;
namespace Volo.Abp.IdentityServer.Devices
{
[Serializable]
public class DeviceFlowCodesEto
{
public Guid Id { get; set; }
public string DeviceCode { get; set; }
public string UserCode { get; set; }
public string SubjectId { get; set; }
public string ClientId { get; set; }
public DateTime? Expiration { get; set; }
public string Data { get; set; }
}
}

24
modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Grants/PersistedGrantEto.cs

@ -0,0 +1,24 @@
using System;
namespace Volo.Abp.IdentityServer.Grants
{
[Serializable]
public class PersistedGrantEto
{
public Guid Id { get; set; }
public string Key { get; set; }
public string Type { get; set; }
public string SubjectId { get; set; }
public string ClientId { get; set; }
public DateTime CreationTime { get; set; }
public DateTime? Expiration { get; set; }
public string Data { get; set; }
}
}

24
modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceEto.cs

@ -0,0 +1,24 @@
using System;
namespace Volo.Abp.IdentityServer.IdentityResources
{
[Serializable]
public class IdentityResourceEto
{
public Guid Id { get; set; }
public string Name { get; set; }
public string DisplayName { get; set; }
public string Description { get; set; }
public bool Enabled { get; set; }
public bool Required { get; set; }
public bool Emphasize { get; set; }
public bool ShowInDiscoveryDocument { get; set; }
}
}

14
modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs

@ -6,7 +6,13 @@ using Microsoft.Extensions.Options;
using Volo.Abp.AutoMapper;
using Volo.Abp.BackgroundWorkers;
using Volo.Abp.Caching;
using Volo.Abp.EventBus.Distributed;
using Volo.Abp.Identity;
using Volo.Abp.IdentityServer.ApiResources;
using Volo.Abp.IdentityServer.Clients;
using Volo.Abp.IdentityServer.Devices;
using Volo.Abp.IdentityServer.Grants;
using Volo.Abp.IdentityServer.IdentityResources;
using Volo.Abp.IdentityServer.Tokens;
using Volo.Abp.Modularity;
using Volo.Abp.Security;
@ -34,6 +40,14 @@ namespace Volo.Abp.IdentityServer
options.AddProfile<IdentityServerAutoMapperProfile>(validate: true);
});
Configure<AbpDistributedEventBusOptions>(options =>
{
options.EtoMappings.Add<ApiResource, ApiResourceEto>(typeof(AbpIdentityServerDomainModule));
options.EtoMappings.Add<Client, ClientEto>(typeof(AbpIdentityServerDomainModule));
options.EtoMappings.Add<DeviceFlowCodes, DeviceFlowCodesEto>(typeof(AbpIdentityServerDomainModule));
options.EtoMappings.Add<IdentityResource, IdentityResourceEto>(typeof(AbpIdentityServerDomainModule));
});
AddIdentityServer(context.Services);
}

7
modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerAutoMapperProfile.cs

@ -3,6 +3,7 @@ using System.Security.Claims;
using AutoMapper;
using Volo.Abp.IdentityServer.ApiResources;
using Volo.Abp.IdentityServer.Clients;
using Volo.Abp.IdentityServer.Devices;
using Volo.Abp.IdentityServer.Grants;
using Volo.Abp.IdentityServer.IdentityResources;
@ -82,6 +83,12 @@ namespace Volo.Abp.IdentityServer
CreateMap<ClientSecret, IdentityServer4.Models.Secret>(MemberList.Destination)
.ForMember(dest => dest.Type, opt => opt.Condition(srs => srs != null))
.ReverseMap();
CreateMap<ApiResource, ApiResourceEto>();
CreateMap<Client, ClientEto>();
CreateMap<DeviceFlowCodes, DeviceFlowCodesEto>();
CreateMap<PersistedGrant, PersistedGrantEto>();
CreateMap<IdentityResource, IdentityResourceEto>();
}
}
}

7
modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo/Abp/PermissionManagement/PermissionManagementRemoteServiceConsts.cs

@ -0,0 +1,7 @@
namespace Volo.Abp.PermissionManagement
{
public class PermissionManagementRemoteServiceConsts
{
public const string RemoteServiceName = "AbpPermissionManagement";
}
}

4
modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi.Client/Volo/Abp/PermissionManagement/AbpPermissionManagementHttpApiClientModule.cs

@ -9,13 +9,11 @@ namespace Volo.Abp.PermissionManagement
typeof(AbpHttpClientModule))]
public class AbpPermissionManagementHttpApiClientModule : AbpModule
{
public const string RemoteServiceName = "AbpPermissionManagement";
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddHttpClientProxies(
typeof(AbpPermissionManagementApplicationContractsModule).Assembly,
RemoteServiceName
PermissionManagementRemoteServiceConsts.RemoteServiceName
);
}
}

2
modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi/Volo/Abp/PermissionManagement/PermissionsController.cs

@ -4,7 +4,7 @@ using Volo.Abp.AspNetCore.Mvc;
namespace Volo.Abp.PermissionManagement
{
[RemoteService]
[RemoteService(Name = PermissionManagementRemoteServiceConsts.RemoteServiceName)]
[Area("abp")]
public class PermissionsController : AbpController, IPermissionAppService
{

7
modules/tenant-management/src/Volo.Abp.TenantManagement.Application.Contracts/Volo/Abp/TenantManagement/TenantManagementRemoteServiceConsts.cs

@ -0,0 +1,7 @@
namespace Volo.Abp.TenantManagement
{
public class TenantManagementRemoteServiceConsts
{
public const string RemoteServiceName = "AbpTenantManagement";
}
}

4
modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi.Client/Volo/Abp/TenantManagement/AbpTenantManagementHttpApiClientModule.cs

@ -9,13 +9,11 @@ namespace Volo.Abp.TenantManagement
typeof(AbpHttpClientModule))]
public class AbpTenantManagementHttpApiClientModule : AbpModule
{
public const string RemoteServiceName = "AbpTenantManagement";
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddHttpClientProxies(
typeof(AbpTenantManagementApplicationContractsModule).Assembly,
RemoteServiceName
TenantManagementRemoteServiceConsts.RemoteServiceName
);
}
}

2
modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi/Volo/Abp/TenantManagement/TenantController.cs

@ -7,7 +7,7 @@ using Volo.Abp.AspNetCore.Mvc;
namespace Volo.Abp.TenantManagement
{
[Controller]
[RemoteService]
[RemoteService(Name = TenantManagementRemoteServiceConsts.RemoteServiceName)]
[Area("multi-tenancy")]
[Route("api/multi-tenancy/tenants")]
public class TenantController : AbpController, ITenantAppService //TODO: Throws exception on validation if we inherit from Controller

42
npm/ng-packs/packages/core/src/lib/services/rest.service.ts

@ -2,10 +2,11 @@ import { HttpClient, HttpRequest } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Store } from '@ngxs/store';
import { Observable, throwError } from 'rxjs';
import { catchError, take, tap } from 'rxjs/operators';
import { catchError } from 'rxjs/operators';
import { RestOccurError } from '../actions/rest.actions';
import { Rest } from '../models/rest';
import { ConfigState } from '../states/config.state';
import { isUndefinedOrEmptyString } from '../utils/common-utils';
@Injectable({
providedIn: 'root',
@ -13,47 +14,40 @@ import { ConfigState } from '../states/config.state';
export class RestService {
constructor(private http: HttpClient, private store: Store) {}
private getApiFromStore(apiName: string): string {
return this.store.selectSnapshot(ConfigState.getApiUrl(apiName));
}
handleError(err: any): Observable<any> {
this.store.dispatch(new RestOccurError(err));
console.error(err);
return throwError(err);
}
// TODO: Deprecate service or improve interface in v3.0
request<T, R>(
request: HttpRequest<T> | Rest.Request<T>,
config?: Rest.Config,
api?: string,
): Observable<R> {
config = config || ({} as Rest.Config);
const { observe = Rest.Observe.Body, skipHandleError } = config;
const url =
(api || this.store.selectSnapshot(ConfigState.getApiUrl(config.apiName))) + request.url;
api = api || this.getApiFromStore(config.apiName);
const { method, params, ...options } = request;
const { observe = Rest.Observe.Body, skipHandleError } = config;
return this.http
.request<T>(method, url, {
.request<R>(method, api + request.url, {
observe,
...(params && {
params: Object.keys(params).reduce(
(acc, key) => ({
...acc,
...(typeof params[key] !== 'undefined' &&
params[key] !== '' && { [key]: params[key] }),
}),
{},
),
params: Object.keys(params).reduce((acc, key) => {
const value = params[key];
if (!isUndefinedOrEmptyString(value)) acc[key] = value;
return acc;
}, {}),
}),
...options,
} as any)
.pipe(
observe === Rest.Observe.Body ? take(1) : tap(),
catchError(err => {
if (skipHandleError) {
return throwError(err);
}
return this.handleError(err);
}),
);
.pipe(catchError(err => (skipHandleError ? throwError(err) : this.handleError(err))));
}
}

18
npm/ng-packs/packages/core/src/lib/tests/common-utils.spec.ts

@ -1,4 +1,4 @@
import { noop } from '../utils';
import { isUndefinedOrEmptyString, noop } from '../utils';
describe('CommonUtils', () => {
describe('#noop', () => {
@ -7,4 +7,20 @@ describe('CommonUtils', () => {
expect(noop()()).toBeUndefined();
});
});
describe('#isUndefinedOrEmptyString', () => {
test.each`
value | expected
${null} | ${false}
${0} | ${false}
${true} | ${false}
${'x'} | ${false}
${{}} | ${false}
${[]} | ${false}
${undefined} | ${true}
${''} | ${true}
`('should return $expected when given parameter is $value', ({ value, expected }) => {
expect(isUndefinedOrEmptyString(value)).toBe(expected);
});
});
});

46
npm/ng-packs/packages/core/src/lib/tests/rest.service.spec.ts

@ -1,9 +1,8 @@
import { ConfigState } from '@abp/ng.core';
import { createHttpFactory, HttpMethod, SpectatorHttp, SpyObject } from '@ngneat/spectator/jest';
import { NgxsModule, Store } from '@ngxs/store';
import { interval, of, Subscription, throwError, timer } from 'rxjs';
import { of, throwError } from 'rxjs';
import { catchError } from 'rxjs/operators';
import { RestOccurError } from '../actions';
import { Rest } from '../models';
import { RestService } from '../services/rest.service';
@ -36,6 +35,10 @@ describe('HttpClient testing', () => {
});
});
afterEach(() => {
spectator.controller.verify();
});
test('should send a GET request with params', () => {
spectator.service
.request({ method: HttpMethod.GET, url: '/test', params: { id: 1 } })
@ -66,34 +69,16 @@ describe('HttpClient testing', () => {
spectator.expectOne('bar' + '/test', HttpMethod.GET);
});
test('should close the subscriber when observe equal to body', done => {
jest.spyOn(spectator.httpClient, 'request').mockReturnValue(interval(50));
test('should complete upon successful request', done => {
const complete = jest.fn(done);
const subscriber: Subscription = spectator.service
.request({ method: HttpMethod.GET, url: '/test' }, { observe: Rest.Observe.Body })
.subscribe();
spectator.service.request({ method: HttpMethod.GET, url: '/test' }).subscribe({ complete });
timer(51).subscribe(() => {
expect(subscriber.closed).toBe(true);
done();
});
});
test('should open the subscriber when observe not equal to body', done => {
jest.spyOn(spectator.httpClient, 'request').mockReturnValue(interval(50));
const subscriber: Subscription = spectator.service
.request({ method: HttpMethod.GET, url: '/test' }, { observe: Rest.Observe.Events })
.subscribe();
timer(51).subscribe(() => {
expect(subscriber.closed).toBe(false);
done();
});
const req = spectator.expectOne(api + '/test', HttpMethod.GET);
spectator.flushAll([req], [{}]);
});
test('should handle the error', () => {
jest.spyOn(spectator.httpClient, 'request').mockReturnValue(throwError('Testing error'));
const spy = jest.spyOn(store, 'dispatch');
spectator.service
@ -101,15 +86,17 @@ describe('HttpClient testing', () => {
.pipe(
catchError(err => {
expect(err).toBeTruthy();
expect(spy.mock.calls[0][0] instanceof RestOccurError).toBe(true);
expect(spy).toHaveBeenCalled();
return of(null);
}),
)
.subscribe();
const req = spectator.expectOne(api + '/test', HttpMethod.GET);
spectator.flushAll([req], [throwError('Testing error')]);
});
test('should not handle the error when skipHandleError is true', () => {
jest.spyOn(spectator.httpClient, 'request').mockReturnValue(throwError('Testing error'));
const spy = jest.spyOn(store, 'dispatch');
spectator.service
@ -120,10 +107,13 @@ describe('HttpClient testing', () => {
.pipe(
catchError(err => {
expect(err).toBeTruthy();
expect(spy.mock.calls).toHaveLength(0);
expect(spy).toHaveBeenCalledTimes(0);
return of(null);
}),
)
.subscribe();
const req = spectator.expectOne(api + '/test', HttpMethod.GET);
spectator.flushAll([req], [throwError('Testing error')]);
});
});

4
npm/ng-packs/packages/core/src/lib/utils/common-utils.ts

@ -3,3 +3,7 @@ export function noop() {
const fn = function() {};
return fn;
}
export function isUndefinedOrEmptyString(value: unknown): boolean {
return value === undefined || value === '';
}

Loading…
Cancel
Save