CustomEndpoint ve Dynamic Component düzenlemesi

This commit is contained in:
Sedat Öztürk 2025-10-30 23:22:31 +03:00
parent a290556ba1
commit 39af771d91
10 changed files with 99 additions and 68 deletions

View file

@ -43,14 +43,14 @@ public class CustomEndpointAppService : PlatformAppService
}
[HttpGet("{**path}")]
[Authorize(PlatformConsts.AppCodes.CustomEndpoints.Get)]
[Authorize(PlatformConsts.AppCodes.DeveloperKits.Get)]
public async Task<IActionResult> GetAsync()
{
return await Execute("GET");
}
[HttpPost("{**path}")]
[Authorize(PlatformConsts.AppCodes.CustomEndpoints.Post)]
[Authorize(PlatformConsts.AppCodes.DeveloperKits.Post)]
public async Task<IActionResult> PostAsync()
{
return await Execute("POST");

View file

@ -10779,13 +10779,13 @@ public class ListFormSeeder : IDataSeedContributor, ITransientDependency
}),
CultureName = LanguageCodes.En,
ListFormCode = ListFormCodes.Lists.CustomEndpoint,
Name = AppCodes.CustomEndpoints,
Title = AppCodes.CustomEndpoints,
Name = AppCodes.DeveloperKits.CustomEndpoints,
Title = AppCodes.DeveloperKits.CustomEndpoints,
DataSourceCode = SeedConsts.DataSources.DefaultCode,
IsTenant = true,
IsBranch = false,
IsOrganizationUnit = false,
Description = AppCodes.CustomEndpoints,
Description = AppCodes.DeveloperKits.CustomEndpoints,
SelectCommandType = SelectCommandTypeEnum.Table,
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.CustomEndpoint)),
KeyFieldName = "Id",
@ -10827,19 +10827,19 @@ public class ListFormSeeder : IDataSeedContributor, ITransientDependency
ButtonPosition= UiCommandButtonPositionTypeEnum.Toolbar,
Hint = "Swagger",
Text = "Swagger",
AuthName=AppCodes.CustomEndpoints,
AuthName=AppCodes.DeveloperKits.CustomEndpoints,
Url= swaggerRootUrl + "/swagger/index.html",
},
}),
PermissionJson = JsonSerializer.Serialize(new PermissionCrudDto
{
C = AppCodes.CustomEndpoints + ".Create",
R = AppCodes.CustomEndpoints,
U = AppCodes.CustomEndpoints + ".Update",
D = AppCodes.CustomEndpoints + ".Delete",
E = AppCodes.CustomEndpoints + ".Export",
I = AppCodes.CustomEndpoints + ".Import",
A = AppCodes.CustomEndpoints + ".Activity",
C = AppCodes.DeveloperKits.CustomEndpoints + ".Create",
R = AppCodes.DeveloperKits.CustomEndpoints,
U = AppCodes.DeveloperKits.CustomEndpoints + ".Update",
D = AppCodes.DeveloperKits.CustomEndpoints + ".Delete",
E = AppCodes.DeveloperKits.CustomEndpoints + ".Export",
I = AppCodes.DeveloperKits.CustomEndpoints + ".Import",
A = AppCodes.DeveloperKits.CustomEndpoints + ".Activity",
}),
DeleteCommand = $"UPDATE \"{FullNameTable(TableNameEnum.CustomEndpoint)}\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id",
DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] {
@ -10929,9 +10929,9 @@ public class ListFormSeeder : IDataSeedContributor, ITransientDependency
}),
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.CustomEndpoints + ".Create",
R = AppCodes.CustomEndpoints,
U = AppCodes.CustomEndpoints + ".Update",
C = AppCodes.DeveloperKits.CustomEndpoints + ".Create",
R = AppCodes.DeveloperKits.CustomEndpoints,
U = AppCodes.DeveloperKits.CustomEndpoints + ".Update",
E = true,
I = true,
Deny = false
@ -10960,9 +10960,9 @@ public class ListFormSeeder : IDataSeedContributor, ITransientDependency
}),
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.CustomEndpoints + ".Create",
R = AppCodes.CustomEndpoints,
U = AppCodes.CustomEndpoints + ".Update",
C = AppCodes.DeveloperKits.CustomEndpoints + ".Create",
R = AppCodes.DeveloperKits.CustomEndpoints,
U = AppCodes.DeveloperKits.CustomEndpoints + ".Update",
E = true,
I = true,
Deny = false
@ -10991,9 +10991,9 @@ public class ListFormSeeder : IDataSeedContributor, ITransientDependency
}),
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.CustomEndpoints + ".Create",
R = AppCodes.CustomEndpoints,
U = AppCodes.CustomEndpoints + ".Update",
C = AppCodes.DeveloperKits.CustomEndpoints + ".Create",
R = AppCodes.DeveloperKits.CustomEndpoints,
U = AppCodes.DeveloperKits.CustomEndpoints + ".Update",
E = true,
I = true,
Deny = false
@ -11022,9 +11022,9 @@ public class ListFormSeeder : IDataSeedContributor, ITransientDependency
}),
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.CustomEndpoints + ".Create",
R = AppCodes.CustomEndpoints,
U = AppCodes.CustomEndpoints + ".Update",
C = AppCodes.DeveloperKits.CustomEndpoints + ".Create",
R = AppCodes.DeveloperKits.CustomEndpoints,
U = AppCodes.DeveloperKits.CustomEndpoints + ".Update",
E = true,
I = true,
Deny = false
@ -11069,9 +11069,9 @@ public class ListFormSeeder : IDataSeedContributor, ITransientDependency
}),
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.CustomEndpoints + ".Create",
R = AppCodes.CustomEndpoints,
U = AppCodes.CustomEndpoints + ".Update",
C = AppCodes.DeveloperKits.CustomEndpoints + ".Create",
R = AppCodes.DeveloperKits.CustomEndpoints,
U = AppCodes.DeveloperKits.CustomEndpoints + ".Update",
E = true,
I = true,
Deny = false
@ -11100,9 +11100,9 @@ public class ListFormSeeder : IDataSeedContributor, ITransientDependency
}),
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.CustomEndpoints + ".Create",
R = AppCodes.CustomEndpoints,
U = AppCodes.CustomEndpoints + ".Update",
C = AppCodes.DeveloperKits.CustomEndpoints + ".Create",
R = AppCodes.DeveloperKits.CustomEndpoints,
U = AppCodes.DeveloperKits.CustomEndpoints + ".Update",
E = true,
I = true,
Deny = false
@ -11137,9 +11137,9 @@ public class ListFormSeeder : IDataSeedContributor, ITransientDependency
}),
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.CustomEndpoints + ".Create",
R = AppCodes.CustomEndpoints,
U = AppCodes.CustomEndpoints + ".Update",
C = AppCodes.DeveloperKits.CustomEndpoints + ".Create",
R = AppCodes.DeveloperKits.CustomEndpoints,
U = AppCodes.DeveloperKits.CustomEndpoints + ".Update",
E = true,
I = true,
Deny = false
@ -11168,9 +11168,9 @@ public class ListFormSeeder : IDataSeedContributor, ITransientDependency
}),
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.CustomEndpoints + ".Create",
R = AppCodes.CustomEndpoints,
U = AppCodes.CustomEndpoints + ".Update",
C = AppCodes.DeveloperKits.CustomEndpoints + ".Create",
R = AppCodes.DeveloperKits.CustomEndpoints,
U = AppCodes.DeveloperKits.CustomEndpoints + ".Update",
E = true,
I = true,
Deny = false
@ -11199,9 +11199,9 @@ public class ListFormSeeder : IDataSeedContributor, ITransientDependency
}),
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.CustomEndpoints + ".Create",
R = AppCodes.CustomEndpoints,
U = AppCodes.CustomEndpoints + ".Update",
C = AppCodes.DeveloperKits.CustomEndpoints + ".Create",
R = AppCodes.DeveloperKits.CustomEndpoints,
U = AppCodes.DeveloperKits.CustomEndpoints + ".Update",
E = true,
I = true,
Deny = false

