From bbdd47d562cde2415cf34ca214d57213990e36bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sedat=20=C3=96zt=C3=BCrk?= Date: Sun, 29 Jun 2025 14:54:11 +0300 Subject: [PATCH] =?UTF-8?q?Dinamik=20route=20d=C3=BCzenlemeleri?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Seeds/ListFormsSeeder.cs | 4 ++-- .../Seeds/SeederData.json | 16 ++++++++-------- .../EntityFrameworkCore/PlatformDbContext.cs | 2 ++ ...r.cs => 20250629111850_AddRoutes.Designer.cs} | 5 ++++- ..._AddRoutes.cs => 20250629111850_AddRoutes.cs} | 6 ++++++ .../Migrations/PlatformDbContextModelSnapshot.cs | 3 +++ ui/dev-dist/sw.js | 2 +- ui/src/routes/route.constant.ts | 8 ++++---- .../Settings.tsx => admin/profile/Profile.tsx} | 14 ++++++++------ .../profile/components}/General.tsx | 0 .../profile/components}/NotificationSettings.tsx | 0 .../profile/components}/Password.tsx | 0 12 files changed, 38 insertions(+), 22 deletions(-) rename api/src/Kurs.Platform.EntityFrameworkCore/Migrations/{20250628190318_AddRoutes.Designer.cs => 20250629111850_AddRoutes.Designer.cs} (99%) rename api/src/Kurs.Platform.EntityFrameworkCore/Migrations/{20250628190318_AddRoutes.cs => 20250629111850_AddRoutes.cs} (98%) rename ui/src/views/{auth/Settings.tsx => admin/profile/Profile.tsx} (86%) rename ui/src/views/{auth/settings => admin/profile/components}/General.tsx (100%) rename ui/src/views/{auth/settings => admin/profile/components}/NotificationSettings.tsx (100%) rename ui/src/views/{auth/settings => admin/profile/components}/Password.tsx (100%) diff --git a/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormsSeeder.cs b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormsSeeder.cs index 57e14986..02fd27b8 100644 --- a/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormsSeeder.cs +++ b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormsSeeder.cs @@ -10743,7 +10743,7 @@ public class ListFormsSeeder : IDataSeedContributor, ITransientDependency D = AppCodes.BlogManagement.BlogCategory + ".Delete", E = AppCodes.BlogManagement.BlogCategory + ".Export" }), - DeleteCommand = $"UPDATE \"{DbTablePrefix}BlogCategories\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteCommand = $"UPDATE \"{DbTablePrefix}BlogCategory\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] { new FieldsDefaultValue @@ -11332,7 +11332,7 @@ public class ListFormsSeeder : IDataSeedContributor, ITransientDependency DataSourceType = UiLookupDataSourceTypeEnum.Query, DisplayExpr = "Name", ValueExpr = "Key", - LookupQuery = $"SELECT \"{DbTablePrefix}BlogCategories\".\"Id\" AS \"Key\", \"{DbTablePrefix}BlogCategories\".\"Name\" as \"Name\" FROM \"{DbTablePrefix}BlogCategories\" ORDER BY \"{DbTablePrefix}BlogCategories\".\"Name\"" + LookupQuery = $"SELECT \"{DbTablePrefix}BlogCategory\".\"Id\" AS \"Key\", \"{DbTablePrefix}BlogCategory\".\"Name\" as \"Name\" FROM \"{DbTablePrefix}BlogCategory\" ORDER BY \"{DbTablePrefix}BlogCategory\".\"Name\"" }), PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto { diff --git a/api/src/Kurs.Platform.DbMigrator/Seeds/SeederData.json b/api/src/Kurs.Platform.DbMigrator/Seeds/SeederData.json index bd1ee463..f24c9186 100644 --- a/api/src/Kurs.Platform.DbMigrator/Seeds/SeederData.json +++ b/api/src/Kurs.Platform.DbMigrator/Seeds/SeederData.json @@ -6903,7 +6903,7 @@ "Code": "App.ForumManagement", "DisplayName": "App.ForumManagement", "Order": 11, - "Url": "/admin/forumManagement", + "Url": "/saas/forumManagement", "Icon": "FcReading", "RequiredPermissionName": "App.ForumManagement", "IsDisabled": false @@ -21521,7 +21521,7 @@ }, { "key": "saas.forumManagement", - "path": "/admin/forumManagement", + "path": "/saas/forumManagement", "componentPath": "@/views/forum/Management", "routeType": "protected", "authority": [] @@ -21535,22 +21535,22 @@ }, { "key": "admin.profile.general", - "path": "/admin/settings/general", - "componentPath": "@/views/auth/Settings", + "path": "/admin/profile/general", + "componentPath": "@/views/admin/profile/Profile", "routeType": "protected", "authority": [] }, { "key": "admin.profile.password", - "path": "/admin/settings/password", - "componentPath": "@/views/auth/Settings", + "path": "/admin/profile/password", + "componentPath": "@/views/admin/profile/Profile", "routeType": "protected", "authority": [] }, { "key": "admin.profile.notificationSettings", - "path": "/admin/settings/notification-settings", - "componentPath": "@/views/auth/Settings", + "path": "/admin/profile/notification-settings", + "componentPath": "@/views/admin/profile/Profile", "routeType": "protected", "authority": [] }, diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs b/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs index 18c44c1b..eef9d1ee 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs @@ -501,6 +501,8 @@ public class PlatformDbContext : b.ToTable(PlatformConsts.DbTablePrefix + nameof(Route), PlatformConsts.DbSchema); b.ConfigureByConvention(); + b.HasIndex(x => x.Key).IsUnique(); + b.Property(x => x.Key).IsRequired().HasMaxLength(128); b.Property(x => x.Path).IsRequired().HasMaxLength(256); b.Property(x => x.ComponentPath).IsRequired().HasMaxLength(256); diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20250628190318_AddRoutes.Designer.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20250629111850_AddRoutes.Designer.cs similarity index 99% rename from api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20250628190318_AddRoutes.Designer.cs rename to api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20250629111850_AddRoutes.Designer.cs index b0927526..87ef3b39 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20250628190318_AddRoutes.Designer.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20250629111850_AddRoutes.Designer.cs @@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; namespace Kurs.Platform.Migrations { [DbContext(typeof(PlatformDbContext))] - [Migration("20250628190318_AddRoutes")] + [Migration("20250629111850_AddRoutes")] partial class AddRoutes { /// @@ -2342,6 +2342,9 @@ namespace Kurs.Platform.Migrations b.HasKey("Id"); + b.HasIndex("Key") + .IsUnique(); + b.ToTable("PRoute", (string)null); }); diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20250628190318_AddRoutes.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20250629111850_AddRoutes.cs similarity index 98% rename from api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20250628190318_AddRoutes.cs rename to api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20250629111850_AddRoutes.cs index 1d94d503..9114ae30 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20250628190318_AddRoutes.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20250629111850_AddRoutes.cs @@ -172,6 +172,12 @@ namespace Kurs.Platform.Migrations table.PrimaryKey("PK_PRoute", x => x.Id); }); + migrationBuilder.CreateIndex( + name: "IX_PRoute_Key", + table: "PRoute", + column: "Key", + unique: true); + migrationBuilder.AddForeignKey( name: "FK_PBlogPost_PBlogCategory_CategoryId", table: "PBlogPost", diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs index 073f63eb..6c76df6e 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs @@ -2339,6 +2339,9 @@ namespace Kurs.Platform.Migrations b.HasKey("Id"); + b.HasIndex("Key") + .IsUnique(); + b.ToTable("PRoute", (string)null); }); diff --git a/ui/dev-dist/sw.js b/ui/dev-dist/sw.js index 7f5ca002..20719f11 100644 --- a/ui/dev-dist/sw.js +++ b/ui/dev-dist/sw.js @@ -82,7 +82,7 @@ define(['./workbox-54d0af47'], (function (workbox) { 'use strict'; "revision": "3ca0b8505b4bec776b69afdba2768812" }, { "url": "index.html", - "revision": "0.vvrlobooaco" + "revision": "0.v7smivsqf3o" }], {}); workbox.cleanupOutdatedCaches(); workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), { diff --git a/ui/src/routes/route.constant.ts b/ui/src/routes/route.constant.ts index bb751bd2..023abe30 100644 --- a/ui/src/routes/route.constant.ts +++ b/ui/src/routes/route.constant.ts @@ -19,16 +19,16 @@ export const ROUTES_ENUM = { chartManagement: { edit: '/saas/chart/edit/:chartCode', }, - forumManagement: '/admin/forumManagement', + forumManagement: '/saas/forumManagement', }, admin: { home: '/home', ai: '/admin/ai', profile: { - general: '/admin/settings/general', - password: '/admin/settings/password', - notificationSettings: '/admin/settings/notification-settings', + general: '/admin/profile/general', + password: '/admin/profile/password', + notificationSettings: '/admin/profile/notification-settings', }, activityLog: '/admin/activityLog', changeLog: '/admin/changeLog', diff --git a/ui/src/views/auth/Settings.tsx b/ui/src/views/admin/profile/Profile.tsx similarity index 86% rename from ui/src/views/auth/Settings.tsx rename to ui/src/views/admin/profile/Profile.tsx index 3020e9b7..b19d91cd 100644 --- a/ui/src/views/auth/Settings.tsx +++ b/ui/src/views/admin/profile/Profile.tsx @@ -21,13 +21,13 @@ type AccountSetting = { }[] } -const General = lazy(() => import('./settings/General')) -const Password = lazy(() => import('./settings/Password')) -const NotificationSettings = lazy(() => import('./settings/NotificationSettings')) +const General = lazy(() => import('./components/General')) +const Password = lazy(() => import('./components/Password')) +const NotificationSettings = lazy(() => import('./components/NotificationSettings')) const { TabNav, TabList } = Tabs -const Settings = () => { +const Profile = () => { const { translate } = useLocalization() const settingsMenu: Record< string, @@ -56,10 +56,12 @@ const Settings = () => { const [data, setData] = useState>({}) const navigate = useNavigate() + const PROFILE_BASE_PATH = '/admin/profile' + const onTabChange = (val: string) => { if (settingsMenu[val]) { setCurrentTab(settingsMenu[val].path) - navigate(`${ROUTES_ENUM.protected.admin.settings}/${settingsMenu[val].path}`) + navigate(`${PROFILE_BASE_PATH}/${settingsMenu[val].path}`) } } @@ -87,4 +89,4 @@ const Settings = () => { ) } -export default Settings +export default Profile diff --git a/ui/src/views/auth/settings/General.tsx b/ui/src/views/admin/profile/components/General.tsx similarity index 100% rename from ui/src/views/auth/settings/General.tsx rename to ui/src/views/admin/profile/components/General.tsx diff --git a/ui/src/views/auth/settings/NotificationSettings.tsx b/ui/src/views/admin/profile/components/NotificationSettings.tsx similarity index 100% rename from ui/src/views/auth/settings/NotificationSettings.tsx rename to ui/src/views/admin/profile/components/NotificationSettings.tsx diff --git a/ui/src/views/auth/settings/Password.tsx b/ui/src/views/admin/profile/components/Password.tsx similarity index 100% rename from ui/src/views/auth/settings/Password.tsx rename to ui/src/views/admin/profile/components/Password.tsx