persistence/Persistence.Repository/Repositories/ChangeLogRepository.cs

86 lines
2.5 KiB
C#

using Mapster;
using Microsoft.EntityFrameworkCore;
using Persistence.Database.Model;
using Persistence.Models;
using Persistence.Repositories;
namespace Persistence.Repository.Repositories;
public class ChangeLogRepository : IChangeLogRepository
{
private DbContext db;
public ChangeLogRepository(DbContext db)
{
this.db = db;
}
public Task<int> Clear(int idUser, CancellationToken token)
{
throw new NotImplementedException();
}
public Task<int> ClearAndInsertRange(int idUser, IEnumerable<IDictionary<string, object>> dtos, CancellationToken token)
{
throw new NotImplementedException();
}
public Task<IEnumerable<ChangeLogDto<IDictionary<string, object>>>> GetChangeLogForDate(DateTimeOffset? updateFrom, CancellationToken token)
{
throw new NotImplementedException();
}
public Task<IEnumerable<IDictionary<string, object>>> GetCurrent(DateTimeOffset moment, CancellationToken token)
{
throw new NotImplementedException();
}
public Task<IEnumerable<DateOnly>> GetDatesChange(CancellationToken token)
{
throw new NotImplementedException();
}
public Task<IEnumerable<IDictionary<string, object>>> GetGtDate(DateTimeOffset dateBegin, CancellationToken token)
{
throw new NotImplementedException();
}
public Task<int> InsertRange(Guid idUser, Guid idDiscriminator, IEnumerable<IDictionary<string, object>> dtos, CancellationToken token)
{
var entities = new List<ChangeLog>();
foreach (var dto in dtos)
{
var entity = new ChangeLog()
{
IdAuthor = idUser,
IdDiscriminator = idDiscriminator,
IdEditor = idUser,
Value = dto,
Creation = DateTimeOffset.UtcNow
};
entity.Id = idUser;
entities.Add(entity);
}
db.Set<ChangeLog>().AddRange(entities);
var result = db.SaveChangesAsync(token);
return result;
}
public Task<int> MarkAsDeleted(int idUser, IEnumerable<int> ids, CancellationToken token)
{
throw new NotImplementedException();
}
public Task<int> UpdateOrInsertRange(int idUser, IEnumerable<IDictionary<string, object>> dtos, CancellationToken token)
{
throw new NotImplementedException();
}
public Task<int> UpdateRange(int idUser, IEnumerable<IDictionary<string, object>> dtos, CancellationToken token)
{
throw new NotImplementedException();
}
}