erp-platform/api/src/Kurs.Platform.Domain/Entities/CustomEndpoint.cs
2025-07-27 21:57:19 +03:00

73 lines
2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
namespace Kurs.Platform.Entities;
public class CustomEndpoint : FullAuditedEntity<Guid>, IMultiTenant
{
public virtual Guid? TenantId { get; protected set; }
public string Name { get; set; }
public string Description { get; set; }
public string Url { get; set; } // GET, POST
public string Method { get; set; }
// DataSourceCode == "!Tenant" ise, isteği yapan kullanıcının TenantDb'sinden data çekilir
// Değilse, DataSourceCode'da belirtilen kaynaktan data çekilir
public string DataSourceCode { get; set; }
public string Sql { get; set; }
public string ParametersJson { get; set; }
public string PermissionsJson { get; set; }
[NotMapped]
public List<CustomEndpointParameter> Parameters
{
get
{
if (!string.IsNullOrEmpty(ParametersJson))
return JsonSerializer.Deserialize<List<CustomEndpointParameter>>(ParametersJson);
return [];
}
set
{
ParametersJson = JsonSerializer.Serialize(value);
}
}
[NotMapped]
public List<CustomEndpointPermission> Permissions
{
get
{
if (!string.IsNullOrEmpty(PermissionsJson))
return JsonSerializer.Deserialize<List<CustomEndpointPermission>>(PermissionsJson);
return [];
}
set
{
PermissionsJson = JsonSerializer.Serialize(value);
}
}
}
public class CustomEndpointParameter
{
public string Type { get; set; } // Static, Query, Path, Body
public string Name { get; set; }
public string DefaultValue { get; set; }
public string Path { get; set; }
public bool IsRequired { get; set; }
}
public class CustomEndpointPermission
{
public string ResourceType { get; set; } // Global, Role, User
public string ResourceId { get; set; }
}