From 531b14938fc506e182a28f41af18fefd2b368fd2 Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Mon, 18 Nov 2024 14:22:09 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=B8=D0=B1=D0=BE=D1=80=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=B2=20=D0=BA=D0=BE=D0=B4=D0=B5,=20=D1=80=D0=B5?= =?UTF-8?q?=D1=84=D0=B0=D0=BA=D1=82=D0=BE=D1=80=D0=B8=D0=BD=D0=B3,=20?= =?UTF-8?q?=D0=B0=D0=B2=D1=82=D0=BE=D1=82=D0=B5=D1=81=D1=82=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=D0=B0=20get=20DataSaubC?= =?UTF-8?q?ontroller?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/DataSaubController.cs | 3 +- .../Controllers/TimeSeriesController.cs | 5 +- Persistence.API/WeatherForecast.cs | 12 --- .../DependencyInjection.cs | 2 - ... 20241118091712_InitialCreate.Designer.cs} | 10 +-- ...ate.cs => 20241118091712_InitialCreate.cs} | 5 +- .../PersistenceDbContextModelSnapshot.cs | 8 +- .../Persistence.Database.Postgres.csproj | 4 + .../PersistenceDbContext.cs | 12 --- Persistence.Database/Entity/DataSaub.cs | 4 +- .../Entity/ITimestampedData.cs | 5 +- .../BaseIntegrationTest.cs | 4 +- .../Clients/ITimeSeriesClient.cs | 9 +- .../Controllers/DataSaubControllerTest.cs | 82 +++++++++++++------ .../TimeSeriesBaseControllerTest.cs | 28 ++++--- .../EFCoreExtensions.cs | 14 ++++ .../Persistence.IntegrationTests.csproj | 1 + .../WebAppFactoryFixture.cs | 4 +- .../Repositories/TimeSeriesDataRepository.cs | 27 ++++-- Persistence/Models/DatesRangeDto.cs | 14 +++- Persistence/Models/ITimeSeriesAbstractDto.cs | 8 +- Persistence/Models/RequestDto.cs | 13 +++ Persistence/Models/SetpointLogDto.cs | 19 +++-- Persistence/Models/SetpointValueDto.cs | 18 ++-- Persistence/Models/UserDto.cs | 11 +-- .../Repositories/ISetpointRepository.cs | 10 +-- Persistence/Services/IArchiveService.cs | 6 +- .../ITimeSeriesDataObserverService.cs | 1 + 28 files changed, 198 insertions(+), 141 deletions(-) delete mode 100644 Persistence.API/WeatherForecast.cs rename Persistence.Database.Postgres/Migrations/{20241115105149_InitialCreate.Designer.cs => 20241118091712_InitialCreate.Designer.cs} (95%) rename Persistence.Database.Postgres/Migrations/{20241115105149_InitialCreate.cs => 20241118091712_InitialCreate.cs} (94%) create mode 100644 Persistence.IntegrationTests/EFCoreExtensions.cs diff --git a/Persistence.API/Controllers/DataSaubController.cs b/Persistence.API/Controllers/DataSaubController.cs index aaeaf1e..60b4e48 100644 --- a/Persistence.API/Controllers/DataSaubController.cs +++ b/Persistence.API/Controllers/DataSaubController.cs @@ -1,5 +1,4 @@ using Microsoft.AspNetCore.Mvc; -using Persistence.API; using Persistence.Repositories; using Persistence.Repository.Data; @@ -11,5 +10,5 @@ public class DataSaubController : TimeSeriesController public DataSaubController(ITimeSeriesDataRepository timeSeriesDataRepository) : base(timeSeriesDataRepository) { - } + } } diff --git a/Persistence.API/Controllers/TimeSeriesController.cs b/Persistence.API/Controllers/TimeSeriesController.cs index ade2b48..e094cc4 100644 --- a/Persistence.API/Controllers/TimeSeriesController.cs +++ b/Persistence.API/Controllers/TimeSeriesController.cs @@ -24,9 +24,10 @@ public class TimeSeriesController : ControllerBase, ITimeSeriesDataApi GetDatesRangeAsync(CancellationToken token) + public async Task GetDatesRangeAsync(CancellationToken token) { - throw new NotImplementedException(); + var result = await this.timeSeriesDataRepository.GetDatesRangeAsync(token); + return Ok(result); } [HttpPost] diff --git a/Persistence.API/WeatherForecast.cs b/Persistence.API/WeatherForecast.cs deleted file mode 100644 index 816dec8..0000000 --- a/Persistence.API/WeatherForecast.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Persistence.API; - -public class WeatherForecast -{ - public DateOnly Date { get; set; } - - public int TemperatureC { get; set; } - - public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); - - public string? Summary { get; set; } -} diff --git a/Persistence.Database.Postgres/DependencyInjection.cs b/Persistence.Database.Postgres/DependencyInjection.cs index 1498932..3acd55c 100644 --- a/Persistence.Database.Postgres/DependencyInjection.cs +++ b/Persistence.Database.Postgres/DependencyInjection.cs @@ -1,8 +1,6 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Persistence.Database; -using Persistence.Database.Model; namespace Persistence.Database.Model; diff --git a/Persistence.Database.Postgres/Migrations/20241115105149_InitialCreate.Designer.cs b/Persistence.Database.Postgres/Migrations/20241118091712_InitialCreate.Designer.cs similarity index 95% rename from Persistence.Database.Postgres/Migrations/20241115105149_InitialCreate.Designer.cs rename to Persistence.Database.Postgres/Migrations/20241118091712_InitialCreate.Designer.cs index b66203a..b340413 100644 --- a/Persistence.Database.Postgres/Migrations/20241115105149_InitialCreate.Designer.cs +++ b/Persistence.Database.Postgres/Migrations/20241118091712_InitialCreate.Designer.cs @@ -12,7 +12,7 @@ using Persistence.Database.Model; namespace Persistence.Database.Postgres.Migrations { [DbContext(typeof(PersistenceDbContext))] - [Migration("20241115105149_InitialCreate")] + [Migration("20241118091712_InitialCreate")] partial class InitialCreate { /// @@ -52,6 +52,10 @@ namespace Persistence.Database.Postgres.Migrations .HasColumnType("double precision") .HasColumnName("blockSpeed"); + b.Property("Date") + .HasColumnType("timestamp with time zone") + .HasColumnName("date"); + b.Property("Flow") .HasColumnType("double precision") .HasColumnName("flow"); @@ -100,10 +104,6 @@ namespace Persistence.Database.Postgres.Migrations .HasColumnType("double precision") .HasColumnName("rotorTorque"); - b.Property("TimeStamp") - .HasColumnType("integer") - .HasColumnName("timestamp"); - b.Property("User") .HasColumnType("text") .HasColumnName("user"); diff --git a/Persistence.Database.Postgres/Migrations/20241115105149_InitialCreate.cs b/Persistence.Database.Postgres/Migrations/20241118091712_InitialCreate.cs similarity index 94% rename from Persistence.Database.Postgres/Migrations/20241115105149_InitialCreate.cs rename to Persistence.Database.Postgres/Migrations/20241118091712_InitialCreate.cs index 69839cd..61ea137 100644 --- a/Persistence.Database.Postgres/Migrations/20241115105149_InitialCreate.cs +++ b/Persistence.Database.Postgres/Migrations/20241118091712_InitialCreate.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore.Migrations; +using System; +using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable @@ -20,7 +21,7 @@ namespace Persistence.Database.Postgres.Migrations { id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - timestamp = table.Column(type: "integer", nullable: false), + date = table.Column(type: "timestamp with time zone", nullable: false), mode = table.Column(type: "integer", nullable: true), user = table.Column(type: "text", nullable: true), wellDepth = table.Column(type: "double precision", nullable: true), diff --git a/Persistence.Database.Postgres/Migrations/PersistenceDbContextModelSnapshot.cs b/Persistence.Database.Postgres/Migrations/PersistenceDbContextModelSnapshot.cs index 4483f7e..08c2720 100644 --- a/Persistence.Database.Postgres/Migrations/PersistenceDbContextModelSnapshot.cs +++ b/Persistence.Database.Postgres/Migrations/PersistenceDbContextModelSnapshot.cs @@ -49,6 +49,10 @@ namespace Persistence.Database.Postgres.Migrations .HasColumnType("double precision") .HasColumnName("blockSpeed"); + b.Property("Date") + .HasColumnType("timestamp with time zone") + .HasColumnName("date"); + b.Property("Flow") .HasColumnType("double precision") .HasColumnName("flow"); @@ -97,10 +101,6 @@ namespace Persistence.Database.Postgres.Migrations .HasColumnType("double precision") .HasColumnName("rotorTorque"); - b.Property("TimeStamp") - .HasColumnType("integer") - .HasColumnName("timestamp"); - b.Property("User") .HasColumnType("text") .HasColumnName("user"); diff --git a/Persistence.Database.Postgres/Persistence.Database.Postgres.csproj b/Persistence.Database.Postgres/Persistence.Database.Postgres.csproj index 6b7cc14..e383e91 100644 --- a/Persistence.Database.Postgres/Persistence.Database.Postgres.csproj +++ b/Persistence.Database.Postgres/Persistence.Database.Postgres.csproj @@ -18,4 +18,8 @@ + + + + diff --git a/Persistence.Database.Postgres/PersistenceDbContext.cs b/Persistence.Database.Postgres/PersistenceDbContext.cs index e4ec60f..f68be73 100644 --- a/Persistence.Database.Postgres/PersistenceDbContext.cs +++ b/Persistence.Database.Postgres/PersistenceDbContext.cs @@ -4,10 +4,8 @@ using System.Data.Common; namespace Persistence.Database.Model; public partial class PersistenceDbContext : DbContext, IPersistenceDbContext { - private readonly DbConnection connection = null!; public DbSet DataSaub => Set(); - public PersistenceDbContext() : base() { @@ -20,16 +18,6 @@ public partial class PersistenceDbContext : DbContext, IPersistenceDbContext } - public PersistenceDbContext(DbConnection connection) - { - this.connection = connection; - } - - protected virtual DbConnection GetConnection() - { - return connection; - } - protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { if (!optionsBuilder.IsConfigured) diff --git a/Persistence.Database/Entity/DataSaub.cs b/Persistence.Database/Entity/DataSaub.cs index 4f1ad9d..39b56cb 100644 --- a/Persistence.Database/Entity/DataSaub.cs +++ b/Persistence.Database/Entity/DataSaub.cs @@ -6,8 +6,8 @@ public class DataSaub : ITimestampedData [Column("id")] public int Id { get; set; } - [Column("timestamp")] - public int TimeStamp { get; set; } + [Column("date")] + public DateTimeOffset Date { get; set; } [Column("mode")] public int? Mode { get; set; } diff --git a/Persistence.Database/Entity/ITimestampedData.cs b/Persistence.Database/Entity/ITimestampedData.cs index e9fb1da..9241ca5 100644 --- a/Persistence.Database/Entity/ITimestampedData.cs +++ b/Persistence.Database/Entity/ITimestampedData.cs @@ -7,5 +7,8 @@ using System.Threading.Tasks; namespace Persistence.Database.Model; public interface ITimestampedData { - int TimeStamp { get; set; } + /// + /// Дата (должна быть обязательно в UTC) + /// + DateTimeOffset Date { get; set; } } diff --git a/Persistence.IntegrationTests/BaseIntegrationTest.cs b/Persistence.IntegrationTests/BaseIntegrationTest.cs index a0edda9..8a8f764 100644 --- a/Persistence.IntegrationTests/BaseIntegrationTest.cs +++ b/Persistence.IntegrationTests/BaseIntegrationTest.cs @@ -17,9 +17,9 @@ public abstract class BaseIntegrationTest : IClassFixture, protected BaseIntegrationTest(WebAppFactoryFixture factory) { - //scope = factory.Services.CreateScope(); + scope = factory.Services.CreateScope(); - //dbContext = scope.ServiceProvider.GetRequiredService(); + dbContext = scope.ServiceProvider.GetRequiredService(); } public void Dispose() diff --git a/Persistence.IntegrationTests/Clients/ITimeSeriesClient.cs b/Persistence.IntegrationTests/Clients/ITimeSeriesClient.cs index 7c78be4..03b7638 100644 --- a/Persistence.IntegrationTests/Clients/ITimeSeriesClient.cs +++ b/Persistence.IntegrationTests/Clients/ITimeSeriesClient.cs @@ -1,11 +1,5 @@ using Microsoft.AspNetCore.Mvc; -using Persistence.Repository.Data; using Refit; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Persistence.IntegrationTests.Clients; public interface ITimeSeriesClient @@ -13,4 +7,7 @@ public interface ITimeSeriesClient { [Post("/api/dataSaub")] Task> InsertRangeAsync(IEnumerable dtos); + + [Get("/api/dataSaub")] + Task>> GetAsync(DateTimeOffset dateBegin, DateTimeOffset dateEnd); } diff --git a/Persistence.IntegrationTests/Controllers/DataSaubControllerTest.cs b/Persistence.IntegrationTests/Controllers/DataSaubControllerTest.cs index fa23e4b..025492a 100644 --- a/Persistence.IntegrationTests/Controllers/DataSaubControllerTest.cs +++ b/Persistence.IntegrationTests/Controllers/DataSaubControllerTest.cs @@ -1,36 +1,56 @@ -using Persistence.Repository.Data; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using Persistence.Database.Model; +using Persistence.Repository.Data; using Xunit; namespace Persistence.IntegrationTests.Controllers; -public class DataSaubControllerTest : TimeSeriesBaseControllerTest +public class DataSaubControllerTest : TimeSeriesBaseControllerTest { private readonly DataSaubDto dto = new DataSaubDto() { - AxialLoad = 1, - BitDepth = 2, - BlockPosition = 3, - BlockSpeed = 4, - Date = DateTimeOffset.Now, - Flow = 5, - HookWeight = 6, - Id = 7, - IdFeedRegulator = 8, - Mode = 9, - Mse = 10, - MseState = 11, - Pressure = 12, - Pump0Flow = 13, - Pump1Flow = 14, - Pump2Flow = 15, - RotorSpeed = 16, - RotorTorque = 17, - User = string.Empty, - WellDepth = 18, + AxialLoad = 1, + BitDepth = 2, + BlockPosition = 3, + BlockSpeed = 4, + Date = DateTimeOffset.Now, + Flow = 5, + HookWeight = 6, + Id = 7, + IdFeedRegulator = 8, + Mode = 9, + Mse = 10, + MseState = 11, + Pressure = 12, + Pump0Flow = 13, + Pump1Flow = 14, + Pump2Flow = 15, + RotorSpeed = 16, + RotorTorque = 17, + User = string.Empty, + WellDepth = 18, + }; + + private readonly DataSaub entity = new DataSaub() + { + AxialLoad = 1, + BitDepth = 2, + BlockPosition = 3, + BlockSpeed = 4, + Date = DateTimeOffset.UtcNow, + Flow = 5, + HookWeight = 6, + Id = 7, + IdFeedRegulator = 8, + Mode = 9, + Mse = 10, + MseState = 11, + Pressure = 12, + Pump0Flow = 13, + Pump1Flow = 14, + Pump2Flow = 15, + RotorSpeed = 16, + RotorTorque = 17, + User = string.Empty, + WellDepth = 18, }; public DataSaubControllerTest(WebAppFactoryFixture factory) : base(factory) @@ -42,4 +62,12 @@ public class DataSaubControllerTest : TimeSeriesBaseControllerTest { await InsertRangeSuccess(dto); } + + [Fact] + public async Task Get_returns_success() + { + var beginDate = DateTimeOffset.UtcNow.AddDays(-1); + var endDate = DateTimeOffset.UtcNow; + await GetSuccess(beginDate, endDate, entity); + } } diff --git a/Persistence.IntegrationTests/Controllers/TimeSeriesBaseControllerTest.cs b/Persistence.IntegrationTests/Controllers/TimeSeriesBaseControllerTest.cs index 3277010..2119bf7 100644 --- a/Persistence.IntegrationTests/Controllers/TimeSeriesBaseControllerTest.cs +++ b/Persistence.IntegrationTests/Controllers/TimeSeriesBaseControllerTest.cs @@ -1,6 +1,7 @@ using Mapster; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Configuration.UserSecrets; using Persistence.IntegrationTests.Clients; using Persistence.Models; using System; @@ -12,14 +13,15 @@ using System.Threading.Tasks; using Xunit; namespace Persistence.IntegrationTests.Controllers; -public abstract class TimeSeriesBaseControllerTest : BaseIntegrationTest +public abstract class TimeSeriesBaseControllerTest : BaseIntegrationTest + where TEntity : class where TDto : class, new() { private ITimeSeriesClient client; public TimeSeriesBaseControllerTest(WebAppFactoryFixture factory) : base(factory) { - //dbContext.CleanupDbSet(); + dbContext.CleanupDbSet(); client = factory.GetHttpClient>(string.Empty); } @@ -34,18 +36,22 @@ public abstract class TimeSeriesBaseControllerTest : BaseIntegrationTest //assert Assert.Equal(HttpStatusCode.OK, response.StatusCode); Assert.Equal(1, response.Content); + } - //var entity = GetByWellId(); + public async Task GetSuccess(DateTimeOffset beginDate, DateTimeOffset endDate, TEntity entity) + { + //arrange + var dbset = dbContext.Set(); - //Assert.NotNull(entity); + dbset.Add(entity); - //var actual = entity.Adapt>(); - //Assert.Equal(ProcessMapPlanBase.IdStateActual, actual.IdState); + dbContext.SaveChanges(); - //var excludeProps = new[] { - // nameof(ProcessMapPlanBaseDto.Id), - // nameof(ProcessMapPlanBaseDto.Section) - //}; - //MatchHelper.Match(expected, actual.Item, excludeProps); + var response = await client.GetAsync(beginDate, endDate); + + //assert + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + Assert.NotNull(response.Content); + Assert.Single(response.Content); } } diff --git a/Persistence.IntegrationTests/EFCoreExtensions.cs b/Persistence.IntegrationTests/EFCoreExtensions.cs new file mode 100644 index 0000000..b41b2d6 --- /dev/null +++ b/Persistence.IntegrationTests/EFCoreExtensions.cs @@ -0,0 +1,14 @@ +using Microsoft.EntityFrameworkCore; +using Persistence.Database.Model; + +namespace Persistence.IntegrationTests; +public static class EFCoreExtensions +{ + public static void CleanupDbSet(this DbContext dbContext) + where T : class + { + var dbset = dbContext.Set(); + dbset.RemoveRange(dbset); + dbContext.SaveChanges(); + } +} diff --git a/Persistence.IntegrationTests/Persistence.IntegrationTests.csproj b/Persistence.IntegrationTests/Persistence.IntegrationTests.csproj index 2b793de..912eeda 100644 --- a/Persistence.IntegrationTests/Persistence.IntegrationTests.csproj +++ b/Persistence.IntegrationTests/Persistence.IntegrationTests.csproj @@ -24,6 +24,7 @@ + diff --git a/Persistence.IntegrationTests/WebAppFactoryFixture.cs b/Persistence.IntegrationTests/WebAppFactoryFixture.cs index ea6016d..d1cedf8 100644 --- a/Persistence.IntegrationTests/WebAppFactoryFixture.cs +++ b/Persistence.IntegrationTests/WebAppFactoryFixture.cs @@ -4,9 +4,9 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Persistence.Database.Model; +using Persistence.Database.Postgres; using Persistence.API; using Refit; -using System.Net.Http.Headers; using System.Text.Json; namespace Persistence.IntegrationTests; @@ -51,7 +51,7 @@ public class WebAppFactoryFixture : WebApplicationFactory var scopedServices = scope.ServiceProvider; var dbContext = scopedServices.GetRequiredService(); - //dbContext.Database.EnsureCreatedAndMigrated(); + dbContext.Database.EnsureCreatedAndMigrated(); //dbContext.Deposits.AddRange(Data.Defaults.Deposits); dbContext.SaveChanges(); }); diff --git a/Persistence.Repository/Repositories/TimeSeriesDataRepository.cs b/Persistence.Repository/Repositories/TimeSeriesDataRepository.cs index 252888c..df8c520 100644 --- a/Persistence.Repository/Repositories/TimeSeriesDataRepository.cs +++ b/Persistence.Repository/Repositories/TimeSeriesDataRepository.cs @@ -1,14 +1,12 @@ using Mapster; using Microsoft.EntityFrameworkCore; +using Persistence.Database.Model; using Persistence.Models; using Persistence.Repositories; -using Persistence.Database.Model; -using Persistence.Repository.Data; -using Persistence.Database; namespace Persistence.Repository.Repositories; public class TimeSeriesDataRepository : ITimeSeriesDataRepository - where TEntity : class + where TEntity : class, ITimestampedData, new() where TDto : class, ITimeSeriesAbstractDto, new() { private DbContext db; @@ -29,14 +27,27 @@ public class TimeSeriesDataRepository : ITimeSeriesDataRepository return dtos; } - public Task GetDatesRangeAsync(CancellationToken token) + public async Task GetDatesRangeAsync(CancellationToken token) { - throw new NotImplementedException(); + var query = GetQueryReadOnly(); + var minDate = await query.MinAsync(o => o.Date, token); + var maxDate = await query.MaxAsync(o => o.Date, token); + + return new DatesRangeDto + { + From = minDate, + To = maxDate + }; } - public Task> GetGtDate(DateTimeOffset date, CancellationToken token) + public async Task> GetGtDate(DateTimeOffset date, CancellationToken token) { - throw new NotImplementedException(); + var query = this.db.Set().Where(e => e.Date > date); + var entities = await query.ToArrayAsync(token); + + var dtos = entities.Select(e => e.Adapt()); + + return dtos; } public async Task InsertRange(IEnumerable dtos, CancellationToken token) diff --git a/Persistence/Models/DatesRangeDto.cs b/Persistence/Models/DatesRangeDto.cs index 5f41083..b8f278e 100644 --- a/Persistence/Models/DatesRangeDto.cs +++ b/Persistence/Models/DatesRangeDto.cs @@ -5,9 +5,19 @@ using System.Text; using System.Threading.Tasks; namespace Persistence.Models; + +/// +/// Диапазон дат +/// public class DatesRangeDto { - public DateTimeOffset dateBegin { get; set; } + /// + /// Дата начала диапазона + /// + public DateTimeOffset From { get; set; } - public DateTimeOffset dateEnd { get; set; } + /// + /// Дата окончания диапазона + /// + public DateTimeOffset To { get; set; } } diff --git a/Persistence/Models/ITimeSeriesAbstractDto.cs b/Persistence/Models/ITimeSeriesAbstractDto.cs index f95fded..39a29cf 100644 --- a/Persistence/Models/ITimeSeriesAbstractDto.cs +++ b/Persistence/Models/ITimeSeriesAbstractDto.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Persistence.Models; +namespace Persistence.Models; /// /// Интерфейс, описывающий временные данные diff --git a/Persistence/Models/RequestDto.cs b/Persistence/Models/RequestDto.cs index d27d210..c61ac79 100644 --- a/Persistence/Models/RequestDto.cs +++ b/Persistence/Models/RequestDto.cs @@ -1,10 +1,23 @@ namespace Persistence.Models; +/// +/// Контейнер для поддержки постраничного просмотра таблиц +/// +/// public class RequestDto { + /// + /// Кол-во записей пропущенных с начала таблицы в запросе от api + /// public int Skip { get; set; } + /// + /// Кол-во записей в запросе от api + /// public int Take { get; set; } + /// + /// Настройки сортировки + /// public string SortSettings { get; set; } = string.Empty; } diff --git a/Persistence/Models/SetpointLogDto.cs b/Persistence/Models/SetpointLogDto.cs index 8c259ca..34b74f5 100644 --- a/Persistence/Models/SetpointLogDto.cs +++ b/Persistence/Models/SetpointLogDto.cs @@ -1,12 +1,17 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +namespace Persistence.Models; -namespace Persistence.Models; +/// +/// Модель для описания лога уставки +/// public class SetpointLogDto : SetpointValueDto { - public DateTimeOffset Edit { get; set; } + /// + /// Дата сохранения уставки + /// + public DateTimeOffset DateEdit { get; set; } + + /// + /// Ключ пользователя + /// public int IdUser { get; set; } } diff --git a/Persistence/Models/SetpointValueDto.cs b/Persistence/Models/SetpointValueDto.cs index 7b49143..5c6d337 100644 --- a/Persistence/Models/SetpointValueDto.cs +++ b/Persistence/Models/SetpointValueDto.cs @@ -1,14 +1,18 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Persistence.Models; +namespace Persistence.Models; +/// +/// Модель для хранения значения уставки +/// public class SetpointValueDto { + /// + /// Идентификатор уставки + /// public int Id { get; set; } + + /// + /// Значение уставки + /// public object Value { get; set; } } diff --git a/Persistence/Models/UserDto.cs b/Persistence/Models/UserDto.cs index cb49514..cd1c192 100644 --- a/Persistence/Models/UserDto.cs +++ b/Persistence/Models/UserDto.cs @@ -1,11 +1,8 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +namespace Persistence.Models; -namespace Persistence.Models; +/// +/// Модель, описывающая пользователя +/// public class UserDto { /// diff --git a/Persistence/Repositories/ISetpointRepository.cs b/Persistence/Repositories/ISetpointRepository.cs index 38bbbf4..4253657 100644 --- a/Persistence/Repositories/ISetpointRepository.cs +++ b/Persistence/Repositories/ISetpointRepository.cs @@ -1,10 +1,4 @@ -using Microsoft.AspNetCore.Mvc; -using Persistence.Models; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using Persistence.Models; namespace Persistence.Repositories; @@ -13,7 +7,7 @@ namespace Persistence.Repositories; /// public interface ISetpointRepository { - + /// /// Получить значения уставок за определенный момент времени /// diff --git a/Persistence/Services/IArchiveService.cs b/Persistence/Services/IArchiveService.cs index 285f76a..9733dc1 100644 --- a/Persistence/Services/IArchiveService.cs +++ b/Persistence/Services/IArchiveService.cs @@ -1,12 +1,12 @@ namespace Persistence.Services; /// -/// +/// Сервис по работе с БД /// internal interface IArchiveService { /// - /// + /// Переименование БД /// /// /// @@ -15,7 +15,7 @@ internal interface IArchiveService Task RenameDatabase(string connectionString, string databaseName, CancellationToken token); /// - /// + /// Создание БД /// /// /// diff --git a/Persistence/Services/ITimeSeriesDataObserverService.cs b/Persistence/Services/ITimeSeriesDataObserverService.cs index 0e0a2c0..12994bb 100644 --- a/Persistence/Services/ITimeSeriesDataObserverService.cs +++ b/Persistence/Services/ITimeSeriesDataObserverService.cs @@ -1,4 +1,5 @@ namespace Persistence.Services; + public interface ITimeSeriesDataObserverService { }