1. Исправлены namespaces.

2. Добавлен проект DD.Persistence.App со всеми необходимыми настройками
This commit is contained in:
Olga Nemt 2024-12-16 15:38:46 +05:00
parent e3319867dd
commit d90b72b14e
166 changed files with 717 additions and 390 deletions

View File

@ -1,11 +1,11 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Persistence.Models;
using Persistence.Models.Requests;
using Persistence.Repositories;
using DD.Persistence.Models;
using DD.Persistence.Models.Requests;
using DD.Persistence.Repositories;
using System.Net;
namespace Persistence.API.Controllers;
namespace DD.Persistence.API.Controllers;
[ApiController]
[Authorize]

View File

@ -1,9 +1,9 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Persistence.Models;
using Persistence.Repositories;
using DD.Persistence.Models;
using DD.Persistence.Repositories;
namespace Persistence.API.Controllers;
namespace DD.Persistence.API.Controllers;
/// <summary>
/// Работа с временными данными

View File

@ -1,10 +1,10 @@
using System.Net;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Persistence.Models;
using Persistence.Repositories;
using DD.Persistence.Models;
using DD.Persistence.Repositories;
namespace Persistence.API.Controllers;
namespace DD.Persistence.API.Controllers;
/// <summary>
/// Работа с системами

View File

@ -1,10 +1,10 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Persistence.Models;
using Persistence.Repositories;
using DD.Persistence.Models;
using DD.Persistence.Repositories;
using System.Net;
namespace Persistence.API.Controllers;
namespace DD.Persistence.API.Controllers;
/// <summary>
/// Работа с уставками

View File

@ -1,11 +1,11 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Persistence.Models;
using Persistence.Models.Requests;
using Persistence.Repositories;
using DD.Persistence.Models;
using DD.Persistence.Models.Requests;
using DD.Persistence.Repositories;
using System.Net;
namespace Persistence.API.Controllers;
namespace DD.Persistence.API.Controllers;
/// <summary>
/// Работа с технологическими сообщениями систем автобурения (АБ)

View File

@ -1,9 +1,9 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Persistence.Models;
using Persistence.Repositories;
using DD.Persistence.Models;
using DD.Persistence.Repositories;
namespace Persistence.API.Controllers;
namespace DD.Persistence.API.Controllers;
[ApiController]
[Authorize]

View File

@ -1,10 +1,10 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Persistence.Models;
using Persistence.Repositories;
using DD.Persistence.Models;
using DD.Persistence.Repositories;
using System.Net;
namespace Persistence.API.Controllers;
namespace DD.Persistence.API.Controllers;
/// <summary>
/// Хранение наборов данных с отметкой времени.

View File

@ -1,10 +1,10 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Persistence.Models;
using Persistence.Services.Interfaces;
using DD.Persistence.Models;
using DD.Persistence.Services.Interfaces;
using System.Net;
namespace Persistence.API.Controllers;
namespace DD.Persistence.API.Controllers;
/// <summary>
/// Работа с параметрами Wits

View File

@ -1,17 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>
</PropertyGroup>
<PropertyGroup>
<VersionPrefix>1.0.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH))</VersionPrefix>
<AssemblyVersion>1.0.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH))</AssemblyVersion>
<OutputType>Library</OutputType>
</PropertyGroup>
<ItemGroup>
@ -22,9 +23,10 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Persistence.Database.Postgres\Persistence.Database.Postgres.csproj" />
<ProjectReference Include="..\Persistence.Repository\Persistence.Repository.csproj" />
<ProjectReference Include="..\Persistence\Persistence.csproj" />
<ProjectReference Include="..\DD.Persistence.Database.Postgres\DD.Persistence.Database.Postgres.csproj" />
<ProjectReference Include="..\DD.Persistence.Database\DD.Persistence.Database.csproj" />
<ProjectReference Include="..\DD.Persistence.Repository\DD.Persistence.Repository.csproj" />
<ProjectReference Include="..\DD.Persistence\DD.Persistence.csproj" />
</ItemGroup>
</Project>

View File

@ -3,16 +3,16 @@ using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.IdentityModel.Tokens;
using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Models;
using Persistence.Database.Entity;
using Persistence.Models;
using Persistence.Models.Configurations;
using Persistence.Services;
using Persistence.Services.Interfaces;
using DD.Persistence.Models;
using DD.Persistence.Models.Configurations;
using DD.Persistence.Services;
using DD.Persistence.Services.Interfaces;
using Swashbuckle.AspNetCore.SwaggerGen;
using System.Reflection;
using System.Text.Json.Nodes;
using DD.Persistence.Database.Entity;
namespace Persistence.API;
namespace DD.Persistence.API;
public static class DependencyInjection
{

View File

@ -1,7 +1,7 @@
using System.ComponentModel;
using System.Security.Claims;
namespace Persistence.API;
namespace DD.Persistence.API;
public static class Extensions
{

View File

@ -1,8 +1,8 @@
using Persistence.Database.Model;
using Persistence.Database.Postgres;
using Persistence.Repository;
using DD.Persistence.Database.Model;
using DD.Persistence.Database.Postgres;
using DD.Persistence.Repository;
namespace Persistence.API;
namespace DD.Persistence.API;
public class Startup
{

View File

@ -0,0 +1,5 @@
{
"version": 1,
"isRoot": true,
"tools": {}
}

View File

@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>8dcdcfed-c959-4eef-9891-ae60b1b136ea</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>
<ItemGroup>
<_WebToolingArtifacts Remove="Properties\PublishProfiles\LinuxRelease.pubxml" />
<_WebToolingArtifacts Remove="Properties\PublishProfiles\WindowsRelease.pubxml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.3" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DD.Persistence.API\DD.Persistence.API.csproj" />
</ItemGroup>
</Project>

View File

@ -4,21 +4,22 @@ FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
USER app
WORKDIR /app
EXPOSE 8080
EXPOSE 8081
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["Persistence.API/Persistence.API.csproj", "Persistence.API/"]
RUN dotnet restore "./Persistence.API/Persistence.API.csproj"
COPY ["DD.Persistence.App/DD.Persistence.App.csproj", "DD.Persistence.App/"]
RUN dotnet restore "./DD.Persistence.App/DD.Persistence.App.csproj"
COPY . .
WORKDIR "/src/Persistence.API"
RUN dotnet build "./Persistence.API.csproj" -c $BUILD_CONFIGURATION -o /app/build
WORKDIR "/src/DD.Persistence.App"
RUN dotnet build "./DD.Persistence.App.csproj" -c $BUILD_CONFIGURATION -o /app/build
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./Persistence.API.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
RUN dotnet publish "./DD.Persistence.App.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Persistence.API.dll"]
ENTRYPOINT ["dotnet", "DD.Persistence.App.dll"]

View File

@ -1,4 +1,7 @@
namespace Persistence.API;
using DD.Persistence.API;
namespace DD.Persistence.App;
public class Program
{

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<DeleteExistingFiles>true</DeleteExistingFiles>
<ExcludeApp_Data>false</ExcludeApp_Data>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>bin\Release\net8.0\publish\</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
<_TargetId>Folder</_TargetId>
<SiteUrlToLaunchAfterPublish />
<TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<ProjectGuid>063238bf-e982-43fa-9ddb-7d7d279086d8</ProjectGuid>
<SelfContained>true</SelfContained>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<DeleteExistingFiles>true</DeleteExistingFiles>
<ExcludeApp_Data>false</ExcludeApp_Data>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>bin\Release\net8.0\publish\</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
<_TargetId>Folder</_TargetId>
<SiteUrlToLaunchAfterPublish />
<TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<ProjectGuid>063238bf-e982-43fa-9ddb-7d7d279086d8</ProjectGuid>
<SelfContained>false</SelfContained>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,52 @@
{
"profiles": {
"http": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true,
"applicationUrl": "http://localhost:5266"
},
"https": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true,
"applicationUrl": "https://localhost:7154;http://localhost:5266"
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Container (Dockerfile)": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
"environmentVariables": {
"ASPNETCORE_HTTPS_PORTS": "8081",
"ASPNETCORE_HTTP_PORTS": "8080"
},
"publishAllPorts": true,
"useSSL": true
}
},
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:54958",
"sslPort": 44352
}
}
}

