forked from xiongyuxing/tiku-backend.net
42 lines
1.2 KiB
C#
42 lines
1.2 KiB
C#
using System.Text.Json;
|
|
using Tiku.Application.Backoffice;
|
|
using Tiku.Domain.Operations;
|
|
|
|
namespace Tiku.Api.Contracts;
|
|
|
|
public sealed class UpsertBackofficeRoleDto
|
|
{
|
|
public Guid? Id { get; set; }
|
|
public string Code { get; set; } = string.Empty;
|
|
public string Name { get; set; } = string.Empty;
|
|
public BackendRoleStatus Status { get; set; } = BackendRoleStatus.Active;
|
|
public string? Description { get; set; }
|
|
public JsonElement? DataScope { get; set; }
|
|
|
|
public UpsertBackofficeRoleCommand ToCommand()
|
|
{
|
|
return new UpsertBackofficeRoleCommand(Id, Code, Name, Status, Description, DataScope);
|
|
}
|
|
}
|
|
|
|
public sealed class ReplaceRoleBindingsDto
|
|
{
|
|
public IReadOnlyCollection<string> PermissionCodes { get; set; } = [];
|
|
public IReadOnlyCollection<string> MenuCodes { get; set; } = [];
|
|
|
|
public ReplaceRoleBindingsCommand ToCommand(Guid roleId)
|
|
{
|
|
return new ReplaceRoleBindingsCommand(roleId, PermissionCodes, MenuCodes);
|
|
}
|
|
}
|
|
|
|
public sealed class ReplaceUserRolesDto
|
|
{
|
|
public IReadOnlyCollection<Guid> RoleIds { get; set; } = [];
|
|
|
|
public ReplaceUserRolesCommand ToCommand(Guid userId)
|
|
{
|
|
return new ReplaceUserRolesCommand(userId, RoleIds);
|
|
}
|
|
}
|