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,27 @@
using Tiku.Application.Backoffice;
using Tiku.Domain.Operations;
using Tiku.Infrastructure.Persistence;
namespace Tiku.Infrastructure.Backoffice;
internal sealed class OperationAuditService(TikuDbContext dbContext) : IOperationAuditService
{
public async Task WriteAsync(
BackofficeOperationAuditCommand command,
CancellationToken cancellationToken = default)
{
dbContext.AuditLogs.Add(new AuditLog
{
TenantId = command.TenantId,
ActorUserId = command.ActorUserId,
Action = command.Action.Trim(),
TargetType = command.TargetType?.Trim(),
TargetId = command.TargetId?.Trim(),
Details = command.Details,
IpAddress = command.IpAddress,
UserAgent = command.UserAgent
});
await dbContext.SaveChangesAsync(cancellationToken);
}
}