forked from gongxuegit/tiku-backend.net
feat: add phase five operations foundation
This commit is contained in:
41
Tiku.Api/Contracts/BackofficeDtos.cs
Normal file
41
Tiku.Api/Contracts/BackofficeDtos.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user