View file

@ -1674,11 +1674,21 @@
"RequiredPermissionName": "App.AuditLogs",
"IsDisabled": false
},
{
"ParentCode": "App.Administration",
"Code": "App.Forum",
"DisplayName": "App.Forum",
"Order": 5,
"Url": "/admin/forum",
"Icon": "FcLink",
"RequiredPermissionName": "App.ForumManagement.Publish",
"IsDisabled": false
},
{
"ParentCode": "App.Administration",
"Code": "App.DeveloperKit",
"DisplayName": "App.DeveloperKit",
"Order": 3,
"Order": 6,
"Url": null,
"Icon": "FcAndroidOs",
"RequiredPermissionName": null,
@ -1748,7 +1758,7 @@
"ParentCode": "App.Administration",
"Code": "App.Reports.Management",
"DisplayName": "App.Reports.Management",
"Order": 4,
"Order": 7,
"Url": null,
"Icon": "FcDocument",
"RequiredPermissionName": null,
@ -1774,21 +1784,11 @@
"RequiredPermissionName": "App.Reports.Management",
"IsDisabled": false
},
{
"ParentCode": "App.Administration",
"Code": "App.Forum",
"DisplayName": "App.Forum",
"Order": 5,
"Url": "/admin/forum",
"Icon": "FcLink",
"RequiredPermissionName": "App.ForumManagement.Publish",
"IsDisabled": false
},
{
"ParentCode": "App.Administration",
"Code": "App.Public",
"DisplayName": "App.Public",
"Order": 6,
"Order": 8,
"Url": null,
"Icon": "FcGenealogy",
"RequiredPermissionName": null,
@ -1898,7 +1898,7 @@
"ParentCode": "App.Administration",
"Code": "App.Definitions",
"DisplayName": "App.Definitions",
"Order": 7,
"Order": 9,
"Url": null,
"Icon": "FcFilingCabinet",
"RequiredPermissionName": null,

View file

@ -45,10 +45,10 @@ public static class LookupQueryValues
public static string DataSourceValues =
$"SELECT " +
$"\"Code\" AS \"Key\", " +
$"\"Name\" AS \"Name\" " +
$"\"Code\" AS \"Name\" " +
$"FROM \"{FullNameTable(TableNameEnum.DataSource)}\" " +
$"WHERE \"IsDeleted\" = 'false' " +
$"ORDER BY \"Name\";";
$"ORDER BY \"Code\";";
public static string BlogCategoryValues =
$"SELECT " +

View file

@ -350,12 +350,15 @@ public static class PlatformConsts
public const string Notification = Default + ".Notification";
}
public const string BackgroundWorkers = Prefix.App + ".BackgroundWorkers";
public static class CustomEndpoints
public static class DeveloperKits
{
public const string Default = Prefix.App + ".CustomEndpoints";
public const string Get = Default + ".Get";
public const string Post = Default + ".Post";
public const string Default = Prefix.App + ".DeveloperKit";
public const string CustomEndpoints = Default + ".CustomEndpoints";
public const string Get = CustomEndpoints + ".Get";
public const string Post = CustomEndpoints + ".Post";
}
public const string Blog = Prefix.App + ".Blog";
public const string Forum = Prefix.App + ".Forum";
public static class Parameters