View File

@ -0,0 +1,30 @@
# DD.Persistence.App Readme
## Краткое описание DD.Persistence.App сервиса
DD.Persistence.App - проект исполняемого файла микросервиса
## Настройка DD.Persistence.App (файл appsettings.json)
- `appsettings.json` - файл с настройками проекта.
### Подключение к БД
- Настройки подключения к базе хранятся в свойстве `DefaultConnection` секции `ConnectionStrings`
файла `appsettings.json`, где:
- Host - название или ip хоста;
- Database - название базы данных;
- Username - пользователь базы данных;
- Password - пароль базы данных;
- Больше информации о настройке подключения к postgreSQL можно прочесть по ссылке:
```https://www.npgsql.org/doc/connection-string-parameters.html```
### Авторизация
1. В проекте предусмотрены 2 типа авторизации:
- Авторизация через KeyCloak. Используется в продакшен версии.
- Авторизация через Jwt-токен. Используется для разработки и тестирования.
2. Для включения авторизации через KeyCloak необходимо:
- Установить секцию `NeedUseKeyCloak` файла `appsettings.json` в `true`
- По необходимости настроить свойства секции `Authentication` файла `appsettings.json`
### defaultsettings.json
Копия файла `appsettings.json` хранится в файле `defaultsettings.json`

View File

@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"NeedUseKeyCloak": false
}

View File

@ -0,0 +1,16 @@
{
"DbConnection": {
"Host": "localhost",
"Port": 5432,
"Username": "postgres",
"Password": "q"
},
"NeedUseKeyCloak": false,
"AuthUser": {
"username": "myuser",
"password": 12345,
"clientId": "webapi",
"grantType": "password"
},
"KeycloakGetTokenUrl": "http://192.168.0.10:8321/realms/Persistence/protocol/openid-connect/token"
}

View File

@ -0,0 +1,26 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"ConnectionStrings": {
"DefaultConnection": "Host=localhost;Database=persistence;Username=postgres;Password=q;Persist Security Info=True"
},
"AllowedHosts": "*",
"Authentication": {
"MetadataAddress": "http://192.168.0.10:8321/realms/Persistence/.well-known/openid-configuration",
"Audience": "account",
"ValidIssuer": "http://192.168.0.10:8321/realms/Persistence",
"AuthorizationUrl": "http://192.168.0.10:8321/realms/Persistence/protocol/openid-connect/auth"
},
"NeedUseKeyCloak": false,
"AuthUser": {
"username": "myuser",
"password": 12345,
"clientId": "webapi",
"grantType": "password",
"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier": "7d9f3574-6574-4ca3-845a-0276eb4aa8f6"
}
}

View File

