59 lines
1.5 KiB
C#
59 lines
1.5 KiB
C#
using System.Text.Json.Serialization;
|
||
using TakeoutSaaS.Shared.Abstractions.Serialization;
|
||
|
||
namespace TakeoutSaaS.Application.Identity.Contracts;
|
||
|
||
/// <summary>
|
||
/// 权限树节点 DTO。
|
||
/// </summary>
|
||
public sealed record PermissionTreeDto
|
||
{
|
||
/// <summary>
|
||
/// 权限 ID(雪花,序列化为字符串)。
|
||
/// </summary>
|
||
[JsonConverter(typeof(SnowflakeIdJsonConverter))]
|
||
public long Id { get; init; }
|
||
|
||
/// <summary>
|
||
/// 租户 ID(雪花,序列化为字符串)。
|
||
/// </summary>
|
||
[JsonConverter(typeof(SnowflakeIdJsonConverter))]
|
||
public long TenantId { get; init; }
|
||
|
||
/// <summary>
|
||
/// 父级权限 ID。
|
||
/// </summary>
|
||
[JsonConverter(typeof(SnowflakeIdJsonConverter))]
|
||
public long ParentId { get; init; }
|
||
|
||
/// <summary>
|
||
/// 排序值,值越小越靠前。
|
||
/// </summary>
|
||
public int SortOrder { get; init; }
|
||
|
||
/// <summary>
|
||
/// 权限类型(group/leaf)。
|
||
/// </summary>
|
||
public string Type { get; init; } = string.Empty;
|
||
|
||
/// <summary>
|
||
/// 权限名称。
|
||
/// </summary>
|
||
public string Name { get; init; } = string.Empty;
|
||
|
||
/// <summary>
|
||
/// 权限编码(租户内唯一)。
|
||
/// </summary>
|
||
public string Code { get; init; } = string.Empty;
|
||
|
||
/// <summary>
|
||
/// 描述。
|
||
/// </summary>
|
||
public string? Description { get; init; }
|
||
|
||
/// <summary>
|
||
/// 子节点集合。
|
||
/// </summary>
|
||
public IReadOnlyList<PermissionTreeDto> Children { get; init; } = Array.Empty<PermissionTreeDto>();
|
||
}
|