feat: add phase five operations foundation

This commit is contained in:
2026-07-28 09:57:50 +08:00
parent 71793a2de0
commit f22f329d33
39 changed files with 4810 additions and 160 deletions

View File

@@ -0,0 +1,22 @@
using System.Text.Json;
using Tiku.Application.Jobs;
namespace Tiku.Api.Contracts;
public sealed class CreateBackgroundJobDto
{
public string JobType { get; set; } = string.Empty;
public JsonElement Payload { get; set; }
public DateTimeOffset? RunAfter { get; set; }
public int MaxRetries { get; set; } = 3;
public CreateBackgroundJobCommand ToCommand(Guid tenantId)
{
return new CreateBackgroundJobCommand(
tenantId,
JobType,
Payload.ValueKind == JsonValueKind.Undefined ? JsonSerializer.SerializeToElement(new { }) : Payload,
RunAfter,
MaxRetries);
}
}

View 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);
}
}

View File

@@ -249,6 +249,91 @@ public sealed class UpsertPointExchangeItemDto
}
}
public sealed class CreateRefundRequestDto
{
[Required]
public Guid OrderId { get; set; }
public Guid? PaymentId { get; set; }
[Range(1, int.MaxValue)]
public int AmountCents { get; set; }
[StringLength(1000)]
public string? Reason { get; set; }
public RefundEntitlementAction EntitlementAction { get; set; } = RefundEntitlementAction.RevokeOnSuccess;
public JsonElement Metadata { get; set; } = JsonDefaults.Object();
public CreateRefundRequestCommand ToCommand()
{
return new CreateRefundRequestCommand(OrderId, PaymentId, AmountCents, Reason, EntitlementAction, Metadata);
}
}
public sealed class UpdateRefundStatusDto
{
[Required]
public Guid RefundRequestId { get; set; }
public CommerceRefundStatus Status { get; set; }
[StringLength(1000)]
public string? Reason { get; set; }
[StringLength(200)]
public string? ProviderRefundNo { get; set; }
public UpdateRefundStatusCommand ToCommand()
{
return new UpdateRefundStatusCommand(RefundRequestId, Status, Reason, ProviderRefundNo);
}
}
public sealed class CreateReconciliationBatchDto
{
[Required]
[StringLength(50)]
public string Provider { get; set; } = string.Empty;
public DateOnly BillDate { get; set; }
public ReconciliationBillType BillType { get; set; } = ReconciliationBillType.Combined;
public ReconciliationSource Source { get; set; } = ReconciliationSource.ManualUpload;
[StringLength(200)]
public string? SourceName { get; set; }
[Required]
[StringLength(200)]
public string SourceHash { get; set; } = string.Empty;
public JsonElement Metadata { get; set; } = JsonDefaults.Object();
public CreateReconciliationBatchCommand ToCommand()
{
return new CreateReconciliationBatchCommand(Provider, BillDate, BillType, Source, SourceName, SourceHash, Metadata);
}
}
public sealed class UpdateReconciliationIssueDto
{
[Required]
public Guid IssueId { get; set; }
public ReconciliationIssueStatus Status { get; set; } = ReconciliationIssueStatus.Investigating;
public ReconciliationResolutionType ResolutionType { get; set; } = ReconciliationResolutionType.None;
[StringLength(1000)]
public string? Note { get; set; }
public Guid? AssignedTo { get; set; }
public UpdateReconciliationIssueCommand ToCommand()
{
return new UpdateReconciliationIssueCommand(IssueId, Status, ResolutionType, Note, AssignedTo);
}
}
public sealed class UpdatePointExchangeOrderStatusDto
{
[Required]