View file

@ -353,7 +353,13 @@ public static class SeedConsts
}
public const string BackgroundWorkers = Prefix.App + ".BackgroundWorkers";
public const string Forum = Prefix.App + ".Forum";
public const string CustomEndpoints = Prefix.App + ".CustomEndpoints";
public static class DeveloperKits
{
public const string Default = Prefix.App + ".DeveloperKit";
public const string CustomEndpoints = Default + ".CustomEndpoints";
}
public static class Reports
{
public const string Default = Prefix.App + ".Reports";

View file

@ -63,7 +63,7 @@
"Url": "/dil/",
"Method": "GET",
"DataSourceCode": "Default",
"Sql": "SELECT * FROM PLanguage WHERE IsEnabled = @IsEnabled AND CultureName = @CultureName",
"Sql": "SELECT * FROM P_P_Language WHERE IsEnabled = @IsEnabled AND CultureName = @CultureName",
"ParametersJson": [
{
"Type": "P",

View file

@ -18,7 +18,7 @@ const EntityEditor: React.FC = () => {
const navigate = useNavigate()
const { translate } = useLocalization()
const { getEntity, addEntity, updateEntity } = useEntities()
const { getEntity, addEntity, updateEntity, refreshEntities } = useEntities()
const [name, setName] = useState('')
const [displayName, setDisplayName] = useState('')
@ -145,12 +145,13 @@ const EntityEditor: React.FC = () => {
}
if (isEditing && id) {
updateEntity(id, entityData)
await updateEntity(id, entityData)
} else {
addEntity(entityData)
await addEntity(entityData)
}
navigate(ROUTES_ENUM.protected.saas.developerKit.entities)
// Başarılı kaydetme sonrasında Varlık Yönetimi sayfasına yönlendir
navigate(ROUTES_ENUM.protected.saas.developerKit.entities, { replace: true })
} catch (error) {
console.error('Error saving entity:', error)
alert('Failed to save entity. Please try again.')

View file

@ -1,4 +1,4 @@
import React, { useState } from 'react'
import React, { useState, useEffect } from 'react'
import { Link } from 'react-router-dom'
import { useEntities } from '../../contexts/EntityContext'
import {
@ -19,11 +19,27 @@ import { ROUTES_ENUM } from '@/routes/route.constant'
import { useLocalization } from '@/utils/hooks/useLocalization'
const EntityManager: React.FC = () => {
const { entities, deleteEntity, toggleEntityActiveStatus } = useEntities()
const { entities, deleteEntity, toggleEntityActiveStatus, refreshEntities } = useEntities()
const [searchTerm, setSearchTerm] = useState('')
const [filterActive, setFilterActive] = useState<'all' | 'active' | 'inactive'>('all')
const { translate } = useLocalization()
// Sayfa odaklandığında varlıkları yenile
useEffect(() => {
const handleVisibilityChange = () => {
if (!document.hidden) {
refreshEntities()
}
}
// Visibility change event listener ekle
document.addEventListener('visibilitychange', handleVisibilityChange)
return () => {
document.removeEventListener('visibilitychange', handleVisibilityChange)
}
}, [refreshEntities])
const filteredEntities = entities.filter((entity) => {
const matchesSearch =
entity.name.toLowerCase().includes(searchTerm.toLowerCase()) ||

View file

@ -108,9 +108,14 @@ export const EntityProvider: React.FC<{ children: React.ReactNode }> = ({
setLoading(true);
setError(null);
const updatedEntity = await developerKitService.updateCustomEntity(id, entityData);
// State'i güncelle
setEntities((prev) =>
prev.map((entity) => (entity.id === id ? updatedEntity : entity))
);
// Güvenlik için tüm varlıkları yenile
await refreshEntities();
} catch (err) {
setError(err instanceof Error ? err.message : "Failed to update entity");
throw err;