Ченджлог (продолжение)
This commit is contained in:
parent
381557459b
commit
d7b5b7e3ab
61
Persistence.API/Controllers/ChangeLogController.cs
Normal file
61
Persistence.API/Controllers/ChangeLogController.cs
Normal file
@ -0,0 +1,61 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Persistence.Database.Model;
|
||||
using Persistence.Models;
|
||||
using Persistence.Repositories;
|
||||
|
||||
namespace Persistence.API.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Authorize]
|
||||
[Route("api/[controller]")]
|
||||
public class ChangeLogRotorController : ControllerBase, IChangeLogApi<ProcessMapRotorDto, ChangeLogDto<ProcessMapRotorDto>>
|
||||
{
|
||||
private IChangeLogRepository<ProcessMapRotorDto, ChangeLogDto<ProcessMapRotorDto>> repository;
|
||||
|
||||
public ChangeLogRotorController(IChangeLogRepository<ProcessMapRotorDto, ChangeLogDto<ProcessMapRotorDto>> repository)
|
||||
{
|
||||
this.repository = repository;
|
||||
}
|
||||
public async Task<ActionResult<int>> Add(ProcessMapRotorDto dto, CancellationToken token)
|
||||
{
|
||||
await repository.InsertRange(0, [dto], token);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Task<ActionResult<int>> AddRange(IEnumerable<ProcessMapRotorDto> dtos, CancellationToken token)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<ActionResult<int>> Delete(int id, CancellationToken token)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<ActionResult<int>> DeleteRange(IEnumerable<int> ids, CancellationToken token)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<ActionResult<IEnumerable<ProcessMapRotorDto>>> GetChangeLogCurrent(CancellationToken token)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<ActionResult<IEnumerable<ChangeLogDto<ProcessMapRotorDto>>>> GetChangeLogForDate(DateTimeOffset historyMoment, CancellationToken token)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<ActionResult<int>> Update(ProcessMapRotorDto dto, CancellationToken token)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<ActionResult<int>> UpdateRange(IEnumerable<ProcessMapRotorDto> dtos, CancellationToken token)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
@ -5,9 +5,9 @@ using System.ComponentModel.DataAnnotations;
|
||||
namespace Persistence.Database.Model;
|
||||
|
||||
/// <summary>
|
||||
/// Часть записи описывающая изменение
|
||||
/// Часть записи, описывающая изменение
|
||||
/// </summary>
|
||||
public class ChangeLog : IChangeLogAbstractData
|
||||
public class ChangeLog : IChangeLog
|
||||
{
|
||||
/// <summary>
|
||||
/// Ид записи
|
||||
@ -15,6 +15,12 @@ public class ChangeLog : IChangeLogAbstractData
|
||||
[Key, Column("Id")]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Дискриминатор таблицы
|
||||
/// </summary>
|
||||
[Column("IdDiscriminator")]
|
||||
public Guid IdDiscriminator { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Автор изменения
|
||||
/// </summary>
|
@ -0,0 +1,29 @@
|
||||
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Persistence.Database.Model;
|
||||
|
||||
/// <summary>
|
||||
/// Часть записи, описывающая изменение данных, содержащие начальную и конечную глубину, а также секцию
|
||||
/// </summary>
|
||||
public class ChangeLogWithWellDepthAndSectionId : ChangeLog
|
||||
{
|
||||
/// <summary>
|
||||
/// Глубина забоя на дату начала интервала
|
||||
/// </summary>
|
||||
[Column("DepthStart")]
|
||||
public double? DepthStart { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Глубина забоя на дату окончания интервала
|
||||
/// </summary>
|
||||
[Column("DepthEnd")]
|
||||
public double? DepthEnd { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Ключ секции
|
||||
/// </summary>
|
||||
[Column("IdSection")]
|
||||
public Guid IdSection { get; set; }
|
||||
}
|
@ -4,7 +4,7 @@ namespace Persistence.Database.Model;
|
||||
/// <summary>
|
||||
/// Часть записи описывающая изменение
|
||||
/// </summary>
|
||||
public interface IChangeLogAbstractData
|
||||
public interface IChangeLog
|
||||
{
|
||||
/// <summary>
|
||||
/// Ид записи
|
||||
@ -14,12 +14,12 @@ public interface IChangeLogAbstractData
|
||||
/// <summary>
|
||||
/// Автор изменения
|
||||
/// </summary>
|
||||
public int IdAuthor { get; set; }
|
||||
public Guid IdAuthor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Редактор
|
||||
/// </summary>
|
||||
public int? IdEditor { get; set; }
|
||||
public Guid? IdEditor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Дата создания записи
|
||||
@ -34,7 +34,7 @@ public interface IChangeLogAbstractData
|
||||
/// <summary>
|
||||
/// Id заменяющей записи
|
||||
/// </summary>
|
||||
public int? IdNext { get; set; }
|
||||
public Guid? IdNext { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Значение
|
68
Persistence.Repository/Repositories/ChangeLogRepository.cs
Normal file
68
Persistence.Repository/Repositories/ChangeLogRepository.cs
Normal file
@ -0,0 +1,68 @@
|
||||
using Mapster;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Persistence.Database.Model;
|
||||
using Persistence.Models;
|
||||
using Persistence.Repositories;
|
||||
|
||||
namespace Persistence.Repository.Repositories;
|
||||
public class ChangeLogRepository<TDto, TChangeLogDto> : IChangeLogRepository<TDto, TChangeLogDto>
|
||||
where TDto : class, IChangeLogDto, new()
|
||||
where TChangeLogDto : ChangeLogDto<TDto>
|
||||
{
|
||||
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<TDto> dtos, CancellationToken token)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<IEnumerable<TChangeLogDto>> GetChangeLogForDate(DateTimeOffset? updateFrom, CancellationToken token)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<IEnumerable<TDto>> GetCurrent(DateTimeOffset moment, CancellationToken token)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<IEnumerable<DateOnly>> GetDatesChange(CancellationToken token)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<IEnumerable<TDto>> GetGtDate(DateTimeOffset dateBegin, CancellationToken token)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<int> InsertRange(int idUser, IEnumerable<TDto> dtos, CancellationToken token)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<int> MarkAsDeleted(int idUser, IEnumerable<int> ids, CancellationToken token)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<int> UpdateOrInsertRange(int idUser, IEnumerable<TDto> dtos, CancellationToken token)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<int> UpdateRange(int idUser, IEnumerable<TDto> dtos, CancellationToken token)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@ namespace Persistence.Models;
|
||||
/// <summary>
|
||||
/// Часть записи описывающая изменение
|
||||
/// </summary>
|
||||
public class ChangeLogDto<T> : IChangeLogAbstractDto
|
||||
public class ChangeLogDto<T> : IChangeLogDto
|
||||
where T: class
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -1,42 +0,0 @@
|
||||
namespace Persistence.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Часть записи описывающая изменение
|
||||
/// </summary>
|
||||
public interface IChangeLogAbstractDto
|
||||
{
|
||||
/// <summary>
|
||||
/// Ид записи
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Автор изменения
|
||||
/// </summary>
|
||||
public int IdAuthor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Редактор
|
||||
/// </summary>
|
||||
public int? IdEditor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Дата создания записи
|
||||
/// </summary>
|
||||
public DateTimeOffset Creation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Дата устаревания (например при удалении)
|
||||
/// </summary>
|
||||
public DateTimeOffset? Obsolete { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Id заменяющей записи
|
||||
/// </summary>
|
||||
public int? IdNext { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Значение
|
||||
/// </summary>
|
||||
public object Value { get; set; }
|
||||
}
|
42
Persistence/Models/IChangeLogDto.cs
Normal file
42
Persistence/Models/IChangeLogDto.cs
Normal file
@ -0,0 +1,42 @@
|
||||
namespace Persistence.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Часть записи описывающая изменение
|
||||
/// </summary>
|
||||
public interface IChangeLogDto
|
||||
{
|
||||
///// <summary>
|
||||
///// Ид записи
|
||||
///// </summary>
|
||||
//public int Id { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// Автор изменения
|
||||
///// </summary>
|
||||
//public int IdAuthor { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// Редактор
|
||||
///// </summary>
|
||||
//public int? IdEditor { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// Дата создания записи
|
||||
///// </summary>
|
||||
//public DateTimeOffset Creation { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// Дата устаревания (например при удалении)
|
||||
///// </summary>
|
||||
//public DateTimeOffset? Obsolete { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// Id заменяющей записи
|
||||
///// </summary>
|
||||
//public int? IdNext { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// Значение
|
||||
///// </summary>
|
||||
//public object Value { get; set; }
|
||||
}
|
11
Persistence/Models/ProcessMapRotorDto.cs
Normal file
11
Persistence/Models/ProcessMapRotorDto.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Persistence.Models;
|
||||
public class ProcessMapRotorDto : IChangeLogDto
|
||||
{
|
||||
public string Caption { get; set; }
|
||||
}
|
@ -7,7 +7,7 @@ namespace Persistence.Repositories;
|
||||
/// </summary>
|
||||
/// <typeparam name="TDto"></typeparam>
|
||||
public interface IChangeLogRepository<TDto, TChangeLogDto> : ISyncRepository<TDto>
|
||||
where TDto : class, ITimeSeriesAbstractDto, new()
|
||||
where TDto : class, IChangeLogDto, new()
|
||||
where TChangeLogDto : ChangeLogDto<TDto>
|
||||
{
|
||||
/// <summary>
|
||||
|
Loading…
Reference in New Issue
Block a user