From a2e2850eca0d485ee97997e6f4f4a0d9f1aa964a Mon Sep 17 00:00:00 2001 From: colin Date: Fri, 9 Aug 2024 20:18:29 +0800 Subject: [PATCH] fix(session): fix some issues caused by user session design. --- Directory.Packages.props | 1 + .../src/api/caching-management/cache/index.ts | 43 +--- apps/vue/src/api/logging/logs/index.ts | 6 +- .../open-iddict-application/index.ts | 71 +------ .../open-iddict-authorization/index.ts | 44 +--- .../api/openiddict/open-iddict-scope/index.ts | 71 +------ .../api/openiddict/open-iddict-token/index.ts | 44 +--- .../permissions/index.ts | 6 +- apps/vue/src/api/platform/package/index.ts | 93 ++------- .../src/api/platform/package/model/index.ts | 1 + .../api/platform/user-favorites-menu/index.ts | 86 ++------ apps/vue/src/api/saas/edition/index.ts | 53 ++--- apps/vue/src/api/saas/tenant/index.ts | 105 ++-------- apps/vue/src/api/sys/menu.ts | 14 +- apps/vue/src/api/sys/theme.ts | 6 +- .../src/api/text-templating/contents/index.ts | 36 +--- .../api/text-templating/definitions/index.ts | 53 ++--- .../src/api/webhooks/send-attempts/index.ts | 14 +- .../src/api/webhooks/subscriptions/index.ts | 16 +- .../hooks/abp/useNotificationSerializer.ts | 62 ++++++ .../header/components/notify/index.vue | 42 +++- .../components/notify/useNotifications.ts | 56 ++--- apps/vue/src/store/modules/user.ts | 11 +- .../components/NotificationTable.vue | 7 +- .../AbpExceptionHandlingWrapperMiddleware.cs | 88 ++++---- .../Wrapper/AbpAspNetCoreMvcWrapperModule.cs | 11 +- ...entitySessionClaimsPrincipalContributor.cs | 3 +- .../IdentitySessionRevokeEventHandler.cs | 2 +- .../AspNetCore/AbpSessionMiddleware.cs | 13 +- .../Menus/UserFavoriteMenuController.cs | 6 +- .../SignalRNotificationPublishProvider.cs | 17 +- .../AuthServerHttpApiHostModule.cs | 3 - ...icroService.AuthServer.HttpApi.Host.csproj | 1 - .../AuthServerModule.cs | 2 - .../LY.MicroService.AuthServer.csproj | 1 - .../BackendAdminHttpApiHostModule.cs | 1 - .../IdentityServerHttpApiHostModule.cs | 1 - ...Service.identityServer.HttpApi.Host.csproj | 1 - .../IdentityServerModule.cs | 2 - .../LY.MicroService.IdentityServer.csproj | 1 - .../Distributed/NotificationEventHandler.cs | 12 +- ...ervice.RealtimeMessage.HttpApi.Host.csproj | 1 + ...ltimeMessageHttpApiHostModule.Configure.cs | 2 +- .../RealtimeMessageHttpApiHostModule.cs | 2 + build/build-aspnetcore-common.ps1 | 4 +- docker-compose.override.configuration.yml | 42 +++- docker-compose.yml | 42 ++-- .../InternalGatewayModule.cs | 29 ++- ...NGYUN.MicroService.Internal.Gateway.csproj | 1 + .../Properties/launchSettings.json | 2 +- .../appsettings.Development.json | 12 +- .../yarp.json | 194 ++++++++++++++---- 52 files changed, 618 insertions(+), 819 deletions(-) create mode 100644 apps/vue/src/hooks/abp/useNotificationSerializer.ts diff --git a/Directory.Packages.props b/Directory.Packages.props index f39241b93..8971999ed 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -252,5 +252,6 @@ + \ No newline at end of file diff --git a/apps/vue/src/api/caching-management/cache/index.ts b/apps/vue/src/api/caching-management/cache/index.ts index fcfaa16c3..b9ab32b64 100644 --- a/apps/vue/src/api/caching-management/cache/index.ts +++ b/apps/vue/src/api/caching-management/cache/index.ts @@ -1,4 +1,4 @@ -import { defAbpHttp } from '/@/utils/http/abp'; +import { defHttp } from '/@/utils/http/axios'; import { CacheKeys, CacheValue, @@ -6,51 +6,28 @@ import { GetCacheKeysRequest, } from './model'; -const remoteServiceName = 'CachingManagement'; -const controllerName = 'Cache'; - export const getKeys = (input: GetCacheKeysRequest) => { - return defAbpHttp.request({ - service: remoteServiceName, - controller: controllerName, - action: 'GetKeysAsync', - params: { - input: input, - }, + return defHttp.get({ + url: '/api/caching-management/cache', + params: input, }); }; export const getValue = (key: string) => { - return defAbpHttp.request({ - service: remoteServiceName, - controller: controllerName, - action: 'GetValueAsync', - params: { - input: { - key: key, - } - }, + return defHttp.get({ + url: `/api/caching-management/cache?key=${key}`, }); }; export const refresh = (input: CacheRefreshRequest) => { - return defAbpHttp.request({ - service: remoteServiceName, - controller: controllerName, - action: 'RefreshAsync', + return defHttp.put({ + url: `/api/caching-management/cache/refresh`, data: input, }); }; export const remove = (key: string) => { - return defAbpHttp.request({ - service: remoteServiceName, - controller: controllerName, - action: 'RemoveAsync', - params: { - input: { - key: key, - } - }, + return defHttp.delete({ + url: `/api/caching-management/cache?key=${key}`, }); }; diff --git a/apps/vue/src/api/logging/logs/index.ts b/apps/vue/src/api/logging/logs/index.ts index 7cbd05cc4..f278bed70 100644 --- a/apps/vue/src/api/logging/logs/index.ts +++ b/apps/vue/src/api/logging/logs/index.ts @@ -1,14 +1,14 @@ -import { defAbpHttp } from '/@/utils/http/abp'; +import { defHttp } from '/@/utils/http/axios'; import { Log, GetLogPagedRequest } from './model'; export const get = (id: string) => { - return defAbpHttp.get({ + return defHttp.get({ url: `/api/auditing/logging/${id}`, }); }; export const getList = (input: GetLogPagedRequest) => { - return defAbpHttp.get>({ + return defHttp.get>({ url: '/api/auditing/logging', params: input, }); diff --git a/apps/vue/src/api/openiddict/open-iddict-application/index.ts b/apps/vue/src/api/openiddict/open-iddict-application/index.ts index 070f530fa..21e3a6e48 100644 --- a/apps/vue/src/api/openiddict/open-iddict-application/index.ts +++ b/apps/vue/src/api/openiddict/open-iddict-application/index.ts @@ -1,4 +1,4 @@ -import { defAbpHttp } from '/@/utils/http/abp'; +import { defHttp } from '/@/utils/http/axios'; import { OpenIddictApplicationDto, OpenIddictApplicationGetListInput, @@ -6,94 +6,35 @@ import { OpenIddictApplicationUpdateDto, } from './model'; -// export const GetAsyncById = (id: string) => { -// return defAbpHttp.request({ -// service: remoteServiceName, -// controller: controllerName, -// action: 'GetAsync', -// uniqueName: 'GetAsyncById', -// params: { -// id: id, -// }, -// }); -// }; - export const get = (id: string) => { - return defAbpHttp.get({ + return defHttp.get({ url: `/api/openiddict/applications/${id}`, }); }; -// export const GetListAsyncByInput = (input: OpenIddictApplicationGetListInput) => { -// return defAbpHttp.pagedRequest({ -// service: remoteServiceName, -// controller: controllerName, -// action: 'GetListAsync', -// uniqueName: 'GetListAsyncByInput', -// params: { -// input: input, -// }, -// }); -// }; - export const getList = (input: OpenIddictApplicationGetListInput) => { - return defAbpHttp.get>({ + return defHttp.get>({ url: '/api/openiddict/applications', params: input, }); }; -// export const CreateAsyncByInput = (input: OpenIddictApplicationCreateDto) => { -// return defAbpHttp.request({ -// service: remoteServiceName, -// controller: controllerName, -// action: 'CreateAsync', -// uniqueName: 'CreateAsyncByInput', -// data: input, -// }); -// }; - export const create = (input: OpenIddictApplicationCreateDto) => { - return defAbpHttp.post({ + return defHttp.post({ url: '/api/openiddict/applications', data: input, }); }; -// export const UpdateAsyncByIdAndInput = (id: string, input: OpenIddictApplicationUpdateDto) => { -// return defAbpHttp.request({ -// service: remoteServiceName, -// controller: controllerName, -// action: 'UpdateAsync', -// uniqueName: 'UpdateAsyncByIdAndInput', -// params: { -// id: id, -// }, -// data: input, -// }); -// }; - export const update = (id: string, input: OpenIddictApplicationUpdateDto) => { - return defAbpHttp.put({ + return defHttp.put({ url: `/api/openiddict/applications/${id}`, data: input, }); }; -// export const DeleteAsyncById = (id: string) => { -// return defAbpHttp.request({ -// service: remoteServiceName, -// controller: controllerName, -// action: 'DeleteAsync', -// uniqueName: 'DeleteAsyncById', -// params: { -// id: id, -// }, -// }); -// }; - export const deleteById = (id: string) => { - return defAbpHttp.delete({ + return defHttp.delete({ url: `/api/openiddict/applications/${id}`, }); }; \ No newline at end of file diff --git a/apps/vue/src/api/openiddict/open-iddict-authorization/index.ts b/apps/vue/src/api/openiddict/open-iddict-authorization/index.ts index ee17df9b9..b2f25c787 100644 --- a/apps/vue/src/api/openiddict/open-iddict-authorization/index.ts +++ b/apps/vue/src/api/openiddict/open-iddict-authorization/index.ts @@ -1,56 +1,20 @@ -import { defAbpHttp } from '/@/utils/http/abp'; +import { defHttp } from '/@/utils/http/axios'; import { OpenIddictAuthorizationDto, OpenIddictAuthorizationGetListInput, } from './model'; -// export const DeleteAsyncById = (id: string) => { -// return defAbpHttp.request({ -// service: remoteServiceName, -// controller: controllerName, -// action: 'DeleteAsync', -// uniqueName: 'DeleteAsyncById', -// params: { -// id: id, -// }, -// }); -// }; - export const deleteById = (id: string) => { - return defAbpHttp.delete({ + return defHttp.delete({ url: `/api/openiddict/authorizations/${id}`, }); }; -// export const GetAsyncById = (id: string) => { -// return defAbpHttp.request({ -// service: remoteServiceName, -// controller: controllerName, -// action: 'GetAsync', -// uniqueName: 'GetAsyncById', -// params: { -// id: id, -// }, -// }); -// }; - export const get = (id: string) => { - return defAbpHttp.get({ + return defHttp.get({ url: `/api/openiddict/authorizations/${id}`, }); }; -// export const GetListAsyncByInput = (input: OpenIddictAuthorizationGetListInput) => { -// return defAbpHttp.pagedRequest({ -// service: remoteServiceName, -// controller: controllerName, -// action: 'GetListAsync', -// uniqueName: 'GetListAsyncByInput', -// params: { -// input: input, -// }, -// }); -// }; - export const getList = (input: OpenIddictAuthorizationGetListInput) => { - return defAbpHttp.get>({ + return defHttp.get>({ url: '/api/openiddict/authorizations', params: input, }); diff --git a/apps/vue/src/api/openiddict/open-iddict-scope/index.ts b/apps/vue/src/api/openiddict/open-iddict-scope/index.ts index 5966ae24e..3d2ca39b3 100644 --- a/apps/vue/src/api/openiddict/open-iddict-scope/index.ts +++ b/apps/vue/src/api/openiddict/open-iddict-scope/index.ts @@ -1,4 +1,4 @@ -import { defAbpHttp } from '/@/utils/http/abp'; +import { defHttp } from '/@/utils/http/axios'; import { OpenIddictScopeCreateDto, OpenIddictScopeDto, @@ -6,93 +6,34 @@ import { OpenIddictScopeUpdateDto, } from './model'; -// export const CreateAsyncByInput = (input: OpenIddictScopeCreateDto) => { -// return defAbpHttp.request({ -// service: remoteServiceName, -// controller: controllerName, -// action: 'CreateAsync', -// uniqueName: 'CreateAsyncByInput', -// data: input, -// }); -// }; - export const create = (input: OpenIddictScopeCreateDto) => { - return defAbpHttp.post({ + return defHttp.post({ url: '/api/openiddict/scopes', data: input, }); }; -// export const DeleteAsyncById = (id: string) => { -// return defAbpHttp.request({ -// service: remoteServiceName, -// controller: controllerName, -// action: 'DeleteAsync', -// uniqueName: 'DeleteAsyncById', -// params: { -// id: id, -// }, -// }); -// }; - export const deleteById = (id: string) => { - return defAbpHttp.delete({ + return defHttp.delete({ url: `/api/openiddict/scopes/${id}` }); }; -// export const GetAsyncById = (id: string) => { -// return defAbpHttp.request({ -// service: remoteServiceName, -// controller: controllerName, -// action: 'GetAsync', -// uniqueName: 'GetAsyncById', -// params: { -// id: id, -// }, -// }); -// }; - export const get = (id: string) => { - return defAbpHttp.get({ + return defHttp.get({ url: `/api/openiddict/scopes/${id}` }); }; -// export const GetListAsyncByInput = (input: OpenIddictScopeGetListInput) => { -// return defAbpHttp.pagedRequest({ -// service: remoteServiceName, -// controller: controllerName, -// action: 'GetListAsync', -// uniqueName: 'GetListAsyncByInput', -// params: { -// input: input, -// }, -// }); -// }; - export const getList = (input: OpenIddictScopeGetListInput) => { - return defAbpHttp.get>({ + return defHttp.get>({ url: '/api/openiddict/scopes', params: input, }); }; -// export const UpdateAsyncByIdAndInput = (id: string, input: OpenIddictScopeUpdateDto) => { -// return defAbpHttp.request({ -// service: remoteServiceName, -// controller: controllerName, -// action: 'UpdateAsync', -// uniqueName: 'UpdateAsyncByIdAndInput', -// params: { -// id: id, -// }, -// data: input, -// }); -// }; - export const update = (id: string, input: OpenIddictScopeUpdateDto) => { - return defAbpHttp.put({ + return defHttp.put({ url: `/api/openiddict/scopes/${id}`, data: input, }); diff --git a/apps/vue/src/api/openiddict/open-iddict-token/index.ts b/apps/vue/src/api/openiddict/open-iddict-token/index.ts index 406ea3099..432fbf5f1 100644 --- a/apps/vue/src/api/openiddict/open-iddict-token/index.ts +++ b/apps/vue/src/api/openiddict/open-iddict-token/index.ts @@ -1,56 +1,20 @@ -import { defAbpHttp } from '/@/utils/http/abp'; +import { defHttp } from '/@/utils/http/axios'; import { OpenIddictTokenDto, OpenIddictTokenGetListInput, } from './model'; -// export const DeleteAsyncById = (id: string) => { -// return defAbpHttp.request({ -// service: remoteServiceName, -// controller: controllerName, -// action: 'DeleteAsync', -// uniqueName: 'DeleteAsyncById', -// params: { -// id: id, -// }, -// }); -// }; - export const deleteById = (id: string) => { - return defAbpHttp.delete({ + return defHttp.delete({ url: `/api/openiddict/tokens/${id}`, }); }; -// export const GetAsyncById = (id: string) => { -// return defAbpHttp.request({ -// service: remoteServiceName, -// controller: controllerName, -// action: 'GetAsync', -// uniqueName: 'GetAsyncById', -// params: { -// id: id, -// }, -// }); -// }; - export const get = (id: string) => { - return defAbpHttp.get({ + return defHttp.get({ url: `/api/openiddict/tokens/${id}`, }); }; -// export const GetListAsyncByInput = (input: OpenIddictTokenGetListInput) => { -// return defAbpHttp.pagedRequest({ -// service: remoteServiceName, -// controller: controllerName, -// action: 'GetListAsync', -// uniqueName: 'GetListAsyncByInput', -// params: { -// input: input, -// }, -// }); -// }; - export const getList = (input: OpenIddictTokenGetListInput) => { - return defAbpHttp.get>({ + return defHttp.get>({ url: '/api/openiddict/tokens', params: input, }); diff --git a/apps/vue/src/api/permission-management/permissions/index.ts b/apps/vue/src/api/permission-management/permissions/index.ts index 0c6437b81..79bd5a59b 100644 --- a/apps/vue/src/api/permission-management/permissions/index.ts +++ b/apps/vue/src/api/permission-management/permissions/index.ts @@ -1,15 +1,15 @@ -import { defAbpHttp } from '/@/utils/http/abp'; +import { defHttp } from '/@/utils/http/axios'; import { PermissionProvider, PermissionResult, UpdatePermissions } from './model'; export const get = (provider: PermissionProvider) => { - return defAbpHttp.get({ + return defHttp.get({ url: '/api/permission-management/permissions', params: provider, }); }; export const update = (provider: PermissionProvider, input: UpdatePermissions) => { - return defAbpHttp.put({ + return defHttp.put({ url: '/api/permission-management/permissions', data: input, params: provider, diff --git a/apps/vue/src/api/platform/package/index.ts b/apps/vue/src/api/platform/package/index.ts index 73b01191d..1c3805ef5 100644 --- a/apps/vue/src/api/platform/package/index.ts +++ b/apps/vue/src/api/platform/package/index.ts @@ -1,4 +1,4 @@ -import { defAbpHttp } from '/@/utils/http/abp'; +import { defHttp } from '/@/utils/http/axios'; import { PackageCreateDto, PackageDto, @@ -11,111 +11,58 @@ import { PackageUpdateDto } from './model'; -const remoteServiceName = 'Platform'; -const controllerName = 'Package'; - export const CreateAsyncByInput = (input: PackageCreateDto) => { - return defAbpHttp.request({ - service: remoteServiceName, - controller: controllerName, - action: 'CreateAsync', - uniqueName: 'CreateAsyncByInput', - params: { - }, + return defHttp.post({ + url: `/api/platform/packages`, data: input, }); }; export const DeleteAsyncById = (id: string) => { - return defAbpHttp.request({ - service: remoteServiceName, - controller: controllerName, - action: 'DeleteAsync', - uniqueName: 'DeleteAsyncById', - params: { - id: id, - }, + return defHttp.delete({ + url: `/api/platform/packages/${id}`, }); }; export const UploadBlobAsyncByIdAndInput = (id: string, input: PackageBlobUploadDto) => { - return defAbpHttp.request({ - service: remoteServiceName, - controller: controllerName, - action: 'UploadBlobAsync', - uniqueName: 'UploadBlobAsyncByIdAndInput', - params: id, + return defHttp.post({ + url: `/api/platform/packages/${id}/blob`, data: input, }); }; export const RemoveBlobAsyncByIdAndInput = (id: string, input: PackageBlobRemoveDto) => { - return defAbpHttp.request({ - service: remoteServiceName, - controller: controllerName, - action: 'RemoveBlobAsync', - uniqueName: 'RemoveBlobAsyncByIdAndInput', - params: { - id: id, - input: input, - }, + return defHttp.delete({ + url: `/api/platform/packages/${id}/blob?name=${input.name}`, }); }; export const DownloadBlobAsyncByIdAndInput = (id: string, input: PackageBlobDownloadInput) => { - return defAbpHttp.request({ - service: remoteServiceName, - controller: controllerName, - action: 'DownloadBlobAsync', - uniqueName: 'DownloadBlobAsyncByIdAndInput', - params: { - id: id, - input: input, - }, + return defHttp.get({ + url: `/api/platform/packages/${id}/blob?name=${input.name}`, },{ withToken: false, }); }; export const GetAsyncById = (id: string) => { - return defAbpHttp.request({ - service: remoteServiceName, - controller: controllerName, - action: 'GetAsync', - uniqueName: 'GetAsyncById', - params: { - id: id, - }, + return defHttp.get({ + url: `/api/platform/packages/${id}`, },{ withToken: false, }); }; export const GetLatestAsyncByInput = (input: PackageGetLatestInput) => { - return defAbpHttp.request({ - service: remoteServiceName, - controller: controllerName, - action: 'GetLatestAsync', - uniqueName: 'GetLatestAsyncByInput', - params: { - input: input, - }, + return defHttp.get({ + url: `/api/platform/packages/${input.name}/latest/${input.version}`, },{ withToken: false, }); }; export const GetListAsyncByInput = (input: PackageGetPagedListInput) => { - return defAbpHttp.pagedRequest({ - service: remoteServiceName, - controller: controllerName, - action: 'GetListAsync', - uniqueName: 'GetListAsyncByInput', - params: { - input: input, - }, + return defHttp.get>({ + url: `/api/platform/packages`, + params: input, }); }; export const UpdateAsyncByIdAndInput = (id: string, input: PackageUpdateDto) => { - return defAbpHttp.request({ - service: remoteServiceName, - controller: controllerName, - action: 'UpdateAsync', - uniqueName: 'UpdateAsyncByIdAndInput', - params: id, + return defHttp.put({ + url: `/api/platform/packages/${id}`, data: input, }); }; diff --git a/apps/vue/src/api/platform/package/model/index.ts b/apps/vue/src/api/platform/package/model/index.ts index aefc684fc..5cee80944 100644 --- a/apps/vue/src/api/platform/package/model/index.ts +++ b/apps/vue/src/api/platform/package/model/index.ts @@ -25,6 +25,7 @@ export interface PackageBlobDownloadInput { export interface PackageGetLatestInput { name: string; + version: string; } export interface PackageGetPagedListInput extends PagedAndSortedResultRequestDto { diff --git a/apps/vue/src/api/platform/user-favorites-menu/index.ts b/apps/vue/src/api/platform/user-favorites-menu/index.ts index 93e79cd14..96803f38e 100644 --- a/apps/vue/src/api/platform/user-favorites-menu/index.ts +++ b/apps/vue/src/api/platform/user-favorites-menu/index.ts @@ -1,104 +1,56 @@ -import { defAbpHttp } from '/@/utils/http/abp'; +import { defHttp } from '/@/utils/http/axios'; import { UserFavoriteMenuDto, UserFavoriteMenuCreateDto, UserFavoriteMenuUpdateDto } from './model'; -const remoteService = { - name: 'Platform', - controller: 'UserFavoriteMenu', - replace: { - framework: 'Vue Vben Admin', - } -}; - export const create = (userId: string, input: UserFavoriteMenuCreateDto) => { - input.framework = remoteService.replace.framework; - return defAbpHttp.request({ - service: remoteService.name, - controller: remoteService.controller, - action: 'CreateAsync', - params: { - userId: userId, - }, + input.framework = 'Vue Vben Admin'; + return defHttp.post({ + url: `/api/platform/menus/favorites/${userId}`, data: input, }); }; export const createMyFavoriteMenu = (input: UserFavoriteMenuCreateDto) => { - input.framework = remoteService.replace.framework; - return defAbpHttp.request({ - service: remoteService.name, - controller: remoteService.controller, - action: 'CreateMyFavoriteMenuAsync', + input.framework = 'Vue Vben Admin'; + return defHttp.post({ + url: `/api/platform/menus/favorites/my-favorite-menus`, data: input, }); }; export const del = (userId: string, menuId: string) => { - return defAbpHttp.request({ - service: remoteService.name, - controller: remoteService.controller, - action: 'DeleteAsync', - params: { - userId: userId, - input: { - MenuId: menuId, - }, - }, + return defHttp.delete({ + url: `/api/platform/menus/favorites/${userId}/${menuId}`, }); }; export const delMyFavoriteMenu = (menuId: string) => { - return defAbpHttp.request({ - service: remoteService.name, - controller: remoteService.controller, - action: 'DeleteMyFavoriteMenuAsync', - params: { - input: { - MenuId: menuId, - }, - }, + return defHttp.delete({ + url: `/api/platform/menus/favorites/my-favorite-menus/${menuId}`, }); }; export const update = (userId: string, input: UserFavoriteMenuUpdateDto) => { - return defAbpHttp.request({ - service: remoteService.name, - controller: remoteService.controller, - action: 'UpdateAsync', - params: { - userId: userId, - }, + return defHttp.put({ + url: `/api/platform/menus/favorites/${userId}`, data: input, }); }; export const updateMyFavoriteMenu = (input: UserFavoriteMenuUpdateDto) => { - return defAbpHttp.request({ - service: remoteService.name, - controller: remoteService.controller, - action: 'UpdateMyFavoriteMenuAsync', + return defHttp.put({ + url: `/api/platform/menus/favorites/my-favorite-menus`, data: input, }); }; export const getList = (userId: string) => { - return defAbpHttp.listRequest({ - service: remoteService.name, - controller: remoteService.controller, - action: 'GetListAsync', - params: { - userId: userId, - framework: remoteService.replace.framework, - }, + return defHttp.get>({ + url: `/api/platform/menus/favorites/${userId}?framework=Vue Vben Admin`, }); }; export const getMyFavoriteMenuList = () => { - return defAbpHttp.listRequest({ - service: remoteService.name, - controller: remoteService.controller, - action: 'GetMyFavoriteMenuListAsync', - params: { - framework: remoteService.replace.framework, - }, + return defHttp.get>({ + url: `/api/platform/menus/favorites/my-favorite-menus?framework=Vue Vben Admin`, }); }; diff --git a/apps/vue/src/api/saas/edition/index.ts b/apps/vue/src/api/saas/edition/index.ts index d2db7f995..162928e97 100644 --- a/apps/vue/src/api/saas/edition/index.ts +++ b/apps/vue/src/api/saas/edition/index.ts @@ -1,64 +1,35 @@ -import { defAbpHttp } from '/@/utils/http/abp'; +import { defHttp } from '/@/utils/http/axios'; import { EditionCreateDto, EditionDto,EditionGetListInput, EditionUpdateDto, } from './model'; -const remoteServiceName = 'AbpSaas'; -const controllerName = 'Edition'; - export const CreateAsyncByInput = (input: EditionCreateDto) => { - return defAbpHttp.request({ - service: remoteServiceName, - controller: controllerName, - action: 'CreateAsync', - uniqueName: 'CreateAsyncByInput', + return defHttp.post({ + url: `/api/saas/editions`, data: input, }); }; export const DeleteAsyncById = (id: string) => { - return defAbpHttp.request({ - service: remoteServiceName, - controller: controllerName, - action: 'DeleteAsync', - uniqueName: 'DeleteAsyncById', - params: { - id: id, - }, + return defHttp.delete({ + url: `/api/saas/editions/${id}`, }); }; export const GetAsyncById = (id: string) => { - return defAbpHttp.request({ - service: remoteServiceName, - controller: controllerName, - action: 'GetAsync', - uniqueName: 'GetAsyncById', - params: { - id: id, - }, + return defHttp.get({ + url: `/api/saas/editions/${id}`, }); }; export const GetListAsyncByInput = (input: EditionGetListInput) => { - return defAbpHttp.pagedRequest({ - service: remoteServiceName, - controller: controllerName, - action: 'GetListAsync', - uniqueName: 'GetListAsyncByInput', - params: { - input: input, - }, + return defHttp.get>({ + url: `/api/saas/editions`, + params: input, }); }; export const UpdateAsyncByIdAndInput = (id: string, input: EditionUpdateDto) => { - return defAbpHttp.request({ - service: remoteServiceName, - controller: controllerName, - action: 'UpdateAsync', - uniqueName: 'UpdateAsyncByIdAndInput', - params: { - id: id, - }, + return defHttp.put({ + url: `/api/saas/editions/${id}`, data: input, }); }; diff --git a/apps/vue/src/api/saas/tenant/index.ts b/apps/vue/src/api/saas/tenant/index.ts index 8b65d95e8..140e71909 100644 --- a/apps/vue/src/api/saas/tenant/index.ts +++ b/apps/vue/src/api/saas/tenant/index.ts @@ -1,127 +1,66 @@ -import { defAbpHttp } from '/@/utils/http/abp'; +import { defHttp } from '/@/utils/http/axios'; import { TenantDto,TenantGetListInput, TenantCreateDto, TenantUpdateDto, TenantConnectionStringDto,TenantConnectionStringCreateOrUpdate, } from './model'; -const remoteServiceName = 'AbpSaas'; -const controllerName = 'Tenant'; - export const GetAsyncById = (id: string) => { - return defAbpHttp.request({ - service: remoteServiceName, - controller: controllerName, - action: 'GetAsync', - uniqueName: 'GetAsyncById', - params: { - id: id, - }, + return defHttp.get({ + url: `/api/saas/tenants/${id}`, }); }; export const GetAsyncByName = (name: string) => { - return defAbpHttp.request({ - service: remoteServiceName, - controller: controllerName, - action: 'GetAsync', - uniqueName: 'GetAsyncByName', - params: { - name: name, - }, + return defHttp.get({ + url: `/api/saas/tenants/by-name/${name}`, }); }; export const GetListAsyncByInput = (input: TenantGetListInput) => { - return defAbpHttp.pagedRequest({ - service: remoteServiceName, - controller: controllerName, - action: 'GetListAsync', - uniqueName: 'GetListAsyncByInput', - params: { - input: input, - }, + return defHttp.get>({ + url: `/api/saas/tenants`, + params: input, }); }; export const CreateAsyncByInput = (input: TenantCreateDto) => { - return defAbpHttp.request({ - service: remoteServiceName, - controller: controllerName, - action: 'CreateAsync', - uniqueName: 'CreateAsyncByInput', + return defHttp.post({ + url: `/api/saas/tenants`, data: input, }); }; export const UpdateAsyncByIdAndInput = (id: string, input: TenantUpdateDto) => { - return defAbpHttp.request({ - service: remoteServiceName, - controller: controllerName, - action: 'UpdateAsync', - uniqueName: 'UpdateAsyncByIdAndInput', - params: { - id: id, - }, + return defHttp.put({ + url: `/api/saas/tenants/${id}`, data: input, }); }; export const DeleteAsyncById = (id: string) => { - return defAbpHttp.request({ - service: remoteServiceName, - controller: controllerName, - action: 'DeleteAsync', - uniqueName: 'DeleteAsyncById', - params: { - id: id, - }, + return defHttp.delete({ + url: `/api/saas/tenants/${id}`, }); }; export const GetConnectionStringAsyncByIdAndName = (id: string, name: string) => { - return defAbpHttp.request({ - service: remoteServiceName, - controller: controllerName, - action: 'GetConnectionStringAsync', - uniqueName: 'GetConnectionStringAsyncByIdAndName', - params: { - id: id, - name: name, - }, + return defHttp.get({ + url: `/api/saas/tenants/${id}/connection-string/${name}`, }); }; export const GetConnectionStringAsyncById = (id: string) => { - return defAbpHttp.listRequest({ - service: remoteServiceName, - controller: controllerName, - action: 'GetConnectionStringAsync', - uniqueName: 'GetConnectionStringAsyncById', - params: { - id: id, - }, + return defHttp.get>({ + url: `/api/saas/tenants/${id}/connection-string`, }); }; export const SetConnectionStringAsyncByIdAndInput = (id: string, input: TenantConnectionStringCreateOrUpdate) => { - return defAbpHttp.request({ - service: remoteServiceName, - controller: controllerName, - action: 'SetConnectionStringAsync', - uniqueName: 'SetConnectionStringAsyncByIdAndInput', - params: { - id: id, - }, + return defHttp.put({ + url: `/api/saas/tenants/${id}/connection-string`, data: input, }); }; export const DeleteConnectionStringAsyncByIdAndName = (id: string, name: string) => { - return defAbpHttp.request({ - service: remoteServiceName, - controller: controllerName, - action: 'DeleteConnectionStringAsync', - uniqueName: 'DeleteConnectionStringAsyncByIdAndName', - params: { - id: id, - name: name, - }, + return defHttp.delete({ + url: `/api/saas/tenants/${id}/connection-string/${name}`, }); }; diff --git a/apps/vue/src/api/sys/menu.ts b/apps/vue/src/api/sys/menu.ts index 7428496f9..fda792c69 100644 --- a/apps/vue/src/api/sys/menu.ts +++ b/apps/vue/src/api/sys/menu.ts @@ -1,4 +1,4 @@ -import { defAbpHttp } from '/@/utils/http/abp'; +import { defHttp } from '/@/utils/http/axios'; import { RouteItem } from './model/menuModel'; /** @@ -6,15 +6,7 @@ import { RouteItem } from './model/menuModel'; */ export const getMenuList = () => { - return defAbpHttp.request>({ - service: 'Platform', - controller: 'Menu', - action: 'GetCurrentUserMenuListAsync', - uniqueName: 'GetCurrentUserMenuListAsyncByInput', - params: { - input: { - framework: 'Vue Vben Admin', - }, - }, + return defHttp.get>({ + url: `/api/platform/menus/by-current-user?framework=Vue Vben Admin`, }); }; diff --git a/apps/vue/src/api/sys/theme.ts b/apps/vue/src/api/sys/theme.ts index 931b7c5c0..488288968 100644 --- a/apps/vue/src/api/sys/theme.ts +++ b/apps/vue/src/api/sys/theme.ts @@ -1,14 +1,14 @@ -import { defAbpHttp } from '/@/utils/http/abp'; +import { defHttp } from '/@/utils/http/axios'; import { ThemeSetting } from './model/themeModel'; export const getTheme = () => { - return defAbpHttp.get({ + return defHttp.get({ url: '/api/platform/theme/vue-vben-admin', }); }; export const changeTheme = (themeSetting: ThemeSetting) => { - return defAbpHttp.put({ + return defHttp.put({ url: '/api/platform/theme/vue-vben-admin/change', data: themeSetting, }); diff --git a/apps/vue/src/api/text-templating/contents/index.ts b/apps/vue/src/api/text-templating/contents/index.ts index 431d37a97..74e747620 100644 --- a/apps/vue/src/api/text-templating/contents/index.ts +++ b/apps/vue/src/api/text-templating/contents/index.ts @@ -1,4 +1,4 @@ -import { defAbpHttp } from '/@/utils/http/abp'; +import { defHttp } from '/@/utils/http/axios'; import { TextTemplateContentDto, TextTemplateContentGetInput, @@ -6,43 +6,23 @@ import { TextTemplateContentUpdateDto } from './model'; -const remoteServiceName = 'AbpTextTemplating'; -const controllerName = 'TextTemplateContent'; - export const GetAsyncByInput = (input: TextTemplateContentGetInput) => { - return defAbpHttp.request({ - service: remoteServiceName, - controller: controllerName, - action: 'GetAsync', - uniqueName: 'GetAsyncByInput', - params: { - input: input, - }, + return defHttp.get({ + url: `/api/text-templating/templates/content`, + params: input, }); }; export const RestoreToDefaultAsyncByNameAndInput = (name: string, input: TextTemplateRestoreInput) => { - return defAbpHttp.request({ - service: remoteServiceName, - controller: controllerName, - action: 'RestoreToDefaultAsync', - uniqueName: 'RestoreToDefaultAsyncByNameAndInput', - params: { - name: name, - }, + return defHttp.put({ + url: `/api/text-templating/templates/content/${name}/restore-to-default`, data: input, }); }; export const UpdateAsyncByNameAndInput = (name: string, input: TextTemplateContentUpdateDto) => { - return defAbpHttp.request({ - service: remoteServiceName, - controller: controllerName, - action: 'UpdateAsync', - uniqueName: 'UpdateAsyncByNameAndInput', - params: { - name: name, - }, + return defHttp.put({ + url: `/api/text-templating/templates/content/${name}`, data: input, }); }; diff --git a/apps/vue/src/api/text-templating/definitions/index.ts b/apps/vue/src/api/text-templating/definitions/index.ts index e9134a9d7..167f5352e 100644 --- a/apps/vue/src/api/text-templating/definitions/index.ts +++ b/apps/vue/src/api/text-templating/definitions/index.ts @@ -1,4 +1,4 @@ -import { defAbpHttp } from '/@/utils/http/abp'; +import { defHttp } from '/@/utils/http/axios'; import { TextTemplateDefinitionDto, TextTemplateDefinitionCreateDto, @@ -6,64 +6,35 @@ import { TextTemplateDefinitionGetListInput } from './model'; -const remoteServiceName = 'AbpTextTemplating'; -const controllerName = 'TextTemplateDefinition'; - export const CreateAsyncByInput = (input: TextTemplateDefinitionCreateDto) => { - return defAbpHttp.request({ - service: remoteServiceName, - controller: controllerName, - action: 'CreateAsync', - uniqueName: 'CreateAsyncByInput', + return defHttp.post({ + url: `/api/text-templating/template/definitions`, data: input, }); }; export const DeleteAsyncByName = (name: string) => { - return defAbpHttp.request({ - service: remoteServiceName, - controller: controllerName, - action: 'DeleteAsync', - uniqueName: 'DeleteAsyncByName', - params: { - name: name, - }, + return defHttp.delete({ + url: `/api/text-templating/template/definitions/${name}`, }); }; export const GetByNameAsyncByName = (name: string) => { - return defAbpHttp.request({ - service: remoteServiceName, - controller: controllerName, - action: 'GetByNameAsync', - uniqueName: 'GetByNameAsyncByName', - params: { - name: name, - }, + return defHttp.get({ + url: `/api/text-templating/template/definitions/${name}`, }); }; export const GetListAsyncByInput = (input: TextTemplateDefinitionGetListInput) => { - return defAbpHttp.request>({ - service: remoteServiceName, - controller: controllerName, - action: 'GetListAsync', - uniqueName: 'GetListAsyncByInput', - params: { - input: input, - }, + return defHttp.get>({ + url: `/api/text-templating/template/definitions`, + params: input, }); }; export const UpdateAsyncByNameAndInput = (name: string, input: TextTemplateDefinitionUpdateDto) => { - return defAbpHttp.request({ - service: remoteServiceName, - controller: controllerName, - action: 'UpdateAsync', - uniqueName: 'UpdateAsyncByNameAndInput', - params: { - name: name, - }, + return defHttp.put({ + url: `/api/text-templating/template/definitions/${name}`, data: input, }); }; diff --git a/apps/vue/src/api/webhooks/send-attempts/index.ts b/apps/vue/src/api/webhooks/send-attempts/index.ts index fcdc98f99..416e871c5 100644 --- a/apps/vue/src/api/webhooks/send-attempts/index.ts +++ b/apps/vue/src/api/webhooks/send-attempts/index.ts @@ -1,4 +1,4 @@ -import { defAbpHttp } from '/@/utils/http/abp'; +import { defHttp } from '/@/utils/http/axios'; import { WebhookSendAttempt, WebhookSendAttemptGetListInput, @@ -7,39 +7,39 @@ import { } from './model'; export const GetAsyncById = (id: string) => { - return defAbpHttp.get({ + return defHttp.get({ url: `/api/webhooks/send-attempts/${id}`, }); }; export const DeleteAsyncById = (id: string) => { - return defAbpHttp.delete({ + return defHttp.delete({ url: `/api/webhooks/send-attempts/${id}`, }); }; export const DeleteManyAsyncByInput = (input: WebhookSendRecordDeleteManyInput) => { - return defAbpHttp.delete({ + return defHttp.delete({ url: `/api/webhooks/send-attempts/delete-many`, data: input, }); }; export const GetListAsyncByInput = (input: WebhookSendAttemptGetListInput) => { - return defAbpHttp.get>({ + return defHttp.get>({ url: `/api/webhooks/send-attempts`, params: input, }); }; export const ResendAsyncById = (id: string) => { - return defAbpHttp.post({ + return defHttp.post({ url: `/api/webhooks/send-attempts/${id}/resend`, }); }; export const ResendManyAsyncByInput = (input: WebhookSendRecordResendManyInput) => { - return defAbpHttp.post({ + return defHttp.post({ url: `/api/webhooks/send-attempts/resend-many`, data: input, }); diff --git a/apps/vue/src/api/webhooks/subscriptions/index.ts b/apps/vue/src/api/webhooks/subscriptions/index.ts index e0793e602..c745a0cac 100644 --- a/apps/vue/src/api/webhooks/subscriptions/index.ts +++ b/apps/vue/src/api/webhooks/subscriptions/index.ts @@ -1,4 +1,4 @@ -import { defAbpHttp } from '/@/utils/http/abp'; +import { defHttp } from '/@/utils/http/axios'; import { WebhookSubscription, WebhookAvailableGroup, @@ -9,47 +9,47 @@ import { } from './model'; export const CreateAsyncByInput = (input: CreateWebhookSubscription) => { - return defAbpHttp.post({ + return defHttp.post({ url: `/api/webhooks/subscriptions`, data: input, }); }; export const UpdateAsyncByIdAndInput = (id: string, input: UpdateWebhookSubscription) => { - return defAbpHttp.put({ + return defHttp.put({ url: `/api/webhooks/subscriptions/${id}`, data: input, }); }; export const GetAsyncById = (id: string) => { - return defAbpHttp.get({ + return defHttp.get({ url: `/api/webhooks/subscriptions/${id}`, }); }; export const DeleteAsyncById = (id: string) => { - return defAbpHttp.delete({ + return defHttp.delete({ url: `/api/webhooks/subscriptions/${id}`, }); }; export const DeleteManyAsyncByInput = (input: WebhookSubscriptionDeleteManyInput) => { - return defAbpHttp.delete({ + return defHttp.delete({ url: `/api/webhooks/subscriptions/delete-many`, data: input, }); }; export const GetListAsyncByInput = (input: WebhookSubscriptionGetListInput) => { - return defAbpHttp.get>({ + return defHttp.get>({ url: `/api/webhooks/subscriptions`, params: input, }); }; export const GetAllAvailableWebhooksAsync = () => { - return defAbpHttp.get>({ + return defHttp.get>({ url: `/api/webhooks/subscriptions/availables`, }); }; diff --git a/apps/vue/src/hooks/abp/useNotificationSerializer.ts b/apps/vue/src/hooks/abp/useNotificationSerializer.ts new file mode 100644 index 000000000..2b2a09474 --- /dev/null +++ b/apps/vue/src/hooks/abp/useNotificationSerializer.ts @@ -0,0 +1,62 @@ + +import { useLocalization } from '/@/hooks/abp/useLocalization'; +import { NotificationInfo } from '/@/api/messages/notifications/model'; +import { NotificationContentType, NotificationLifetime, NotificationSeverity, NotificationType } from '/@/api/realtime/notifications/types'; + +interface Notification { + name: string; + title: string; + message: string; + description?: string; + creationTime: Date; + lifetime: NotificationLifetime; + type: NotificationType; + severity: NotificationSeverity; + contentType: NotificationContentType; + data: Recordable; +} + +export function useNotificationSerializer() { + function deserialize(notificationInfo: NotificationInfo): Notification { + const { data } = notificationInfo; + let title = data.extraProperties.title; + let message = data.extraProperties.message; + let description = data.extraProperties.description; + if (data.extraProperties.L === true || data.extraProperties.L === 'true') { + const { L } = useLocalization( + [data.extraProperties.title.resourceName ?? data.extraProperties.title.ResourceName, + data.extraProperties.message.resourceName ?? data.extraProperties.message.ResourceName, + data.extraProperties.description?.resourceName ?? data.extraProperties.description?.ResourceName ?? "AbpUi"]); + title = L( + data.extraProperties.title.name ?? data.extraProperties.title.Name, + data.extraProperties.title.values ?? data.extraProperties.title.Values, + ); + message = L( + data.extraProperties.message.name ?? data.extraProperties.message.Name, + data.extraProperties.message.values ?? data.extraProperties.message.Values, + ); + if (description) { + description = L( + data.extraProperties.description.name ?? data.extraProperties.description.Name, + data.extraProperties.description.values ?? data.extraProperties.description.Values, + ); + } + } + return { + title, + message, + description, + creationTime: notificationInfo.creationTime, + contentType: notificationInfo.contentType, + lifetime: notificationInfo.lifetime, + severity: notificationInfo.severity, + type: notificationInfo.type, + data: data.extraProperties, + name: notificationInfo.name, + }; + }; + + return { + deserialize, + }; +} \ No newline at end of file diff --git a/apps/vue/src/layouts/default/header/components/notify/index.vue b/apps/vue/src/layouts/default/header/components/notify/index.vue index 73f6f90c7..b0feb52cd 100644 --- a/apps/vue/src/layouts/default/header/components/notify/index.vue +++ b/apps/vue/src/layouts/default/header/components/notify/index.vue @@ -42,15 +42,21 @@