using TakeoutSaaS.Domain.Tenants.Entities;
using TakeoutSaaS.Domain.Tenants.Repositories;
using TakeoutSaaS.Infrastructure.Logs.Persistence;

namespace TakeoutSaaS.Infrastructure.Logs.Repositories;

/// <summary>
/// 运营操作日志仓储实现。
/// </summary>
public sealed class EfOperationLogRepository(TakeoutLogsDbContext logsContext) : IOperationLogRepository
{
    /// <inheritdoc />
    public Task AddAsync(OperationLog log, CancellationToken cancellationToken = default)
    {
        // 1. 添加日志实体
        logsContext.OperationLogs.Add(log);
        // 2. 返回完成任务
        return Task.CompletedTask;
    }

    /// <inheritdoc />
    public Task SaveChangesAsync(CancellationToken cancellationToken = default)
        => logsContext.SaveChangesAsync(cancellationToken);
}