@ -1,8 +1,8 @@
using Microsoft.Extensions.Logging;
using Persistence.Client.Helpers;
using DD.Persistence.Client.Helpers;
using Microsoft.Extensions.Logging;
using Refit;
namespace Persistence.Client.Clients.Base;
namespace DD.Persistence.Client.Clients.Base;
public abstract class BaseClient
{
private readonly ILogger logger;

View File

@ -1,10 +1,10 @@
using Microsoft.Extensions.Logging;
using Persistence.Client.Clients.Base;
using Persistence.Client.Clients.Interfaces;
using Persistence.Models;
using Persistence.Models.Requests;
using DD.Persistence.Client.Clients.Base;
using DD.Persistence.Client.Clients.Interfaces;
using DD.Persistence.Models;
using DD.Persistence.Models.Requests;
namespace Persistence.Client.Clients;
namespace DD.Persistence.Client.Clients;
public class ChangeLogClient : BaseClient, IChangeLogClient
{
private readonly Interfaces.Refit.IRefitChangeLogClient refitChangeLogClient;

View File

@ -1,10 +1,10 @@
using Microsoft.Extensions.Logging;
using Persistence.Client.Clients.Base;
using Persistence.Client.Clients.Interfaces;
using Persistence.Client.Clients.Interfaces.Refit;
using Persistence.Models;
using DD.Persistence.Client.Clients.Base;
using DD.Persistence.Client.Clients.Interfaces;
using DD.Persistence.Client.Clients.Interfaces.Refit;
using DD.Persistence.Models;
namespace Persistence.Client.Clients;
namespace DD.Persistence.Client.Clients;
public class DataSourceSystemClient : BaseClient, IDataSourceSystemClient
{
private readonly IRefitDataSourceSystemClient dataSourceSystemClient;

View File

@ -1,7 +1,7 @@
using Persistence.Models;
using Persistence.Models.Requests;
using DD.Persistence.Models;
using DD.Persistence.Models.Requests;
namespace Persistence.Client.Clients.Interfaces;
namespace DD.Persistence.Client.Clients.Interfaces;
/// <summary>
/// Клиент для работы с записями ChangeLog

View File

@ -1,7 +1,7 @@
using Persistence.Models;
using DD.Persistence.Models;
using Refit;
namespace Persistence.Client.Clients.Interfaces;
namespace DD.Persistence.Client.Clients.Interfaces;
/// <summary>
/// Клиент для работы с системами

View File

@ -1,6 +1,6 @@
using Persistence.Models;
using DD.Persistence.Models;
namespace Persistence.Client.Clients.Interfaces;
namespace DD.Persistence.Client.Clients.Interfaces;
/// <summary>
/// Клиент для работы с уставками

View File

@ -1,7 +1,7 @@
using Persistence.Models;
using Persistence.Models.Requests;
using DD.Persistence.Models;
using DD.Persistence.Models.Requests;
namespace Persistence.Client.Clients.Interfaces;
namespace DD.Persistence.Client.Clients.Interfaces;
/// <summary>
/// Клиент для работы с технологическими сообщениями

View File

@ -1,6 +1,6 @@
using Persistence.Models;
using DD.Persistence.Models;
namespace Persistence.Client.Clients.Interfaces;
namespace DD.Persistence.Client.Clients.Interfaces;
/// <summary>
/// Клиент для работы с временными данными

View File

@ -1,6 +1,6 @@
using Persistence.Models;
using DD.Persistence.Models;
namespace Persistence.Client.Clients.Interfaces;
namespace DD.Persistence.Client.Clients.Interfaces;
/// <summary>
/// Клиент для работы с репозиторием для хранения разных наборов данных рядов.

View File

@ -1,7 +1,7 @@
using Persistence.Models;
using DD.Persistence.Models;
using Refit;
namespace Persistence.Client.Clients.Interfaces;
namespace DD.Persistence.Client.Clients.Interfaces;
/// <summary>
/// Клиент для работы с параметрами Wits

View File

@ -1,8 +1,8 @@
using Persistence.Models;
using Persistence.Models.Requests;
using DD.Persistence.Models;
using DD.Persistence.Models.Requests;
using Refit;
namespace Persistence.Client.Clients.Interfaces.Refit;
namespace DD.Persistence.Client.Clients.Interfaces.Refit;
public interface IRefitChangeLogClient : IDisposable
{

View File

@ -1,7 +1,7 @@
using Persistence.Models;
using DD.Persistence.Models;
using Refit;
namespace Persistence.Client.Clients.Interfaces.Refit;
namespace DD.Persistence.Client.Clients.Interfaces.Refit;
public interface IRefitDataSourceSystemClient : IDisposable
{
private const string BaseRoute = "/api/dataSourceSystem";

View File

@ -1,7 +1,7 @@
using Persistence.Models;
using DD.Persistence.Models;
using Refit;
namespace Persistence.Client.Clients.Interfaces.Refit;
namespace DD.Persistence.Client.Clients.Interfaces.Refit;
public interface IRefitSetpointClient : IDisposable
{

View File

@ -1,9 +1,9 @@
using Microsoft.AspNetCore.Mvc;
using Persistence.Models;
using Persistence.Models.Requests;
using DD.Persistence.Models;
using DD.Persistence.Models.Requests;
using Refit;
namespace Persistence.Client.Clients.Interfaces.Refit
namespace DD.Persistence.Client.Clients.Interfaces.Refit
{
public interface IRefitTechMessagesClient : IDisposable
{

View File

@ -1,7 +1,7 @@
using Persistence.Models;
using DD.Persistence.Models;
using Refit;
namespace Persistence.Client.Clients.Interfaces.Refit;
namespace DD.Persistence.Client.Clients.Interfaces.Refit;
public interface IRefitTimeSeriesClient<TDto> : IDisposable
where TDto : class, new()
{

View File

@ -1,7 +1,7 @@
using Persistence.Models;
using DD.Persistence.Models;
using Refit;
namespace Persistence.Client.Clients.Interfaces.Refit;
namespace DD.Persistence.Client.Clients.Interfaces.Refit;
public interface IRefitTimestampedSetClient : IDisposable
{

View File

@ -1,8 +1,8 @@
using Microsoft.AspNetCore.Mvc;
using Persistence.Models;
using DD.Persistence.Models;
using Refit;
namespace Persistence.Client.Clients.Interfaces.Refit;
namespace DD.Persistence.Client.Clients.Interfaces.Refit;
public interface IRefitWitsDataClient : IDisposable
{
private const string BaseRoute = "/api/witsData";

View File

@ -1,10 +1,10 @@
using Microsoft.Extensions.Logging;
using Persistence.Client.Clients.Base;
using Persistence.Client.Clients.Interfaces;
using Persistence.Client.Clients.Interfaces.Refit;
using Persistence.Models;
using DD.Persistence.Client.Clients.Base;
using DD.Persistence.Client.Clients.Interfaces;
using DD.Persistence.Client.Clients.Interfaces.Refit;
using DD.Persistence.Models;
namespace Persistence.Client.Clients;
namespace DD.Persistence.Client.Clients;
public class SetpointClient : BaseClient, ISetpointClient
{

View File

@ -1,11 +1,11 @@
using Microsoft.Extensions.Logging;
using Persistence.Client.Clients.Base;
using Persistence.Client.Clients.Interfaces;
using Persistence.Client.Clients.Interfaces.Refit;
using Persistence.Models;
using Persistence.Models.Requests;
using DD.Persistence.Client.Clients.Base;
using DD.Persistence.Client.Clients.Interfaces;
using DD.Persistence.Client.Clients.Interfaces.Refit;
using DD.Persistence.Models;
using DD.Persistence.Models.Requests;
namespace Persistence.Client.Clients;
namespace DD.Persistence.Client.Clients;
public class TechMessagesClient : BaseClient, ITechMessagesClient
{

View File

@ -1,10 +1,10 @@
using Microsoft.Extensions.Logging;
using Persistence.Client.Clients.Base;
using Persistence.Client.Clients.Interfaces;
using Persistence.Client.Clients.Interfaces.Refit;
using Persistence.Models;
using DD.Persistence.Client.Clients.Base;
using DD.Persistence.Client.Clients.Interfaces;
using DD.Persistence.Client.Clients.Interfaces.Refit;
using DD.Persistence.Models;
namespace Persistence.Client.Clients;
namespace DD.Persistence.Client.Clients;
public class TimeSeriesClient<TDto> : BaseClient, ITimeSeriesClient<TDto> where TDto : class, new()
{
private readonly IRefitTimeSeriesClient<TDto> timeSeriesClient;

View File

@ -1,10 +1,10 @@
using Microsoft.Extensions.Logging;
using Persistence.Client.Clients.Base;
using Persistence.Client.Clients.Interfaces;
using Persistence.Client.Clients.Interfaces.Refit;
using Persistence.Models;
using DD.Persistence.Client.Clients.Base;
using DD.Persistence.Client.Clients.Interfaces;
using DD.Persistence.Client.Clients.Interfaces.Refit;
using DD.Persistence.Models;
namespace Persistence.Client.Clients;
namespace DD.Persistence.Client.Clients;
public class TimestampedSetClient : BaseClient, ITimestampedSetClient
{
private readonly IRefitTimestampedSetClient refitTimestampedSetClient;

View File

@ -1,10 +1,10 @@
using Microsoft.Extensions.Logging;
using Persistence.Client.Clients.Base;
using Persistence.Client.Clients.Interfaces;
using Persistence.Client.Clients.Interfaces.Refit;
using Persistence.Models;
using DD.Persistence.Client.Clients.Base;
using DD.Persistence.Client.Clients.Interfaces;
using DD.Persistence.Client.Clients.Interfaces.Refit;
using DD.Persistence.Models;
namespace Persistence.Client.Clients;
namespace DD.Persistence.Client.Clients;
public class WitsDataClient : BaseClient, IWitsDataClient
{
private readonly IRefitWitsDataClient refitWitsDataClient;

View File

@ -1,4 +1,4 @@
namespace Persistence.Client.CustomExceptions;
namespace DD.Persistence.Client.CustomExceptions;
/// <summary>
/// Not Acceptable (406)

View File

@ -1,4 +1,4 @@
namespace Persistence.Client.CustomExceptions;
namespace DD.Persistence.Client.CustomExceptions;
/// <summary>
/// Bad gateway (502)

View File

@ -1,4 +1,4 @@
namespace Persistence.Client.CustomExceptions;
namespace DD.Persistence.Client.CustomExceptions;
/// <summary>
/// Forbidden (403)

View File

@ -1,4 +1,4 @@
namespace Persistence.Client.CustomExceptions;
namespace DD.Persistence.Client.CustomExceptions;
/// <summary>
/// Internal Server Error (500)

View File

@ -1,4 +1,4 @@
namespace Persistence.Client.CustomExceptions;
namespace DD.Persistence.Client.CustomExceptions;
/// <summary>
/// Locked (423)

View File

@ -1,4 +1,4 @@
namespace Persistence.Client.CustomExceptions;
namespace DD.Persistence.Client.CustomExceptions;
/// <summary>
/// Service Unavailable Error (503)

View File

@ -1,4 +1,4 @@
namespace Persistence.Client.CustomExceptions;
namespace DD.Persistence.Client.CustomExceptions;
/// <summary>
/// Too Many Requests (429)

View File

@ -0,0 +1,63 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<!--Генерация NuGet пакета при сборке-->
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<!--Наименование-->
<Title>Persistence.Client</Title>
<!--Версия пакета-->
<VersionPrefix>1.0.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH))</VersionPrefix>
<!--Версия сборки-->
<AssemblyVersion>1.0.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH))</AssemblyVersion>
<!--Id пакета-->
<PackageId>Persistence.Client</PackageId>
<!--Автор-->
<Authors>Digital Drilling</Authors>
<!--Компания-->
<Company>Digital Drilling</Company>
<!--Описание-->
<Description>Пакет для получения клиентов для работы с Persistence сервисом</Description>
<!--Url репозитория-->
<RepositoryUrl>https://git.ddrilling.ru/on.nemtina/persistence.git</RepositoryUrl>
<!--тип репозитория-->
<RepositoryType>git</RepositoryType>
<!--Символы отладки-->
<IncludeSymbols>true</IncludeSymbols>
<!--Формат пакета с символами-->
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<!--Путь к пакету-->
<PackageOutputPath>C:\Projects\Nuget</PackageOutputPath>
<!--Readme-->
<PackageReadmeFile>Readme.md</PackageReadmeFile>
</PropertyGroup>
<PropertyGroup>
<VersionPrefix>1.0.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH))</VersionPrefix>
<AssemblyVersion>1.0.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH))</AssemblyVersion>
</PropertyGroup>
<ItemGroup>
<None Include="Readme.md" Pack="true" PackagePath="\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="8.2.1" />
<PackageReference Include="Refit" Version="8.0.0" />
<PackageReference Include="Refit.HttpClientFactory" Version="8.0.0" />
<PackageReference Include="RestSharp" Version="112.1.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.2.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DD.Persistence\DD.Persistence.csproj" />
</ItemGroup>
</Project>

View File

@ -1,13 +1,13 @@
using Microsoft.Extensions.Configuration;
using Microsoft.IdentityModel.Tokens;
using Persistence.Models.Configurations;
using DD.Persistence.Models.Configurations;
using RestSharp;
using System.IdentityModel.Tokens.Jwt;
using System.Net.Http.Headers;
using System.Security.Claims;
using System.Text.Json;
namespace Persistence.Client.Helpers;
namespace DD.Persistence.Client.Helpers;
public static class ApiTokenHelper
{
public static void Authorize(this HttpClient httpClient, IConfiguration configuration)

View File

@ -1,8 +1,8 @@
using System.ComponentModel.DataAnnotations;
using Persistence.Client.CustomExceptions;
using DD.Persistence.Client.CustomExceptions;
using Refit;
using System.ComponentModel.DataAnnotations;
namespace Persistence.Client.Helpers;
namespace DD.Persistence.Client.Helpers;
public static class ExceptionsHelper
{
private static readonly Dictionary<System.Net.HttpStatusCode, Exception> ExceptionsDictionary = new Dictionary<System.Net.HttpStatusCode, Exception>()

View File

@ -1,15 +1,15 @@
using Microsoft.Extensions.Configuration;
using Persistence.Client.Clients.Interfaces;
using Persistence.Client.Clients;
using Persistence.Client.Helpers;
using DD.Persistence.Client.Clients.Interfaces;
using DD.Persistence.Client.Clients;
using DD.Persistence.Client.Helpers;
using Refit;
using Persistence.Factories;
using Persistence.Client.Clients.Interfaces.Refit;
using DD.Persistence.Factories;
using DD.Persistence.Client.Clients.Interfaces.Refit;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.DependencyInjection;
using System.Text.Json;
namespace Persistence.Client
namespace DD.Persistence.Client
{
/// <summary>
/// Фабрика клиентов для доступа к Persistence - сервису

View File

@ -6,7 +6,7 @@ Persistence сервис отвечает за работу с хранимым
## Описание пакета
Данный пакет предоставляет возможность взаимодействия с
Persistence сервисом посредством обращения к конкретному
клиенту, ответсвенному за работу с одной из областей сервиса.
клиенту, ответственному за работу с одной из областей сервиса.
## Список предоставляемых клиентов
- `ISetpointClient` - Клиент для работы с уставками
@ -31,7 +31,7 @@ Persistence сервисом посредством обращения к кон
4. Обратиться к фабрике Persistence - клиентов и получить требуемого клиента.
## xunit тестирование
При написании интеграционных тестов с ипользованием Persistence - клиентов
При написании интеграционных тестов с использованием Persistence - клиентов
Http - клиент не обязан быть авторизован через передачу токена в `PersistenceClientFactory`.
Для осуществления тестовой авторизации достаточно добавить в `appsettings.Tests.json` :
```json

View File

@ -14,12 +14,12 @@
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.10" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Persistence.Database\Persistence.Database.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Migrations\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DD.Persistence.Database\DD.Persistence.Database.csproj" />
</ItemGroup>
</Project>

View File

@ -2,7 +2,7 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace Persistence.Database.Model;
namespace DD.Persistence.Database.Model;
public static class DependencyInjection
{

View File

@ -1,9 +1,9 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Npgsql;
using Persistence.Database.Model;
using DD.Persistence.Database.Model;
namespace Persistence.Database.Postgres;
namespace DD.Persistence.Database.Postgres;
/// <summary>
/// Фабрика контекста для dotnet ef миграций

View File

@ -2,7 +2,7 @@
using Microsoft.EntityFrameworkCore.Infrastructure;
using System.Diagnostics;
namespace Persistence.Database.Postgres;
namespace DD.Persistence.Database.Postgres;
public static class EFExtensionsInitialization
{
public static void EnsureCreatedAndMigrated(this DatabaseFacade db)

View File

@ -2,7 +2,7 @@
#nullable disable
namespace Persistence.Database.Postgres.Migrations
namespace DD.Persistence.Database.Postgres.Migrations
{
/// <inheritdoc />
public partial class SetpointMigration : Migration

View File

@ -6,11 +6,11 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using Persistence.Database.Model;
using DD.Persistence.Database.Model;
#nullable disable
namespace Persistence.Database.Postgres.Migrations
namespace DD.Persistence.Database.Postgres.Migrations
{
[DbContext(typeof(PersistenceDbContext))]
[Migration("20241126071115_Add_ChangeLog")]
@ -28,7 +28,7 @@ namespace Persistence.Database.Postgres.Migrations
NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "adminpack");
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Persistence.Database.Model.ChangeLog", b =>
modelBuilder.Entity("DD.Persistence.Database.Model.ChangeLog", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@ -81,7 +81,7 @@ namespace Persistence.Database.Postgres.Migrations
b.ToTable("ChangeLog");
});
modelBuilder.Entity("Persistence.Database.Model.DataSaub", b =>
modelBuilder.Entity("DD.Persistence.Database.Model.DataSaub", b =>
{
b.Property<DateTimeOffset>("Date")
.HasColumnType("timestamp with time zone")

View File

@ -2,7 +2,7 @@
#nullable disable
namespace Persistence.Database.Postgres.Migrations
namespace DD.Persistence.Database.Postgres.Migrations
{
/// <inheritdoc />
public partial class Add_ChangeLog : Migration

View File

@ -5,11 +5,11 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using Persistence.Database.Model;
using DD.Persistence.Database.Model;
#nullable disable
namespace Persistence.Database.Postgres.Migrations
namespace DD.Persistence.Database.Postgres.Migrations
{
[DbContext(typeof(PersistencePostgresContext))]
[Migration("20241126100631_Init")]
@ -27,7 +27,7 @@ namespace Persistence.Database.Postgres.Migrations
NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "adminpack");
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Persistence.Database.Entity.TimestampedSet", b =>
modelBuilder.Entity("DD.Persistence.Database.Entity.TimestampedSet", b =>
{
b.Property<Guid>("IdDiscriminator")
.HasColumnType("uuid")
@ -50,7 +50,7 @@ namespace Persistence.Database.Postgres.Migrations
});
});
modelBuilder.Entity("Persistence.Database.Model.DataSaub", b =>
modelBuilder.Entity("DD.Persistence.Database.Model.DataSaub", b =>
{
b.Property<DateTimeOffset>("Date")
.HasColumnType("timestamp with time zone")
@ -133,7 +133,7 @@ namespace Persistence.Database.Postgres.Migrations
b.ToTable("DataSaub");
});
modelBuilder.Entity("Persistence.Database.Model.Setpoint", b =>
modelBuilder.Entity("DD.Persistence.Database.Model.Setpoint", b =>
{
b.Property<Guid>("Key")
.HasColumnType("uuid")

View File

@ -2,7 +2,7 @@
#nullable disable
namespace Persistence.Database.Postgres.Migrations
namespace DD.Persistence.Database.Postgres.Migrations
{
/// <inheritdoc />
public partial class Init : Migration

View File

@ -5,11 +5,11 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using Persistence.Database.Model;
using DD.Persistence.Database.Model;
#nullable disable
namespace Persistence.Database.Postgres.Migrations
namespace DD.Persistence.Database.Postgres.Migrations
{
[DbContext(typeof(PersistenceDbContext))]
[Migration("20241203120141_ParameterDataMigration")]
@ -27,7 +27,7 @@ namespace Persistence.Database.Postgres.Migrations
NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "adminpack");
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Persistence.Database.Entity.DrillingSystem", b =>
modelBuilder.Entity("DD.Persistence.Database.Entity.DrillingSystem", b =>
{
b.Property<Guid>("SystemId")
.ValueGeneratedOnAdd()
@ -48,7 +48,7 @@ namespace Persistence.Database.Postgres.Migrations
b.ToTable("DrillingSystem");
});
modelBuilder.Entity("Persistence.Database.Entity.ParameterData", b =>
modelBuilder.Entity("DD.Persistence.Database.Entity.ParameterData", b =>
{
b.Property<int>("DiscriminatorId")
.HasColumnType("integer")
@ -72,7 +72,7 @@ namespace Persistence.Database.Postgres.Migrations
b.ToTable("ParameterData");
});
modelBuilder.Entity("Persistence.Database.Entity.TechMessage", b =>
modelBuilder.Entity("DD.Persistence.Database.Entity.TechMessage", b =>
{
b.Property<Guid>("EventId")
.ValueGeneratedOnAdd()
@ -111,7 +111,7 @@ namespace Persistence.Database.Postgres.Migrations
b.ToTable("TechMessage");
});
modelBuilder.Entity("Persistence.Database.Entity.TimestampedSet", b =>
modelBuilder.Entity("DD.Persistence.Database.Entity.TimestampedSet", b =>
{
b.Property<Guid>("IdDiscriminator")
.HasColumnType("uuid")
@ -134,7 +134,7 @@ namespace Persistence.Database.Postgres.Migrations
});
});
modelBuilder.Entity("Persistence.Database.Model.DataSaub", b =>
modelBuilder.Entity("DD.Persistence.Database.Model.DataSaub", b =>
{
b.Property<DateTimeOffset>("Date")
.HasColumnType("timestamp with time zone")
@ -217,7 +217,7 @@ namespace Persistence.Database.Postgres.Migrations
b.ToTable("DataSaub");
});
modelBuilder.Entity("Persistence.Database.Model.Setpoint", b =>
modelBuilder.Entity("DD.Persistence.Database.Model.Setpoint", b =>
{
b.Property<Guid>("Key")
.HasColumnType("uuid")
@ -241,9 +241,9 @@ namespace Persistence.Database.Postgres.Migrations
b.ToTable("Setpoint");
});
modelBuilder.Entity("Persistence.Database.Entity.TechMessage", b =>
modelBuilder.Entity("DD.Persistence.Database.Entity.TechMessage", b =>
{
b.HasOne("Persistence.Database.Entity.DrillingSystem", "System")
b.HasOne("DD.Persistence.Database.Entity.DrillingSystem", "System")
.WithMany()
.HasForeignKey("SystemId")
.OnDelete(DeleteBehavior.Cascade)

View File

@ -2,7 +2,7 @@
#nullable disable
namespace Persistence.Database.Postgres.Migrations
namespace DD.Persistence.Database.Postgres.Migrations
{
/// <inheritdoc />
public partial class ParameterDataMigration : Migration

View File

@ -5,11 +5,11 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using Persistence.Database.Model;
using DD.Persistence.Database.Model;
#nullable disable
namespace Persistence.Database.Postgres.Migrations.PersistencePostgres
namespace DD.Persistence.Database.Postgres.Migrations.PersistencePostgres
{
[DbContext(typeof(PersistencePostgresContext))]
[Migration("20241212041758_TechMessageMigration")]
@ -27,7 +27,7 @@ namespace Persistence.Database.Postgres.Migrations.PersistencePostgres
NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "adminpack");
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Persistence.Database.Entity.DrillingSystem", b =>
modelBuilder.Entity("DD.Persistence.Database.Entity.DrillingSystem", b =>
{
b.Property<Guid>("SystemId")
.ValueGeneratedOnAdd()
@ -48,7 +48,7 @@ namespace Persistence.Database.Postgres.Migrations.PersistencePostgres
b.ToTable("DrillingSystem");
});
modelBuilder.Entity("Persistence.Database.Entity.ParameterData", b =>
modelBuilder.Entity("DD.Persistence.Database.Entity.ParameterData", b =>
{
b.Property<Guid>("DiscriminatorId")
.HasColumnType("uuid")
@ -72,7 +72,7 @@ namespace Persistence.Database.Postgres.Migrations.PersistencePostgres
b.ToTable("ParameterData");
});
modelBuilder.Entity("Persistence.Database.Entity.TechMessage", b =>
modelBuilder.Entity("DD.Persistence.Database.Entity.TechMessage", b =>
{
b.Property<Guid>("EventId")
.ValueGeneratedOnAdd()
@ -107,7 +107,7 @@ namespace Persistence.Database.Postgres.Migrations.PersistencePostgres
b.ToTable("TechMessage");
});
modelBuilder.Entity("Persistence.Database.Entity.TimestampedSet", b =>
modelBuilder.Entity("DD.Persistence.Database.Entity.TimestampedSet", b =>
{
b.Property<Guid>("IdDiscriminator")
.HasColumnType("uuid")
@ -130,7 +130,7 @@ namespace Persistence.Database.Postgres.Migrations.PersistencePostgres
});
});
modelBuilder.Entity("Persistence.Database.Model.ChangeLog", b =>
modelBuilder.Entity("DD.Persistence.Database.Model.ChangeLog", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@ -183,7 +183,7 @@ namespace Persistence.Database.Postgres.Migrations.PersistencePostgres
b.ToTable("ChangeLog");
});
modelBuilder.Entity("Persistence.Database.Model.DataSaub", b =>
modelBuilder.Entity("DD.Persistence.Database.Model.DataSaub", b =>
{
b.Property<DateTimeOffset>("Date")
.HasColumnType("timestamp with time zone")
@ -266,7 +266,7 @@ namespace Persistence.Database.Postgres.Migrations.PersistencePostgres
b.ToTable("DataSaub");
});
modelBuilder.Entity("Persistence.Database.Model.Setpoint", b =>
modelBuilder.Entity("DD.Persistence.Database.Model.Setpoint", b =>
{
b.Property<Guid>("Key")
.HasColumnType("uuid")
@ -290,9 +290,9 @@ namespace Persistence.Database.Postgres.Migrations.PersistencePostgres
b.ToTable("Setpoint");
});
modelBuilder.Entity("Persistence.Database.Entity.TechMessage", b =>
modelBuilder.Entity("DD.Persistence.Database.Entity.TechMessage", b =>
{
b.HasOne("Persistence.Database.Entity.DrillingSystem", "System")
b.HasOne("DD.Persistence.Database.Entity.DrillingSystem", "System")
.WithMany()
.HasForeignKey("SystemId")
.OnDelete(DeleteBehavior.Cascade)

View File

@ -2,7 +2,7 @@
#nullable disable
namespace Persistence.Database.Postgres.Migrations.PersistencePostgres
namespace DD.Persistence.Database.Postgres.Migrations.PersistencePostgres
{
/// <inheritdoc />
public partial class TechMessageMigration : Migration

View File

@ -4,11 +4,11 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using Persistence.Database.Model;
using DD.Persistence.Database.Model;
#nullable disable
namespace Persistence.Database.Postgres.Migrations
namespace DD.Persistence.Database.Postgres.Migrations
{
[DbContext(typeof(PersistencePostgresContext))]
partial class PersistencePostgresContextModelSnapshot : ModelSnapshot
@ -24,7 +24,7 @@ namespace Persistence.Database.Postgres.Migrations
NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "adminpack");
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Persistence.Database.Entity.DataSourceSystem", b =>
modelBuilder.Entity("DD.Persistence.Database.Entity.DataSourceSystem", b =>
{
b.Property<Guid>("SystemId")
.ValueGeneratedOnAdd()
@ -45,7 +45,7 @@ namespace Persistence.Database.Postgres.Migrations
b.ToTable("DataSourceSystem");
});
modelBuilder.Entity("Persistence.Database.Entity.ParameterData", b =>
modelBuilder.Entity("DD.Persistence.Database.Entity.ParameterData", b =>
{
b.Property<Guid>("DiscriminatorId")
.HasColumnType("uuid")
@ -69,7 +69,7 @@ namespace Persistence.Database.Postgres.Migrations
b.ToTable("ParameterData");
});
modelBuilder.Entity("Persistence.Database.Entity.TechMessage", b =>
modelBuilder.Entity("DD.Persistence.Database.Entity.TechMessage", b =>
{
b.Property<Guid>("EventId")
.ValueGeneratedOnAdd()
@ -104,7 +104,7 @@ namespace Persistence.Database.Postgres.Migrations
b.ToTable("TechMessage");
});
modelBuilder.Entity("Persistence.Database.Entity.TimestampedSet", b =>
modelBuilder.Entity("DD.Persistence.Database.Entity.TimestampedSet", b =>
{
b.Property<Guid>("IdDiscriminator")
.HasColumnType("uuid")
@ -127,7 +127,7 @@ namespace Persistence.Database.Postgres.Migrations
});
});
modelBuilder.Entity("Persistence.Database.Model.ChangeLog", b =>
modelBuilder.Entity("DD.Persistence.Database.Model.ChangeLog", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@ -180,7 +180,7 @@ namespace Persistence.Database.Postgres.Migrations
b.ToTable("ChangeLog");
});
modelBuilder.Entity("Persistence.Database.Model.DataSaub", b =>
modelBuilder.Entity("DD.Persistence.Database.Model.DataSaub", b =>
{
b.Property<DateTimeOffset>("Date")
.HasColumnType("timestamp with time zone")
@ -263,7 +263,7 @@ namespace Persistence.Database.Postgres.Migrations
b.ToTable("DataSaub");
});
modelBuilder.Entity("Persistence.Database.Model.Setpoint", b =>
modelBuilder.Entity("DD.Persistence.Database.Model.Setpoint", b =>
{
b.Property<Guid>("Key")
.HasColumnType("uuid")
@ -287,9 +287,9 @@ namespace Persistence.Database.Postgres.Migrations
b.ToTable("Setpoint");
});
modelBuilder.Entity("Persistence.Database.Entity.TechMessage", b =>
modelBuilder.Entity("DD.Persistence.Database.Entity.TechMessage", b =>
{
b.HasOne("Persistence.Database.Entity.DataSourceSystem", "System")
b.HasOne("DD.Persistence.Database.Entity.DataSourceSystem", "System")
.WithMany()
.HasForeignKey("SystemId")
.OnDelete(DeleteBehavior.Cascade)

View File

@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore;
namespace Persistence.Database.Model;
namespace DD.Persistence.Database.Model;
/// <summary>
/// EF êîíòåêñò äëÿ ÁÄ Postgres

View File

@ -0,0 +1,11 @@
## Создать миграцию
```
dotnet ef migrations add <MigrationName> --project DD.Persistence.Database.Postgres
```
## Откатить миграцию
```
dotnet ef migrations remove --project DD.Persistence.Database.Postgres
```
Удаляется последняя созданная миграция.

View File

@ -15,7 +15,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Persistence\Persistence.csproj" />
<ProjectReference Include="..\DD.Persistence\DD.Persistence.csproj" />
</ItemGroup>
</Project>

View File

@ -2,7 +2,7 @@
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Persistence.Database;
namespace DD.Persistence.Database;
public static class EFExtensions
{

View File

@ -1,10 +1,10 @@

using Microsoft.EntityFrameworkCore;
using Persistence.Models;
using DD.Persistence.Models;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Persistence.Database.Model;
namespace DD.Persistence.Database.Model;
/// <summary>
/// Часть записи, описывающая изменение

View File

@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Persistence.Database.Model;
namespace DD.Persistence.Database.Model;
public class DataSaub : ITimestampedData
{
[Key, Column("date")]

View File

@ -2,7 +2,7 @@ using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Persistence.Database.Entity;
namespace DD.Persistence.Database.Entity;
public class DataSourceSystem
{
[Key, Comment("Id системы - источника данных")]

View File

@ -1,5 +1,5 @@

namespace Persistence.Database.Model;
namespace DD.Persistence.Database.Model;
/// <summary>
/// Часть записи, описывающая изменение

View File

@ -1,4 +1,4 @@
namespace Persistence.Database.Model;
namespace DD.Persistence.Database.Model;
public interface ITimestampedData
{
/// <summary>

View File

@ -2,7 +2,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Persistence.Database.Entity;
namespace DD.Persistence.Database.Entity;
[PrimaryKey(nameof(DiscriminatorId), nameof(ParameterId), nameof(Timestamp))]
public class ParameterData

View File

@ -1,7 +1,7 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
namespace Persistence.Database.Model
namespace DD.Persistence.Database.Model
{
[PrimaryKey(nameof(Key), nameof(Created))]
public class Setpoint

View File

@ -2,7 +2,7 @@ using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Persistence.Database.Entity
namespace DD.Persistence.Database.Entity
{
public class TechMessage
{

View File

@ -1,7 +1,7 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
namespace Persistence.Database.Entity;
namespace DD.Persistence.Database.Entity;
[Comment("Общая таблица данных временных рядов")]
[PrimaryKey(nameof(IdDiscriminator), nameof(Timestamp))]

View File

@ -1,8 +1,8 @@
using Microsoft.EntityFrameworkCore;
using Persistence.Database.Entity;
using Persistence.Database.Model;
using DD.Persistence.Database.Entity;
using DD.Persistence.Database.Model;
namespace Persistence.Database;
namespace DD.Persistence.Database;
/// <summary>
/// EF контекст для любых БД поддерживаемых в EF

View File

@ -1,9 +1,9 @@
using Microsoft.Extensions.DependencyInjection;
using Persistence.Database;
using Persistence.Database.Model;
using DD.Persistence.Database;
using DD.Persistence.Database.Model;
using Xunit;
namespace Persistence.IntegrationTests;
namespace DD.Persistence.IntegrationTests;
public abstract class BaseIntegrationTest : IClassFixture<WebAppFactoryFixture>, IDisposable
{
protected readonly IServiceScope scope;

View File

@ -1,15 +1,14 @@
using Mapster;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Persistence.Client;
using Persistence.Client.Clients.Interfaces;
using Persistence.Database.Entity;
using Persistence.Database.Model;
using Persistence.Models;
using Persistence.Models.Requests;
using DD.Persistence.Database.Model;
using DD.Persistence.Models;
using DD.Persistence.Models.Requests;
using Xunit;
using DD.Persistence.Client.Clients.Interfaces;
using DD.Persistence.Client;
namespace Persistence.IntegrationTests.Controllers;
namespace DD.Persistence.IntegrationTests.Controllers;
public class ChangeLogControllerTest : BaseIntegrationTest
{
private readonly IChangeLogClient client;

View File

@ -1,8 +1,8 @@
using Persistence.Database.Model;
using Persistence.Models;
using DD.Persistence.Database.Model;
using DD.Persistence.Models;
using Xunit;
namespace Persistence.IntegrationTests.Controllers;
namespace DD.Persistence.IntegrationTests.Controllers;
public class DataSaubControllerTest : TimeSeriesBaseControllerTest<DataSaub, DataSaubDto>
{
private readonly DataSaubDto dto = new()

View File

@ -1,13 +1,13 @@
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.DependencyInjection;
using Persistence.Client;
using Persistence.Client.Clients;
using Persistence.Client.Clients.Interfaces;
using Persistence.Database.Entity;
using Persistence.Models;
using DD.Persistence.Client;
using DD.Persistence.Client.Clients;
using DD.Persistence.Client.Clients.Interfaces;
using DD.Persistence.Database.Entity;
using DD.Persistence.Models;
using Xunit;
namespace Persistence.IntegrationTests.Controllers
namespace DD.Persistence.IntegrationTests.Controllers
{
public class DataSourceSystemControllerTest : BaseIntegrationTest
{

View File

@ -1,11 +1,11 @@
using Microsoft.Extensions.DependencyInjection;
using Persistence.Client;
using Persistence.Client.Clients.Interfaces;
using Persistence.Database.Model;
using DD.Persistence.Client;
using DD.Persistence.Client.Clients.Interfaces;
using DD.Persistence.Database.Model;
using System.Net;
using Xunit;
namespace Persistence.IntegrationTests.Controllers
namespace DD.Persistence.IntegrationTests.Controllers
{
public class SetpointControllerTest : BaseIntegrationTest
{

View File

@ -1,15 +1,15 @@
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.DependencyInjection;
using Persistence.Client;
using Persistence.Client.Clients.Interfaces;
using Persistence.Database.Entity;
using Persistence.Models;
using Persistence.Models.Enumerations;
using Persistence.Models.Requests;
using DD.Persistence.Client;
using DD.Persistence.Client.Clients.Interfaces;
using DD.Persistence.Database.Entity;
using DD.Persistence.Models;
using DD.Persistence.Models.Enumerations;
using DD.Persistence.Models.Requests;
using System.Net;
using Xunit;
namespace Persistence.IntegrationTests.Controllers
namespace DD.Persistence.IntegrationTests.Controllers
{
public class TechMessagesControllerTest : BaseIntegrationTest
{

View File

@ -1,12 +1,12 @@
using Mapster;
using Microsoft.Extensions.DependencyInjection;
using Persistence.Client;
using Persistence.Client.Clients.Interfaces;
using Persistence.Database.Model;
using DD.Persistence.Client;
using DD.Persistence.Client.Clients.Interfaces;
using DD.Persistence.Database.Model;
using System.Net;
using Xunit;
namespace Persistence.IntegrationTests.Controllers;
namespace DD.Persistence.IntegrationTests.Controllers;
public abstract class TimeSeriesBaseControllerTest<TEntity, TDto> : BaseIntegrationTest
where TEntity : class, ITimestampedData, new()

View File

@ -1,10 +1,10 @@
using Microsoft.Extensions.DependencyInjection;
using Persistence.Client;
using Persistence.Client.Clients.Interfaces;
using Persistence.Models;
using DD.Persistence.Client;
using DD.Persistence.Client.Clients.Interfaces;
using DD.Persistence.Models;
using Xunit;
namespace Persistence.IntegrationTests.Controllers;
namespace DD.Persistence.IntegrationTests.Controllers;
public class TimestampedSetControllerTest : BaseIntegrationTest
{
private readonly ITimestampedSetClient client;

View File

@ -1,13 +1,12 @@
using Microsoft.Extensions.DependencyInjection;
using Persistence.Client;
using Persistence.Client.Clients;
using Persistence.Client.Clients.Interfaces;
using Persistence.Database.Entity;
using Persistence.Models;
using DD.Persistence.Database.Entity;
using DD.Persistence.Models;
using System.Net;
using Xunit;
using DD.Persistence.Client.Clients.Interfaces;
using DD.Persistence.Client;
namespace Persistence.IntegrationTests.Controllers;
namespace DD.Persistence.IntegrationTests.Controllers;
public class WitsDataControllerTest : BaseIntegrationTest
{
private IWitsDataClient witsDataClient;

View File

@ -24,9 +24,10 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Persistence.API\Persistence.API.csproj" />
<ProjectReference Include="..\Persistence.Client\Persistence.Client.csproj" />
<ProjectReference Include="..\Persistence.Database.Postgres\Persistence.Database.Postgres.csproj" />
<ProjectReference Include="..\DD.Persistence.App\DD.Persistence.App.csproj" />
<ProjectReference Include="..\DD.Persistence.Client\DD.Persistence.Client.csproj" />
<ProjectReference Include="..\DD.Persistence.Database\DD.Persistence.Database.csproj" />
<ProjectReference Include="..\DD.Persistence\DD.Persistence.csproj" />
</ItemGroup>
</Project>

View File

@ -1,4 +1,4 @@
namespace Persistence.IntegrationTests;
namespace DD.Persistence.IntegrationTests;
public class DbConnection
{
public string Host { get; set; } = null!;

Some files were not shown because too many files have changed in this diff Show More