2024-11-25 18:11:46 +05:00
|
|
|
|
using Mapster;
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
using Persistence.Database.Model;
|
|
|
|
|
using Persistence.Models;
|
|
|
|
|
using Persistence.Repositories;
|
|
|
|
|
|
|
|
|
|
namespace Persistence.Repository.Repositories;
|
2024-11-26 11:47:42 +05:00
|
|
|
|
public class ChangeLogRepository : IChangeLogRepository
|
2024-11-25 18:11:46 +05:00
|
|
|
|
{
|
|
|
|
|
private DbContext db;
|
|
|
|
|
|
|
|
|
|
public ChangeLogRepository(DbContext db)
|
|
|
|
|
{
|
|
|
|
|
this.db = db;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<int> Clear(int idUser, CancellationToken token)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-26 11:47:42 +05:00
|
|
|
|
public Task<int> ClearAndInsertRange(int idUser, IEnumerable<IDictionary<string, object>> dtos, CancellationToken token)
|
2024-11-25 18:11:46 +05:00
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-26 11:47:42 +05:00
|
|
|
|
public Task<IEnumerable<ChangeLogDto<IDictionary<string, object>>>> GetChangeLogForDate(DateTimeOffset? updateFrom, CancellationToken token)
|
2024-11-25 18:11:46 +05:00
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-26 11:47:42 +05:00
|
|
|
|
public Task<IEnumerable<IDictionary<string, object>>> GetCurrent(DateTimeOffset moment, CancellationToken token)
|
2024-11-25 18:11:46 +05:00
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<IEnumerable<DateOnly>> GetDatesChange(CancellationToken token)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-26 11:47:42 +05:00
|
|
|
|
public Task<IEnumerable<IDictionary<string, object>>> GetGtDate(DateTimeOffset dateBegin, CancellationToken token)
|
2024-11-25 18:11:46 +05:00
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-26 11:47:42 +05:00
|
|
|
|
public Task<int> InsertRange(Guid idUser, Guid idDiscriminator, IEnumerable<IDictionary<string, object>> dtos, CancellationToken token)
|
2024-11-25 18:11:46 +05:00
|
|
|
|
{
|
2024-11-26 11:47:42 +05:00
|
|
|
|
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;
|
2024-11-26 10:32:44 +05:00
|
|
|
|
|
2024-11-26 11:47:42 +05:00
|
|
|
|
entities.Add(entity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
db.Set<ChangeLog>().AddRange(entities);
|
2024-11-26 10:32:44 +05:00
|
|
|
|
var result = db.SaveChangesAsync(token);
|
2024-11-26 11:47:42 +05:00
|
|
|
|
|
2024-11-26 10:32:44 +05:00
|
|
|
|
return result;
|
2024-11-25 18:11:46 +05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<int> MarkAsDeleted(int idUser, IEnumerable<int> ids, CancellationToken token)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-26 11:47:42 +05:00
|
|
|
|
public Task<int> UpdateOrInsertRange(int idUser, IEnumerable<IDictionary<string, object>> dtos, CancellationToken token)
|
2024-11-25 18:11:46 +05:00
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-26 11:47:42 +05:00
|
|
|
|
public Task<int> UpdateRange(int idUser, IEnumerable<IDictionary<string, object>> dtos, CancellationToken token)
|
2024-11-25 18:11:46 +05:00
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
}
|