diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/zh-Hans.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/zh-Hans.json index 7a3bbd3a21..986d1fdc2c 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/zh-Hans.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/zh-Hans.json @@ -26,6 +26,6 @@ "ContributionGuide": "贡献指南", "Blog": "博客", "Commercial": "商业版", - "SeeDocuments": "见文档" + "SeeDocuments": "查看文档" } } \ No newline at end of file diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/zh-Hans.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/zh-Hans.json index c91f115d69..a0a3ff0d40 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/zh-Hans.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/zh-Hans.json @@ -42,11 +42,11 @@ "BootstrapTagHelpersDynamicFormsExplanation": "内置的后台作业系统可以集成到Hangfire,RabbitMQ或您喜欢的任何工具中.", //TODO explanation doesn't match. "HTTPAPIsDynamicProxies": "HTTP APIs和动态代理", "HTTPAPIsDynamicProxiesExplanation": "自动将应用程序服务公开为REST样式的HTTP API,并与动态JavaScript和C#代理一起使用.", - "CompleteArchitectureInfo": "现代构架用来创建可维护的软件解决方案.", + "CompleteArchitectureInfo": "现代架构用来创建可维护的软件解决方案.", "DomainDrivenDesignBasedLayeringModelExplanation": "帮助你实现基于DDD的分层架构并构建可维护的代码库.", "DomainDrivenDesignBasedLayeringModelExplanationCont": "提供启动模板,抽象,基类,服务,文档和指南以帮助你开发基于DDD模式和准则的应用程序.", "MicroserviceCompatibleModelExplanation": "核心框架和预构建模块在设计时就考虑了微服务架构.", - "MicroserviceCompatibleModelExplanationCont": "提供基础结构,集成,示例和文档,以更轻松地实现微服务解决方案,而如果你要使用整体应用程序,则不会带来额外的复杂性.", + "MicroserviceCompatibleModelExplanationCont": "提供基础结构,集成,示例和文档,以更轻松地实现微服务解决方案,而如果你要使用整体应用程序,也不会带来额外的复杂性.", "ModularInfo": "ABP提供了完整的模块化系统,使你能够开发可重复使用的应用程序模块.", "PreBuiltModulesThemes": "预构建模块和主题", "PreBuiltModulesThemesExplanation": "开源和商业模块和主题已准备好在你的业务应用程序中使用.", @@ -125,7 +125,7 @@ "DatabaseConnectionTransactionManagement": "数据库连接和事务管理", "CorrelationIdTracking": "关联ID跟踪", "BundlingMinificationExplanation": "ABP提供了一个简单,动态,功能强大,模块化的内置Bundling & Minification系统.", - "VirtualFileSystemnExplanation": "虚拟文件系统使管理文件系统(磁盘)上不存在的文件成为可能.它主要用于将(js,css,image,cshtml...)文件嵌入到程序集中,并在运行时像物理文件一样使用它们.", + "VirtualFileSystemnExplanation": "虚拟文件系统使管理文件系统(磁盘)上不存在的文件成为可能.它主要用于将(js,css,image,cshtml...)文件嵌入到程序集中,并在运行时像物理文件一样使用它们.", "ThemingExplanation": "主题系统允许通过基于最新的Bootstrap框架定义一组通用基础库和布局来独立开发应用程序和模块主题.", "DomainDrivenDesignInfrastructureExplanation": "基于域驱动设计模式和准则构建分层应用程序的完整基础设施;", "Specification": "规范", @@ -154,7 +154,7 @@ "Result": "结果", "SeeTheDocumentForMoreInformation": "查看{0} 文档获得更多信息", "IndexPageHeroSection": "asp.net core的开源Web应用程序框架 ", - "UiFramework": "UI构架", + "UiFramework": "UI框架", "EmailAddress": "电子邮件地址" } } \ No newline at end of file diff --git a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json index 07f1dbb041..1db38474ae 100644 --- a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json +++ b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json @@ -27,7 +27,7 @@ "DisplayName:Email": "电子邮件", "DisplayName:Name": "名字", "DisplayName:Surname": "姓", - "DisplayName:Password": "姓", + "DisplayName:Password": "密码", "DisplayName:EmailAddress": "电子邮件地址", "DisplayName:PhoneNumber": "电话号码", "PersonalSettings": "个人设置", diff --git a/npm/ng-packs/packages/account/src/lib/components/change-password/change-password.component.ts b/npm/ng-packs/packages/account/src/lib/components/change-password/change-password.component.ts index afef2ccf95..850e4e37a1 100644 --- a/npm/ng-packs/packages/account/src/lib/components/change-password/change-password.component.ts +++ b/npm/ng-packs/packages/account/src/lib/components/change-password/change-password.component.ts @@ -1,8 +1,8 @@ -import { ChangePassword } from '@abp/ng.core'; +import { ChangePassword, ConfigState, ABP } from '@abp/ng.core'; import { ToasterService } from '@abp/ng.theme.shared'; import { Component, OnInit } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { comparePasswords, Validation } from '@ngx-validate/core'; +import { comparePasswords, Validation, PasswordRules, validatePassword } from '@ngx-validate/core'; import { Store } from '@ngxs/store'; import snq from 'snq'; import { finalize } from 'rxjs/operators'; @@ -29,11 +29,45 @@ export class ChangePasswordComponent implements OnInit { constructor(private fb: FormBuilder, private store: Store, private toasterService: ToasterService) {} ngOnInit(): void { + const passwordRules: ABP.Dictionary = this.store.selectSnapshot( + ConfigState.getSettings('Identity.Password'), + ); + const passwordRulesArr = [] as PasswordRules; + let requiredLength = 1; + + if ((passwordRules['Abp.Identity.Password.RequireDigit'] || '').toLowerCase() === 'true') { + passwordRulesArr.push('number'); + } + + if ((passwordRules['Abp.Identity.Password.RequireLowercase'] || '').toLowerCase() === 'true') { + passwordRulesArr.push('small'); + } + + if ((passwordRules['Abp.Identity.Password.RequireUppercase'] || '').toLowerCase() === 'true') { + passwordRulesArr.push('capital'); + } + + if (+(passwordRules['Abp.Identity.Password.RequiredUniqueChars'] || 0) > 0) { + passwordRulesArr.push('special'); + } + + if (Number.isInteger(+passwordRules['Abp.Identity.Password.RequiredLength'])) { + requiredLength = +passwordRules['Abp.Identity.Password.RequiredLength']; + } + this.form = this.fb.group( { password: ['', required], - newPassword: ['', required], - repeatNewPassword: ['', required], + newPassword: [ + '', + { + validators: [required, validatePassword(passwordRulesArr), minLength(requiredLength)], + }, + ], + repeatNewPassword: [ + '', + { validators: [required, validatePassword(passwordRulesArr), minLength(requiredLength)] }, + ], }, { validators: [comparePasswords(PASSWORD_FIELDS)], diff --git a/npm/ng-packs/packages/core/src/lib/core.module.ts b/npm/ng-packs/packages/core/src/lib/core.module.ts index 2fe908cf8e..1d696d2951 100644 --- a/npm/ng-packs/packages/core/src/lib/core.module.ts +++ b/npm/ng-packs/packages/core/src/lib/core.module.ts @@ -24,7 +24,7 @@ import { ConfigState } from './states/config.state'; import { ProfileState } from './states/profile.state'; import { SessionState } from './states/session.state'; import { getInitialData, localeInitializer } from './utils/initial-utils'; -import { ConfigPlugin, NGXS_CONFIG_PLUGIN_OPTIONS } from './plugins/config/config.plugin'; +import { ConfigPlugin, NGXS_CONFIG_PLUGIN_OPTIONS } from './plugins/config.plugin'; import { ForDirective } from './directives/for.directive'; import { AbstractNgModelComponent } from './abstracts/ng-model.component'; import { TableSortDirective } from './directives/table-sort.directive'; diff --git a/npm/ng-packs/packages/core/src/lib/plugins/config/config.plugin.ts b/npm/ng-packs/packages/core/src/lib/plugins/config.plugin.ts similarity index 97% rename from npm/ng-packs/packages/core/src/lib/plugins/config/config.plugin.ts rename to npm/ng-packs/packages/core/src/lib/plugins/config.plugin.ts index 99ca53ebbd..621d1c39d1 100644 --- a/npm/ng-packs/packages/core/src/lib/plugins/config/config.plugin.ts +++ b/npm/ng-packs/packages/core/src/lib/plugins/config.plugin.ts @@ -2,8 +2,8 @@ import { Inject, Injectable, InjectionToken } from '@angular/core'; import { Router, Routes } from '@angular/router'; import { actionMatcher, InitState, NgxsNextPluginFn, NgxsPlugin, setValue, UpdateState } from '@ngxs/store'; import snq from 'snq'; -import { ABP } from '../../models'; -import { organizeRoutes, getAbpRoutes } from '../../utils/route-utils'; +import { ABP } from '../models'; +import { organizeRoutes, getAbpRoutes } from '../utils/route-utils'; import clone from 'just-clone'; export const NGXS_CONFIG_PLUGIN_OPTIONS = new InjectionToken('NGXS_CONFIG_PLUGIN_OPTIONS'); diff --git a/npm/ng-packs/packages/core/src/lib/plugins/index.ts b/npm/ng-packs/packages/core/src/lib/plugins/index.ts index 7107ea01dd..42ab2f291c 100644 --- a/npm/ng-packs/packages/core/src/lib/plugins/index.ts +++ b/npm/ng-packs/packages/core/src/lib/plugins/index.ts @@ -1 +1 @@ -export * from './config/config.plugin'; +export * from './config.plugin'; diff --git a/npm/ng-packs/packages/core/src/lib/tests/application-configuration.service.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/application-configuration.service.spec.ts new file mode 100644 index 0000000000..4aa1a98e7a --- /dev/null +++ b/npm/ng-packs/packages/core/src/lib/tests/application-configuration.service.spec.ts @@ -0,0 +1,20 @@ +import { createHttpFactory, HttpMethod, SpectatorHttp } from '@ngneat/spectator/jest'; +import { ApplicationConfigurationService, RestService } from '../services'; +import { Store } from '@ngxs/store'; + +describe('ApplicationConfigurationService', () => { + let spectator: SpectatorHttp; + const createHttp = createHttpFactory({ + dataService: ApplicationConfigurationService, + providers: [RestService], + mocks: [Store], + }); + + beforeEach(() => (spectator = createHttp())); + + it('should send a GET to application-configuration API', () => { + spectator.get(Store).selectSnapshot.andReturn('https://abp.io'); + spectator.service.getConfiguration().subscribe(); + spectator.expectOne('https://abp.io/api/abp/application-configuration', HttpMethod.GET); + }); +}); diff --git a/npm/ng-packs/packages/core/src/lib/tests/config-state.service.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/config-state.service.spec.ts index d7bae11a51..1b20a2889b 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/config-state.service.spec.ts +++ b/npm/ng-packs/packages/core/src/lib/tests/config-state.service.spec.ts @@ -1,14 +1,122 @@ -import { createServiceFactory, SpectatorService } from '@ngneat/spectator/jest'; +import { createServiceFactory, SpectatorService, SpyObject } from '@ngneat/spectator/jest'; import { ConfigStateService } from '../services/config-state.service'; import { ConfigState } from '../states'; import { Store } from '@ngxs/store'; +import { Config } from '../models/config'; + +const CONFIG_STATE_DATA = { + environment: { + production: false, + application: { + name: 'MyProjectName', + }, + oAuthConfig: { + issuer: 'https://localhost:44305', + }, + apis: { + default: { + url: 'https://localhost:44305', + }, + other: { + url: 'https://localhost:44306', + }, + }, + localization: { + defaultResourceName: 'MyProjectName', + }, + }, + requirements: { + layouts: [null, null, null], + }, + routes: [ + { + name: '::Menu:Home', + path: '', + children: [], + url: '/', + }, + { + name: 'AbpAccount::Menu:Account', + path: 'account', + invisible: true, + layout: 'application', + children: [ + { + path: 'login', + name: 'AbpAccount::Login', + order: 1, + url: '/account/login', + }, + ], + url: '/account', + }, + ], + flattedRoutes: [ + { + name: '::Menu:Home', + path: '', + children: [], + url: '/', + }, + { + name: '::Menu:Identity', + path: 'identity', + children: [], + url: '/identity', + }, + ], + localization: { + values: { + MyProjectName: { + "'{0}' and '{1}' do not match.": "'{0}' and '{1}' do not match.", + }, + AbpIdentity: { + Identity: 'identity', + }, + }, + languages: [ + { + cultureName: 'cs', + uiCultureName: 'cs', + displayName: 'Čeština', + flagIcon: null, + }, + ], + }, + auth: { + policies: { + 'AbpIdentity.Roles': true, + }, + grantedPolicies: { + 'Abp.Identity': false, + }, + }, + setting: { + values: { + 'Abp.Localization.DefaultLanguage': 'en', + }, + }, + currentUser: { + isAuthenticated: false, + id: null, + tenantId: null, + userName: null, + }, + features: { + values: {}, + }, +} as Config.State; + describe('ConfigStateService', () => { let service: ConfigStateService; let spectator: SpectatorService; + let store: SpyObject; + const createService = createServiceFactory({ service: ConfigStateService, mocks: [Store] }); beforeEach(() => { spectator = createService(); service = spectator.service; + store = spectator.get(Store); }); test('should have the all ConfigState static methods', () => { const reg = /(?<=static )(.*)(?=\()/gm; @@ -16,6 +124,20 @@ describe('ConfigStateService', () => { .match(reg) .forEach(fnName => { expect(service[fnName]).toBeTruthy(); + + const spy = jest.spyOn(store, 'selectSnapshot'); + spy.mockClear(); + + const isDynamicSelector = ConfigState[fnName].name !== 'memoized'; + + if (isDynamicSelector) { + ConfigState[fnName] = jest.fn((...args) => args); + service[fnName]('test', 0, {}); + expect(ConfigState[fnName]).toHaveBeenCalledWith('test', 0, {}); + } else { + service[fnName](); + expect(spy).toHaveBeenCalledWith(ConfigState[fnName]); + } }); }); }); diff --git a/npm/ng-packs/packages/core/src/lib/tests/profile-state.service.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/profile-state.service.spec.ts index 4cd7016aca..3732d8000c 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/profile-state.service.spec.ts +++ b/npm/ng-packs/packages/core/src/lib/tests/profile-state.service.spec.ts @@ -1,14 +1,17 @@ -import { createServiceFactory, SpectatorService } from '@ngneat/spectator/jest'; +import { createServiceFactory, SpectatorService, SpyObject } from '@ngneat/spectator/jest'; import { ProfileStateService } from '../services/profile-state.service'; import { ProfileState } from '../states/profile.state'; import { Store } from '@ngxs/store'; describe('ProfileStateService', () => { let service: ProfileStateService; let spectator: SpectatorService; + let store: SpyObject; + const createService = createServiceFactory({ service: ProfileStateService, mocks: [Store] }); beforeEach(() => { spectator = createService(); service = spectator.service; + store = spectator.get(Store); }); test('should have the all ProfileState static methods', () => { const reg = /(?<=static )(.*)(?=\()/gm; @@ -16,6 +19,20 @@ describe('ProfileStateService', () => { .match(reg) .forEach(fnName => { expect(service[fnName]).toBeTruthy(); + + const spy = jest.spyOn(store, 'selectSnapshot'); + spy.mockClear(); + + const isDynamicSelector = ProfileState[fnName].name !== 'memoized'; + + if (isDynamicSelector) { + ProfileState[fnName] = jest.fn((...args) => args); + service[fnName]('test', 0, {}); + expect(ProfileState[fnName]).toHaveBeenCalledWith('test', 0, {}); + } else { + service[fnName](); + expect(spy).toHaveBeenCalledWith(ProfileState[fnName]); + } }); }); }); diff --git a/npm/ng-packs/packages/core/src/lib/tests/profile.service.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/profile.service.spec.ts new file mode 100644 index 0000000000..6dac6f4bb5 --- /dev/null +++ b/npm/ng-packs/packages/core/src/lib/tests/profile.service.spec.ts @@ -0,0 +1,42 @@ +import { createHttpFactory, HttpMethod, SpectatorHttp } from '@ngneat/spectator/jest'; +import { ProfileService, RestService } from '../services'; +import { Store } from '@ngxs/store'; + +describe('ProfileService', () => { + let spectator: SpectatorHttp; + const createHttp = createHttpFactory({ + dataService: ProfileService, + providers: [RestService], + mocks: [Store], + }); + + beforeEach(() => (spectator = createHttp())); + + it('should send a GET to my-profile API', () => { + spectator.get(Store).selectSnapshot.andReturn('https://abp.io'); + spectator.service.get().subscribe(); + spectator.expectOne('https://abp.io/api/identity/my-profile', HttpMethod.GET); + }); + + it('should send a POST to change-password API', () => { + const mock = { currentPassword: 'test', newPassword: 'test' }; + spectator.get(Store).selectSnapshot.andReturn('https://abp.io'); + spectator.service.changePassword(mock).subscribe(); + const req = spectator.expectOne('https://abp.io/api/identity/my-profile/change-password', HttpMethod.POST); + expect(req.request.body).toEqual(mock); + }); + + it('should send a PUT to my-profile API', () => { + const mock = { + email: 'info@volosoft.com', + userName: 'admin', + name: 'John', + surname: 'Doe', + phoneNumber: '+123456', + }; + spectator.get(Store).selectSnapshot.andReturn('https://abp.io'); + spectator.service.update(mock).subscribe(); + const req = spectator.expectOne('https://abp.io/api/identity/my-profile', HttpMethod.PUT); + expect(req.request.body).toEqual(mock); + }); +}); diff --git a/npm/ng-packs/packages/core/src/lib/tests/session-state.service.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/session-state.service.spec.ts index aa76e9fccf..40664f29b5 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/session-state.service.spec.ts +++ b/npm/ng-packs/packages/core/src/lib/tests/session-state.service.spec.ts @@ -1,14 +1,17 @@ -import { createServiceFactory, SpectatorService } from '@ngneat/spectator/jest'; +import { createServiceFactory, SpectatorService, SpyObject } from '@ngneat/spectator/jest'; import { SessionStateService } from '../services/session-state.service'; import { SessionState } from '../states/session.state'; import { Store } from '@ngxs/store'; describe('SessionStateService', () => { let service: SessionStateService; let spectator: SpectatorService; + let store: SpyObject; + const createService = createServiceFactory({ service: SessionStateService, mocks: [Store] }); beforeEach(() => { spectator = createService(); service = spectator.service; + store = spectator.get(Store); }); test('should have the all SessionState static methods', () => { const reg = /(?<=static )(.*)(?=\()/gm; @@ -16,6 +19,20 @@ describe('SessionStateService', () => { .match(reg) .forEach(fnName => { expect(service[fnName]).toBeTruthy(); + + const spy = jest.spyOn(store, 'selectSnapshot'); + spy.mockClear(); + + const isDynamicSelector = SessionState[fnName].name !== 'memoized'; + + if (isDynamicSelector) { + SessionState[fnName] = jest.fn((...args) => args); + service[fnName]('test', 0, {}); + expect(SessionState[fnName]).toHaveBeenCalledWith('test', 0, {}); + } else { + service[fnName](); + expect(spy).toHaveBeenCalledWith(SessionState[fnName]); + } }); }); }); diff --git a/npm/ng-packs/packages/feature-management/src/lib/tests/feature-management-state.service.spec.ts b/npm/ng-packs/packages/feature-management/src/lib/tests/feature-management-state.service.spec.ts index 0463fccf8f..9e04806b7e 100644 --- a/npm/ng-packs/packages/feature-management/src/lib/tests/feature-management-state.service.spec.ts +++ b/npm/ng-packs/packages/feature-management/src/lib/tests/feature-management-state.service.spec.ts @@ -1,4 +1,4 @@ -import { createServiceFactory, SpectatorService } from '@ngneat/spectator/jest'; +import { createServiceFactory, SpectatorService, SpyObject } from '@ngneat/spectator/jest'; import { Store } from '@ngxs/store'; import { FeatureManagementStateService } from '../services/feature-management-state.service'; import { FeatureManagementState } from '../states'; @@ -6,17 +6,35 @@ import { FeatureManagementState } from '../states'; describe('FeatureManagementStateService', () => { let service: FeatureManagementStateService; let spectator: SpectatorService; + let store: SpyObject; + const createService = createServiceFactory({ service: FeatureManagementStateService, mocks: [Store] }); beforeEach(() => { spectator = createService(); service = spectator.service; + store = spectator.get(Store); }); + test('should have the all FeatureManagementState static methods', () => { const reg = /(?<=static )(.*)(?=\()/gm; FeatureManagementState.toString() .match(reg) .forEach(fnName => { expect(service[fnName]).toBeTruthy(); + + const spy = jest.spyOn(store, 'selectSnapshot'); + spy.mockClear(); + + const isDynamicSelector = FeatureManagementState[fnName].name !== 'memoized'; + + if (isDynamicSelector) { + FeatureManagementState[fnName] = jest.fn((...args) => args); + service[fnName]('test', 0, {}); + expect(FeatureManagementState[fnName]).toHaveBeenCalledWith('test', 0, {}); + } else { + service[fnName](); + expect(spy).toHaveBeenCalledWith(FeatureManagementState[fnName]); + } }); }); }); diff --git a/npm/ng-packs/packages/identity/src/lib/tests/identity-state.service.spec.ts b/npm/ng-packs/packages/identity/src/lib/tests/identity-state.service.spec.ts index 393aaeabf5..6d78aa950f 100644 --- a/npm/ng-packs/packages/identity/src/lib/tests/identity-state.service.spec.ts +++ b/npm/ng-packs/packages/identity/src/lib/tests/identity-state.service.spec.ts @@ -1,21 +1,39 @@ -import { createServiceFactory, SpectatorService } from '@ngneat/spectator/jest'; +import { createServiceFactory, SpectatorService, SpyObject } from '@ngneat/spectator/jest'; import { IdentityStateService } from '../services/identity-state.service'; import { IdentityState } from '../states/identity.state'; import { Store } from '@ngxs/store'; describe('IdentityStateService', () => { let service: IdentityStateService; let spectator: SpectatorService; + let store: SpyObject; + const createService = createServiceFactory({ service: IdentityStateService, mocks: [Store] }); beforeEach(() => { spectator = createService(); service = spectator.service; + store = spectator.get(Store); }); + test('should have the all IdentityState static methods', () => { const reg = /(?<=static )(.*)(?=\()/gm; IdentityState.toString() .match(reg) .forEach(fnName => { expect(service[fnName]).toBeTruthy(); + + const spy = jest.spyOn(store, 'selectSnapshot'); + spy.mockClear(); + + const isDynamicSelector = IdentityState[fnName].name !== 'memoized'; + + if (isDynamicSelector) { + IdentityState[fnName] = jest.fn((...args) => args); + service[fnName]('test', 0, {}); + expect(IdentityState[fnName]).toHaveBeenCalledWith('test', 0, {}); + } else { + service[fnName](); + expect(spy).toHaveBeenCalledWith(IdentityState[fnName]); + } }); }); }); diff --git a/npm/ng-packs/packages/permission-management/src/lib/tests/permission-management-state.service.spec.ts b/npm/ng-packs/packages/permission-management/src/lib/tests/permission-management-state.service.spec.ts index 190e670b8e..65df916a0f 100644 --- a/npm/ng-packs/packages/permission-management/src/lib/tests/permission-management-state.service.spec.ts +++ b/npm/ng-packs/packages/permission-management/src/lib/tests/permission-management-state.service.spec.ts @@ -1,14 +1,18 @@ -import { createServiceFactory, SpectatorService } from '@ngneat/spectator/jest'; +import { createServiceFactory, SpectatorService, SpyObject } from '@ngneat/spectator/jest'; import { PermissionManagementStateService } from '../services/permission-management-state.service'; import { PermissionManagementState } from '../states/permission-management.state'; import { Store } from '@ngxs/store'; + describe('PermissionManagementStateService', () => { let service: PermissionManagementStateService; let spectator: SpectatorService; + let store: SpyObject; + const createService = createServiceFactory({ service: PermissionManagementStateService, mocks: [Store] }); beforeEach(() => { spectator = createService(); service = spectator.service; + store = spectator.get(Store); }); test('should have the all PermissionManagementState static methods', () => { const reg = /(?<=static )(.*)(?=\()/gm; @@ -16,6 +20,20 @@ describe('PermissionManagementStateService', () => { .match(reg) .forEach(fnName => { expect(service[fnName]).toBeTruthy(); + + const spy = jest.spyOn(store, 'selectSnapshot'); + spy.mockClear(); + + const isDynamicSelector = PermissionManagementState[fnName].name !== 'memoized'; + + if (isDynamicSelector) { + PermissionManagementState[fnName] = jest.fn((...args) => args); + service[fnName]('test', 0, {}); + expect(PermissionManagementState[fnName]).toHaveBeenCalledWith('test', 0, {}); + } else { + service[fnName](); + expect(spy).toHaveBeenCalledWith(PermissionManagementState[fnName]); + } }); }); }); diff --git a/npm/ng-packs/packages/tenant-management/src/lib/tests/tenant-management-state.service.spec.ts b/npm/ng-packs/packages/tenant-management/src/lib/tests/tenant-management-state.service.spec.ts index 1b45597075..c5b40fb54b 100644 --- a/npm/ng-packs/packages/tenant-management/src/lib/tests/tenant-management-state.service.spec.ts +++ b/npm/ng-packs/packages/tenant-management/src/lib/tests/tenant-management-state.service.spec.ts @@ -1,21 +1,39 @@ -import { createServiceFactory, SpectatorService } from '@ngneat/spectator/jest'; +import { createServiceFactory, SpectatorService, SpyObject } from '@ngneat/spectator/jest'; import { TenantManagementStateService } from '../services/tenant-management-state.service'; import { TenantManagementState } from '../states/tenant-management.state'; import { Store } from '@ngxs/store'; describe('TenantManagementStateService', () => { let service: TenantManagementStateService; let spectator: SpectatorService; + let store: SpyObject; + const createService = createServiceFactory({ service: TenantManagementStateService, mocks: [Store] }); beforeEach(() => { spectator = createService(); service = spectator.service; + store = spectator.get(Store); }); + test('should have the all TenantManagementState static methods', () => { const reg = /(?<=static )(.*)(?=\()/gm; TenantManagementState.toString() .match(reg) .forEach(fnName => { expect(service[fnName]).toBeTruthy(); + + const spy = jest.spyOn(store, 'selectSnapshot'); + spy.mockClear(); + + const isDynamicSelector = TenantManagementState[fnName].name !== 'memoized'; + + if (isDynamicSelector) { + TenantManagementState[fnName] = jest.fn((...args) => args); + service[fnName]('test', 0, {}); + expect(TenantManagementState[fnName]).toHaveBeenCalledWith('test', 0, {}); + } else { + service[fnName](); + expect(spy).toHaveBeenCalledWith(TenantManagementState[fnName]); + } }); }); }); diff --git a/npm/ng-packs/packages/theme-basic/src/lib/tests/layout-state.service.spec.ts b/npm/ng-packs/packages/theme-basic/src/lib/tests/layout-state.service.spec.ts index ccdb512c65..2a88a93f47 100644 --- a/npm/ng-packs/packages/theme-basic/src/lib/tests/layout-state.service.spec.ts +++ b/npm/ng-packs/packages/theme-basic/src/lib/tests/layout-state.service.spec.ts @@ -1,21 +1,39 @@ -import { createServiceFactory, SpectatorService } from '@ngneat/spectator/jest'; +import { createServiceFactory, SpectatorService, SpyObject } from '@ngneat/spectator/jest'; import { LayoutStateService } from '../services/layout-state.service'; import { LayoutState } from '../states/layout.state'; import { Store } from '@ngxs/store'; describe('LayoutStateService', () => { let service: LayoutStateService; let spectator: SpectatorService; + let store: SpyObject; + const createService = createServiceFactory({ service: LayoutStateService, mocks: [Store] }); beforeEach(() => { spectator = createService(); service = spectator.service; + store = spectator.get(Store); }); + test('should have the all LayoutState static methods', () => { const reg = /(?<=static )(.*)(?=\()/gm; LayoutState.toString() .match(reg) .forEach(fnName => { expect(service[fnName]).toBeTruthy(); + + const spy = jest.spyOn(store, 'selectSnapshot'); + spy.mockClear(); + + const isDynamicSelector = LayoutState[fnName].name !== 'memoized'; + + if (isDynamicSelector) { + LayoutState[fnName] = jest.fn((...args) => args); + service[fnName]('test', 0, {}); + expect(LayoutState[fnName]).toHaveBeenCalledWith('test', 0, {}); + } else { + service[fnName](); + expect(spy).toHaveBeenCalledWith(LayoutState[fnName]); + } }); }); }); diff --git a/npm/ng-packs/packages/theme-basic/src/lib/theme-basic.module.ts b/npm/ng-packs/packages/theme-basic/src/lib/theme-basic.module.ts index f758e83dd6..00d651f9af 100644 --- a/npm/ng-packs/packages/theme-basic/src/lib/theme-basic.module.ts +++ b/npm/ng-packs/packages/theme-basic/src/lib/theme-basic.module.ts @@ -29,9 +29,9 @@ export const LAYOUTS = [ApplicationLayoutComponent, AccountLayoutComponent, Empt blueprints: { email: 'AbpAccount::ThisFieldIsNotAValidEmailAddress.', max: 'AbpAccount::ThisFieldMustBeBetween{0}And{1}[{{ min }},{{ max }}]', - maxlength: 'AbpAccount::ThisFieldMustBeAStringWithAMaximumLengthOf{1}[{{ requiredLength }}]', + maxlength: 'AbpAccount::ThisFieldMustBeAStringOrArrayTypeWithAMaximumLengthoOf{0}[{{ requiredLength }}]', min: 'AbpAccount::ThisFieldMustBeBetween{0}And{1}[{{ min }},{{ max }}]', - minlength: 'AbpAccount::ThisFieldMustBeAStringOrArrayTypeWithAMinimumLengthOf[{{ min }},{{ max }}]', + minlength: 'AbpAccount::ThisFieldMustBeAStringOrArrayTypeWithAMinimumLengthOf{0}[{{ requiredLength }}]', required: 'AbpAccount::ThisFieldIsRequired.', passwordMismatch: 'AbpIdentity::Identity.PasswordConfirmationFailed', }, diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/change-password/change-password.component.html b/npm/ng-packs/packages/theme-shared/src/lib/components/change-password/change-password.component.html deleted file mode 100644 index 75f71556eb..0000000000 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/change-password/change-password.component.html +++ /dev/null @@ -1,31 +0,0 @@ - - - {{ 'AbpIdentity::ChangePassword' | abpLocalization }} - - - - - {{ 'AbpIdentity::DisplayName:CurrentPassword' | abpLocalization }} * - - - {{ 'AbpIdentity::DisplayName:NewPassword' | abpLocalization }} * - - - {{ 'AbpIdentity::DisplayName:NewPasswordConfirm' | abpLocalization }} * - - - - - - {{ 'AbpIdentity::Cancel' | abpLocalization }} - - {{ - 'AbpIdentity::Save' | abpLocalization - }} - - diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/change-password/change-password.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/change-password/change-password.component.ts deleted file mode 100644 index 09c7a8da5d..0000000000 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/change-password/change-password.component.ts +++ /dev/null @@ -1,113 +0,0 @@ -import { ChangePassword } from '@abp/ng.core'; -import { - Component, - EventEmitter, - Input, - OnChanges, - OnInit, - Output, - SimpleChanges, - TemplateRef, - ViewChild, -} from '@angular/core'; -import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { comparePasswords, Validation } from '@ngx-validate/core'; -import { Store } from '@ngxs/store'; -import snq from 'snq'; -import { finalize } from 'rxjs/operators'; -import { ToasterService } from '../../services/toaster.service'; - -const { minLength, required } = Validators; - -const PASSWORD_FIELDS = ['newPassword', 'repeatNewPassword']; - -@Component({ - selector: 'abp-change-password', - templateUrl: './change-password.component.html', -}) -export class ChangePasswordComponent implements OnInit, OnChanges { - protected _visible; - - @Input() - get visible(): boolean { - return this._visible; - } - - set visible(value: boolean) { - this._visible = value; - this.visibleChange.emit(value); - } - - @Output() readonly visibleChange = new EventEmitter(); - - @ViewChild('modalContent', { static: false }) - modalContent: TemplateRef; - - form: FormGroup; - - modalBusy = false; - - mapErrorsFn: Validation.MapErrorsFn = (errors, groupErrors, control) => { - if (PASSWORD_FIELDS.indexOf(control.name) < 0) return errors; - - return errors.concat(groupErrors.filter(({ key }) => key === 'passwordMismatch')); - }; - - constructor(private fb: FormBuilder, private store: Store, private toasterService: ToasterService) {} - - ngOnInit(): void { - this.form = this.fb.group( - { - password: ['', required], - newPassword: ['', required], - repeatNewPassword: ['', required], - }, - { - validators: [comparePasswords(PASSWORD_FIELDS)], - }, - ); - } - - onSubmit() { - if (this.form.invalid) return; - this.modalBusy = true; - - this.store - .dispatch( - new ChangePassword({ - currentPassword: this.form.get('password').value, - newPassword: this.form.get('newPassword').value, - }), - ) - .pipe( - finalize(() => { - this.modalBusy = false; - }), - ) - .subscribe({ - next: () => { - this.visible = false; - this.form.reset(); - }, - error: err => { - this.toasterService.error(snq(() => err.error.error.message, 'AbpAccount::DefaultErrorMessage'), 'Error', { - life: 7000, - }); - }, - }); - } - - openModal() { - this.visible = true; - } - - ngOnChanges({ visible }: SimpleChanges): void { - if (!visible) return; - - if (visible.currentValue) { - this.openModal(); - } else if (visible.currentValue === false && this.visible) { - this.visible = false; - } - } -} diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/index.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/index.ts index 900d9fa925..c812fc601e 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/index.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/index.ts @@ -1,11 +1,9 @@ export * from './breadcrumb/breadcrumb.component'; export * from './button/button.component'; -export * from './change-password/change-password.component'; export * from './chart/chart.component'; export * from './confirmation/confirmation.component'; export * from './loader-bar/loader-bar.component'; export * from './modal/modal.component'; -export * from './profile/profile.component'; export * from './table-empty-message/table-empty-message.component'; export * from './toast/toast.component'; export * from './sort-order-icon/sort-order-icon.component'; diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/profile/profile.component.html b/npm/ng-packs/packages/theme-shared/src/lib/components/profile/profile.component.html deleted file mode 100644 index 797b4c7509..0000000000 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/profile/profile.component.html +++ /dev/null @@ -1,41 +0,0 @@ - - - {{ 'AbpIdentity::PersonalInfo' | abpLocalization }} - - - - - {{ 'AbpIdentity::DisplayName:UserName' | abpLocalization }} * - - - - - {{ 'AbpIdentity::DisplayName:Name' | abpLocalization }} - - - - - {{ 'AbpIdentity::DisplayName:Surname' | abpLocalization }} - - - - - {{ 'AbpIdentity::DisplayName:Email' | abpLocalization }} * - - - {{ 'AbpIdentity::DisplayName:PhoneNumber' | abpLocalization }} - - - - - - {{ 'AbpIdentity::Cancel' | abpLocalization }} - - {{ 'AbpIdentity::Save' | abpLocalization }} - - diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/profile/profile.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/profile/profile.component.ts deleted file mode 100644 index e7d110365b..0000000000 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/profile/profile.component.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { Profile, GetProfile, ProfileState, UpdateProfile } from '@abp/ng.core'; -import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core'; -import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { Select, Store } from '@ngxs/store'; -import { Observable } from 'rxjs'; -import { take, withLatestFrom } from 'rxjs/operators'; - -const { maxLength, required, email } = Validators; - -@Component({ - selector: 'abp-profile', - templateUrl: './profile.component.html' -}) -export class ProfileComponent implements OnChanges { - protected _visible; - - @Input() - get visible(): boolean { - return this._visible; - } - - set visible(value: boolean) { - this._visible = value; - this.visibleChange.emit(value); - } - - @Output() readonly visibleChange = new EventEmitter(); - - @Select(ProfileState.getProfile) - profile$: Observable; - - form: FormGroup; - - modalBusy = false; - - constructor(private fb: FormBuilder, private store: Store) {} - - buildForm() { - this.store - .dispatch(new GetProfile()) - .pipe( - withLatestFrom(this.profile$), - take(1) - ) - .subscribe(([, profile]) => { - this.form = this.fb.group({ - userName: [profile.userName, [required, maxLength(256)]], - email: [profile.email, [required, email, maxLength(256)]], - name: [profile.name || '', [maxLength(64)]], - surname: [profile.surname || '', [maxLength(64)]], - phoneNumber: [profile.phoneNumber || '', [maxLength(16)]] - }); - }); - } - - submit() { - if (this.form.invalid) return; - this.modalBusy = true; - - this.store.dispatch(new UpdateProfile(this.form.value)).subscribe(() => { - this.modalBusy = false; - this.visible = false; - this.form.reset(); - }); - } - - openModal() { - this.buildForm(); - this.visible = true; - } - - ngOnChanges({ visible }: SimpleChanges): void { - if (!visible) return; - - if (visible.currentValue) { - this.openModal(); - } else if (visible.currentValue === false && this.visible) { - this.visible = false; - } - } -} diff --git a/npm/ng-packs/packages/theme-shared/src/lib/theme-shared.module.ts b/npm/ng-packs/packages/theme-shared/src/lib/theme-shared.module.ts index 1159b10735..beea6d4c70 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/theme-shared.module.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/theme-shared.module.ts @@ -6,13 +6,11 @@ import { forkJoin } from 'rxjs'; import { take } from 'rxjs/operators'; import { BreadcrumbComponent } from './components/breadcrumb/breadcrumb.component'; import { ButtonComponent } from './components/button/button.component'; -import { ChangePasswordComponent } from './components/change-password/change-password.component'; import { ChartComponent } from './components/chart/chart.component'; import { ConfirmationComponent } from './components/confirmation/confirmation.component'; import { ErrorComponent } from './components/error/error.component'; import { LoaderBarComponent } from './components/loader-bar/loader-bar.component'; import { ModalComponent } from './components/modal/modal.component'; -import { ProfileComponent } from './components/profile/profile.component'; import { ToastComponent } from './components/toast/toast.component'; import { SortOrderIconComponent } from './components/sort-order-icon/sort-order-icon.component'; import styles from './contants/styles'; @@ -46,13 +44,11 @@ export function appendScript(injector: Injector) { declarations: [ BreadcrumbComponent, ButtonComponent, - ChangePasswordComponent, ChartComponent, ConfirmationComponent, ErrorComponent, LoaderBarComponent, ModalComponent, - ProfileComponent, TableEmptyMessageComponent, ToastComponent, SortOrderIconComponent, @@ -60,12 +56,10 @@ export function appendScript(injector: Injector) { exports: [ BreadcrumbComponent, ButtonComponent, - ChangePasswordComponent, ChartComponent, ConfirmationComponent, LoaderBarComponent, ModalComponent, - ProfileComponent, TableEmptyMessageComponent, ToastComponent, SortOrderIconComponent, diff --git a/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.Domain.Shared/BookStoreDomainSharedModule.cs b/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.Domain.Shared/BookStoreDomainSharedModule.cs index e7f8fc146a..95241feeb8 100644 --- a/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.Domain.Shared/BookStoreDomainSharedModule.cs +++ b/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.Domain.Shared/BookStoreDomainSharedModule.cs @@ -16,7 +16,7 @@ namespace Acme.BookStore { [DependsOn( typeof(AbpAuditLoggingDomainSharedModule), - typeof(BackgroundJobsDomainSharedModule), + typeof(AbpBackgroundJobsDomainSharedModule), typeof(AbpFeatureManagementDomainSharedModule), typeof(AbpIdentityDomainSharedModule), typeof(AbpIdentityServerDomainSharedModule), diff --git a/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.Domain/BookStoreDomainModule.cs b/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.Domain/BookStoreDomainModule.cs index 91cae5f506..2f3f2610a9 100644 --- a/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.Domain/BookStoreDomainModule.cs +++ b/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.Domain/BookStoreDomainModule.cs @@ -16,7 +16,7 @@ namespace Acme.BookStore [DependsOn( typeof(BookStoreDomainSharedModule), typeof(AbpAuditLoggingDomainModule), - typeof(BackgroundJobsDomainModule), + typeof(AbpBackgroundJobsDomainModule), typeof(AbpFeatureManagementDomainModule), typeof(AbpIdentityDomainModule), typeof(AbpPermissionManagementDomainIdentityModule), diff --git a/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.HttpApi.Host/BookStoreHttpApiHostModule.cs b/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.HttpApi.Host/BookStoreHttpApiHostModule.cs index 32163e5cda..d7ccc537e0 100644 --- a/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.HttpApi.Host/BookStoreHttpApiHostModule.cs +++ b/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.HttpApi.Host/BookStoreHttpApiHostModule.cs @@ -54,7 +54,7 @@ namespace Acme.BookStore ConfigureSwaggerServices(context); } - private void ConfigureUrls(IConfigurationRoot configuration) + private void ConfigureUrls(IConfiguration configuration) { Configure(options => { @@ -86,7 +86,7 @@ namespace Acme.BookStore }); } - private void ConfigureAuthentication(ServiceConfigurationContext context, IConfigurationRoot configuration) + private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration) { context.Services.AddAuthentication() .AddIdentityServerAuthentication(options => @@ -123,7 +123,7 @@ namespace Acme.BookStore }); } - private void ConfigureCors(ServiceConfigurationContext context, IConfigurationRoot configuration) + private void ConfigureCors(ServiceConfigurationContext context, IConfiguration configuration) { context.Services.AddCors(options => { diff --git a/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.MongoDB/MongoDb/BookStoreMongoDbModule.cs b/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.MongoDB/MongoDb/BookStoreMongoDbModule.cs index cd0696569f..356ff38ef5 100644 --- a/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.MongoDB/MongoDb/BookStoreMongoDbModule.cs +++ b/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.MongoDB/MongoDb/BookStoreMongoDbModule.cs @@ -17,7 +17,7 @@ namespace Acme.BookStore.MongoDB typeof(AbpSettingManagementMongoDbModule), typeof(AbpIdentityMongoDbModule), typeof(AbpIdentityServerMongoDbModule), - typeof(BackgroundJobsMongoDbModule), + typeof(AbpBackgroundJobsMongoDbModule), typeof(AbpAuditLoggingMongoDbModule), typeof(AbpTenantManagementMongoDbModule), typeof(AbpFeatureManagementMongoDbModule) diff --git a/samples/BookStore-Modular/application/src/Acme.BookStore.Domain.Shared/BookStoreDomainSharedModule.cs b/samples/BookStore-Modular/application/src/Acme.BookStore.Domain.Shared/BookStoreDomainSharedModule.cs index fe94f9d80d..8d6172ee28 100644 --- a/samples/BookStore-Modular/application/src/Acme.BookStore.Domain.Shared/BookStoreDomainSharedModule.cs +++ b/samples/BookStore-Modular/application/src/Acme.BookStore.Domain.Shared/BookStoreDomainSharedModule.cs @@ -17,7 +17,7 @@ namespace Acme.BookStore { [DependsOn( typeof(AbpAuditLoggingDomainSharedModule), - typeof(BackgroundJobsDomainSharedModule), + typeof(AbpBackgroundJobsDomainSharedModule), typeof(AbpFeatureManagementDomainSharedModule), typeof(AbpIdentityDomainSharedModule), typeof(AbpIdentityServerDomainSharedModule), diff --git a/samples/BookStore-Modular/application/src/Acme.BookStore.Domain/BookStoreDomainModule.cs b/samples/BookStore-Modular/application/src/Acme.BookStore.Domain/BookStoreDomainModule.cs index 3c5fabb562..fdd0445913 100644 --- a/samples/BookStore-Modular/application/src/Acme.BookStore.Domain/BookStoreDomainModule.cs +++ b/samples/BookStore-Modular/application/src/Acme.BookStore.Domain/BookStoreDomainModule.cs @@ -17,7 +17,7 @@ namespace Acme.BookStore [DependsOn( typeof(BookStoreDomainSharedModule), typeof(AbpAuditLoggingDomainModule), - typeof(BackgroundJobsDomainModule), + typeof(AbpBackgroundJobsDomainModule), typeof(AbpFeatureManagementDomainModule), typeof(AbpIdentityDomainModule), typeof(AbpPermissionManagementDomainIdentityModule), diff --git a/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/BookStoreMigrationsDbContextFactory.cs b/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/BookStoreMigrationsDbContextFactory.cs index da72e6fb21..7212eb7340 100644 --- a/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/BookStoreMigrationsDbContextFactory.cs +++ b/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/BookStoreMigrationsDbContextFactory.cs @@ -19,7 +19,7 @@ namespace Acme.BookStore.EntityFrameworkCore return new BookStoreMigrationsDbContext(builder.Options); } - private static IConfigurationRoot BuildConfiguration() + private static IConfiguration BuildConfiguration() { var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) diff --git a/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore/EntityFrameworkCore/BookStoreEntityFrameworkCoreModule.cs b/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore/EntityFrameworkCore/BookStoreEntityFrameworkCoreModule.cs index 08c438f03a..5cb2a6dc7e 100644 --- a/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore/EntityFrameworkCore/BookStoreEntityFrameworkCoreModule.cs +++ b/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore/EntityFrameworkCore/BookStoreEntityFrameworkCoreModule.cs @@ -21,7 +21,7 @@ namespace Acme.BookStore.EntityFrameworkCore typeof(AbpPermissionManagementEntityFrameworkCoreModule), typeof(AbpSettingManagementEntityFrameworkCoreModule), typeof(AbpEntityFrameworkCoreSqlServerModule), - typeof(BackgroundJobsEntityFrameworkCoreModule), + typeof(AbpBackgroundJobsEntityFrameworkCoreModule), typeof(AbpAuditLoggingEntityFrameworkCoreModule), typeof(AbpTenantManagementEntityFrameworkCoreModule), typeof(AbpFeatureManagementEntityFrameworkCoreModule), diff --git a/samples/BookStore-Modular/application/src/Acme.BookStore.Web/BookStoreWebModule.cs b/samples/BookStore-Modular/application/src/Acme.BookStore.Web/BookStoreWebModule.cs index e13fcdca40..f8a38f66b4 100644 --- a/samples/BookStore-Modular/application/src/Acme.BookStore.Web/BookStoreWebModule.cs +++ b/samples/BookStore-Modular/application/src/Acme.BookStore.Web/BookStoreWebModule.cs @@ -82,7 +82,7 @@ namespace Acme.BookStore.Web ConfigureSwaggerServices(context.Services); } - private void ConfigureUrls(IConfigurationRoot configuration) + private void ConfigureUrls(IConfiguration configuration) { Configure(options => { @@ -90,7 +90,7 @@ namespace Acme.BookStore.Web }); } - private void ConfigureAuthentication(ServiceConfigurationContext context, IConfigurationRoot configuration) + private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration) { context.Services.AddAuthentication() .AddIdentityServerAuthentication(options => diff --git a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.HttpApi.Host/BookManagementHttpApiHostModule.cs b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.HttpApi.Host/BookManagementHttpApiHostModule.cs index 431d3f467a..1e9a170c47 100644 --- a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.HttpApi.Host/BookManagementHttpApiHostModule.cs +++ b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.HttpApi.Host/BookManagementHttpApiHostModule.cs @@ -89,7 +89,7 @@ namespace Acme.BookStore.BookManagement options.ApiName = "BookManagement"; }); - Configure(options => + Configure(options => { options.KeyPrefix = "BookManagement:"; }); diff --git a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.HttpApi.Host/EntityFrameworkCore/MyProjectHttpApiHostMigrationsDbContextFactory.cs b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.HttpApi.Host/EntityFrameworkCore/MyProjectHttpApiHostMigrationsDbContextFactory.cs index 90798873d4..8def84ba37 100644 --- a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.HttpApi.Host/EntityFrameworkCore/MyProjectHttpApiHostMigrationsDbContextFactory.cs +++ b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.HttpApi.Host/EntityFrameworkCore/MyProjectHttpApiHostMigrationsDbContextFactory.cs @@ -17,7 +17,7 @@ namespace Acme.BookStore.BookManagement.EntityFrameworkCore return new MyProjectHttpApiHostMigrationsDbContext(builder.Options); } - private static IConfigurationRoot BuildConfiguration() + private static IConfiguration BuildConfiguration() { var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) diff --git a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.IdentityServer/BookManagementIdentityServerModule.cs b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.IdentityServer/BookManagementIdentityServerModule.cs index 2133245501..9c75a1b167 100644 --- a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.IdentityServer/BookManagementIdentityServerModule.cs +++ b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.IdentityServer/BookManagementIdentityServerModule.cs @@ -108,7 +108,7 @@ namespace Acme.BookStore.BookManagement options.ApiName = configuration["AuthServer:ApiName"]; }); - Configure(options => + Configure(options => { options.KeyPrefix = "BookManagement:"; }); diff --git a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.IdentityServer/EntityFrameworkCore/IdentityServerHostMigrationsDbContextFactory.cs b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.IdentityServer/EntityFrameworkCore/IdentityServerHostMigrationsDbContextFactory.cs index d099542fa1..03824a1c70 100644 --- a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.IdentityServer/EntityFrameworkCore/IdentityServerHostMigrationsDbContextFactory.cs +++ b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.IdentityServer/EntityFrameworkCore/IdentityServerHostMigrationsDbContextFactory.cs @@ -17,7 +17,7 @@ namespace Acme.BookStore.BookManagement.EntityFrameworkCore return new IdentityServerHostMigrationsDbContext(builder.Options); } - private static IConfigurationRoot BuildConfiguration() + private static IConfiguration BuildConfiguration() { var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) diff --git a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Host/BookManagementWebHostModule.cs b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Host/BookManagementWebHostModule.cs index abe360ec94..da1a8dc2fb 100644 --- a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Host/BookManagementWebHostModule.cs +++ b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Host/BookManagementWebHostModule.cs @@ -85,15 +85,15 @@ namespace Acme.BookStore.BookManagement ConfigureRedis(context, configuration, hostingEnvironment); } - private void ConfigureCache(IConfigurationRoot configuration) + private void ConfigureCache(IConfiguration configuration) { - Configure(options => + Configure(options => { options.KeyPrefix = "BookManagement:"; }); } - private void ConfigureUrls(IConfigurationRoot configuration) + private void ConfigureUrls(IConfiguration configuration) { Configure(options => { @@ -109,7 +109,7 @@ namespace Acme.BookStore.BookManagement }); } - private void ConfigureAuthentication(ServiceConfigurationContext context, IConfigurationRoot configuration) + private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration) { context.Services.AddAuthentication(options => { @@ -177,7 +177,7 @@ namespace Acme.BookStore.BookManagement private void ConfigureRedis( ServiceConfigurationContext context, - IConfigurationRoot configuration, + IConfiguration configuration, IWebHostEnvironment hostingEnvironment) { context.Services.AddStackExchangeRedisCache(options => diff --git a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Unified/EntityFrameworkCore/UnifiedDbContextFactory.cs b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Unified/EntityFrameworkCore/UnifiedDbContextFactory.cs index feda4e7912..0becde1b9d 100644 --- a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Unified/EntityFrameworkCore/UnifiedDbContextFactory.cs +++ b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Unified/EntityFrameworkCore/UnifiedDbContextFactory.cs @@ -17,7 +17,7 @@ namespace Acme.BookStore.BookManagement.EntityFrameworkCore return new UnifiedDbContext(builder.Options); } - private static IConfigurationRoot BuildConfiguration() + private static IConfiguration BuildConfiguration() { var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) diff --git a/samples/BookStore/src/Acme.BookStore.Domain.Shared/BookStoreDomainSharedModule.cs b/samples/BookStore/src/Acme.BookStore.Domain.Shared/BookStoreDomainSharedModule.cs index e7f8fc146a..95241feeb8 100644 --- a/samples/BookStore/src/Acme.BookStore.Domain.Shared/BookStoreDomainSharedModule.cs +++ b/samples/BookStore/src/Acme.BookStore.Domain.Shared/BookStoreDomainSharedModule.cs @@ -16,7 +16,7 @@ namespace Acme.BookStore { [DependsOn( typeof(AbpAuditLoggingDomainSharedModule), - typeof(BackgroundJobsDomainSharedModule), + typeof(AbpBackgroundJobsDomainSharedModule), typeof(AbpFeatureManagementDomainSharedModule), typeof(AbpIdentityDomainSharedModule), typeof(AbpIdentityServerDomainSharedModule), diff --git a/samples/BookStore/src/Acme.BookStore.Domain/BookStoreDomainModule.cs b/samples/BookStore/src/Acme.BookStore.Domain/BookStoreDomainModule.cs index 91cae5f506..2f3f2610a9 100644 --- a/samples/BookStore/src/Acme.BookStore.Domain/BookStoreDomainModule.cs +++ b/samples/BookStore/src/Acme.BookStore.Domain/BookStoreDomainModule.cs @@ -16,7 +16,7 @@ namespace Acme.BookStore [DependsOn( typeof(BookStoreDomainSharedModule), typeof(AbpAuditLoggingDomainModule), - typeof(BackgroundJobsDomainModule), + typeof(AbpBackgroundJobsDomainModule), typeof(AbpFeatureManagementDomainModule), typeof(AbpIdentityDomainModule), typeof(AbpPermissionManagementDomainIdentityModule), diff --git a/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/EntityFrameworkCore/BookStoreEntityFrameworkCoreModule.cs b/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/EntityFrameworkCore/BookStoreEntityFrameworkCoreModule.cs index efa5642632..156a4207cb 100644 --- a/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/EntityFrameworkCore/BookStoreEntityFrameworkCoreModule.cs +++ b/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/EntityFrameworkCore/BookStoreEntityFrameworkCoreModule.cs @@ -20,7 +20,7 @@ namespace Acme.BookStore.EntityFrameworkCore typeof(AbpPermissionManagementEntityFrameworkCoreModule), typeof(AbpSettingManagementEntityFrameworkCoreModule), typeof(AbpEntityFrameworkCoreSqlServerModule), - typeof(BackgroundJobsEntityFrameworkCoreModule), + typeof(AbpBackgroundJobsEntityFrameworkCoreModule), typeof(AbpAuditLoggingEntityFrameworkCoreModule), typeof(AbpTenantManagementEntityFrameworkCoreModule), typeof(AbpFeatureManagementEntityFrameworkCoreModule) diff --git a/samples/BookStore/src/Acme.BookStore.Web/BookStoreWebModule.cs b/samples/BookStore/src/Acme.BookStore.Web/BookStoreWebModule.cs index 6b071d8b71..e835890482 100644 --- a/samples/BookStore/src/Acme.BookStore.Web/BookStoreWebModule.cs +++ b/samples/BookStore/src/Acme.BookStore.Web/BookStoreWebModule.cs @@ -73,7 +73,7 @@ namespace Acme.BookStore.Web ConfigureSwaggerServices(context.Services); } - private void ConfigureUrls(IConfigurationRoot configuration) + private void ConfigureUrls(IConfiguration configuration) { Configure(options => { @@ -81,7 +81,7 @@ namespace Acme.BookStore.Web }); } - private void ConfigureAuthentication(ServiceConfigurationContext context, IConfigurationRoot configuration) + private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration) { context.Services.AddAuthentication() .AddIdentityServerAuthentication(options => diff --git a/samples/DashboardDemo/src/DashboardDemo.Domain.Shared/DashboardDemoDomainSharedModule.cs b/samples/DashboardDemo/src/DashboardDemo.Domain.Shared/DashboardDemoDomainSharedModule.cs index 4b7195bb94..ad6d56630b 100644 --- a/samples/DashboardDemo/src/DashboardDemo.Domain.Shared/DashboardDemoDomainSharedModule.cs +++ b/samples/DashboardDemo/src/DashboardDemo.Domain.Shared/DashboardDemoDomainSharedModule.cs @@ -16,7 +16,7 @@ namespace DashboardDemo { [DependsOn( typeof(AbpAuditLoggingDomainSharedModule), - typeof(BackgroundJobsDomainSharedModule), + typeof(AbpBackgroundJobsDomainSharedModule), typeof(AbpFeatureManagementDomainSharedModule), typeof(AbpIdentityDomainSharedModule), typeof(AbpIdentityServerDomainSharedModule), diff --git a/samples/DashboardDemo/src/DashboardDemo.Domain/DashboardDemoDomainModule.cs b/samples/DashboardDemo/src/DashboardDemo.Domain/DashboardDemoDomainModule.cs index 0b0a2b5d76..5e386f7336 100644 --- a/samples/DashboardDemo/src/DashboardDemo.Domain/DashboardDemoDomainModule.cs +++ b/samples/DashboardDemo/src/DashboardDemo.Domain/DashboardDemoDomainModule.cs @@ -16,7 +16,7 @@ namespace DashboardDemo [DependsOn( typeof(DashboardDemoDomainSharedModule), typeof(AbpAuditLoggingDomainModule), - typeof(BackgroundJobsDomainModule), + typeof(AbpBackgroundJobsDomainModule), typeof(AbpFeatureManagementDomainModule), typeof(AbpIdentityDomainModule), typeof(AbpPermissionManagementDomainIdentityModule), diff --git a/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/DashboardDemoMigrationsDbContextFactory.cs b/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/DashboardDemoMigrationsDbContextFactory.cs index a2ff117ec4..0773892abc 100644 --- a/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/DashboardDemoMigrationsDbContextFactory.cs +++ b/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/DashboardDemoMigrationsDbContextFactory.cs @@ -19,7 +19,7 @@ namespace DashboardDemo.EntityFrameworkCore return new DashboardDemoMigrationsDbContext(builder.Options); } - private static IConfigurationRoot BuildConfiguration() + private static IConfiguration BuildConfiguration() { var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) diff --git a/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore/EntityFrameworkCore/DashboardDemoEntityFrameworkCoreModule.cs b/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore/EntityFrameworkCore/DashboardDemoEntityFrameworkCoreModule.cs index 66c26ec224..de03726a20 100644 --- a/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore/EntityFrameworkCore/DashboardDemoEntityFrameworkCoreModule.cs +++ b/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore/EntityFrameworkCore/DashboardDemoEntityFrameworkCoreModule.cs @@ -20,7 +20,7 @@ namespace DashboardDemo.EntityFrameworkCore typeof(AbpPermissionManagementEntityFrameworkCoreModule), typeof(AbpSettingManagementEntityFrameworkCoreModule), typeof(AbpEntityFrameworkCoreSqlServerModule), - typeof(BackgroundJobsEntityFrameworkCoreModule), + typeof(AbpBackgroundJobsEntityFrameworkCoreModule), typeof(AbpAuditLoggingEntityFrameworkCoreModule), typeof(AbpTenantManagementEntityFrameworkCoreModule), typeof(AbpFeatureManagementEntityFrameworkCoreModule) diff --git a/samples/DashboardDemo/src/DashboardDemo.Web/DashboardDemoWebModule.cs b/samples/DashboardDemo/src/DashboardDemo.Web/DashboardDemoWebModule.cs index b10bda3080..4b84952eec 100644 --- a/samples/DashboardDemo/src/DashboardDemo.Web/DashboardDemoWebModule.cs +++ b/samples/DashboardDemo/src/DashboardDemo.Web/DashboardDemoWebModule.cs @@ -79,7 +79,7 @@ namespace DashboardDemo.Web ConfigureSwaggerServices(context.Services); } - private void ConfigureUrls(IConfigurationRoot configuration) + private void ConfigureUrls(IConfiguration configuration) { Configure(options => { @@ -87,7 +87,7 @@ namespace DashboardDemo.Web }); } - private void ConfigureAuthentication(ServiceConfigurationContext context, IConfigurationRoot configuration) + private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration) { context.Services.AddAuthentication() .AddIdentityServerAuthentication(options =>