diff --git a/apps/vue/docker/nginx/default.conf b/apps/vue/docker/nginx/default.conf index 667402c07..baa501441 100644 --- a/apps/vue/docker/nginx/default.conf +++ b/apps/vue/docker/nginx/default.conf @@ -41,6 +41,12 @@ server { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } + location ^~/wapi/ { + proxy_pass http://www.nmc.cn/; + proxy_set_header Host www.nmc.cn; + proxy_set_header Referer http://www.nmc.cn; + } + location /signalr-hubs/ { proxy_pass http://127.0.0.1:30000/; proxy_http_version 1.1; diff --git a/apps/vue/package.json b/apps/vue/package.json index fc116b104..49842c7c6 100644 --- a/apps/vue/package.json +++ b/apps/vue/package.json @@ -75,6 +75,7 @@ "vue-json-pretty": "^2.0.6", "vue-router": "^4.0.14", "vue-types": "^4.1.1", + "vue3-colorpicker": "^2.0.4", "xlsx": "^0.18.5" }, "devDependencies": { diff --git a/apps/vue/src/api/model/baseModel.ts b/apps/vue/src/api/model/baseModel.ts index 978b638e6..6a411e534 100644 --- a/apps/vue/src/api/model/baseModel.ts +++ b/apps/vue/src/api/model/baseModel.ts @@ -51,6 +51,10 @@ export class CreationAuditedEntityDto implements IMayHaveCreator { creationTime!: Date; } +export class EntityDto { + id!: TKey; +} + /** 实体审计对象 */ export class AuditedEntityDto implements CreationAuditedEntityDto, IModificationAuditedObject { lastModifierId: string | undefined; diff --git a/apps/vue/src/api/platform/user-favorites-menu/index.ts b/apps/vue/src/api/platform/user-favorites-menu/index.ts new file mode 100644 index 000000000..6162bce68 --- /dev/null +++ b/apps/vue/src/api/platform/user-favorites-menu/index.ts @@ -0,0 +1,114 @@ +import { defAbpHttp } from '/@/utils/http/abp'; +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, + }, + data: { + input: input, + }, + }); +}; + +export const createMyFavoriteMenu = (input: UserFavoriteMenuCreateDto) => { + input.framework = remoteService.replace.framework; + return defAbpHttp.request({ + service: remoteService.name, + controller: remoteService.controller, + action: 'CreateMyFavoriteMenuAsync', + data: { + input: input, + }, + }); +}; + +export const del = (userId: string, menuId: string) => { + return defAbpHttp.request({ + service: remoteService.name, + controller: remoteService.controller, + action: 'DeleteAsync', + params: { + userId: userId, + }, + data: { + input: { + menuId: menuId, + }, + }, + }); +}; + +export const delMyFavoriteMenu = (menuId: string) => { + return defAbpHttp.request({ + service: remoteService.name, + controller: remoteService.controller, + action: 'DeleteMyFavoriteMenuAsync', + data: { + input: { + menuId: menuId, + }, + }, + }); +}; + +export const update = (userId: string, input: UserFavoriteMenuUpdateDto) => { + return defAbpHttp.request({ + service: remoteService.name, + controller: remoteService.controller, + action: 'UpdateAsync', + params: { + userId: userId, + }, + data: { + input: input, + }, + }); +}; + +export const updateMyFavoriteMenu = (input: UserFavoriteMenuUpdateDto) => { + return defAbpHttp.request({ + service: remoteService.name, + controller: remoteService.controller, + action: 'UpdateMyFavoriteMenuAsync', + data: { + input: input, + }, + }); +}; + +export const getList = (userId: string) => { + return defAbpHttp.listRequest({ + service: remoteService.name, + controller: remoteService.controller, + action: 'GetListAsync', + params: { + userId: userId, + framework: remoteService.replace.framework, + }, + }); +}; + +export const getMyFavoriteMenuList = () => { + return defAbpHttp.listRequest({ + service: remoteService.name, + controller: remoteService.controller, + action: 'GetMyFavoriteMenuListAsync', + params: { + framework: remoteService.replace.framework, + }, + }); +}; diff --git a/apps/vue/src/api/platform/user-favorites-menu/model/index.ts b/apps/vue/src/api/platform/user-favorites-menu/model/index.ts new file mode 100644 index 000000000..5173e035c --- /dev/null +++ b/apps/vue/src/api/platform/user-favorites-menu/model/index.ts @@ -0,0 +1,28 @@ +import { AuditedEntityDto, EntityDto, IHasConcurrencyStamp } from '/@/api/model/baseModel'; + +export interface UserFavoriteMenuDto extends AuditedEntityDto, EntityDto { + menuId: string; + userId: string; + aliasName?: string; + color?: string; + framework: string; + name: string; + displayName: string; + path?: string; + icon?: string; +} + +interface UserFavoriteMenuCreateOrUpdateDto { + menuId: string; + color?: string; + aliasName?: string; + icon?: string; +} + +export interface UserFavoriteMenuCreateDto extends UserFavoriteMenuCreateOrUpdateDto { + framework: string; +} + +export interface UserFavoriteMenuUpdateDto extends UserFavoriteMenuCreateOrUpdateDto, IHasConcurrencyStamp { +} + diff --git a/apps/vue/src/api/weather/index.ts b/apps/vue/src/api/weather/index.ts new file mode 100644 index 000000000..7e8976bb1 --- /dev/null +++ b/apps/vue/src/api/weather/index.ts @@ -0,0 +1,75 @@ +/* + 天气接口 + 数据来源: http://www.nmc.cn (中央气象台) +*/ +import { defHttp } from '/@/utils/http/axios'; +import { Position, Province, WeatherResult } from './model'; +import { format } from '/@/utils/strings'; + +//const Host = 'http://www.nmc.cn'; +const Api = { + GetProvinces: '/wapi/rest/province/all', + GetPosition: '/wapi/rest/position', + GetCitys: '/wapi/rest/province/{province}', + GetWeather: '/wapi/rest/weather?stationid={code}', +}; + +export const getProvinces = () => { + return defHttp.get({ + url: Api.GetProvinces, + //baseURL: Host, + headers: { + 'X-Requested-With': 'XMLHttpRequest' + } + }, { + apiUrl: '', + joinTime: false, + withToken: false, + withAcceptLanguage: false, + }); +}; + +export const getPosition = () => { + return defHttp.get({ + url: Api.GetPosition, + //baseURL: Host, + headers: { + 'X-Requested-With': 'XMLHttpRequest', + } + }, { + apiUrl: '', + joinTime: false, + withToken: false, + withAcceptLanguage: false, + }); +} + +export const getCitys = (provinceCode: string) => { + return defHttp.get({ + url: format(Api.GetCitys, {province: provinceCode}), + //baseURL: Host, + headers: { + 'X-Requested-With': 'XMLHttpRequest' + } + }, { + apiUrl: '', + joinTime: false, + withToken: false, + withAcceptLanguage: false, + }); +} + +export const getWeather = (cityCode: string) => { + return defHttp.get({ + url: format(Api.GetWeather, {code: cityCode}), + //baseURL: Host, + headers: { + 'X-Requested-With': 'XMLHttpRequest' + } + }, { + apiUrl: '', + joinTime: false, + withToken: false, + withAcceptLanguage: false, + }); +} diff --git a/apps/vue/src/api/weather/model/index.ts b/apps/vue/src/api/weather/model/index.ts new file mode 100644 index 000000000..dc3553b9d --- /dev/null +++ b/apps/vue/src/api/weather/model/index.ts @@ -0,0 +1,101 @@ +/* + 天气数据模型 + 数据来源: http://www.nmc.cn (中央气象台) +*/ + +/** + * 定位 + */ +export interface Position { + /** 城市 */ + city: string; + /** 代码 */ + code: string; + /** 省份 */ + province: string; + /** 专用页面 */ + url: string; +} + +/** + * 省份 + */ +export interface Province { + /** 代码 */ + code: string; + /** 名称 */ + name: string; + /** 专用页面 */ + url: string; +} + +export interface Air { + aq: number; + aqi: number; + aqiCode: string; + forecasttime: Date; + text: string; +} + +export interface Weather { + airpressure: number; + feelst: number; + humidity: number; + icomfort: number; + img: string; + info: string; + rain: number; + rcomfort: number; + temperature: number; + temperatureDiff: number; +} + +export interface Wind { + degree: number; + direct: string; + power: string; + speed: number; +} + +export interface PredictDetail { + date: Date; + pt: Date; + day: { weather: Weather; wind: Wind }; + night: { weather: Weather; wind: Wind }; +} + +export interface Predict { + detail: PredictDetail[]; + publish_time: Date; + station: Position; +} + +export interface Real { + publish_time: Date; + station: Position; + weather: Weather; + wind: Wind; +} + +export interface Tempchart { + day_img: string; + day_text: string; + max_temp: number; + min_temp: number; + night_img: string; + night_text: string; + time: Date; +} + +export interface WeatherInfo { + air: Air; + predict: Predict; + real: Real; + tempchart: Tempchart; +} + +export interface WeatherResult { + code: number; + msg: string; + data: WeatherInfo; +} diff --git a/apps/vue/src/components/Form/src/components/ApiTree.vue b/apps/vue/src/components/Form/src/components/ApiTree.vue index 0ec6917dd..44d6b5a2c 100644 --- a/apps/vue/src/components/Form/src/components/ApiTree.vue +++ b/apps/vue/src/components/Form/src/components/ApiTree.vue @@ -1,12 +1,12 @@ diff --git a/apps/vue/src/views/dashboard/workbench/components/MenuReference.vue b/apps/vue/src/views/dashboard/workbench/components/MenuReference.vue new file mode 100644 index 000000000..a580eb598 --- /dev/null +++ b/apps/vue/src/views/dashboard/workbench/components/MenuReference.vue @@ -0,0 +1,107 @@ + + + + + \ No newline at end of file diff --git a/apps/vue/src/views/dashboard/workbench/components/ProjectCard.vue b/apps/vue/src/views/dashboard/workbench/components/ProjectCard.vue index 0c4990bf2..f990e802d 100644 --- a/apps/vue/src/views/dashboard/workbench/components/ProjectCard.vue +++ b/apps/vue/src/views/dashboard/workbench/components/ProjectCard.vue @@ -4,7 +4,7 @@ 更多 - + {{ item.title }} diff --git a/apps/vue/src/views/dashboard/workbench/components/WorkbenchHeader.vue b/apps/vue/src/views/dashboard/workbench/components/WorkbenchHeader.vue index ef4d90d79..089b7fe38 100644 --- a/apps/vue/src/views/dashboard/workbench/components/WorkbenchHeader.vue +++ b/apps/vue/src/views/dashboard/workbench/components/WorkbenchHeader.vue @@ -2,32 +2,88 @@
-

早安, {{ userinfo.realName }}, 开始您一天的工作吧!

- 今日晴,20℃ - 32℃! +

{{ getWelcomeTitle }}

+ {{ getWeatherInfo }}
-
- 待办 - 2/10 -
- -
- 项目 - 8 -
- 团队 - 300 + {{ t('routes.dashboard.workbench.header.notifier.title') }} + {{ t('routes.dashboard.workbench.header.notifier.count', [unReadNotiferCount]) }}
diff --git a/apps/vue/src/views/dashboard/workbench/components/menuProps.ts b/apps/vue/src/views/dashboard/workbench/components/menuProps.ts new file mode 100644 index 000000000..89fafb094 --- /dev/null +++ b/apps/vue/src/views/dashboard/workbench/components/menuProps.ts @@ -0,0 +1,49 @@ +import { useI18n } from '/@/hooks/web/useI18n'; + +export interface Menu { + id: string, + title: string; + desc?: string; + icon?: string; + color?: string; + size?: number; + path?: string; + hasDefault?: boolean; +} + +export function useDefaultMenus() { + const { t } = useI18n(); + + const defaultMenus: Menu[] = [{ + id: '0', + title: t('layout.header.home'), + icon: 'ion:home-outline', + color: '#1fdaca', + path: '/', + hasDefault: true, + },{ + id: '1', + title: t('routes.dashboard.dashboard'), + icon: 'ion:grid-outline', + color: '#bf0c2c', + path: '/dashboard/workbench', + hasDefault: true, + },{ + id: '2', + title: t('routes.basic.accountSetting'), + icon: 'ant-design:setting-outlined', + color: '#3fb27f', + path: '/account/settings', + hasDefault: true, + },{ + id: '3', + title: t('routes.basic.accountCenter'), + icon: 'ant-design:profile-outlined', + color: '#4daf1bc9', + path: '/account/center', + hasDefault: true, + } + ]; + + return defaultMenus; +} diff --git a/apps/vue/src/views/dashboard/workbench/index.vue b/apps/vue/src/views/dashboard/workbench/index.vue index 5ee292e22..1452de6e9 100644 --- a/apps/vue/src/views/dashboard/workbench/index.vue +++ b/apps/vue/src/views/dashboard/workbench/index.vue @@ -3,34 +3,82 @@
- - +
- + - +
diff --git a/apps/vue/types/axios.d.ts b/apps/vue/types/axios.d.ts index 0c7943c21..5306958f6 100644 --- a/apps/vue/types/axios.d.ts +++ b/apps/vue/types/axios.d.ts @@ -23,6 +23,8 @@ export interface RequestOptions { ignoreCancelToken?: boolean; // Whether to send token in header withToken?: boolean; + // Whether to send Accept-Language in header + withAcceptLanguage?: boolean; } export interface Result { diff --git a/apps/vue/vite.config.ts b/apps/vue/vite.config.ts index d315597c6..c3a6691ef 100644 --- a/apps/vue/vite.config.ts +++ b/apps/vue/vite.config.ts @@ -1,7 +1,7 @@ import type { UserConfig, ConfigEnv } from 'vite'; import pkg from './package.json'; import dayjs from 'dayjs'; -import { loadEnv } from 'vite'; +import { loadEnv, ProxyOptions } from 'vite'; import { resolve } from 'path'; import { generateModifyVars } from './build/generate/generateModifyVars'; import { createProxy } from './build/vite/proxy'; @@ -9,6 +9,24 @@ import { wrapperEnv } from './build/utils'; import { createVitePlugins } from './build/vite/plugin'; import { OUTPUT_DIR } from './build/constant'; +/** + * 天气api代理 + * production环境请在nginx配置 + */ +function buildWeatherProxy(): Record { + return { + '/wapi': { + target: 'http://www.nmc.cn', + changeOrigin: true, + rewrite: (path) => path.replace('/wapi', ''), + headers: { + host: 'www.nmc.cn', + referer: 'http://www.nmc.cn', + }, + }, + }; +} + function pathResolve(dir: string) { return resolve(process.cwd(), '.', dir); } @@ -58,7 +76,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => { host: true, port: VITE_PORT, // Load proxy configuration from .env - proxy: createProxy(VITE_PROXY), + proxy: { ...createProxy(VITE_PROXY), ...buildWeatherProxy() }, }, esbuild: { pure: VITE_DROP_CONSOLE ? ['console.log', 'debugger'] : [], diff --git a/aspnet-core/modules/platform/LINGYUN.Abp.UI.Navigation.VueVbenAdmin/LINGYUN/Abp/UI/Navigation/VueVbenAdmin/VueVbenAdminStandardMenuConverter.cs b/aspnet-core/modules/platform/LINGYUN.Abp.UI.Navigation.VueVbenAdmin/LINGYUN/Abp/UI/Navigation/VueVbenAdmin/VueVbenAdminStandardMenuConverter.cs new file mode 100644 index 000000000..3f922bceb --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Abp.UI.Navigation.VueVbenAdmin/LINGYUN/Abp/UI/Navigation/VueVbenAdmin/VueVbenAdminStandardMenuConverter.cs @@ -0,0 +1,28 @@ +using LINGYUN.Platform.Menus; +using Volo.Abp.DependencyInjection; + +namespace LINGYUN.Abp.UI.Navigation.VueVbenAdmin; + +[Dependency(ReplaceServices = true)] +public class VueVbenAdminStandardMenuConverter : IStandardMenuConverter, ISingletonDependency +{ + public StandardMenu Convert(Menu menu) + { + var standardMenu = new StandardMenu + { + Icon = "", + Name = menu.Name, + Path = menu.Path, + DisplayName = menu.DisplayName, + Description = menu.Description, + Redirect = menu.Redirect, + }; + + if (menu.ExtraProperties.TryGetValue("icon", out var icon)) + { + standardMenu.Icon = icon.ToString(); + } + + return standardMenu; + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Localization/ApplicationContracts/en.json b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Localization/ApplicationContracts/en.json index 8e03de109..3ff372b52 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Localization/ApplicationContracts/en.json +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Localization/ApplicationContracts/en.json @@ -27,6 +27,7 @@ "Permission:Delete": "Delete", "Permission:ManageItems": "Manage Items", "Permission:ManageRoleMenus": "Manage Role Menus", - "Permission:ManageUserMenus": "Manage User Menus" + "Permission:ManageUserMenus": "Manage User Menus", + "Permission:ManageUserFavoriteMenus": "Manage User Favorite Menus" } } \ No newline at end of file diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Localization/ApplicationContracts/zh-Hans.json b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Localization/ApplicationContracts/zh-Hans.json index e2b685748..8fda302d0 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Localization/ApplicationContracts/zh-Hans.json +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Localization/ApplicationContracts/zh-Hans.json @@ -27,6 +27,7 @@ "Permission:Delete": "删除", "Permission:ManageItems": "管理项目", "Permission:ManageRoleMenus": "管理角色菜单", - "Permission:ManageUserMenus": "管理用户菜单" + "Permission:ManageUserMenus": "管理用户菜单", + "Permission:ManageUserFavoriteMenus": "管理用户收藏菜单" } } \ No newline at end of file diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/UserFavoriteMenuCreateDto.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/UserFavoriteMenuCreateDto.cs new file mode 100644 index 000000000..7326d0268 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/UserFavoriteMenuCreateDto.cs @@ -0,0 +1,13 @@ +using LINGYUN.Platform.Routes; +using System.ComponentModel.DataAnnotations; +using Volo.Abp.Validation; + +namespace LINGYUN.Platform.Menus; + +public class UserFavoriteMenuCreateDto : UserFavoriteMenuCreateOrUpdateDto +{ + [Required] + [DynamicStringLength(typeof(LayoutConsts), nameof(LayoutConsts.MaxFrameworkLength))] + + public string Framework { get; set; } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/UserFavoriteMenuCreateOrUpdateDto.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/UserFavoriteMenuCreateOrUpdateDto.cs new file mode 100644 index 000000000..3814d0de5 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/UserFavoriteMenuCreateOrUpdateDto.cs @@ -0,0 +1,20 @@ +using System; +using System.ComponentModel.DataAnnotations; +using Volo.Abp.Validation; + +namespace LINGYUN.Platform.Menus; + +public abstract class UserFavoriteMenuCreateOrUpdateDto +{ + [Required] + public Guid MenuId { get; set; } + + [DynamicStringLength(typeof(UserFavoriteMenuConsts), nameof(UserFavoriteMenuConsts.MaxColorLength))] + public string Color { get; set; } + + [DynamicStringLength(typeof(UserFavoriteMenuConsts), nameof(UserFavoriteMenuConsts.MaxAliasNameLength))] + public string AliasName { get; set; } + + [DynamicStringLength(typeof(UserFavoriteMenuConsts), nameof(UserFavoriteMenuConsts.MaxIconLength))] + public string Icon { get; set; } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/UserFavoriteMenuDto.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/UserFavoriteMenuDto.cs new file mode 100644 index 000000000..7087df150 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/UserFavoriteMenuDto.cs @@ -0,0 +1,25 @@ +using System; +using Volo.Abp.Application.Dtos; + +namespace LINGYUN.Platform.Menus; + +public class UserFavoriteMenuDto : AuditedEntityDto +{ + public Guid MenuId { get; set; } + + public Guid UserId { get; set; } + + public string AliasName { get; set; } + + public string Color { get; set; } + + public string Framework { get; set; } + + public string Name { get; set; } + + public string DisplayName { get; set; } + + public string Path { get; set; } + + public string Icon { get; set; } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/UserFavoriteMenuGetListInput.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/UserFavoriteMenuGetListInput.cs new file mode 100644 index 000000000..e917c4e57 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/UserFavoriteMenuGetListInput.cs @@ -0,0 +1,9 @@ +using LINGYUN.Platform.Routes; +using Volo.Abp.Validation; + +namespace LINGYUN.Platform.Menus; +public class UserFavoriteMenuGetListInput +{ + [DynamicStringLength(typeof(LayoutConsts), nameof(LayoutConsts.MaxFrameworkLength))] + public string Framework { get; set; } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/UserFavoriteMenuRemoveInput.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/UserFavoriteMenuRemoveInput.cs new file mode 100644 index 000000000..0679ac8e1 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/UserFavoriteMenuRemoveInput.cs @@ -0,0 +1,9 @@ +using System; +using System.ComponentModel.DataAnnotations; + +namespace LINGYUN.Platform.Menus; +public class UserFavoriteMenuRemoveInput +{ + [Required] + public Guid MenuId { get; set; } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/UserFavoriteMenuUpdateDto.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/UserFavoriteMenuUpdateDto.cs new file mode 100644 index 000000000..90a0e702d --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/UserFavoriteMenuUpdateDto.cs @@ -0,0 +1,9 @@ +using Volo.Abp.Domain.Entities; + +namespace LINGYUN.Platform.Menus; + +public class UserFavoriteMenuUpdateDto : UserFavoriteMenuCreateOrUpdateDto, IHasConcurrencyStamp +{ + + public string ConcurrencyStamp { get; set; } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/IUserFavoriteMenuAppService.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/IUserFavoriteMenuAppService.cs new file mode 100644 index 000000000..aa914ca1f --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/IUserFavoriteMenuAppService.cs @@ -0,0 +1,25 @@ +using System; +using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Application.Services; + +namespace LINGYUN.Platform.Menus; + +public interface IUserFavoriteMenuAppService : IApplicationService +{ + Task CreateAsync(Guid userId, UserFavoriteMenuCreateDto input); + + Task CreateMyFavoriteMenuAsync(UserFavoriteMenuCreateDto input); + + Task UpdateAsync(Guid userId, UserFavoriteMenuUpdateDto input); + + Task UpdateMyFavoriteMenuAsync(UserFavoriteMenuUpdateDto input); + + Task DeleteAsync(Guid userId, UserFavoriteMenuRemoveInput input); + + Task DeleteMyFavoriteMenuAsync(UserFavoriteMenuRemoveInput input); + + Task> GetMyFavoriteMenuListAsync(UserFavoriteMenuGetListInput input); + + Task> GetListAsync(Guid userId, UserFavoriteMenuGetListInput input); +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Permissions/PlatformPermissionDefinitionProvider.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Permissions/PlatformPermissionDefinitionProvider.cs index acb000fe9..719bf2240 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Permissions/PlatformPermissionDefinitionProvider.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Permissions/PlatformPermissionDefinitionProvider.cs @@ -36,25 +36,8 @@ namespace LINGYUN.Platform.Permissions menu.AddChild(PlatformPermissions.Menu.Update, L("Permission:Update")); menu.AddChild(PlatformPermissions.Menu.Delete, L("Permission:Delete")); menu.AddChild(PlatformPermissions.Menu.ManageRoles, L("Permission:ManageRoleMenus")); - menu.AddChild(PlatformPermissions.Menu.ManageUsers, L("Permission:ManageUserMenus")); - - - // TODO: 2020-07-27 目前abp不支持对象存储管理(或者属于企业版?)需要创建一个 LINGYUN.Abp.BlobStoring 项目自行实现 - - //var fileSystem = platform.AddPermission(PlatformPermissions.FileSystem.Default, L("Permission:FileSystem")); - //fileSystem.AddChild(PlatformPermissions.FileSystem.Create, L("Permission:CreateFolder")); - //fileSystem.AddChild(PlatformPermissions.FileSystem.Delete, L("Permission:DeleteFolder")); - //fileSystem.AddChild(PlatformPermissions.FileSystem.Rename, L("Permission:RenameFolder")); - //fileSystem.AddChild(PlatformPermissions.FileSystem.Copy, L("Permission:CopyFolder")); - //fileSystem.AddChild(PlatformPermissions.FileSystem.Move, L("Permission:MoveFolder")); - - //var fileManager = fileSystem.AddChild(PlatformPermissions.FileSystem.FileManager.Default, L("Permission:FileManager")); - //fileManager.AddChild(PlatformPermissions.FileSystem.FileManager.Create, L("Permission:AppendFile")); - //fileManager.AddChild(PlatformPermissions.FileSystem.FileManager.Update, L("Permission:UpdateFile")); - //fileManager.AddChild(PlatformPermissions.FileSystem.FileManager.Delete, L("Permission:DeleteFile")); - //fileManager.AddChild(PlatformPermissions.FileSystem.FileManager.Copy, L("Permission:CopyFile")); - //fileManager.AddChild(PlatformPermissions.FileSystem.FileManager.Move, L("Permission:MoveFile")); - //fileManager.AddChild(PlatformPermissions.FileSystem.FileManager.Download, L("Permission:DownloadFile")); + menu.AddChild(PlatformPermissions.Menu.ManageUsers, L("Permission:ManageUserMenus")); + menu.AddChild(PlatformPermissions.Menu.ManageUserFavorites, L("Permission:ManageUserFavoriteMenus")); } private static LocalizableString L(string name) diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Permissions/PlatformPermissions.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Permissions/PlatformPermissions.cs index f978b1829..6e38b5dda 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Permissions/PlatformPermissions.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Permissions/PlatformPermissions.cs @@ -44,7 +44,9 @@ namespace LINGYUN.Platform.Permissions public const string ManageRoles = Default + ".ManageRoles"; - public const string ManageUsers = Default + ".ManageUsers"; + public const string ManageUsers = Default + ".ManageUsers"; + + public const string ManageUserFavorites = Default + ".ManageUserFavorites"; } // 如果abp后期提供对象存储的目录管理接口,则启用此权限 diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Menus/UserFavoriteMenuAppService.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Menus/UserFavoriteMenuAppService.cs new file mode 100644 index 000000000..2aac9e760 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Menus/UserFavoriteMenuAppService.cs @@ -0,0 +1,172 @@ +using LINGYUN.Platform.Permissions; +using Microsoft.AspNetCore.Authorization; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Users; + +namespace LINGYUN.Platform.Menus; + +[Authorize] +public class UserFavoriteMenuAppService : PlatformApplicationServiceBase, IUserFavoriteMenuAppService +{ + protected IStandardMenuConverter StandardMenuConverter => LazyServiceProvider.LazyGetRequiredService(); + protected IMenuRepository MenuRepository { get; } + protected IUserFavoriteMenuRepository UserFavoriteMenuRepository { get; } + + public UserFavoriteMenuAppService( + IMenuRepository menuRepository, + IUserFavoriteMenuRepository userFavoriteMenuRepository) + { + MenuRepository = menuRepository; + UserFavoriteMenuRepository = userFavoriteMenuRepository; + } + + [Authorize(PlatformPermissions.Menu.ManageUserFavorites)] + public async virtual Task CreateAsync(Guid userId, UserFavoriteMenuCreateDto input) + { + if (!await UserFavoriteMenuRepository.CheckExistsAsync(input.Framework, userId, input.MenuId)) + { + throw new BusinessException(PlatformErrorCodes.UserDuplicateFavoriteMenu); + } + + var menu = await MenuRepository.GetAsync(input.MenuId); + var standardMenu = StandardMenuConverter.Convert(menu); + var userFavoriteMenu = new UserFavoriteMenu( + GuidGenerator.Create(), + input.MenuId, + userId, + input.Framework, + standardMenu.Name, + standardMenu.DisplayName, + standardMenu.Path, + standardMenu.Icon, + input.Color, + input.AliasName, + CurrentTenant.Id); + + userFavoriteMenu = await UserFavoriteMenuRepository.InsertAsync(userFavoriteMenu); + + await CurrentUnitOfWork.SaveChangesAsync(); + + return ObjectMapper.Map(userFavoriteMenu); + } + + public async virtual Task CreateMyFavoriteMenuAsync(UserFavoriteMenuCreateDto input) + { + var userId = CurrentUser.GetId(); + if (!await UserFavoriteMenuRepository.CheckExistsAsync(input.Framework, userId, input.MenuId)) + { + throw new BusinessException(PlatformErrorCodes.UserDuplicateFavoriteMenu); + } + + var menu = await MenuRepository.GetAsync(input.MenuId); + var standardMenu = StandardMenuConverter.Convert(menu); + var userFavoriteMenu = new UserFavoriteMenu( + GuidGenerator.Create(), + input.MenuId, + userId, + input.Framework, + standardMenu.Name, + standardMenu.DisplayName, + standardMenu.Path, + standardMenu.Icon, + input.Color, + input.AliasName, + CurrentTenant.Id); + + userFavoriteMenu = await UserFavoriteMenuRepository.InsertAsync(userFavoriteMenu); + + await CurrentUnitOfWork.SaveChangesAsync(); + + return ObjectMapper.Map(userFavoriteMenu); + } + + [Authorize(PlatformPermissions.Menu.ManageUserFavorites)] + public async virtual Task DeleteAsync(Guid userId, UserFavoriteMenuRemoveInput input) + { + var userFavoriteMenu = await GetUserMenuAsync(userId, input.MenuId); + + await UserFavoriteMenuRepository.DeleteAsync(userFavoriteMenu); + } + + public async virtual Task DeleteMyFavoriteMenuAsync(UserFavoriteMenuRemoveInput input) + { + var userFavoriteMenu = await GetUserMenuAsync(CurrentUser.GetId(), input.MenuId); + + await UserFavoriteMenuRepository.DeleteAsync(userFavoriteMenu); + } + + [Authorize(PlatformPermissions.Menu.ManageUserFavorites)] + public async virtual Task> GetListAsync(Guid userId, UserFavoriteMenuGetListInput input) + { + var userFacoriteMenus = await UserFavoriteMenuRepository.GetFavoriteMenusAsync( + userId, input.Framework); + + return new ListResultDto( + ObjectMapper.Map, List>(userFacoriteMenus)); + } + + public async virtual Task> GetMyFavoriteMenuListAsync(UserFavoriteMenuGetListInput input) + { + var userFacoriteMenus = await UserFavoriteMenuRepository.GetFavoriteMenusAsync( + CurrentUser.GetId(), input.Framework); + + return new ListResultDto( + ObjectMapper.Map, List>(userFacoriteMenus)); + } + + [Authorize(PlatformPermissions.Menu.ManageUserFavorites)] + public async virtual Task UpdateAsync(Guid userId, UserFavoriteMenuUpdateDto input) + { + var userFavoriteMenu = await GetUserMenuAsync(userId, input.MenuId); + + UpdateByInput(userFavoriteMenu, input); + + userFavoriteMenu = await UserFavoriteMenuRepository.UpdateAsync(userFavoriteMenu); + + await CurrentUnitOfWork.SaveChangesAsync(); + + return ObjectMapper.Map(userFavoriteMenu); + } + + public async virtual Task UpdateMyFavoriteMenuAsync(UserFavoriteMenuUpdateDto input) + { + var userFavoriteMenu = await GetUserMenuAsync(CurrentUser.GetId(), input.MenuId); + + UpdateByInput(userFavoriteMenu, input); + + userFavoriteMenu = await UserFavoriteMenuRepository.UpdateAsync(userFavoriteMenu); + + await CurrentUnitOfWork.SaveChangesAsync(); + + return ObjectMapper.Map(userFavoriteMenu); + } + + protected async virtual Task GetUserMenuAsync(Guid userId, Guid menuId) + { + var userFavoriteMenu = await UserFavoriteMenuRepository.FindByUserMenuAsync(userId, menuId); + + return userFavoriteMenu ?? throw new BusinessException(PlatformErrorCodes.UserFavoriteMenuNotFound); + } + + protected virtual void UpdateByInput(UserFavoriteMenu userFavoriteMenu, UserFavoriteMenuCreateOrUpdateDto input) + { + if (!string.Equals(userFavoriteMenu.Color, input.Color, StringComparison.CurrentCultureIgnoreCase)) + { + userFavoriteMenu.Color = Check.Length(input.Color, nameof(UserFavoriteMenuCreateOrUpdateDto.Color), UserFavoriteMenuConsts.MaxColorLength); + } + + if (!string.Equals(userFavoriteMenu.AliasName, input.AliasName, StringComparison.CurrentCultureIgnoreCase)) + { + userFavoriteMenu.AliasName = Check.Length(input.AliasName, nameof(UserFavoriteMenuCreateOrUpdateDto.AliasName), UserFavoriteMenuConsts.MaxAliasNameLength); + } + + if (!string.Equals(userFavoriteMenu.Icon, input.Icon, StringComparison.CurrentCultureIgnoreCase)) + { + userFavoriteMenu.Icon = Check.Length(input.Icon, nameof(UserFavoriteMenuCreateOrUpdateDto.Icon), UserFavoriteMenuConsts.MaxIconLength); + } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/PlatformApplicationMappingProfile.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/PlatformApplicationMappingProfile.cs index eeab10553..f39293e4e 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/PlatformApplicationMappingProfile.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/PlatformApplicationMappingProfile.cs @@ -20,6 +20,7 @@ namespace LINGYUN.Platform .ForMember(dto => dto.Startup, map => map.Ignore()); CreateMap() .ForMember(dto => dto.Meta, map => map.MapFrom(src => src.ExtraProperties)); + CreateMap(); } } } diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN.Platform.Domain.Shared.csproj b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN.Platform.Domain.Shared.csproj index 8e386eb74..13efc2f73 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN.Platform.Domain.Shared.csproj +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN.Platform.Domain.Shared.csproj @@ -22,8 +22,4 @@ - - - - diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Layouts/LayoutEto.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Layouts/LayoutEto.cs new file mode 100644 index 000000000..8c0ddca8e --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Layouts/LayoutEto.cs @@ -0,0 +1,10 @@ +using LINGYUN.Platform.Routes; +using Volo.Abp.EventBus; + +namespace LINGYUN.Platform.Layouts +{ + [EventName("platform.layouts.layout")] + public class LayoutEto : RouteEto + { + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Menus/MenuEto.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Menus/MenuEto.cs new file mode 100644 index 000000000..d16481845 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Menus/MenuEto.cs @@ -0,0 +1,11 @@ +using LINGYUN.Platform.Routes; +using Volo.Abp.EventBus; + +namespace LINGYUN.Platform.Menus +{ + [EventName("platform.menus.menu")] + public class MenuEto : RouteEto + { + public string Framework { get; set; } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Menus/RoleMenuEto.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Menus/RoleMenuEto.cs new file mode 100644 index 000000000..33f5e2405 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Menus/RoleMenuEto.cs @@ -0,0 +1,14 @@ +using System; +using Volo.Abp.EventBus; +using Volo.Abp.MultiTenancy; + +namespace LINGYUN.Platform.Menus +{ + [EventName("platform.menus.role_menu")] + public class RoleMenuEto : IMultiTenant + { + public Guid? TenantId { get; set; } + public Guid MenuId { get; set; } + public string RoleName { get; set; } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Menus/UserFavoriteMenuConsts.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Menus/UserFavoriteMenuConsts.cs new file mode 100644 index 000000000..cc109cd05 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Menus/UserFavoriteMenuConsts.cs @@ -0,0 +1,9 @@ +using LINGYUN.Platform.Routes; + +namespace LINGYUN.Platform.Menus; +public class UserFavoriteMenuConsts +{ + public static int MaxIconLength { get; set; } = 512; + public static int MaxColorLength { get; set; } = 30; + public static int MaxAliasNameLength { get; set; } = RouteConsts.MaxDisplayNameLength; +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Menus/UserMenuEto.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Menus/UserMenuEto.cs new file mode 100644 index 000000000..b1b5e4faa --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Menus/UserMenuEto.cs @@ -0,0 +1,14 @@ +using System; +using Volo.Abp.EventBus; +using Volo.Abp.MultiTenancy; + +namespace LINGYUN.Platform.Menus +{ + [EventName("platform.menus.user_menu")] + public class UserMenuEto : IMultiTenant + { + public Guid? TenantId { get; set; } + public Guid MenuId { get; set; } + public Guid UserId { get; set; } + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/PlatformErrorCodes.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/PlatformErrorCodes.cs index 42468aaf7..3c1e2cb01 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/PlatformErrorCodes.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/PlatformErrorCodes.cs @@ -25,5 +25,13 @@ /// 元数据格式不匹配 /// public const string MetaFormatMissMatch = Namespace + ":03001"; + /// + /// 用户重复收藏菜单 + /// + public const string UserDuplicateFavoriteMenu = Namespace + ":04400"; + /// + /// 用户收藏菜单未找到 + /// + public const string UserFavoriteMenuNotFound = Namespace + ":04404"; } } diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Routes/RoleRouteEto.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Routes/RoleRouteEto.cs deleted file mode 100644 index 6f6a0eabf..000000000 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Routes/RoleRouteEto.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using Volo.Abp.MultiTenancy; - -namespace LINGYUN.Platform.Routes -{ - public class RoleRouteEto : IMultiTenant - { - public Guid? TenantId { get; set; } - public Guid RouteId { get; set; } - public string RoleName { get; set; } - } -} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Routes/RouteEto.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Routes/RouteEto.cs index 52bfc1954..b411e9f88 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Routes/RouteEto.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Routes/RouteEto.cs @@ -3,7 +3,7 @@ using Volo.Abp.MultiTenancy; namespace LINGYUN.Platform.Routes { - public class RouteEto : IMultiTenant + public abstract class RouteEto : IMultiTenant { public Guid? TenantId { get; set; } public Guid Id { get; set; } diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Routes/UserRouteEto.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Routes/UserRouteEto.cs deleted file mode 100644 index 75409b0b5..000000000 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Routes/UserRouteEto.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using Volo.Abp.MultiTenancy; - -namespace LINGYUN.Platform.Routes -{ - public class UserRouteEto : IMultiTenant - { - public Guid? TenantId { get; set; } - public Guid RouteId { get; set; } - public Guid UserId { get; set; } - } -} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/DataItemMappingOptions.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/DataItemMappingOptions.cs index c7d80cbee..ac9276df8 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/DataItemMappingOptions.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Datas/DataItemMappingOptions.cs @@ -2,6 +2,7 @@ using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; +using System.Text.Json.Nodes; using Volo.Abp; namespace LINGYUN.Platform.Datas @@ -24,14 +25,34 @@ namespace LINGYUN.Platform.Datas return ""; } - if (value is JArray array) + if (value is Array array) { var joinString = string.Empty; - foreach (var obj in array.Children()) + foreach (var obj in array) { joinString += obj.ToString() + ","; } - return joinString.EndsWith(",") ? joinString.Substring(0, joinString.Length - 1) : joinString; + return joinString.EndsWith(",") ? joinString[..^1] : joinString; + } + + if (value is JsonArray jsonArray) + { + var joinString = string.Empty; + foreach (var node in jsonArray) + { + joinString += node.ToString() + ","; + } + return joinString.EndsWith(",") ? joinString[..^1] : joinString; + } + + if (value is JArray jArray) + { + var joinString = string.Empty; + foreach (var token in jArray.Children()) + { + joinString += token.ToString() + ","; + } + return joinString.EndsWith(",") ? joinString[..^1] : joinString; } throw new BusinessException(PlatformErrorCodes.MetaFormatMissMatch); }); diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/DefaultStandardMenuConverter.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/DefaultStandardMenuConverter.cs new file mode 100644 index 000000000..4159e63c9 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/DefaultStandardMenuConverter.cs @@ -0,0 +1,20 @@ +using Volo.Abp.DependencyInjection; + +namespace LINGYUN.Platform.Menus; + +[Dependency(TryRegister = true)] +public class DefaultStandardMenuConverter : IStandardMenuConverter, ISingletonDependency +{ + public StandardMenu Convert(Menu menu) + { + return new StandardMenu + { + Icon = "", + Name = menu.Name, + Path = menu.Path, + DisplayName = menu.DisplayName, + Description = menu.Description, + Redirect = menu.Redirect, + }; + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IMenuRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IMenuRepository.cs index 69f01757f..445f93d82 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IMenuRepository.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IMenuRepository.cs @@ -8,6 +8,9 @@ namespace LINGYUN.Platform.Menus { public interface IMenuRepository : IBasicRepository { + Task> GetListAsync( + IEnumerable idList, + CancellationToken cancellationToken = default); /// /// 获取最后一个菜单 /// diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IStandardMenuConverter.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IStandardMenuConverter.cs new file mode 100644 index 000000000..b6d8779c1 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IStandardMenuConverter.cs @@ -0,0 +1,6 @@ +namespace LINGYUN.Platform.Menus; + +public interface IStandardMenuConverter +{ + StandardMenu Convert(Menu menu); +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IUserFavoriteMenuRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IUserFavoriteMenuRepository.cs new file mode 100644 index 000000000..31bf1d08f --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IUserFavoriteMenuRepository.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories; + +namespace LINGYUN.Platform.Menus; + +public interface IUserFavoriteMenuRepository : IBasicRepository +{ + Task CheckExistsAsync( + string framework, + Guid userId, + Guid menuId, + CancellationToken cancellationToken = default); + + Task FindByUserMenuAsync( + Guid userId, + Guid menuId, + CancellationToken cancellationToken = default); + + Task> GetListByMenuIdAsync( + Guid menuId, + CancellationToken cancellationToken = default); + + Task> GetFavoriteMenusAsync( + Guid userId, + string framework = null, + Guid? menuId = null, + CancellationToken cancellationToken = default); +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/MenuChangeHandler.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/MenuChangeHandler.cs new file mode 100644 index 000000000..ff72ce6cb --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/MenuChangeHandler.cs @@ -0,0 +1,71 @@ +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Entities.Events.Distributed; +using Volo.Abp.EventBus.Distributed; +using Volo.Abp.Uow; + +namespace LINGYUN.Platform.Menus; + +public class MenuChangeHandler : + IDistributedEventHandler>, + IDistributedEventHandler>, + IDistributedEventHandler>, + ITransientDependency +{ + private readonly IMenuRepository _menuRepository; + private readonly IStandardMenuConverter _standardMenuConverter; + private readonly IUserFavoriteMenuRepository _userFavoriteMenuRepository; + + public MenuChangeHandler( + IMenuRepository menuRepository, + IStandardMenuConverter standardMenuConverter, + IUserFavoriteMenuRepository userFavoriteMenuRepository) + { + _menuRepository = menuRepository; + _standardMenuConverter = standardMenuConverter; + _userFavoriteMenuRepository = userFavoriteMenuRepository; + } + + [UnitOfWork] + public async virtual Task HandleEventAsync(EntityUpdatedEto eventData) + { + // 菜单变更同步变更收藏菜单 + var menu = await _menuRepository.GetAsync(eventData.Entity.Id); + var favoriteMenus = await _userFavoriteMenuRepository.GetListByMenuIdAsync(menu.Id); + + var standardMenu = _standardMenuConverter.Convert(menu); + + foreach (var favoriteMenu in favoriteMenus) + { + favoriteMenu.Framework = menu.Framework; + + favoriteMenu.Name = standardMenu.Name; + favoriteMenu.Path = standardMenu.Path; + favoriteMenu.Icon = standardMenu.Icon; + favoriteMenu.DisplayName = standardMenu.DisplayName; + } + + await _userFavoriteMenuRepository.UpdateManyAsync(favoriteMenus); + } + + [UnitOfWork] + public async virtual Task HandleEventAsync(EntityDeletedEto eventData) + { + // 菜单删除同步删除收藏菜单 + + var favoriteMenus = await _userFavoriteMenuRepository.GetListByMenuIdAsync(eventData.Entity.Id); + + await _userFavoriteMenuRepository.DeleteManyAsync(favoriteMenus); + } + + [UnitOfWork] + public async virtual Task HandleEventAsync(EntityDeletedEto eventData) + { + // 用户菜单删除同步删除收藏菜单 + + var favoriteMenus = await _userFavoriteMenuRepository.GetListByMenuIdAsync( + eventData.Entity.UserId); + + await _userFavoriteMenuRepository.DeleteManyAsync(favoriteMenus); + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/StandardMenu.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/StandardMenu.cs new file mode 100644 index 000000000..f71227dc1 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/StandardMenu.cs @@ -0,0 +1,10 @@ +namespace LINGYUN.Platform.Menus; +public class StandardMenu +{ + public string Icon { get; set; } + public string Path { get; set; } + public string Name { get; set; } + public string DisplayName { get; set; } + public string Description { get; set; } + public string Redirect { get; set; } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/UserFavoriteMenu.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/UserFavoriteMenu.cs new file mode 100644 index 000000000..046345e8a --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/UserFavoriteMenu.cs @@ -0,0 +1,57 @@ +using LINGYUN.Platform.Routes; +using System; +using Volo.Abp; +using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.MultiTenancy; + +namespace LINGYUN.Platform.Menus; + +public class UserFavoriteMenu : AuditedEntity, IMultiTenant +{ + public virtual Guid? TenantId { get; protected set; } + + public virtual Guid MenuId { get; protected set; } + + public virtual Guid UserId { get; protected set; } + + public virtual string AliasName { get; set; } + + public virtual string Color { get; set; } + + public virtual string Framework { get; set; } + + public virtual string Name { get; set; } + + public virtual string DisplayName { get; set; } + + public virtual string Path { get; set; } + + public virtual string Icon { get; set; } + + protected UserFavoriteMenu() { } + public UserFavoriteMenu( + Guid id, + Guid menuId, + Guid userId, + string framework, + string name, + string displayName, + string path, + string icon, + string color, + string aliasName = null, + Guid? tenantId = null) + : base(id) + { + MenuId = menuId; + UserId = userId; + Framework = Check.NotNullOrWhiteSpace(framework, nameof(framework), LayoutConsts.MaxFrameworkLength); + Name = Check.NotNullOrWhiteSpace(name, nameof(name), RouteConsts.MaxNameLength); + DisplayName = Check.NotNullOrWhiteSpace(displayName, nameof(displayName), RouteConsts.MaxDisplayNameLength); + Path = Check.NotNullOrWhiteSpace(path, nameof(path), RouteConsts.MaxPathLength); + Icon = Check.Length(icon, nameof(icon), UserFavoriteMenuConsts.MaxIconLength); + Color = Check.Length(color, nameof(color), UserFavoriteMenuConsts.MaxColorLength); + AliasName = Check.Length(aliasName, nameof(aliasName), UserFavoriteMenuConsts.MaxAliasNameLength); + TenantId = tenantId; + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainMappingProfile.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainMappingProfile.cs index 39d783243..31949f32f 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainMappingProfile.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainMappingProfile.cs @@ -1,4 +1,6 @@ using AutoMapper; +using LINGYUN.Platform.Layouts; +using LINGYUN.Platform.Menus; using LINGYUN.Platform.Routes; using LINGYUN.Platform.Versions; @@ -8,7 +10,11 @@ namespace LINGYUN.Platform { public PlatformDomainMappingProfile() { - CreateMap(); + CreateMap(); + + CreateMap(); + CreateMap(); + CreateMap(); CreateMap() .ForMember(eto => eto.FileCount, map => map.MapFrom(src => src.Files.Count)); diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainModule.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainModule.cs index c65f34fb9..71825dd44 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainModule.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainModule.cs @@ -1,4 +1,6 @@ using LINGYUN.Platform.Datas; +using LINGYUN.Platform.Layouts; +using LINGYUN.Platform.Menus; using LINGYUN.Platform.ObjectExtending; using LINGYUN.Platform.Routes; using LINGYUN.Platform.Versions; @@ -42,11 +44,13 @@ namespace LINGYUN.Platform Configure(options => { - options.EtoMappings.Add(typeof(PlatformDomainModule)); + options.EtoMappings.Add(typeof(PlatformDomainModule)); - options.EtoMappings.Add(typeof(PlatformDomainModule)); + options.EtoMappings.Add(typeof(PlatformDomainModule)); + options.EtoMappings.Add(typeof(PlatformDomainModule)); + options.EtoMappings.Add(typeof(PlatformDomainModule)); - options.AutoEventSelectors.Add(); + options.EtoMappings.Add(typeof(PlatformDomainModule)); }); } public override void PostConfigureServices(ServiceConfigurationContext context) diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformDbContextModelBuilderExtensions.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformDbContextModelBuilderExtensions.cs index 373655b5d..d4de4b1db 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformDbContextModelBuilderExtensions.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformDbContextModelBuilderExtensions.cs @@ -82,6 +82,42 @@ namespace LINGYUN.Platform.EntityFrameworkCore x.HasIndex(i => new { i.UserId, i.MenuId }); }); + builder.Entity(x => + { + x.ToTable(options.TablePrefix + "UserFavoriteMenus"); + + x.Property(p => p.Framework) + .HasMaxLength(LayoutConsts.MaxFrameworkLength) + .HasColumnName(nameof(Menu.Framework)) + .IsRequired(); + x.Property(p => p.DisplayName) + .HasMaxLength(RouteConsts.MaxDisplayNameLength) + .HasColumnName(nameof(Route.DisplayName)) + .IsRequired(); + x.Property(p => p.Name) + .HasMaxLength(RouteConsts.MaxNameLength) + .HasColumnName(nameof(Route.Name)) + .IsRequired(); + x.Property(p => p.Path) + .HasMaxLength(RouteConsts.MaxPathLength) + .HasColumnName(nameof(Route.Path)) + .IsRequired(); + + x.Property(p => p.Icon) + .HasMaxLength(UserFavoriteMenuConsts.MaxIconLength) + .HasColumnName(nameof(UserFavoriteMenu.Icon)); + x.Property(p => p.Color) + .HasMaxLength(UserFavoriteMenuConsts.MaxColorLength) + .HasColumnName(nameof(UserFavoriteMenu.Color)); + x.Property(p => p.AliasName) + .HasMaxLength(UserFavoriteMenuConsts.MaxAliasNameLength) + .HasColumnName(nameof(UserFavoriteMenu.AliasName)); + + x.ConfigureByConvention(); + + x.HasIndex(i => new { i.UserId, i.MenuId }); + }); + builder.Entity(x => { x.ToTable(options.TablePrefix + "Datas"); diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformEntityFrameworkCoreModule.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformEntityFrameworkCoreModule.cs index 7f590458a..7990b233b 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformEntityFrameworkCoreModule.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformEntityFrameworkCoreModule.cs @@ -21,7 +21,8 @@ namespace LINGYUN.Platform.EntityFrameworkCore options.AddRepository(); options.AddRepository(); options.AddRepository(); - options.AddRepository(); + options.AddRepository(); + options.AddRepository(); options.AddRepository(); options.AddRepository(); diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs index 84315358f..4ec99db2b 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs @@ -19,6 +19,15 @@ namespace LINGYUN.Platform.Menus { } + public async virtual Task> GetListAsync( + IEnumerable idList, + CancellationToken cancellationToken = default) + { + return await (await GetDbSetAsync()) + .Where(x => idList.Contains(x.Id)) + .ToListAsync(GetCancellationToken(cancellationToken)); + } + public async virtual Task GetLastMenuAsync( Guid? parentId = null, CancellationToken cancellationToken = default) diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreUserFavoriteMenuRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreUserFavoriteMenuRepository.cs new file mode 100644 index 000000000..f43af6609 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreUserFavoriteMenuRepository.cs @@ -0,0 +1,66 @@ +using LINGYUN.Platform.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; + +namespace LINGYUN.Platform.Menus; +public class EfCoreUserFavoriteMenuRepository : + EfCoreRepository, + IUserFavoriteMenuRepository +{ + public EfCoreUserFavoriteMenuRepository( + IDbContextProvider dbContextProvider) + : base(dbContextProvider) + { + } + + public async virtual Task> GetListByMenuIdAsync( + Guid menuId, + CancellationToken cancellationToken = default) + { + return await (await GetDbSetAsync()) + .Where(x => x.MenuId == menuId) + .ToListAsync(GetCancellationToken(cancellationToken)); + } + + public async virtual Task> GetFavoriteMenusAsync( + Guid userId, + string framework = null, + Guid? menuId = null, + CancellationToken cancellationToken = default) + { + return await (await GetDbSetAsync()) + .Where(x => x.UserId == userId) + .WhereIf(menuId.HasValue, x => x.MenuId == menuId) + .WhereIf(!framework.IsNullOrWhiteSpace(), x => x.Framework == framework) + .OrderBy(x => x.CreationTime) + .ToListAsync(GetCancellationToken(cancellationToken)); + } + + public async virtual Task CheckExistsAsync( + string framework, + Guid userId, + Guid menuId, + CancellationToken cancellationToken = default) + { + return await (await GetDbSetAsync()) + .AnyAsync(x => + x.Framework == framework && x.UserId == userId && x.MenuId == menuId, + GetCancellationToken(cancellationToken)); + } + + public async virtual Task FindByUserMenuAsync( + Guid userId, + Guid menuId, + CancellationToken cancellationToken = default) + { + return await (await GetDbSetAsync()) + .Where(x => x.UserId == userId && x.MenuId == menuId) + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Menus/UserFavoriteMenuController.cs b/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Menus/UserFavoriteMenuController.cs new file mode 100644 index 000000000..a0def9042 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Menus/UserFavoriteMenuController.cs @@ -0,0 +1,78 @@ +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using System; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.Application.Dtos; + +namespace LINGYUN.Platform.Menus; + +[Authorize] +[RemoteService(Name = PlatformRemoteServiceConsts.RemoteServiceName)] +[Area("platform")] +[Route("api/platform/menus/favorites")] +public class UserFavoriteMenuController : PlatformControllerBase, IUserFavoriteMenuAppService +{ + protected IUserFavoriteMenuAppService Service { get; } + + public UserFavoriteMenuController(IUserFavoriteMenuAppService service) + { + Service = service; + } + + [HttpPost] + [Route("{userId}")] + public virtual Task CreateAsync(Guid userId, UserFavoriteMenuCreateDto input) + { + return Service.CreateAsync(userId, input); + } + + [HttpPost] + [Route("my-favorite-menu")] + public virtual Task CreateMyFavoriteMenuAsync(UserFavoriteMenuCreateDto input) + { + return Service.CreateMyFavoriteMenuAsync(input); + } + + [HttpDelete] + [Route("{userId}/{MenuId}")] + public virtual Task DeleteAsync(Guid userId, UserFavoriteMenuRemoveInput input) + { + return Service.DeleteAsync(userId, input); + } + + [HttpDelete] + [Route("my-favorite-menu/{MenuId}")] + public virtual Task DeleteMyFavoriteMenuAsync(UserFavoriteMenuRemoveInput input) + { + return Service.DeleteMyFavoriteMenuAsync(input); + } + + [HttpGet] + [Route("{userId}")] + public virtual Task> GetListAsync(Guid userId, UserFavoriteMenuGetListInput input) + { + return Service.GetListAsync(userId, input); + } + + [HttpGet] + [Route("my-favorite-menus")] + public virtual Task> GetMyFavoriteMenuListAsync(UserFavoriteMenuGetListInput input) + { + return Service.GetMyFavoriteMenuListAsync(input); + } + + [HttpPut] + [Route("{userId}")] + public virtual Task UpdateAsync(Guid userId, UserFavoriteMenuUpdateDto input) + { + return Service.UpdateAsync(userId, input); + } + + [HttpPut] + [Route("my-favorite-menu")] + public virtual Task UpdateMyFavoriteMenuAsync(UserFavoriteMenuUpdateDto input) + { + return Service.UpdateMyFavoriteMenuAsync(input); + } +} diff --git a/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/Migrations/20220923113938_Add-User-Favorite-Menu.Designer.cs b/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/Migrations/20220923113938_Add-User-Favorite-Menu.Designer.cs new file mode 100644 index 000000000..fd78a579c --- /dev/null +++ b/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/Migrations/20220923113938_Add-User-Favorite-Menu.Designer.cs @@ -0,0 +1,740 @@ +// +using System; +using LY.MicroService.PlatformManagement.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; + +#nullable disable + +namespace LY.MicroService.PlatformManagement.Migrations +{ + [DbContext(typeof(PlatformManagementMigrationsDbContext))] + [Migration("20220923113938_Add-User-Favorite-Menu")] + partial class AddUserFavoriteMenu + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) + .HasAnnotation("ProductVersion", "6.0.9") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("LINGYUN.Platform.Datas.Data", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("varchar(1024)") + .HasColumnName("Code"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)") + .HasColumnName("Description"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasColumnName("DisplayName"); + + b.Property("ExtraProperties") + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsStatic") + .HasColumnType("tinyint(1)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(30) + .HasColumnType("varchar(30)") + .HasColumnName("Name"); + + b.Property("ParentId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("AppPlatformDatas", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Platform.Datas.DataItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllowBeNull") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(true); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DataId") + .HasColumnType("char(36)"); + + b.Property("DefaultValue") + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasColumnName("DefaultValue"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)") + .HasColumnName("Description"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasColumnName("DisplayName"); + + b.Property("ExtraProperties") + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsStatic") + .HasColumnType("tinyint(1)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(30) + .HasColumnType("varchar(30)") + .HasColumnName("Name"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.Property("ValueType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DataId"); + + b.HasIndex("Name"); + + b.ToTable("AppPlatformDataItems", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Platform.Layouts.Layout", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DataId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasColumnName("DisplayName"); + + b.Property("ExtraProperties") + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("Framework") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasColumnName("Framework"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasColumnName("Name"); + + b.Property("Path") + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasColumnName("Path"); + + b.Property("Redirect") + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasColumnName("Redirect"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("AppPlatformLayouts", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.Menu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(23) + .HasColumnType("varchar(23)") + .HasColumnName("Code"); + + b.Property("Component") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasColumnName("Component"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasColumnName("DisplayName"); + + b.Property("ExtraProperties") + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("Framework") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasColumnName("Framework"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsPublic") + .HasColumnType("tinyint(1)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("LayoutId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasColumnName("Name"); + + b.Property("ParentId") + .HasColumnType("char(36)"); + + b.Property("Path") + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasColumnName("Path"); + + b.Property("Redirect") + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasColumnName("Redirect"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("AppPlatformMenus", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.RoleMenu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("MenuId") + .HasColumnType("char(36)"); + + b.Property("RoleName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)") + .HasColumnName("RoleName"); + + b.Property("Startup") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("RoleName", "MenuId"); + + b.ToTable("AppPlatformRoleMenus", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.UserFavoriteMenu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasColumnName("DisplayName"); + + b.Property("Framework") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasColumnName("Framework"); + + b.Property("Icon") + .HasMaxLength(512) + .HasColumnType("varchar(512)") + .HasColumnName("Icon"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("MenuId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasColumnName("Name"); + + b.Property("Path") + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasColumnName("Path"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UserId", "MenuId"); + + b.ToTable("AppPlatformUserFavoriteMenus", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.UserMenu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("MenuId") + .HasColumnType("char(36)"); + + b.Property("Startup") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UserId", "MenuId"); + + b.ToTable("AppPlatformUserMenus", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.AppVersion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)") + .HasColumnName("Description"); + + b.Property("ExtraProperties") + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("PlatformType") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasColumnName("Title"); + + b.Property("Version") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasColumnName("Version"); + + b.HasKey("Id"); + + b.HasIndex("Version"); + + b.ToTable("AppPlatformVersion", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.VersionFile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AppVersionId") + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DownloadCount") + .HasColumnType("int"); + + b.Property("FileType") + .HasColumnType("int"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasColumnName("Name"); + + b.Property("Path") + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasColumnName("Path"); + + b.Property("SHA256") + .IsRequired() + .HasMaxLength(65) + .HasColumnType("varchar(65)") + .HasColumnName("SHA256"); + + b.Property("Size") + .HasColumnType("bigint"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.Property("Version") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasColumnName("Version"); + + b.HasKey("Id"); + + b.HasIndex("AppVersionId"); + + b.HasIndex("Path", "Name", "Version") + .IsUnique(); + + b.ToTable("AppPlatformVersionFile", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Platform.Datas.DataItem", b => + { + b.HasOne("LINGYUN.Platform.Datas.Data", null) + .WithMany("Items") + .HasForeignKey("DataId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.VersionFile", b => + { + b.HasOne("LINGYUN.Platform.Versions.AppVersion", "AppVersion") + .WithMany("Files") + .HasForeignKey("AppVersionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AppVersion"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Datas.Data", b => + { + b.Navigation("Items"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.AppVersion", b => + { + b.Navigation("Files"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/Migrations/20220923113938_Add-User-Favorite-Menu.cs b/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/Migrations/20220923113938_Add-User-Favorite-Menu.cs new file mode 100644 index 000000000..22eac4f74 --- /dev/null +++ b/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/Migrations/20220923113938_Add-User-Favorite-Menu.cs @@ -0,0 +1,53 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace LY.MicroService.PlatformManagement.Migrations +{ + public partial class AddUserFavoriteMenu : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "AppPlatformUserFavoriteMenus", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + TenantId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), + MenuId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + UserId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + Framework = table.Column(type: "varchar(64)", maxLength: 64, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Name = table.Column(type: "varchar(64)", maxLength: 64, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + DisplayName = table.Column(type: "varchar(128)", maxLength: 128, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Path = table.Column(type: "varchar(255)", maxLength: 255, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Icon = table.Column(type: "varchar(512)", maxLength: 512, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + CreationTime = table.Column(type: "datetime(6)", nullable: false), + CreatorId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), + LastModificationTime = table.Column(type: "datetime(6)", nullable: true), + LastModifierId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_AppPlatformUserFavoriteMenus", x => x.Id); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_AppPlatformUserFavoriteMenus_UserId_MenuId", + table: "AppPlatformUserFavoriteMenus", + columns: new[] { "UserId", "MenuId" }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AppPlatformUserFavoriteMenus"); + } + } +} diff --git a/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/Migrations/20220926012110_Add-Color-And-AliasName-With-UserFavoriteMenu.Designer.cs b/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/Migrations/20220926012110_Add-Color-And-AliasName-With-UserFavoriteMenu.Designer.cs new file mode 100644 index 000000000..bb5c5c43e --- /dev/null +++ b/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/Migrations/20220926012110_Add-Color-And-AliasName-With-UserFavoriteMenu.Designer.cs @@ -0,0 +1,751 @@ +// +using System; +using LY.MicroService.PlatformManagement.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; + +#nullable disable + +namespace LY.MicroService.PlatformManagement.Migrations +{ + [DbContext(typeof(PlatformManagementMigrationsDbContext))] + [Migration("20220926012110_Add-Color-And-AliasName-With-UserFavoriteMenu")] + partial class AddColorAndAliasNameWithUserFavoriteMenu + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) + .HasAnnotation("ProductVersion", "6.0.9") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("LINGYUN.Platform.Datas.Data", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("varchar(1024)") + .HasColumnName("Code"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)") + .HasColumnName("Description"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasColumnName("DisplayName"); + + b.Property("ExtraProperties") + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsStatic") + .HasColumnType("tinyint(1)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(30) + .HasColumnType("varchar(30)") + .HasColumnName("Name"); + + b.Property("ParentId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("AppPlatformDatas", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Platform.Datas.DataItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllowBeNull") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(true); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DataId") + .HasColumnType("char(36)"); + + b.Property("DefaultValue") + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasColumnName("DefaultValue"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)") + .HasColumnName("Description"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasColumnName("DisplayName"); + + b.Property("ExtraProperties") + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsStatic") + .HasColumnType("tinyint(1)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(30) + .HasColumnType("varchar(30)") + .HasColumnName("Name"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.Property("ValueType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DataId"); + + b.HasIndex("Name"); + + b.ToTable("AppPlatformDataItems", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Platform.Layouts.Layout", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DataId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasColumnName("DisplayName"); + + b.Property("ExtraProperties") + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("Framework") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasColumnName("Framework"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasColumnName("Name"); + + b.Property("Path") + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasColumnName("Path"); + + b.Property("Redirect") + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasColumnName("Redirect"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("AppPlatformLayouts", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.Menu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(23) + .HasColumnType("varchar(23)") + .HasColumnName("Code"); + + b.Property("Component") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasColumnName("Component"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasColumnName("DisplayName"); + + b.Property("ExtraProperties") + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("Framework") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasColumnName("Framework"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsPublic") + .HasColumnType("tinyint(1)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("LayoutId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasColumnName("Name"); + + b.Property("ParentId") + .HasColumnType("char(36)"); + + b.Property("Path") + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasColumnName("Path"); + + b.Property("Redirect") + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasColumnName("Redirect"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("AppPlatformMenus", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.RoleMenu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("MenuId") + .HasColumnType("char(36)"); + + b.Property("RoleName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)") + .HasColumnName("RoleName"); + + b.Property("Startup") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("RoleName", "MenuId"); + + b.ToTable("AppPlatformRoleMenus", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.UserFavoriteMenu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AliasName") + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasColumnName("AliasName"); + + b.Property("Color") + .HasMaxLength(30) + .HasColumnType("varchar(30)") + .HasColumnName("Color"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasColumnName("DisplayName"); + + b.Property("Framework") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasColumnName("Framework"); + + b.Property("Icon") + .HasMaxLength(512) + .HasColumnType("varchar(512)") + .HasColumnName("Icon"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("MenuId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasColumnName("Name"); + + b.Property("Path") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasColumnName("Path"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UserId", "MenuId"); + + b.ToTable("AppPlatformUserFavoriteMenus", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.UserMenu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("MenuId") + .HasColumnType("char(36)"); + + b.Property("Startup") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UserId", "MenuId"); + + b.ToTable("AppPlatformUserMenus", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.AppVersion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)") + .HasColumnName("Description"); + + b.Property("ExtraProperties") + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("PlatformType") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasColumnName("Title"); + + b.Property("Version") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasColumnName("Version"); + + b.HasKey("Id"); + + b.HasIndex("Version"); + + b.ToTable("AppPlatformVersion", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.VersionFile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AppVersionId") + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DownloadCount") + .HasColumnType("int"); + + b.Property("FileType") + .HasColumnType("int"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasColumnName("Name"); + + b.Property("Path") + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasColumnName("Path"); + + b.Property("SHA256") + .IsRequired() + .HasMaxLength(65) + .HasColumnType("varchar(65)") + .HasColumnName("SHA256"); + + b.Property("Size") + .HasColumnType("bigint"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.Property("Version") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasColumnName("Version"); + + b.HasKey("Id"); + + b.HasIndex("AppVersionId"); + + b.HasIndex("Path", "Name", "Version") + .IsUnique(); + + b.ToTable("AppPlatformVersionFile", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Platform.Datas.DataItem", b => + { + b.HasOne("LINGYUN.Platform.Datas.Data", null) + .WithMany("Items") + .HasForeignKey("DataId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.VersionFile", b => + { + b.HasOne("LINGYUN.Platform.Versions.AppVersion", "AppVersion") + .WithMany("Files") + .HasForeignKey("AppVersionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AppVersion"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Datas.Data", b => + { + b.Navigation("Items"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.AppVersion", b => + { + b.Navigation("Files"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/Migrations/20220926012110_Add-Color-And-AliasName-With-UserFavoriteMenu.cs b/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/Migrations/20220926012110_Add-Color-And-AliasName-With-UserFavoriteMenu.cs new file mode 100644 index 000000000..9e1ed10eb --- /dev/null +++ b/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/Migrations/20220926012110_Add-Color-And-AliasName-With-UserFavoriteMenu.cs @@ -0,0 +1,71 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace LY.MicroService.PlatformManagement.Migrations +{ + public partial class AddColorAndAliasNameWithUserFavoriteMenu : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.UpdateData( + table: "AppPlatformUserFavoriteMenus", + keyColumn: "Path", + keyValue: null, + column: "Path", + value: ""); + + migrationBuilder.AlterColumn( + name: "Path", + table: "AppPlatformUserFavoriteMenus", + type: "varchar(255)", + maxLength: 255, + nullable: false, + oldClrType: typeof(string), + oldType: "varchar(255)", + oldMaxLength: 255, + oldNullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AddColumn( + name: "AliasName", + table: "AppPlatformUserFavoriteMenus", + type: "varchar(128)", + maxLength: 128, + nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AddColumn( + name: "Color", + table: "AppPlatformUserFavoriteMenus", + type: "varchar(30)", + maxLength: 30, + nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "AliasName", + table: "AppPlatformUserFavoriteMenus"); + + migrationBuilder.DropColumn( + name: "Color", + table: "AppPlatformUserFavoriteMenus"); + + migrationBuilder.AlterColumn( + name: "Path", + table: "AppPlatformUserFavoriteMenus", + type: "varchar(255)", + maxLength: 255, + nullable: true, + oldClrType: typeof(string), + oldType: "varchar(255)", + oldMaxLength: 255) + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4"); + } + } +} diff --git a/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/Migrations/PlatformHttpApiHostMigrationsDbContextModelSnapshot.cs b/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/Migrations/PlatformHttpApiHostMigrationsDbContextModelSnapshot.cs index d489922aa..ceaa9ce46 100644 --- a/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/Migrations/PlatformHttpApiHostMigrationsDbContextModelSnapshot.cs +++ b/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/Migrations/PlatformHttpApiHostMigrationsDbContextModelSnapshot.cs @@ -18,7 +18,7 @@ namespace LY.MicroService.PlatformManagement.Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) - .HasAnnotation("ProductVersion", "6.0.2") + .HasAnnotation("ProductVersion", "6.0.9") .HasAnnotation("Relational:MaxIdentifierLength", 64); modelBuilder.Entity("LINGYUN.Platform.Datas.Data", b => @@ -443,6 +443,84 @@ namespace LY.MicroService.PlatformManagement.Migrations b.ToTable("AppPlatformRoleMenus", (string)null); }); + modelBuilder.Entity("LINGYUN.Platform.Menus.UserFavoriteMenu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AliasName") + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasColumnName("AliasName"); + + b.Property("Color") + .HasMaxLength(30) + .HasColumnType("varchar(30)") + .HasColumnName("Color"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasColumnName("DisplayName"); + + b.Property("Framework") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasColumnName("Framework"); + + b.Property("Icon") + .HasMaxLength(512) + .HasColumnType("varchar(512)") + .HasColumnName("Icon"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("MenuId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasColumnName("Name"); + + b.Property("Path") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasColumnName("Path"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UserId", "MenuId"); + + b.ToTable("AppPlatformUserFavoriteMenus", (string)null); + }); + modelBuilder.Entity("LINGYUN.Platform.Menus.UserMenu", b => { b.Property("Id") diff --git a/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/PlatformManagementHttpApiHostModule.Configure.cs b/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/PlatformManagementHttpApiHostModule.Configure.cs index c1ecaef44..e42f914cc 100644 --- a/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/PlatformManagementHttpApiHostModule.Configure.cs +++ b/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/PlatformManagementHttpApiHostModule.Configure.cs @@ -38,7 +38,7 @@ namespace LY.MicroService.PlatformManagement; public partial class PlatformManagementHttpApiHostModule { protected const string DefaultCorsPolicyName = "Default"; - + protected const string ApplicationName = "Platform"; private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); private void PreConfigureFeature() @@ -51,7 +51,7 @@ public partial class PlatformManagementHttpApiHostModule private void PreConfigureApp() { - AbpSerilogEnrichersConsts.ApplicationName = "Platform"; + AbpSerilogEnrichersConsts.ApplicationName = ApplicationName; PreConfigure(options => { @@ -158,7 +158,7 @@ public partial class PlatformManagementHttpApiHostModule { Configure(options => { - options.ApplicationName = "Platform"; + options.ApplicationName = ApplicationName; // 是否启用实体变更记录 var entitiesChangedConfig = configuration.GetSection("App:TrackingEntitiesChanged"); if (entitiesChangedConfig.Exists() && entitiesChangedConfig.Get()) @@ -324,6 +324,11 @@ public partial class PlatformManagementHttpApiHostModule }; }); + if (isDevelopment) + { + // services.AddAlwaysAllowAuthorization(); + } + if (!isDevelopment) { var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]); diff --git a/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/appsettings.Development.json b/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/appsettings.Development.json index aeef1aa34..6664ad683 100644 --- a/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/appsettings.Development.json +++ b/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/appsettings.Development.json @@ -8,6 +8,7 @@ "tag": "Platform" }, "App": { + "TrackingEntitiesChanged": true, "Forwarded": { "ForwardedHeaders": 5, "KnownProxies": [