App refactor done

This commit is contained in:
Michał Zieliński
2025-11-05 20:50:25 +01:00
parent b65ea7d17f
commit 5bee3912f1
97 changed files with 2454 additions and 2320 deletions

View File

@@ -15,23 +15,23 @@ DOCKER_BACKUP_PATH=${DOCKER_BACKUP_DIR}/${BACKUP_FILE}
#SERVER VARIABLES #SERVER VARIABLES
REMOTE_HOST="bim-it.pl" REMOTE_HOST="bim-it.pl"
REMOTE_USER="mz" REMOTE_USER="mz"
REMOTE_SA_PASSWORD="v](8Lc|RfG" REMOTE_SA_PASSWORD="9832&^*&huihj"
REMOTE_BACKUP_DIR="/tmp" REMOTE_BACKUP_DIR="/tmp"
ssh ${REMOTE_USER}@${REMOTE_HOST} "sudo rm ${REMOTE_BACKUP_DIR}/${BACKUP_FILE}" ssh ${REMOTE_USER}@${REMOTE_HOST} "sudo rm ${REMOTE_BACKUP_DIR}/${BACKUP_FILE}"
ssh ${REMOTE_USER}@${REMOTE_HOST} "/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P '${REMOTE_SA_PASSWORD}' -Q \"BACKUP DATABASE [${DB_NAME}] TO DISK = '${REMOTE_BACKUP_DIR}/${BACKUP_FILE}'\"" ssh ${REMOTE_USER}@${REMOTE_HOST} "/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P '${REMOTE_SA_PASSWORD}' -Q \"BACKUP DATABASE [${DB_NAME}] TO DISK = '${REMOTE_BACKUP_DIR}/${BACKUP_FILE}'\""
scp ${REMOTE_USER}@${REMOTE_HOST}:${REMOTE_BACKUP_DIR}/${BACKUP_FILE} ${LOCAL_BACKUP_DIR}/ scp ${REMOTE_USER}@${REMOTE_HOST}:${REMOTE_BACKUP_DIR}/${BACKUP_FILE} ${LOCAL_BACKUP_DIR}/
docker exec -i ${DOCKER_CONTAINER_NAME} mkdir -p ${DOCKER_BACKUP_DIR} podman exec -i ${DOCKER_CONTAINER_NAME} mkdir -p ${DOCKER_BACKUP_DIR}
docker cp "${LOCAL_BACKUP_PATH}" "${DOCKER_CONTAINER_NAME}:${DOCKER_BACKUP_PATH}" podman cp "${LOCAL_BACKUP_PATH}" "${DOCKER_CONTAINER_NAME}:${DOCKER_BACKUP_PATH}"
docker exec --user=root -i ${DOCKER_CONTAINER_NAME} chown mssql:mssql "$DOCKER_BACKUP_PATH" podman exec --user=root -i ${DOCKER_CONTAINER_NAME} chown mssql:mssql "$DOCKER_BACKUP_PATH"
LOGICAL_FILE_INFO=$(docker exec -i ${DOCKER_CONTAINER_NAME} ${DOCKER_SQLCMD} -C -S localhost -U SA -P "${DOCKER_SA_PASSWORD}" -Q "RESTORE FILELISTONLY FROM DISK = '${DOCKER_BACKUP_PATH}'" 2>&1) LOGICAL_FILE_INFO=$(podman exec -i ${DOCKER_CONTAINER_NAME} ${DOCKER_SQLCMD} -C -S localhost -U SA -P "${DOCKER_SA_PASSWORD}" -Q "RESTORE FILELISTONLY FROM DISK = '${DOCKER_BACKUP_PATH}'" 2>&1)
DATA_FILE=$(echo "$LOGICAL_FILE_INFO" | awk 'NR==3 {print $1}' | tr -d '[:space:]') DATA_FILE=$(echo "$LOGICAL_FILE_INFO" | awk 'NR==3 {print $1}' | tr -d '[:space:]')
LOG_FILE=$(echo "$LOGICAL_FILE_INFO" | awk 'NR==4 {print $1}' | tr -d '[:space:]') LOG_FILE=$(echo "$LOGICAL_FILE_INFO" | awk 'NR==4 {print $1}' | tr -d '[:space:]')
RESTORE_OUTPUT=$( RESTORE_OUTPUT=$(
docker exec -i ${DOCKER_CONTAINER_NAME} ${DOCKER_SQLCMD} -C -S localhost -U SA -P "${DOCKER_SA_PASSWORD}" -Q " podman exec -i ${DOCKER_CONTAINER_NAME} ${DOCKER_SQLCMD} -C -S localhost -U SA -P "${DOCKER_SA_PASSWORD}" -Q "
IF EXISTS (SELECT name FROM sys.databases WHERE name = '${DB_NAME}') IF EXISTS (SELECT name FROM sys.databases WHERE name = '${DB_NAME}')
BEGIN BEGIN
PRINT 'Database ${DB_NAME} exists. Dropping the database.'; PRINT 'Database ${DB_NAME} exists. Dropping the database.';

View File

@@ -1,60 +1,60 @@
using Google.Apis.Auth; using Google.Apis.Auth;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.IdentityModel.Tokens;
using Microsoft.IdentityModel.Tokens; using System.IdentityModel.Tokens.Jwt;
using System.IdentityModel.Tokens.Jwt; using System.Security.Claims;
using System.Security.Claims; using System.Text;
using System.Text; using DiunaBI.Domain.Entities;
using DiunaBI.Core.Models; using DiunaBI.Infrastructure.Data;
using DiunaBI.Core.Database.Context; using Microsoft.EntityFrameworkCore;
namespace DiunaBI.WebAPI.Controllers; namespace DiunaBI.API.Controllers;
[ApiController] [ApiController]
[Route("api/[controller]")] [Route("api/[controller]")]
// [Authorize] // [Authorize]
public class AuthController : Controller public class AuthController : Controller
{ {
private readonly AppDbContext _db; private readonly AppDbContext _db;
private readonly IConfiguration _configuration; private readonly IConfiguration _configuration;
public AuthController( public AuthController(
AppDbContext db, IConfiguration configuration) AppDbContext db, IConfiguration configuration)
{ _db = db; _configuration = configuration; } { _db = db; _configuration = configuration; }
[HttpPost] [HttpPost]
[Route("apiToken")] [Route("apiToken")]
public async Task<IActionResult> ApiToken([FromBody] string credential) public async Task<IActionResult> ApiToken([FromBody] string credential)
{ {
var settings = new GoogleJsonWebSignature.ValidationSettings var settings = new GoogleJsonWebSignature.ValidationSettings
{ {
Audience = new List<string> { _configuration.GetValue<string>("GoogleClientId")! } Audience = new List<string> { _configuration.GetValue<string>("GoogleClientId")! }
}; };
var payload = await GoogleJsonWebSignature.ValidateAsync(credential, settings); var payload = await GoogleJsonWebSignature.ValidateAsync(credential, settings);
var user = _db.Users.AsNoTracking().FirstOrDefault(x => x.Email == payload.Email); var user = _db.Users.AsNoTracking().FirstOrDefault(x => x.Email == payload.Email);
return user != null ? (IActionResult)Ok(JwtGenerator(user)) : Unauthorized(); return user != null ? (IActionResult)Ok(JwtGenerator(user)) : Unauthorized();
} }
private dynamic JwtGenerator(User user) private dynamic JwtGenerator(User user)
{ {
var key = Encoding.ASCII.GetBytes(_configuration.GetValue<string>("Secret")!); var key = Encoding.ASCII.GetBytes(_configuration.GetValue<string>("Secret")!);
var expirationTime = DateTime.UtcNow.AddMinutes(5); var expirationTime = DateTime.UtcNow.AddMinutes(5);
var tokenDescriptor = new SecurityTokenDescriptor var tokenDescriptor = new SecurityTokenDescriptor
{ {
Subject = new ClaimsIdentity(new[] Subject = new ClaimsIdentity(new[]
{ {
new Claim("Id", Guid.NewGuid().ToString()), new Claim("Id", Guid.NewGuid().ToString()),
new Claim(JwtRegisteredClaimNames.Sub, user.Id.ToString()), new Claim(JwtRegisteredClaimNames.Sub, user.Id.ToString()),
new Claim(JwtRegisteredClaimNames.Jti, new Claim(JwtRegisteredClaimNames.Jti,
Guid.NewGuid().ToString()) Guid.NewGuid().ToString())
}), }),
Expires = expirationTime, Expires = expirationTime,
SigningCredentials = new SigningCredentials SigningCredentials = new SigningCredentials
(new SymmetricSecurityKey(key), (new SymmetricSecurityKey(key),
SecurityAlgorithms.HmacSha512Signature) SecurityAlgorithms.HmacSha512Signature)
}; };
var tokenHandler = new JwtSecurityTokenHandler(); var tokenHandler = new JwtSecurityTokenHandler();
var token = tokenHandler.CreateToken(tokenDescriptor); var token = tokenHandler.CreateToken(tokenDescriptor);
var stringToken = tokenHandler.WriteToken(token); var stringToken = tokenHandler.WriteToken(token);
return new { token = stringToken, id = user.Id, expirationTime }; return new { token = stringToken, id = user.Id, expirationTime };
} }
} }

View File

@@ -1,132 +1,131 @@
using System.Text; using System.Text;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging; using DiunaBI.Infrastructure.Data;
using DiunaBI.Core.Database.Context; using DiunaBI.Domain.Entities;
using DiunaBI.Core.Models;
namespace DiunaBI.API.Controllers;
namespace DiunaBI.WebAPI.Controllers;
[ApiController]
[ApiController] [Route("api/[controller]")]
[Route("api/[controller]")] public class DataInboxController : Controller
public class DataInboxController : Controller {
{ private readonly AppDbContext _db;
private readonly AppDbContext _db; private readonly IConfiguration _configuration;
private readonly IConfiguration _configuration; private readonly ILogger<DataInboxController> _logger;
private readonly ILogger<DataInboxController> _logger;
public DataInboxController(
public DataInboxController( AppDbContext db,
AppDbContext db, IConfiguration configuration,
IConfiguration configuration, ILogger<DataInboxController> logger)
ILogger<DataInboxController> logger) {
{ _db = db;
_db = db; _configuration = configuration;
_configuration = configuration; _logger = logger;
_logger = logger; }
}
[HttpPut]
[HttpPut] [Route("Add/{apiKey}")]
[Route("Add/{apiKey}")] [AllowAnonymous]
[AllowAnonymous] public IActionResult Add(string apiKey, [FromBody] DataInbox dataInbox)
public IActionResult Add(string apiKey, [FromBody] DataInbox dataInbox) {
{ if (apiKey != _configuration["apiKey"])
if (apiKey != _configuration["apiKey"]) {
{ _logger.LogWarning("DataInbox: Unauthorized request - wrong apiKey for source {Source}", dataInbox.Source);
_logger.LogWarning("DataInbox: Unauthorized request - wrong apiKey for source {Source}", dataInbox.Source); return Unauthorized();
return Unauthorized(); }
}
try
try {
{ if (!Request.Headers.TryGetValue("Authorization", out var authHeader))
if (!Request.Headers.TryGetValue("Authorization", out var authHeader)) {
{ _logger.LogWarning("DataInbox: Unauthorized request - no authorization header for source {Source}", dataInbox.Source);
_logger.LogWarning("DataInbox: Unauthorized request - no authorization header for source {Source}", dataInbox.Source); return Unauthorized();
return Unauthorized(); }
}
var credentialsArr = authHeader.ToString().Split(" ");
var credentialsArr = authHeader.ToString().Split(" "); if (credentialsArr.Length != 2)
if (credentialsArr.Length != 2) {
{ _logger.LogWarning("DataInbox: Unauthorized request - wrong auth header format for source {Source}", dataInbox.Source);
_logger.LogWarning("DataInbox: Unauthorized request - wrong auth header format for source {Source}", dataInbox.Source); return Unauthorized();
return Unauthorized(); }
}
var authValue = Encoding.UTF8.GetString(Convert.FromBase64String(credentialsArr[1]));
var authValue = Encoding.UTF8.GetString(Convert.FromBase64String(credentialsArr[1])); var username = authValue.Split(':')[0];
var username = authValue.Split(':')[0]; var password = authValue.Split(':')[1];
var password = authValue.Split(':')[1]; if (username != _configuration["morska-user"] || password != _configuration["morska-pass"])
if (username != _configuration["morska-user"] || password != _configuration["morska-pass"]) {
{ _logger.LogWarning("DataInbox: Unauthorized request - bad credentials for source {Source}", dataInbox.Source);
_logger.LogWarning("DataInbox: Unauthorized request - bad credentials for source {Source}", dataInbox.Source); return Unauthorized();
return Unauthorized(); }
}
// check if datainbox.data is base64 encoded value
// check if datainbox.data is base64 encoded value if (!string.IsNullOrEmpty(dataInbox.Data) && !IsBase64String(dataInbox.Data))
if (!string.IsNullOrEmpty(dataInbox.Data) && !IsBase64String(dataInbox.Data)) {
{ _logger.LogWarning("DataInbox: Invalid data format - not base64 encoded for source {Source}", dataInbox.Source);
_logger.LogWarning("DataInbox: Invalid data format - not base64 encoded for source {Source}", dataInbox.Source); return BadRequest("Invalid data format - not base64 encoded");
return BadRequest("Invalid data format - not base64 encoded"); }
}
dataInbox.Id = Guid.NewGuid();
dataInbox.Id = Guid.NewGuid(); dataInbox.CreatedAt = DateTime.UtcNow;
dataInbox.CreatedAt = DateTime.UtcNow; _db.DataInbox.Add(dataInbox);
_db.DataInbox.Add(dataInbox); _db.SaveChanges();
_db.SaveChanges();
_logger.LogInformation("DataInbox: Insert success for source {Source}, name {Name}", dataInbox.Source, dataInbox.Name);
_logger.LogInformation("DataInbox: Insert success for source {Source}, name {Name}", dataInbox.Source, dataInbox.Name);
if (dataInbox.Name == "morska.d3.importer")
if (dataInbox.Name == "morska.d3.importer") {
{ _logger.LogDebug("DataInbox: Detected morska.d3.importer - processing will be handled by AutoImport");
_logger.LogDebug("DataInbox: Detected morska.d3.importer - processing will be handled by AutoImport"); // AutoImport będzie obsługiwać ten typ danych
// AutoImport będzie obsługiwać ten typ danych }
}
return Ok();
return Ok(); }
} catch (Exception e)
catch (Exception e) {
{ _logger.LogError(e, "DataInbox: Insert error for source {Source}, name {Name}", dataInbox.Source, dataInbox.Name);
_logger.LogError(e, "DataInbox: Insert error for source {Source}, name {Name}", dataInbox.Source, dataInbox.Name); return BadRequest(e.ToString());
return BadRequest(e.ToString()); }
} }
}
[HttpGet]
[HttpGet] public IActionResult GetAll()
public IActionResult GetAll() {
{ try
try {
{ var dataInbox = _db.DataInbox.AsNoTracking().ToList();
var dataInbox = _db.DataInbox.AsNoTracking().ToList(); _logger.LogDebug("DataInbox: Retrieved {Count} records", dataInbox.Count);
_logger.LogDebug("DataInbox: Retrieved {Count} records", dataInbox.Count); return Ok(dataInbox);
return Ok(dataInbox); }
} catch (Exception e)
catch (Exception e) {
{ _logger.LogError(e, "DataInbox: Error retrieving records");
_logger.LogError(e, "DataInbox: Error retrieving records"); return BadRequest(e.ToString());
return BadRequest(e.ToString()); }
} }
}
// helpers
// helpers private bool IsBase64String(string data)
private bool IsBase64String(string data) {
{ if (string.IsNullOrEmpty(data))
if (string.IsNullOrEmpty(data)) {
{ return false;
return false; }
} try
try {
{ var base64Bytes = Convert.FromBase64String(data);
var base64Bytes = Convert.FromBase64String(data); var utf8String = Encoding.UTF8.GetString(base64Bytes);
var utf8String = Encoding.UTF8.GetString(base64Bytes); var reEncoded = Convert.ToBase64String(Encoding.UTF8.GetBytes(utf8String));
var reEncoded = Convert.ToBase64String(Encoding.UTF8.GetBytes(utf8String)); return data.TrimEnd('=') == reEncoded.TrimEnd('=');
return data.TrimEnd('=') == reEncoded.TrimEnd('='); }
} catch (FormatException)
catch (FormatException) {
{ return false;
return false; }
} catch (DecoderFallbackException)
catch (DecoderFallbackException) {
{ return false;
return false; }
} }
}
} }

View File

@@ -4,12 +4,11 @@ using Google.Apis.Sheets.v4;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using DiunaBI.Core.Models; using DiunaBI.Domain.Entities;
using DiunaBI.Core.Database.Context; using DiunaBI.Infrastructure.Data;
using DiunaBI.Core.Services; using DiunaBI.Infrastructure.Services;
using DiunaBI.Core.Interfaces;
namespace DiunaBI.WebAPI.Controllers; namespace DiunaBI.API.Controllers;
[ApiController] [ApiController]
[Route("api/[controller]")] [Route("api/[controller]")]

View File

@@ -1,50 +1,50 @@
using DiunaBI.Core.Services; using DiunaBI.Infrastructure.Services;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace DiunaBI.WebAPI.Controllers; namespace DiunaBI.API.Controllers;
[ApiController] [ApiController]
[Route("api/[controller]")] [Route("api/[controller]")]
[Authorize] [Authorize]
public class TestsController : Controller public class TestsController : Controller
{ {
private readonly PluginManager _pluginManager; private readonly PluginManager _pluginManager;
private readonly ILogger<LayersController> _logger; private readonly ILogger<LayersController> _logger;
public TestsController( public TestsController(
PluginManager pluginManager, PluginManager pluginManager,
ILogger<LayersController> logger) ILogger<LayersController> logger)
{ {
_pluginManager = pluginManager; _pluginManager = pluginManager;
_logger = logger; _logger = logger;
} }
[HttpGet] [HttpGet]
[Route("Ping")] [Route("Ping")]
[AllowAnonymous] [AllowAnonymous]
public IActionResult Ping() public IActionResult Ping()
{ {
var tmp = new var tmp = new
{ {
a = 2, a = 2,
b = "test" b = "test"
}; };
var tmp2 = new var tmp2 = new
{ {
a = 2, a = 2,
b = "test" b = "test"
}; };
var user = User.Identity; var user = User.Identity;
_logger.LogInformation("LogTest: OldValue {tmp}, NewValue {tmp2}, ChangedBy: {user}", tmp, tmp2, user?.Name); _logger.LogInformation("LogTest: OldValue {tmp}, NewValue {tmp2}, ChangedBy: {user}", tmp, tmp2, user?.Name);
return Ok("Pong"); return Ok("Pong");
} }
[HttpGet] [HttpGet]
[Route("Plugins")] [Route("Plugins")]
[AllowAnonymous] [AllowAnonymous]
public IActionResult GetPlugins() public IActionResult GetPlugins()
{ {
var plugins = _pluginManager.GetPluginsCount(); var plugins = _pluginManager.GetPluginsCount();
return Ok(plugins); return Ok(plugins);
} }
} }

View File

@@ -1,43 +1,45 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup> <RootNamespace>DiunaBI.WebAPI</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Google.Cloud.Firestore" Version="3.4.0" /> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.0" /> <PackageReference Include="Google.Cloud.Firestore" Version="3.4.0" />
<PackageReference Include="Google.Apis.Auth" Version="1.68.0" /> <PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.0" />
<PackageReference Include="Google.Apis.Drive.v3" Version="1.68.0.3627" /> <PackageReference Include="Google.Apis.Auth" Version="1.68.0" />
<PackageReference Include="Google.Apis.Sheets.v4" Version="1.68.0.3624" /> <PackageReference Include="Google.Apis.Drive.v3" Version="1.68.0.3627" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.0" /> <PackageReference Include="Google.Apis.Sheets.v4" Version="1.68.0.3624" />
<PackageReference Include="Serilog.AspNetCore" Version="9.0.0" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.0" />
<PackageReference Include="Serilog.Enrichers.Environment" Version="3.0.1" /> <PackageReference Include="Serilog.AspNetCore" Version="9.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="7.0.0" /> <PackageReference Include="Serilog.Enrichers.Environment" Version="3.0.1" />
<PackageReference Include="Serilog.Sinks.Seq" Version="9.0.0" /> <PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.0" /> <PackageReference Include="Serilog.Sinks.Seq" Version="9.0.0" />
</ItemGroup> <PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DiunaBI.Core\DiunaBI.Core.csproj" /> <ItemGroup>
</ItemGroup> <ProjectReference Include="..\DiunaBI.Infrastructure\DiunaBI.Infrastructure.csproj" />
<ProjectReference Include="..\DiunaBI.Application\DiunaBI.Application.csproj" />
<ItemGroup> </ItemGroup>
<Content Update="client_secrets.Development.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <ItemGroup>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile> <Content Update="client_secrets.Development.json">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> <ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</ItemGroup> <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Target Name="CopyPlugins" AfterTargets="Build"> </ItemGroup>
<MSBuild Projects="../DiunaBI.Plugins.Morska/DiunaBI.Plugins.Morska.csproj" Properties="Configuration=$(Configuration);TargetFramework=$(TargetFramework)" />
<Target Name="CopyPlugins" AfterTargets="Build">
<ItemGroup> <MSBuild Projects="../DiunaBI.Plugins.Morska/DiunaBI.Plugins.Morska.csproj" Properties="Configuration=$(Configuration);TargetFramework=$(TargetFramework)" />
<PluginFiles Include="../DiunaBI.Plugins.Morska/bin/$(Configuration)/$(TargetFramework)/DiunaBI.Plugins.Morska.dll" />
</ItemGroup> <ItemGroup>
<MakeDir Directories="$(OutputPath)Plugins" /> <PluginFiles Include="../DiunaBI.Plugins.Morska/bin/$(Configuration)/$(TargetFramework)/DiunaBI.Plugins.Morska.dll" />
<Copy SourceFiles="@(PluginFiles)" DestinationFolder="$(OutputPath)Plugins" /> </ItemGroup>
</Target> <MakeDir Directories="$(OutputPath)Plugins" />
<Copy SourceFiles="@(PluginFiles)" DestinationFolder="$(OutputPath)Plugins" />
</Target>
</Project> </Project>

View File

@@ -1,170 +1,169 @@
using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.IdentityModel.Tokens; using Microsoft.IdentityModel.Tokens;
using System.IdentityModel.Tokens.Jwt; using System.IdentityModel.Tokens.Jwt;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
using DiunaBI.Core.Database.Context; using DiunaBI.Infrastructure.Data;
using DiunaBI.Core.Services; using DiunaBI.Infrastructure.Services;
using Google.Apis.Sheets.v4; using Google.Apis.Sheets.v4;
using Serilog; using Serilog;
using DiunaBI.Core.Interfaces;
var builder = WebApplication.CreateBuilder(args);
var builder = WebApplication.CreateBuilder(args);
if (builder.Environment.IsProduction())
if (builder.Environment.IsProduction()) {
{ builder.Host.UseSerilog((context, configuration) =>
builder.Host.UseSerilog((context, configuration) => {
{ var instanceName = context.Configuration["InstanceName"] ?? "unknown";
var instanceName = context.Configuration["InstanceName"] ?? "unknown"; configuration
configuration .ReadFrom.Configuration(context.Configuration)
.ReadFrom.Configuration(context.Configuration) .Enrich.FromLogContext()
.Enrich.FromLogContext() .Enrich.WithProperty("Application", $"DiunaBI-{instanceName}")
.Enrich.WithProperty("Application", $"DiunaBI-{instanceName}") .Enrich.WithProperty("Version", Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "unknown")
.Enrich.WithProperty("Version", Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "unknown") .Enrich.WithEnvironmentName()
.Enrich.WithEnvironmentName() .Enrich.WithMachineName();
.Enrich.WithMachineName(); });
}); }
}
var connectionString = builder.Configuration.GetConnectionString("SQLDatabase");
var connectionString = builder.Configuration.GetConnectionString("SQLDatabase");
builder.Services.AddDbContext<AppDbContext>(x =>
builder.Services.AddDbContext<AppDbContext>(x => {
{ x.UseSqlServer(connectionString);
x.UseSqlServer(connectionString); x.EnableSensitiveDataLogging();
x.EnableSensitiveDataLogging(); });
});
builder.Services.AddCors(options =>
builder.Services.AddCors(options => {
{ options.AddPolicy("CORSPolicy", corsPolicyBuilder =>
options.AddPolicy("CORSPolicy", corsPolicyBuilder => {
{ corsPolicyBuilder.WithOrigins("http://localhost:4200")
corsPolicyBuilder.WithOrigins("http://localhost:4200") .AllowAnyMethod()
.AllowAnyMethod() .AllowAnyHeader()
.AllowAnyHeader() .AllowCredentials();
.AllowCredentials();
corsPolicyBuilder.WithOrigins("https://diuna.bim-it.pl")
corsPolicyBuilder.WithOrigins("https://diuna.bim-it.pl") .AllowAnyMethod()
.AllowAnyMethod() .AllowAnyHeader()
.AllowAnyHeader() .AllowCredentials();
.AllowCredentials();
corsPolicyBuilder.WithOrigins("https://morska.diunabi.com")
corsPolicyBuilder.WithOrigins("https://morska.diunabi.com") .AllowAnyMethod()
.AllowAnyMethod() .AllowAnyHeader()
.AllowAnyHeader() .AllowCredentials();
.AllowCredentials(); });
}); });
});
builder.Services.AddControllers();
builder.Services.AddControllers();
builder.Services.AddAuthentication(options =>
builder.Services.AddAuthentication(options => {
{ options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; options.DefaultScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultScheme = JwtBearerDefaults.AuthenticationScheme; }).AddJwtBearer(options =>
}).AddJwtBearer(options => {
{ options.TokenValidationParameters = new TokenValidationParameters
options.TokenValidationParameters = new TokenValidationParameters {
{ ValidateIssuer = false,
ValidateIssuer = false, ValidateAudience = false,
ValidateAudience = false, ValidateLifetime = true,
ValidateLifetime = true, ValidateIssuerSigningKey = true,
ValidateIssuerSigningKey = true, IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(builder.Configuration["Secret"]!))
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(builder.Configuration["Secret"]!)) };
}; });
});
// Google Sheets dependencies
// Google Sheets dependencies Console.WriteLine("Adding Google Sheets dependencies...");
Console.WriteLine("Adding Google Sheets dependencies..."); builder.Services.AddSingleton<GoogleSheetsHelper>();
builder.Services.AddSingleton<GoogleSheetsHelper>(); builder.Services.AddSingleton<GoogleDriveHelper>();
builder.Services.AddSingleton<GoogleDriveHelper>(); builder.Services.AddSingleton<SpreadsheetsResource.ValuesResource>(provider =>
builder.Services.AddSingleton<SpreadsheetsResource.ValuesResource>(provider => {
{ var googleSheetsHelper = provider.GetRequiredService<GoogleSheetsHelper>();
var googleSheetsHelper = provider.GetRequiredService<GoogleSheetsHelper>(); var valuesResource = googleSheetsHelper.Service?.Spreadsheets.Values;
var valuesResource = googleSheetsHelper.Service?.Spreadsheets.Values;
if (valuesResource == null)
if (valuesResource == null) {
{ throw new InvalidOperationException("Google Sheets Service is not initialized properly");
throw new InvalidOperationException("Google Sheets Service is not initialized properly"); }
}
return valuesResource;
return valuesResource; });
});
builder.Services.AddSingleton<PluginManager>();
builder.Services.AddSingleton<PluginManager>();
var app = builder.Build();
var app = builder.Build();
if (app.Environment.IsProduction())
if (app.Environment.IsProduction()) {
{ app.UseSerilogRequestLogging(options =>
app.UseSerilogRequestLogging(options => {
{ options.MessageTemplate = "HTTP {RequestMethod} {RequestPath} responded {StatusCode} in {Elapsed:0.0000} ms";
options.MessageTemplate = "HTTP {RequestMethod} {RequestPath} responded {StatusCode} in {Elapsed:0.0000} ms"; options.EnrichDiagnosticContext = (diagnosticContext, httpContext) =>
options.EnrichDiagnosticContext = (diagnosticContext, httpContext) => {
{ diagnosticContext.Set("RequestHost", httpContext.Request.Host.Value);
diagnosticContext.Set("RequestHost", httpContext.Request.Host.Value); diagnosticContext.Set("RequestScheme", httpContext.Request.Scheme);
diagnosticContext.Set("RequestScheme", httpContext.Request.Scheme);
var userAgent = httpContext.Request.Headers.UserAgent.FirstOrDefault();
var userAgent = httpContext.Request.Headers.UserAgent.FirstOrDefault(); if (!string.IsNullOrEmpty(userAgent))
if (!string.IsNullOrEmpty(userAgent)) {
{ diagnosticContext.Set("UserAgent", userAgent);
diagnosticContext.Set("UserAgent", userAgent); }
}
diagnosticContext.Set("RemoteIP", httpContext.Connection.RemoteIpAddress?.ToString() ?? "unknown");
diagnosticContext.Set("RemoteIP", httpContext.Connection.RemoteIpAddress?.ToString() ?? "unknown"); diagnosticContext.Set("RequestContentType", httpContext.Request.ContentType ?? "none");
diagnosticContext.Set("RequestContentType", httpContext.Request.ContentType ?? "none"); };
}; });
}); }
}
// Plugin initialization
// Plugin initialization var pluginManager = app.Services.GetRequiredService<PluginManager>();
var pluginManager = app.Services.GetRequiredService<PluginManager>(); var executablePath = Assembly.GetExecutingAssembly().Location;
var executablePath = Assembly.GetExecutingAssembly().Location; var executableDir = Path.GetDirectoryName(executablePath)!;
var executableDir = Path.GetDirectoryName(executablePath)!; var pluginsPath = Path.Combine(executableDir, "Plugins");
var pluginsPath = Path.Combine(executableDir, "Plugins");
if (app.Environment.IsProduction())
if (app.Environment.IsProduction()) {
{ Log.Information("Starting DiunaBI application");
Log.Information("Starting DiunaBI application"); Log.Information("Loading plugins from: {PluginsPath}", pluginsPath);
Log.Information("Loading plugins from: {PluginsPath}", pluginsPath); }
} else
else {
{ var logger = app.Services.GetRequiredService<ILogger<Program>>();
var logger = app.Services.GetRequiredService<ILogger<Program>>(); logger.LogInformation("Starting DiunaBI application (Development)");
logger.LogInformation("Starting DiunaBI application (Development)"); logger.LogInformation("Loading plugins from: {PluginsPath}", pluginsPath);
logger.LogInformation("Loading plugins from: {PluginsPath}", pluginsPath); }
}
pluginManager.LoadPluginsFromDirectory(pluginsPath);
pluginManager.LoadPluginsFromDirectory(pluginsPath);
app.Use(async (context, next) =>
app.Use(async (context, next) => {
{ var token = context.Request.Headers.Authorization.ToString();
var token = context.Request.Headers.Authorization.ToString(); if (token.Length > 0
if (token.Length > 0 && !context.Request.Path.ToString().Contains("getForPowerBI")
&& !context.Request.Path.ToString().Contains("getForPowerBI") && !context.Request.Path.ToString().Contains("getConfiguration")
&& !context.Request.Path.ToString().Contains("getConfiguration") && !context.Request.Path.ToString().Contains("DataInbox/Add"))
&& !context.Request.Path.ToString().Contains("DataInbox/Add")) {
{ var handler = new JwtSecurityTokenHandler();
var handler = new JwtSecurityTokenHandler(); var data = handler.ReadJwtToken(token.Split(' ')[1]);
var data = handler.ReadJwtToken(token.Split(' ')[1]); context.Request.Headers.Append("UserId", new Microsoft.Extensions.Primitives.StringValues(data.Subject));
context.Request.Headers.Append("UserId", new Microsoft.Extensions.Primitives.StringValues(data.Subject)); }
} await next(context);
await next(context); });
});
app.UseCors("CORSPolicy");
app.UseCors("CORSPolicy");
app.UseAuthentication();
app.UseAuthentication(); app.UseAuthorization();
app.UseAuthorization();
app.MapControllers();
app.MapControllers();
app.Run();
app.Run();
if (app.Environment.IsProduction())
if (app.Environment.IsProduction()) {
{ Log.CloseAndFlush();
Log.CloseAndFlush(); }
} // for testing purposes
// for testing purposes
public partial class Program { } public partial class Program { }

View File

@@ -1,23 +1,23 @@
{ {
"$schema": "https://json.schemastore.org/launchsettings.json", "$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": { "profiles": {
"http": { "http": {
"commandName": "Project", "commandName": "Project",
"dotnetRunMessages": true, "dotnetRunMessages": true,
"launchBrowser": false, "launchBrowser": false,
"applicationUrl": "http://localhost:5163", "applicationUrl": "http://localhost:5163",
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
} }
}, },
"https": { "https": {
"commandName": "Project", "commandName": "Project",
"dotnetRunMessages": true, "dotnetRunMessages": true,
"launchBrowser": false, "launchBrowser": false,
"applicationUrl": "https://localhost:7148;http://localhost:5163", "applicationUrl": "https://localhost:7148;http://localhost:5163",
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
} }
} }
} }
} }

View File

@@ -1,69 +1,69 @@
{ {
"PONG": "#{PING}#", "PONG": "#{PING}#",
"app-version": "#{buildId}#", "app-version": "#{buildId}#",
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {
"Default": "Information", "Default": "Information",
"Microsoft.AspNetCore": "Warning" "Microsoft.AspNetCore": "Warning"
} }
}, },
"Serilog": { "Serilog": {
"MinimumLevel": { "MinimumLevel": {
"Default": "Information", "Default": "Information",
"Override": { "Override": {
"Microsoft.AspNetCore": "Warning", "Microsoft.AspNetCore": "Warning",
"Microsoft.EntityFrameworkCore.Database.Command": "Warning", "Microsoft.EntityFrameworkCore.Database.Command": "Warning",
"Microsoft.EntityFrameworkCore.Infrastructure": "Warning", "Microsoft.EntityFrameworkCore.Infrastructure": "Warning",
"System.Net.Http.HttpClient": "Warning", "System.Net.Http.HttpClient": "Warning",
"Google.Apis": "Warning", "Google.Apis": "Warning",
"DiunaBI.Core.Services.PluginManager": "Information" "DiunaBI.Core.Services.PluginManager": "Information"
} }
}, },
"WriteTo": [ "WriteTo": [
{ {
"Name": "Console", "Name": "Console",
"Args": { "Args": {
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}" "outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}"
} }
}, },
{ {
"Name": "File", "Name": "File",
"Args": { "Args": {
"path": "/var/log/diunabi/app-.log", "path": "/var/log/diunabi/app-.log",
"rollingInterval": "Day", "rollingInterval": "Day",
"retainedFileCountLimit": 30, "retainedFileCountLimit": 30,
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {SourceContext} {Message:lj} {Properties:j}{NewLine}{Exception}" "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {SourceContext} {Message:lj} {Properties:j}{NewLine}{Exception}"
} }
}, },
{ {
"Name": "Seq", "Name": "Seq",
"Args": { "Args": {
"serverUrl": "http://localhost:5341", "serverUrl": "http://localhost:5341",
"restrictedToMinimumLevel": "Information" "restrictedToMinimumLevel": "Information"
} }
} }
], ],
"Enrich": ["FromLogContext", "WithMachineName", "WithThreadId"] "Enrich": ["FromLogContext", "WithMachineName", "WithThreadId"]
}, },
"AllowedHosts": "*", "AllowedHosts": "*",
"ConnectionStrings": { "ConnectionStrings": {
"SQLDatabase": "#{db-connection-string}#" "SQLDatabase": "#{db-connection-string}#"
}, },
"InstanceName": "#{app-environment}#", "InstanceName": "#{app-environment}#",
"GoogleClientId": "#{google-backend-login-client-id}#", "GoogleClientId": "#{google-backend-login-client-id}#",
"Secret": "#{google-backend-login-secret}#", "Secret": "#{google-backend-login-secret}#",
"apiKey": "#{api-key}#", "apiKey": "#{api-key}#",
"powerBI-user": "#{powerBI-user}#", "powerBI-user": "#{powerBI-user}#",
"powerBI-pass": "#{powerBI-pass}#", "powerBI-pass": "#{powerBI-pass}#",
"morska-user": "#{morska-user}#", "morska-user": "#{morska-user}#",
"morska-pass": "#{morska-pass}#", "morska-pass": "#{morska-pass}#",
"exportDirectory": "#{export-directory}#", "exportDirectory": "#{export-directory}#",
"apiLocalUrl": "#{api-local-url}#", "apiLocalUrl": "#{api-local-url}#",
"Kestrel": { "Kestrel": {
"Endpoints": { "Endpoints": {
"Http": { "Http": {
"Url": "http://#{api-local-url}#" "Url": "http://#{api-local-url}#"
} }
} }
} }
} }

View File

@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>12.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\DiunaBI.Domain\DiunaBI.Domain.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="AngouriMath" Version="1.4.0-preview.3" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
</ItemGroup>
</Project>

View File

@@ -1,24 +0,0 @@
using Microsoft.EntityFrameworkCore;
using DiunaBI.Core.Models;
using Microsoft.Extensions.Logging;
namespace DiunaBI.Core.Database.Context;
public class AppDbContext(DbContextOptions<AppDbContext> options) : DbContext(options)
{
public DbSet<User> Users { get; init; }
public DbSet<Layer> Layers { get; init; }
public DbSet<Record> Records { get; init; }
public DbSet<ProcessSource> ProcessSources { get; init; }
public DbSet<DataInbox> DataInbox { get; init; }
public DbSet<QueueJob> QueueJobs { get; init; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<ProcessSource>().HasKey(x => new
{
x.LayerId,
x.SourceId
});
}
}

View File

@@ -1,29 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageReference Include="Google.Apis.Drive.v3" Version="1.68.0.3490" />
<PackageReference Include="Google.Apis.Sheets.v4" Version="1.68.0.3525" />
<PackageReference Include="Google.Apis.Auth" Version="1.68.0" />
<PackageReference Include="AngouriMath" Version="1.4.0-preview.3" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>12.0</LangVersion>
</PropertyGroup>
</Project>

View File

@@ -1,19 +1,15 @@
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
namespace DiunaBI.Core.Models; namespace DiunaBI.Domain.Entities;
public class DataInbox public class DataInbox
{ {
#region Properties #region Properties
[Key] public Guid Id { get; set; }
public Guid Id { get; set; } public required string Name { get; init; }
[StringLength(50)] public required string Source { get; set; }
public required string Name { get; init; } public required string Data { get; init; }
[StringLength(50)] public DateTime CreatedAt { get; set; }
public required string Source { get; set; } #endregion
[StringLength(int.MaxValue)]
public required string Data { get; init; }
public DateTime CreatedAt { get; set; }
#endregion
} }

View File

@@ -1,45 +1,34 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
namespace DiunaBI.Core.Models; namespace DiunaBI.Domain.Entities;
public enum LayerType public enum LayerType
{ {
Import, Import,
Processed, Processed,
Administration, Administration,
Dictionary, Dictionary,
} }
public class Layer public class Layer
{ {
#region Properties #region Properties
[Key] public Guid Id { get; init; }
public Guid Id { get; init; } public int Number { get; init; }
[Required] public string? Name { get; set; }
public int Number { get; init; } public LayerType Type { get; init; }
[Required] public DateTime CreatedAt { get; set; }
[MaxLength(50)] public DateTime ModifiedAt { get; set; }
public string? Name { get; set; } public bool IsDeleted { get; init; } = false;
[Required] public bool IsCancelled { get; init; } = false;
public LayerType Type { get; init; } #endregion
[Required] #region Relations
public DateTime CreatedAt { get; set; } public ICollection<Record>? Records { get; init; }
[Required] public Guid CreatedById { get; set; }
public DateTime ModifiedAt { get; set; } public User? CreatedBy { get; init; }
[Required] public Guid ModifiedById { get; set; }
public bool IsDeleted { get; init; } = false; public User? ModifiedBy { get; init; }
[Required] public Guid? ParentId { get; init; }
public bool IsCancelled { get; init; } = false; #endregion
#endregion
#region Relations
public ICollection<Record>? Records { get; init; }
[Required]
public Guid CreatedById { get; set; }
public User? CreatedBy { get; init; }
[Required]
public Guid ModifiedById { get; set; }
public User? ModifiedBy { get; init; }
public Guid? ParentId { get; init; }
#endregion
} }

View File

@@ -1,15 +1,13 @@
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
namespace DiunaBI.Core.Models; namespace DiunaBI.Domain.Entities;
public class ProcessSource public class ProcessSource
{ {
#region Relations #region Relations
[Required] public Guid LayerId { get; init; }
public Guid LayerId { get; init; } public Guid SourceId { get; init; }
[Required] public Layer? Source { get; init; }
public Guid SourceId { get; init; } #endregion
public Layer? Source { get; init; }
#endregion
} }

View File

@@ -1,56 +1,26 @@
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
namespace DiunaBI.Core.Models; namespace DiunaBI.Domain.Entities;
public class QueueJob public class QueueJob
{ {
[Key]
public Guid Id { get; set; } = Guid.NewGuid(); public Guid Id { get; set; } = Guid.NewGuid();
[Required]
public Guid LayerId { get; set; } public Guid LayerId { get; set; }
[Required]
[MaxLength(200)]
public string LayerName { get; set; } = string.Empty; public string LayerName { get; set; } = string.Empty;
[Required]
[MaxLength(100)]
public string PluginName { get; set; } = string.Empty; public string PluginName { get; set; } = string.Empty;
[Required]
public JobType JobType { get; set; } public JobType JobType { get; set; }
public int Priority { get; set; } = 0; // 0 = highest priority public int Priority { get; set; } = 0; // 0 = highest priority
[Required]
public DateTime CreatedAt { get; set; } = DateTime.UtcNow; public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public int RetryCount { get; set; } = 0; public int RetryCount { get; set; } = 0;
public int MaxRetries { get; set; } = 5; public int MaxRetries { get; set; } = 5;
[Required]
public JobStatus Status { get; set; } = JobStatus.Pending; public JobStatus Status { get; set; } = JobStatus.Pending;
[MaxLength(1000)]
public string? LastError { get; set; } public string? LastError { get; set; }
public DateTime? LastAttemptAt { get; set; } public DateTime? LastAttemptAt { get; set; }
public DateTime? CompletedAt { get; set; } public DateTime? CompletedAt { get; set; }
[Required]
public Guid CreatedById { get; set; } public Guid CreatedById { get; set; }
[Required]
public DateTime CreatedAtUtc { get; set; } = DateTime.UtcNow; public DateTime CreatedAtUtc { get; set; } = DateTime.UtcNow;
[Required]
public Guid ModifiedById { get; set; } public Guid ModifiedById { get; set; }
[Required]
public DateTime ModifiedAtUtc { get; set; } = DateTime.UtcNow; public DateTime ModifiedAtUtc { get; set; } = DateTime.UtcNow;
} }

View File

@@ -1,15 +1,12 @@
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
namespace DiunaBI.Core.Models; namespace DiunaBI.Domain.Entities;
public class Record public class Record
{ {
#region Properties #region Properties
[Key]
public Guid Id { get; set; } public Guid Id { get; set; }
[Required]
[StringLength(50)]
public string? Code { get; init; } public string? Code { get; init; }
public double? Value1 { get; set; } public double? Value1 { get; set; }
public double? Value2 { get; set; } public double? Value2 { get; set; }
@@ -43,18 +40,14 @@ public class Record
public double? Value30 { get; set; } public double? Value30 { get; set; }
public double? Value31 { get; set; } public double? Value31 { get; set; }
public double? Value32 { get; set; } public double? Value32 { get; set; }
//Description fields
[StringLength(10000)]
public string? Desc1 { get; set; } public string? Desc1 { get; set; }
public DateTime CreatedAt { get; set; } public DateTime CreatedAt { get; set; }
public DateTime ModifiedAt { get; set; } public DateTime ModifiedAt { get; set; }
public bool IsDeleted { get; init; } public bool IsDeleted { get; init; }
#endregion #endregion
#region Relations #region Relations
[Required]
public Guid CreatedById { get; set; } public Guid CreatedById { get; set; }
public User? CreatedBy { get; init; } public User? CreatedBy { get; init; }
[Required]
public Guid ModifiedById { get; set; } public Guid ModifiedById { get; set; }
public User? ModifiedBy { get; init; } public User? ModifiedBy { get; init; }
public Guid LayerId { get; set; } public Guid LayerId { get; set; }

View File

@@ -1,17 +1,14 @@
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
namespace DiunaBI.Core.Models; namespace DiunaBI.Domain.Entities;
public class User public class User
{ {
#region Properties #region Properties
[Key] public Guid Id { get; init; }
public Guid Id { get; init; } public string? Email { get; init; }
[StringLength(50)] public string? UserName { get; init; }
public string? Email { get; init; } public DateTime CreatedAt { get; init; }
[StringLength(50)] #endregion
public string? UserName { get; init; }
public DateTime CreatedAt { get; init; }
#endregion
} }

View File

@@ -0,0 +1,183 @@
using Microsoft.EntityFrameworkCore;
using DiunaBI.Domain.Entities;
namespace DiunaBI.Infrastructure.Data;
public class AppDbContext(DbContextOptions<AppDbContext> options) : DbContext(options)
{
public DbSet<User> Users { get; init; }
public DbSet<Layer> Layers { get; init; }
public DbSet<Record> Records { get; init; }
public DbSet<ProcessSource> ProcessSources { get; init; }
public DbSet<DataInbox> DataInbox { get; init; }
public DbSet<QueueJob> QueueJobs { get; init; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<User>().HasKey(x => x.Id);
modelBuilder.Entity<User>().Property(x => x.Email).HasMaxLength(50);
modelBuilder.Entity<User>().Property(x => x.UserName).HasMaxLength(50);
modelBuilder.Entity<Layer>().HasKey(x => x.Id);
modelBuilder.Entity<Layer>().Property(x => x.Number).IsRequired();
modelBuilder.Entity<Layer>().Property(x => x.Name).IsRequired().HasMaxLength(50);
modelBuilder.Entity<Layer>().Property(x => x.Type).IsRequired().HasConversion<int>();
modelBuilder.Entity<Layer>().Property(x => x.CreatedAt).IsRequired();
modelBuilder.Entity<Layer>().Property(x => x.ModifiedAt).IsRequired();
modelBuilder.Entity<Layer>().Property(x => x.IsDeleted).IsRequired().HasDefaultValue(false);
modelBuilder.Entity<Layer>().Property(x => x.IsCancelled).IsRequired();
modelBuilder.Entity<Layer>().Property(x => x.CreatedById).IsRequired();
modelBuilder.Entity<Layer>().Property(x => x.ModifiedById).IsRequired();
modelBuilder.Entity<Layer>()
.HasOne(x => x.CreatedBy)
.WithMany()
.HasForeignKey(x => x.CreatedById)
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<Layer>()
.HasOne(x => x.ModifiedBy)
.WithMany()
.HasForeignKey(x => x.ModifiedById)
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<Layer>()
.HasMany(x => x.Records)
.WithOne()
.HasForeignKey(r => r.LayerId)
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<Record>().HasKey(x => x.Id);
modelBuilder.Entity<Record>().Property(x => x.Code).IsRequired().HasMaxLength(50);
modelBuilder.Entity<Record>().Property(x => x.Desc1).HasMaxLength(10000);
modelBuilder.Entity<Record>().Property(x => x.CreatedAt);
modelBuilder.Entity<Record>().Property(x => x.ModifiedAt);
modelBuilder.Entity<Record>().Property(x => x.IsDeleted);
modelBuilder.Entity<Record>().Property(x => x.CreatedById).IsRequired();
modelBuilder.Entity<Record>().Property(x => x.ModifiedById).IsRequired();
modelBuilder.Entity<Record>().Property(x => x.LayerId).IsRequired();
modelBuilder.Entity<Record>()
.HasOne(x => x.CreatedBy)
.WithMany()
.HasForeignKey(x => x.CreatedById)
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<Record>()
.HasOne(x => x.ModifiedBy)
.WithMany()
.HasForeignKey(x => x.ModifiedById)
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<Record>()
.HasOne<Layer>()
.WithMany(l => l.Records!)
.HasForeignKey(x => x.LayerId)
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<ProcessSource>().HasKey(x => new { x.LayerId, x.SourceId });
modelBuilder.Entity<ProcessSource>().Property(x => x.LayerId).IsRequired();
modelBuilder.Entity<ProcessSource>().Property(x => x.SourceId).IsRequired();
modelBuilder.Entity<ProcessSource>()
.HasOne<Layer>()
.WithMany()
.HasForeignKey(x => x.LayerId)
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<ProcessSource>()
.HasOne(x => x.Source)
.WithMany()
.HasForeignKey(x => x.SourceId)
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<DataInbox>().HasKey(x => x.Id);
modelBuilder.Entity<DataInbox>().Property(x => x.Name).IsRequired().HasMaxLength(50);
modelBuilder.Entity<DataInbox>().Property(x => x.Source).IsRequired().HasMaxLength(50);
modelBuilder.Entity<DataInbox>().Property(x => x.Data).IsRequired();
modelBuilder.Entity<DataInbox>().Property(x => x.CreatedAt);
modelBuilder.Entity<QueueJob>().HasKey(x => x.Id);
modelBuilder.Entity<QueueJob>().Property(x => x.LayerId).IsRequired();
modelBuilder.Entity<QueueJob>().Property(x => x.LayerName).IsRequired().HasMaxLength(200);
modelBuilder.Entity<QueueJob>().Property(x => x.PluginName).IsRequired().HasMaxLength(100);
modelBuilder.Entity<QueueJob>().Property(x => x.JobType).IsRequired().HasConversion<int>();
modelBuilder.Entity<QueueJob>().Property(x => x.Priority);
modelBuilder.Entity<QueueJob>().Property(x => x.CreatedAt).IsRequired();
modelBuilder.Entity<QueueJob>().Property(x => x.RetryCount);
modelBuilder.Entity<QueueJob>().Property(x => x.MaxRetries);
modelBuilder.Entity<QueueJob>().Property(x => x.Status).IsRequired().HasConversion<int>();
modelBuilder.Entity<QueueJob>().Property(x => x.LastError).HasMaxLength(1000);
modelBuilder.Entity<QueueJob>().Property(x => x.LastAttemptAt);
modelBuilder.Entity<QueueJob>().Property(x => x.CompletedAt);
modelBuilder.Entity<QueueJob>().Property(x => x.CreatedById).IsRequired();
modelBuilder.Entity<QueueJob>().Property(x => x.CreatedAtUtc).IsRequired();
modelBuilder.Entity<QueueJob>().Property(x => x.ModifiedById).IsRequired();
modelBuilder.Entity<QueueJob>().Property(x => x.ModifiedAtUtc).IsRequired();
// Configure automatic timestamps for entities with CreatedAt/ModifiedAt
ConfigureTimestamps(modelBuilder);
}
private void ConfigureTimestamps(ModelBuilder modelBuilder)
{
foreach (var entityType in modelBuilder.Model.GetEntityTypes())
{
// Check if entity has CreatedAt property
var createdAtProperty = entityType.FindProperty("CreatedAt");
if (createdAtProperty != null)
{
modelBuilder.Entity(entityType.ClrType)
.Property("CreatedAt")
.HasDefaultValueSql("NOW()");
}
// Check if entity has ModifiedAt property
var modifiedAtProperty = entityType.FindProperty("ModifiedAt");
if (modifiedAtProperty != null)
{
modelBuilder.Entity(entityType.ClrType)
.Property("ModifiedAt")
.HasDefaultValueSql("NOW()");
}
}
}
public override int SaveChanges()
{
UpdateTimestamps();
return base.SaveChanges();
}
public override Task<int> SaveChangesAsync(CancellationToken cancellationToken = default)
{
UpdateTimestamps();
return base.SaveChangesAsync(cancellationToken);
}
private void UpdateTimestamps()
{
var entities = ChangeTracker.Entries()
.Where(e => e.State == EntityState.Added || e.State == EntityState.Modified);
foreach (var entity in entities)
{
// Try to set CreatedAt for new entities
if (entity.State == EntityState.Added)
{
var createdAtProperty = entity.Properties.FirstOrDefault(p => p.Metadata.Name == "CreatedAt");
if (createdAtProperty != null)
{
createdAtProperty.CurrentValue = DateTime.UtcNow;
}
}
// Always update ModifiedAt
var modifiedAtProperty = entity.Properties.FirstOrDefault(p => p.Metadata.Name == "ModifiedAt");
if (modifiedAtProperty != null)
{
modifiedAtProperty.CurrentValue = DateTime.UtcNow;
}
}
}
}

View File

@@ -4,14 +4,14 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design; using Microsoft.EntityFrameworkCore.Design;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
namespace DiunaBI.Core.Database.Context; namespace DiunaBI.Infrastructure.Data;
public class DesignTimeDbContextFactory : IDesignTimeDbContextFactory<AppDbContext> public class DesignTimeDbContextFactory : IDesignTimeDbContextFactory<AppDbContext>
{ {
public AppDbContext CreateDbContext(string[] args) public AppDbContext CreateDbContext(string[] args)
{ {
var configuration = new ConfigurationBuilder() var configuration = new ConfigurationBuilder()
.SetBasePath(Path.Combine(Directory.GetCurrentDirectory(), "../DiunaBI.WebAPI")) .SetBasePath(Path.Combine(Directory.GetCurrentDirectory(), "../DiunaBI.API"))
.AddJsonFile("appsettings.json", optional: false) .AddJsonFile("appsettings.json", optional: false)
.AddJsonFile("appsettings.Development.json", optional: true) .AddJsonFile("appsettings.Development.json", optional: true)
.Build(); .Build();

View File

@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>12.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\DiunaBI.Domain\DiunaBI.Domain.csproj" />
<ProjectReference Include="..\DiunaBI.Application\DiunaBI.Application.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0" />
<PackageReference Include="Google.Apis.Sheets.v4" Version="1.68.0.3525" />
<PackageReference Include="Google.Apis.Drive.v3" Version="1.68.0.3490" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
</ItemGroup>
</Project>

View File

@@ -1,6 +1,6 @@
using DiunaBI.Core.Models; using DiunaBI.Domain.Entities;
namespace DiunaBI.Core.Interfaces; namespace DiunaBI.Infrastructure.Interfaces;
public interface IDataExporter public interface IDataExporter
{ {

View File

@@ -1,6 +1,6 @@
using DiunaBI.Core.Models; using DiunaBI.Domain.Entities;
namespace DiunaBI.Core.Interfaces; namespace DiunaBI.Infrastructure.Interfaces;
public interface IDataImporter public interface IDataImporter
{ {

View File

@@ -1,6 +1,6 @@
using DiunaBI.Core.Models; using DiunaBI.Domain.Entities;
namespace DiunaBI.Core.Interfaces; namespace DiunaBI.Infrastructure.Interfaces;
public interface IDataProcessor public interface IDataProcessor
{ {

View File

@@ -1,4 +1,4 @@
namespace DiunaBI.Core.Interfaces; namespace DiunaBI.Infrastructure.Interfaces;
public interface IPlugin public interface IPlugin
{ {

View File

@@ -1,52 +1,52 @@
// <auto-generated /> // <auto-generated />
using System; using System;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using DiunaBI.Core.Models; using DiunaBI.Domain.Entities;
using DiunaBI.Core.Database.Context; using DiunaBI.Infrastructure.Data;
#nullable disable #nullable disable
namespace DiunaBI.Core.Migrations namespace DiunaBI.Core.Migrations
{ {
[DbContext(typeof(AppDbContext))] [DbContext(typeof(AppDbContext))]
[Migration("20221205190148_Initial")] [Migration("20221205190148_Initial")]
partial class Initial partial class Initial
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "7.0.0") .HasAnnotation("ProductVersion", "7.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 128); .HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("WebAPI.Models.User", b => modelBuilder.Entity("WebAPI.Models.User", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreatedAt") b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<string>("Email") b.Property<string>("Email")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("UserName") b.Property<string>("UserName")
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("nvarchar(50)");
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("Users"); b.ToTable("Users");
}); });
#pragma warning restore 612, 618 #pragma warning restore 612, 618
} }
} }
} }

View File

@@ -1,36 +1,36 @@
using System; using System;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable #nullable disable
namespace DiunaBI.Core.Migrations namespace DiunaBI.Infrastructure.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class Initial : Migration public partial class Initial : Migration
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "Users", name: "Users",
columns: table => new columns: table => new
{ {
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Email = table.Column<string>(type: "nvarchar(max)", nullable: true), Email = table.Column<string>(type: "nvarchar(max)", nullable: true),
UserName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true), UserName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false) CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_Users", x => x.Id); table.PrimaryKey("PK_Users", x => x.Id);
}); });
} }
/// <inheritdoc /> /// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Users"); name: "Users");
} }
} }
} }

View File

@@ -1,193 +1,193 @@
// <auto-generated /> // <auto-generated />
using System; using System;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using DiunaBI.Core.Models; using DiunaBI.Domain.Entities;
using DiunaBI.Core.Database.Context; using DiunaBI.Infrastructure.Data;
#nullable disable #nullable disable
namespace DiunaBI.Core.Migrations namespace DiunaBI.Core.Migrations
{ {
[DbContext(typeof(AppDbContext))] [DbContext(typeof(AppDbContext))]
[Migration("20221211210507_DataSetsAndDataRows")] [Migration("20221211210507_DataSetsAndDataRows")]
partial class DataSetsAndDataRows partial class DataSetsAndDataRows
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "7.0.0") .HasAnnotation("ProductVersion", "7.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 128); .HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("WebAPI.Models.DataRow", b => modelBuilder.Entity("WebAPI.Models.DataRow", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreatedAt") b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<Guid>("CreatedById") b.Property<Guid>("CreatedById")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<Guid?>("DataSetId") b.Property<Guid?>("DataSetId")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<string>("Desc1") b.Property<string>("Desc1")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("Desc2") b.Property<string>("Desc2")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("Desc3") b.Property<string>("Desc3")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("Desc4") b.Property<string>("Desc4")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("Desc5") b.Property<string>("Desc5")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<bool>("IsDeleted") b.Property<bool>("IsDeleted")
.HasColumnType("bit"); .HasColumnType("bit");
b.Property<string>("MPK") b.Property<string>("MPK")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<DateTime>("ModifiedAt") b.Property<DateTime>("ModifiedAt")
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<Guid>("ModifiedById") b.Property<Guid>("ModifiedById")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<float>("Value") b.Property<float>("Value")
.HasColumnType("real"); .HasColumnType("real");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("CreatedById"); b.HasIndex("CreatedById");
b.HasIndex("DataSetId"); b.HasIndex("DataSetId");
b.HasIndex("ModifiedById"); b.HasIndex("ModifiedById");
b.ToTable("DataRows"); b.ToTable("DataRows");
}); });
modelBuilder.Entity("WebAPI.Models.DataSet", b => modelBuilder.Entity("WebAPI.Models.DataSet", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreatedAt") b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<Guid>("CreatedById") b.Property<Guid>("CreatedById")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<bool>("IsDeleted") b.Property<bool>("IsDeleted")
.HasColumnType("bit"); .HasColumnType("bit");
b.Property<DateTime>("ModifiedAt") b.Property<DateTime>("ModifiedAt")
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<Guid>("ModifiedById") b.Property<Guid>("ModifiedById")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<string>("Name") b.Property<string>("Name")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("Number") b.Property<string>("Number")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("CreatedById"); b.HasIndex("CreatedById");
b.HasIndex("ModifiedById"); b.HasIndex("ModifiedById");
b.ToTable("DataSets"); b.ToTable("DataSets");
}); });
modelBuilder.Entity("WebAPI.Models.User", b => modelBuilder.Entity("WebAPI.Models.User", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreatedAt") b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<string>("Email") b.Property<string>("Email")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("UserName") b.Property<string>("UserName")
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("nvarchar(50)");
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("Users"); b.ToTable("Users");
}); });
modelBuilder.Entity("WebAPI.Models.DataRow", b => modelBuilder.Entity("WebAPI.Models.DataRow", b =>
{ {
b.HasOne("WebAPI.Models.User", "CreatedBy") b.HasOne("WebAPI.Models.User", "CreatedBy")
.WithMany() .WithMany()
.HasForeignKey("CreatedById") .HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.HasOne("WebAPI.Models.DataSet", null) b.HasOne("WebAPI.Models.DataSet", null)
.WithMany("DataRows") .WithMany("DataRows")
.HasForeignKey("DataSetId"); .HasForeignKey("DataSetId");
b.HasOne("WebAPI.Models.User", "ModifiedBy") b.HasOne("WebAPI.Models.User", "ModifiedBy")
.WithMany() .WithMany()
.HasForeignKey("ModifiedById") .HasForeignKey("ModifiedById")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("CreatedBy"); b.Navigation("CreatedBy");
b.Navigation("ModifiedBy"); b.Navigation("ModifiedBy");
}); });
modelBuilder.Entity("WebAPI.Models.DataSet", b => modelBuilder.Entity("WebAPI.Models.DataSet", b =>
{ {
b.HasOne("WebAPI.Models.User", "CreatedBy") b.HasOne("WebAPI.Models.User", "CreatedBy")
.WithMany() .WithMany()
.HasForeignKey("CreatedById") .HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.HasOne("WebAPI.Models.User", "ModifiedBy") b.HasOne("WebAPI.Models.User", "ModifiedBy")
.WithMany() .WithMany()
.HasForeignKey("ModifiedById") .HasForeignKey("ModifiedById")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("CreatedBy"); b.Navigation("CreatedBy");
b.Navigation("ModifiedBy"); b.Navigation("ModifiedBy");
}); });
modelBuilder.Entity("WebAPI.Models.DataSet", b => modelBuilder.Entity("WebAPI.Models.DataSet", b =>
{ {
b.Navigation("DataRows"); b.Navigation("DataRows");
}); });
#pragma warning restore 612, 618 #pragma warning restore 612, 618
} }
} }
} }

View File

@@ -1,121 +1,121 @@
using System; using System;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable #nullable disable
namespace DiunaBI.Core.Migrations namespace DiunaBI.Infrastructure.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class DataSetsAndDataRows : Migration public partial class DataSetsAndDataRows : Migration
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "DataSets", name: "DataSets",
columns: table => new columns: table => new
{ {
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Number = table.Column<string>(type: "nvarchar(max)", nullable: false), Number = table.Column<string>(type: "nvarchar(max)", nullable: false),
Name = table.Column<string>(type: "nvarchar(max)", nullable: true), Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false), CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
ModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false), ModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
IsDeleted = table.Column<bool>(type: "bit", nullable: false), IsDeleted = table.Column<bool>(type: "bit", nullable: false),
CreatedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false), CreatedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ModifiedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false) ModifiedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_DataSets", x => x.Id); table.PrimaryKey("PK_DataSets", x => x.Id);
table.ForeignKey( table.ForeignKey(
name: "FK_DataSets_Users_CreatedById", name: "FK_DataSets_Users_CreatedById",
column: x => x.CreatedById, column: x => x.CreatedById,
principalTable: "Users", principalTable: "Users",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.NoAction); onDelete: ReferentialAction.NoAction);
table.ForeignKey( table.ForeignKey(
name: "FK_DataSets_Users_ModifiedById", name: "FK_DataSets_Users_ModifiedById",
column: x => x.ModifiedById, column: x => x.ModifiedById,
principalTable: "Users", principalTable: "Users",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.NoAction); onDelete: ReferentialAction.NoAction);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "DataRows", name: "DataRows",
columns: table => new columns: table => new
{ {
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
MPK = table.Column<string>(type: "nvarchar(max)", nullable: false), MPK = table.Column<string>(type: "nvarchar(max)", nullable: false),
Value = table.Column<float>(type: "real", nullable: false), Value = table.Column<float>(type: "real", nullable: false),
Desc1 = table.Column<string>(type: "nvarchar(max)", nullable: true), Desc1 = table.Column<string>(type: "nvarchar(max)", nullable: true),
Desc2 = table.Column<string>(type: "nvarchar(max)", nullable: true), Desc2 = table.Column<string>(type: "nvarchar(max)", nullable: true),
Desc3 = table.Column<string>(type: "nvarchar(max)", nullable: true), Desc3 = table.Column<string>(type: "nvarchar(max)", nullable: true),
Desc4 = table.Column<string>(type: "nvarchar(max)", nullable: true), Desc4 = table.Column<string>(type: "nvarchar(max)", nullable: true),
Desc5 = table.Column<string>(type: "nvarchar(max)", nullable: true), Desc5 = table.Column<string>(type: "nvarchar(max)", nullable: true),
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false), CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
ModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false), ModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
IsDeleted = table.Column<bool>(type: "bit", nullable: false), IsDeleted = table.Column<bool>(type: "bit", nullable: false),
CreatedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false), CreatedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ModifiedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false), ModifiedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
DataSetId = table.Column<Guid>(type: "uniqueidentifier", nullable: true) DataSetId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_DataRows", x => x.Id); table.PrimaryKey("PK_DataRows", x => x.Id);
table.ForeignKey( table.ForeignKey(
name: "FK_DataRows_DataSets_DataSetId", name: "FK_DataRows_DataSets_DataSetId",
column: x => x.DataSetId, column: x => x.DataSetId,
principalTable: "DataSets", principalTable: "DataSets",
principalColumn: "Id"); principalColumn: "Id");
table.ForeignKey( table.ForeignKey(
name: "FK_DataRows_Users_CreatedById", name: "FK_DataRows_Users_CreatedById",
column: x => x.CreatedById, column: x => x.CreatedById,
principalTable: "Users", principalTable: "Users",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.NoAction); onDelete: ReferentialAction.NoAction);
table.ForeignKey( table.ForeignKey(
name: "FK_DataRows_Users_ModifiedById", name: "FK_DataRows_Users_ModifiedById",
column: x => x.ModifiedById, column: x => x.ModifiedById,
principalTable: "Users", principalTable: "Users",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.NoAction); onDelete: ReferentialAction.NoAction);
}); });
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_DataRows_CreatedById", name: "IX_DataRows_CreatedById",
table: "DataRows", table: "DataRows",
column: "CreatedById"); column: "CreatedById");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_DataRows_DataSetId", name: "IX_DataRows_DataSetId",
table: "DataRows", table: "DataRows",
column: "DataSetId"); column: "DataSetId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_DataRows_ModifiedById", name: "IX_DataRows_ModifiedById",
table: "DataRows", table: "DataRows",
column: "ModifiedById"); column: "ModifiedById");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_DataSets_CreatedById", name: "IX_DataSets_CreatedById",
table: "DataSets", table: "DataSets",
column: "CreatedById"); column: "CreatedById");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_DataSets_ModifiedById", name: "IX_DataSets_ModifiedById",
table: "DataSets", table: "DataSets",
column: "ModifiedById"); column: "ModifiedById");
} }
/// <inheritdoc /> /// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "DataRows"); name: "DataRows");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "DataSets"); name: "DataSets");
} }
} }
} }

View File

@@ -1,198 +1,198 @@
// <auto-generated /> // <auto-generated />
using System; using System;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using DiunaBI.Core.Models; using DiunaBI.Domain.Entities;
using DiunaBI.Core.Database.Context; using DiunaBI.Infrastructure.Data;
#nullable disable #nullable disable
namespace DiunaBI.Core.Migrations namespace DiunaBI.Core.Migrations
{ {
[DbContext(typeof(AppDbContext))] [DbContext(typeof(AppDbContext))]
[Migration("20221219163620_RenameFields")] [Migration("20221219163620_RenameFields")]
partial class RenameFields partial class RenameFields
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "7.0.0") .HasAnnotation("ProductVersion", "7.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 128); .HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("WebAPI.Models.DataRow", b => modelBuilder.Entity("WebAPI.Models.DataRow", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<string>("Code") b.Property<string>("Code")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreatedAt") b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<Guid>("CreatedById") b.Property<Guid>("CreatedById")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<Guid?>("DataSetId") b.Property<Guid?>("DataSetId")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<string>("Desc1") b.Property<string>("Desc1")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("Desc2") b.Property<string>("Desc2")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("Desc3") b.Property<string>("Desc3")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("Desc4") b.Property<string>("Desc4")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("Desc5") b.Property<string>("Desc5")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<bool>("IsDeleted") b.Property<bool>("IsDeleted")
.HasColumnType("bit"); .HasColumnType("bit");
b.Property<DateTime>("ModifiedAt") b.Property<DateTime>("ModifiedAt")
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<Guid>("ModifiedById") b.Property<Guid>("ModifiedById")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<float>("Value") b.Property<float>("Value")
.HasColumnType("real"); .HasColumnType("real");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("CreatedById"); b.HasIndex("CreatedById");
b.HasIndex("DataSetId"); b.HasIndex("DataSetId");
b.HasIndex("ModifiedById"); b.HasIndex("ModifiedById");
b.ToTable("DataRows"); b.ToTable("DataRows");
}); });
modelBuilder.Entity("WebAPI.Models.DataSet", b => modelBuilder.Entity("WebAPI.Models.DataSet", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreatedAt") b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<Guid>("CreatedById") b.Property<Guid>("CreatedById")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<bool>("IsDeleted") b.Property<bool>("IsDeleted")
.HasColumnType("bit"); .HasColumnType("bit");
b.Property<DateTime>("ModifiedAt") b.Property<DateTime>("ModifiedAt")
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<Guid>("ModifiedById") b.Property<Guid>("ModifiedById")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<string>("Name") b.Property<string>("Name")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<int?>("Number") b.Property<int?>("Number")
.IsRequired() .IsRequired()
.HasColumnType("int"); .HasColumnType("int");
b.Property<string>("Source") b.Property<string>("Source")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("CreatedById"); b.HasIndex("CreatedById");
b.HasIndex("ModifiedById"); b.HasIndex("ModifiedById");
b.ToTable("DataSets"); b.ToTable("DataSets");
}); });
modelBuilder.Entity("WebAPI.Models.User", b => modelBuilder.Entity("WebAPI.Models.User", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreatedAt") b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<string>("Email") b.Property<string>("Email")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("UserName") b.Property<string>("UserName")
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("nvarchar(50)");
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("Users"); b.ToTable("Users");
}); });
modelBuilder.Entity("WebAPI.Models.DataRow", b => modelBuilder.Entity("WebAPI.Models.DataRow", b =>
{ {
b.HasOne("WebAPI.Models.User", "CreatedBy") b.HasOne("WebAPI.Models.User", "CreatedBy")
.WithMany() .WithMany()
.HasForeignKey("CreatedById") .HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.HasOne("WebAPI.Models.DataSet", null) b.HasOne("WebAPI.Models.DataSet", null)
.WithMany("DataRows") .WithMany("DataRows")
.HasForeignKey("DataSetId"); .HasForeignKey("DataSetId");
b.HasOne("WebAPI.Models.User", "ModifiedBy") b.HasOne("WebAPI.Models.User", "ModifiedBy")
.WithMany() .WithMany()
.HasForeignKey("ModifiedById") .HasForeignKey("ModifiedById")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("CreatedBy"); b.Navigation("CreatedBy");
b.Navigation("ModifiedBy"); b.Navigation("ModifiedBy");
}); });
modelBuilder.Entity("WebAPI.Models.DataSet", b => modelBuilder.Entity("WebAPI.Models.DataSet", b =>
{ {
b.HasOne("WebAPI.Models.User", "CreatedBy") b.HasOne("WebAPI.Models.User", "CreatedBy")
.WithMany() .WithMany()
.HasForeignKey("CreatedById") .HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.HasOne("WebAPI.Models.User", "ModifiedBy") b.HasOne("WebAPI.Models.User", "ModifiedBy")
.WithMany() .WithMany()
.HasForeignKey("ModifiedById") .HasForeignKey("ModifiedById")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("CreatedBy"); b.Navigation("CreatedBy");
b.Navigation("ModifiedBy"); b.Navigation("ModifiedBy");
}); });
modelBuilder.Entity("WebAPI.Models.DataSet", b => modelBuilder.Entity("WebAPI.Models.DataSet", b =>
{ {
b.Navigation("DataRows"); b.Navigation("DataRows");
}); });
#pragma warning restore 612, 618 #pragma warning restore 612, 618
} }
} }
} }

View File

@@ -1,73 +1,73 @@
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable #nullable disable
namespace DiunaBI.Core.Migrations namespace DiunaBI.Infrastructure.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class RenameFields : Migration public partial class RenameFields : Migration
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.RenameColumn( migrationBuilder.RenameColumn(
name: "MPK", name: "MPK",
table: "DataRows", table: "DataRows",
newName: "Code"); newName: "Code");
migrationBuilder.AlterColumn<int>( migrationBuilder.AlterColumn<int>(
name: "Number", name: "Number",
table: "DataSets", table: "DataSets",
type: "int", type: "int",
nullable: false, nullable: false,
oldClrType: typeof(string), oldClrType: typeof(string),
oldType: "nvarchar(max)"); oldType: "nvarchar(max)");
migrationBuilder.AlterColumn<string>( migrationBuilder.AlterColumn<string>(
name: "Name", name: "Name",
table: "DataSets", table: "DataSets",
type: "nvarchar(max)", type: "nvarchar(max)",
nullable: false, nullable: false,
defaultValue: "", defaultValue: "",
oldClrType: typeof(string), oldClrType: typeof(string),
oldType: "nvarchar(max)", oldType: "nvarchar(max)",
oldNullable: true); oldNullable: true);
migrationBuilder.AddColumn<string>( migrationBuilder.AddColumn<string>(
name: "Source", name: "Source",
table: "DataSets", table: "DataSets",
type: "nvarchar(max)", type: "nvarchar(max)",
nullable: false, nullable: false,
defaultValue: ""); defaultValue: "");
} }
/// <inheritdoc /> /// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.DropColumn( migrationBuilder.DropColumn(
name: "Source", name: "Source",
table: "DataSets"); table: "DataSets");
migrationBuilder.RenameColumn( migrationBuilder.RenameColumn(
name: "Code", name: "Code",
table: "DataRows", table: "DataRows",
newName: "MPK"); newName: "MPK");
migrationBuilder.AlterColumn<string>( migrationBuilder.AlterColumn<string>(
name: "Number", name: "Number",
table: "DataSets", table: "DataSets",
type: "nvarchar(max)", type: "nvarchar(max)",
nullable: false, nullable: false,
oldClrType: typeof(int), oldClrType: typeof(int),
oldType: "int"); oldType: "int");
migrationBuilder.AlterColumn<string>( migrationBuilder.AlterColumn<string>(
name: "Name", name: "Name",
table: "DataSets", table: "DataSets",
type: "nvarchar(max)", type: "nvarchar(max)",
nullable: true, nullable: true,
oldClrType: typeof(string), oldClrType: typeof(string),
oldType: "nvarchar(max)"); oldType: "nvarchar(max)");
} }
} }
} }

View File

@@ -1,200 +1,200 @@
// <auto-generated /> // <auto-generated />
using System; using System;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using DiunaBI.Core.Models; using DiunaBI.Domain.Entities;
using DiunaBI.Core.Database.Context; using DiunaBI.Infrastructure.Data;
#nullable disable #nullable disable
namespace DiunaBI.Core.Migrations namespace DiunaBI.Core.Migrations
{ {
[DbContext(typeof(AppDbContext))] [DbContext(typeof(AppDbContext))]
[Migration("20221221165749_DataSetIdOnDataRow")] [Migration("20221221165749_DataSetIdOnDataRow")]
partial class DataSetIdOnDataRow partial class DataSetIdOnDataRow
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "7.0.0") .HasAnnotation("ProductVersion", "7.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 128); .HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("WebAPI.Models.DataRow", b => modelBuilder.Entity("WebAPI.Models.DataRow", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<string>("Code") b.Property<string>("Code")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreatedAt") b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<Guid>("CreatedById") b.Property<Guid>("CreatedById")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<Guid>("DataSetId") b.Property<Guid>("DataSetId")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<string>("Desc1") b.Property<string>("Desc1")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("Desc2") b.Property<string>("Desc2")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("Desc3") b.Property<string>("Desc3")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("Desc4") b.Property<string>("Desc4")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("Desc5") b.Property<string>("Desc5")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<bool>("IsDeleted") b.Property<bool>("IsDeleted")
.HasColumnType("bit"); .HasColumnType("bit");
b.Property<DateTime>("ModifiedAt") b.Property<DateTime>("ModifiedAt")
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<Guid>("ModifiedById") b.Property<Guid>("ModifiedById")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<float>("Value") b.Property<float>("Value")
.HasColumnType("real"); .HasColumnType("real");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("CreatedById"); b.HasIndex("CreatedById");
b.HasIndex("DataSetId"); b.HasIndex("DataSetId");
b.HasIndex("ModifiedById"); b.HasIndex("ModifiedById");
b.ToTable("DataRows"); b.ToTable("DataRows");
}); });
modelBuilder.Entity("WebAPI.Models.DataSet", b => modelBuilder.Entity("WebAPI.Models.DataSet", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreatedAt") b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<Guid>("CreatedById") b.Property<Guid>("CreatedById")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<bool>("IsDeleted") b.Property<bool>("IsDeleted")
.HasColumnType("bit"); .HasColumnType("bit");
b.Property<DateTime>("ModifiedAt") b.Property<DateTime>("ModifiedAt")
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<Guid>("ModifiedById") b.Property<Guid>("ModifiedById")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<string>("Name") b.Property<string>("Name")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<int?>("Number") b.Property<int?>("Number")
.IsRequired() .IsRequired()
.HasColumnType("int"); .HasColumnType("int");
b.Property<string>("Source") b.Property<string>("Source")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("CreatedById"); b.HasIndex("CreatedById");
b.HasIndex("ModifiedById"); b.HasIndex("ModifiedById");
b.ToTable("DataSets"); b.ToTable("DataSets");
}); });
modelBuilder.Entity("WebAPI.Models.User", b => modelBuilder.Entity("WebAPI.Models.User", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreatedAt") b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<string>("Email") b.Property<string>("Email")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("UserName") b.Property<string>("UserName")
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("nvarchar(50)");
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("Users"); b.ToTable("Users");
}); });
modelBuilder.Entity("WebAPI.Models.DataRow", b => modelBuilder.Entity("WebAPI.Models.DataRow", b =>
{ {
b.HasOne("WebAPI.Models.User", "CreatedBy") b.HasOne("WebAPI.Models.User", "CreatedBy")
.WithMany() .WithMany()
.HasForeignKey("CreatedById") .HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.HasOne("WebAPI.Models.DataSet", null) b.HasOne("WebAPI.Models.DataSet", null)
.WithMany("DataRows") .WithMany("DataRows")
.HasForeignKey("DataSetId") .HasForeignKey("DataSetId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.HasOne("WebAPI.Models.User", "ModifiedBy") b.HasOne("WebAPI.Models.User", "ModifiedBy")
.WithMany() .WithMany()
.HasForeignKey("ModifiedById") .HasForeignKey("ModifiedById")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("CreatedBy"); b.Navigation("CreatedBy");
b.Navigation("ModifiedBy"); b.Navigation("ModifiedBy");
}); });
modelBuilder.Entity("WebAPI.Models.DataSet", b => modelBuilder.Entity("WebAPI.Models.DataSet", b =>
{ {
b.HasOne("WebAPI.Models.User", "CreatedBy") b.HasOne("WebAPI.Models.User", "CreatedBy")
.WithMany() .WithMany()
.HasForeignKey("CreatedById") .HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.HasOne("WebAPI.Models.User", "ModifiedBy") b.HasOne("WebAPI.Models.User", "ModifiedBy")
.WithMany() .WithMany()
.HasForeignKey("ModifiedById") .HasForeignKey("ModifiedById")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("CreatedBy"); b.Navigation("CreatedBy");
b.Navigation("ModifiedBy"); b.Navigation("ModifiedBy");
}); });
modelBuilder.Entity("WebAPI.Models.DataSet", b => modelBuilder.Entity("WebAPI.Models.DataSet", b =>
{ {
b.Navigation("DataRows"); b.Navigation("DataRows");
}); });
#pragma warning restore 612, 618 #pragma warning restore 612, 618
} }
} }
} }

View File

@@ -1,60 +1,60 @@
using System; using System;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable #nullable disable
namespace DiunaBI.Core.Migrations namespace DiunaBI.Infrastructure.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class DataSetIdOnDataRow : Migration public partial class DataSetIdOnDataRow : Migration
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.DropForeignKey( migrationBuilder.DropForeignKey(
name: "FK_DataRows_DataSets_DataSetId", name: "FK_DataRows_DataSets_DataSetId",
table: "DataRows"); table: "DataRows");
migrationBuilder.AlterColumn<Guid>( migrationBuilder.AlterColumn<Guid>(
name: "DataSetId", name: "DataSetId",
table: "DataRows", table: "DataRows",
type: "uniqueidentifier", type: "uniqueidentifier",
nullable: false, nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
oldClrType: typeof(Guid), oldClrType: typeof(Guid),
oldType: "uniqueidentifier", oldType: "uniqueidentifier",
oldNullable: true); oldNullable: true);
migrationBuilder.AddForeignKey( migrationBuilder.AddForeignKey(
name: "FK_DataRows_DataSets_DataSetId", name: "FK_DataRows_DataSets_DataSetId",
table: "DataRows", table: "DataRows",
column: "DataSetId", column: "DataSetId",
principalTable: "DataSets", principalTable: "DataSets",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
} }
/// <inheritdoc /> /// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.DropForeignKey( migrationBuilder.DropForeignKey(
name: "FK_DataRows_DataSets_DataSetId", name: "FK_DataRows_DataSets_DataSetId",
table: "DataRows"); table: "DataRows");
migrationBuilder.AlterColumn<Guid>( migrationBuilder.AlterColumn<Guid>(
name: "DataSetId", name: "DataSetId",
table: "DataRows", table: "DataRows",
type: "uniqueidentifier", type: "uniqueidentifier",
nullable: true, nullable: true,
oldClrType: typeof(Guid), oldClrType: typeof(Guid),
oldType: "uniqueidentifier"); oldType: "uniqueidentifier");
migrationBuilder.AddForeignKey( migrationBuilder.AddForeignKey(
name: "FK_DataRows_DataSets_DataSetId", name: "FK_DataRows_DataSets_DataSetId",
table: "DataRows", table: "DataRows",
column: "DataSetId", column: "DataSetId",
principalTable: "DataSets", principalTable: "DataSets",
principalColumn: "Id"); principalColumn: "Id");
} }
} }
} }

View File

@@ -1,200 +1,200 @@
// <auto-generated /> // <auto-generated />
using System; using System;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using DiunaBI.Core.Models; using DiunaBI.Domain.Entities;
using DiunaBI.Core.Database.Context; using DiunaBI.Infrastructure.Data;
#nullable disable #nullable disable
namespace DiunaBI.Core.Migrations namespace DiunaBI.Core.Migrations
{ {
[DbContext(typeof(AppDbContext))] [DbContext(typeof(AppDbContext))]
[Migration("20230106095427_RenameModels")] [Migration("20230106095427_RenameModels")]
partial class RenameModels partial class RenameModels
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "7.0.0") .HasAnnotation("ProductVersion", "7.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 128); .HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("WebAPI.Models.Layer", b => modelBuilder.Entity("WebAPI.Models.Layer", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreatedAt") b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<Guid>("CreatedById") b.Property<Guid>("CreatedById")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<bool>("IsDeleted") b.Property<bool>("IsDeleted")
.HasColumnType("bit"); .HasColumnType("bit");
b.Property<DateTime>("ModifiedAt") b.Property<DateTime>("ModifiedAt")
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<Guid>("ModifiedById") b.Property<Guid>("ModifiedById")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<string>("Name") b.Property<string>("Name")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<int?>("Number") b.Property<int?>("Number")
.IsRequired() .IsRequired()
.HasColumnType("int"); .HasColumnType("int");
b.Property<string>("Source") b.Property<string>("Source")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("CreatedById"); b.HasIndex("CreatedById");
b.HasIndex("ModifiedById"); b.HasIndex("ModifiedById");
b.ToTable("Layers"); b.ToTable("Layers");
}); });
modelBuilder.Entity("WebAPI.Models.Record", b => modelBuilder.Entity("WebAPI.Models.Record", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<string>("Code") b.Property<string>("Code")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreatedAt") b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<Guid>("CreatedById") b.Property<Guid>("CreatedById")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<string>("Desc1") b.Property<string>("Desc1")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("Desc2") b.Property<string>("Desc2")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("Desc3") b.Property<string>("Desc3")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("Desc4") b.Property<string>("Desc4")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("Desc5") b.Property<string>("Desc5")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<bool>("IsDeleted") b.Property<bool>("IsDeleted")
.HasColumnType("bit"); .HasColumnType("bit");
b.Property<Guid>("LayerId") b.Property<Guid>("LayerId")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<DateTime>("ModifiedAt") b.Property<DateTime>("ModifiedAt")
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<Guid>("ModifiedById") b.Property<Guid>("ModifiedById")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<float>("Value") b.Property<float>("Value")
.HasColumnType("real"); .HasColumnType("real");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("CreatedById"); b.HasIndex("CreatedById");
b.HasIndex("LayerId"); b.HasIndex("LayerId");
b.HasIndex("ModifiedById"); b.HasIndex("ModifiedById");
b.ToTable("Records"); b.ToTable("Records");
}); });
modelBuilder.Entity("WebAPI.Models.User", b => modelBuilder.Entity("WebAPI.Models.User", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreatedAt") b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<string>("Email") b.Property<string>("Email")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("UserName") b.Property<string>("UserName")
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("nvarchar(50)");
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("Users"); b.ToTable("Users");
}); });
modelBuilder.Entity("WebAPI.Models.Layer", b => modelBuilder.Entity("WebAPI.Models.Layer", b =>
{ {
b.HasOne("WebAPI.Models.User", "CreatedBy") b.HasOne("WebAPI.Models.User", "CreatedBy")
.WithMany() .WithMany()
.HasForeignKey("CreatedById") .HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.HasOne("WebAPI.Models.User", "ModifiedBy") b.HasOne("WebAPI.Models.User", "ModifiedBy")
.WithMany() .WithMany()
.HasForeignKey("ModifiedById") .HasForeignKey("ModifiedById")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("CreatedBy"); b.Navigation("CreatedBy");
b.Navigation("ModifiedBy"); b.Navigation("ModifiedBy");
}); });
modelBuilder.Entity("WebAPI.Models.Record", b => modelBuilder.Entity("WebAPI.Models.Record", b =>
{ {
b.HasOne("WebAPI.Models.User", "CreatedBy") b.HasOne("WebAPI.Models.User", "CreatedBy")
.WithMany() .WithMany()
.HasForeignKey("CreatedById") .HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.HasOne("WebAPI.Models.Layer", null) b.HasOne("WebAPI.Models.Layer", null)
.WithMany("Records") .WithMany("Records")
.HasForeignKey("LayerId") .HasForeignKey("LayerId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.HasOne("WebAPI.Models.User", "ModifiedBy") b.HasOne("WebAPI.Models.User", "ModifiedBy")
.WithMany() .WithMany()
.HasForeignKey("ModifiedById") .HasForeignKey("ModifiedById")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("CreatedBy"); b.Navigation("CreatedBy");
b.Navigation("ModifiedBy"); b.Navigation("ModifiedBy");
}); });
modelBuilder.Entity("WebAPI.Models.Layer", b => modelBuilder.Entity("WebAPI.Models.Layer", b =>
{ {
b.Navigation("Records"); b.Navigation("Records");
}); });
#pragma warning restore 612, 618 #pragma warning restore 612, 618
} }
} }
} }

View File

@@ -1,227 +1,227 @@
using System; using System;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable #nullable disable
namespace DiunaBI.Core.Migrations namespace DiunaBI.Infrastructure.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class RenameModels : Migration public partial class RenameModels : Migration
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "DataRows"); name: "DataRows");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "DataSets"); name: "DataSets");
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "Layers", name: "Layers",
columns: table => new columns: table => new
{ {
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Number = table.Column<int>(type: "int", nullable: false), Number = table.Column<int>(type: "int", nullable: false),
Source = table.Column<string>(type: "nvarchar(max)", nullable: false), Source = table.Column<string>(type: "nvarchar(max)", nullable: false),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false), Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false), CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
ModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false), ModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
IsDeleted = table.Column<bool>(type: "bit", nullable: false), IsDeleted = table.Column<bool>(type: "bit", nullable: false),
CreatedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false), CreatedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ModifiedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false) ModifiedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_Layers", x => x.Id); table.PrimaryKey("PK_Layers", x => x.Id);
table.ForeignKey( table.ForeignKey(
name: "FK_Layers_Users_CreatedById", name: "FK_Layers_Users_CreatedById",
column: x => x.CreatedById, column: x => x.CreatedById,
principalTable: "Users", principalTable: "Users",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.NoAction); onDelete: ReferentialAction.NoAction);
table.ForeignKey( table.ForeignKey(
name: "FK_Layers_Users_ModifiedById", name: "FK_Layers_Users_ModifiedById",
column: x => x.ModifiedById, column: x => x.ModifiedById,
principalTable: "Users", principalTable: "Users",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.NoAction); onDelete: ReferentialAction.NoAction);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "Records", name: "Records",
columns: table => new columns: table => new
{ {
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Code = table.Column<string>(type: "nvarchar(max)", nullable: false), Code = table.Column<string>(type: "nvarchar(max)", nullable: false),
Value = table.Column<float>(type: "real", nullable: false), Value = table.Column<float>(type: "real", nullable: false),
Desc1 = table.Column<string>(type: "nvarchar(max)", nullable: true), Desc1 = table.Column<string>(type: "nvarchar(max)", nullable: true),
Desc2 = table.Column<string>(type: "nvarchar(max)", nullable: true), Desc2 = table.Column<string>(type: "nvarchar(max)", nullable: true),
Desc3 = table.Column<string>(type: "nvarchar(max)", nullable: true), Desc3 = table.Column<string>(type: "nvarchar(max)", nullable: true),
Desc4 = table.Column<string>(type: "nvarchar(max)", nullable: true), Desc4 = table.Column<string>(type: "nvarchar(max)", nullable: true),
Desc5 = table.Column<string>(type: "nvarchar(max)", nullable: true), Desc5 = table.Column<string>(type: "nvarchar(max)", nullable: true),
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false), CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
ModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false), ModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
IsDeleted = table.Column<bool>(type: "bit", nullable: false), IsDeleted = table.Column<bool>(type: "bit", nullable: false),
CreatedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false), CreatedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ModifiedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false), ModifiedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
LayerId = table.Column<Guid>(type: "uniqueidentifier", nullable: false) LayerId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_Records", x => x.Id); table.PrimaryKey("PK_Records", x => x.Id);
table.ForeignKey( table.ForeignKey(
name: "FK_Records_Layers_LayerId", name: "FK_Records_Layers_LayerId",
column: x => x.LayerId, column: x => x.LayerId,
principalTable: "Layers", principalTable: "Layers",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.NoAction); onDelete: ReferentialAction.NoAction);
table.ForeignKey( table.ForeignKey(
name: "FK_Records_Users_CreatedById", name: "FK_Records_Users_CreatedById",
column: x => x.CreatedById, column: x => x.CreatedById,
principalTable: "Users", principalTable: "Users",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.NoAction); onDelete: ReferentialAction.NoAction);
table.ForeignKey( table.ForeignKey(
name: "FK_Records_Users_ModifiedById", name: "FK_Records_Users_ModifiedById",
column: x => x.ModifiedById, column: x => x.ModifiedById,
principalTable: "Users", principalTable: "Users",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.NoAction); onDelete: ReferentialAction.NoAction);
}); });
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Layers_CreatedById", name: "IX_Layers_CreatedById",
table: "Layers", table: "Layers",
column: "CreatedById"); column: "CreatedById");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Layers_ModifiedById", name: "IX_Layers_ModifiedById",
table: "Layers", table: "Layers",
column: "ModifiedById"); column: "ModifiedById");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Records_CreatedById", name: "IX_Records_CreatedById",
table: "Records", table: "Records",
column: "CreatedById"); column: "CreatedById");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Records_LayerId", name: "IX_Records_LayerId",
table: "Records", table: "Records",
column: "LayerId"); column: "LayerId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Records_ModifiedById", name: "IX_Records_ModifiedById",
table: "Records", table: "Records",
column: "ModifiedById"); column: "ModifiedById");
} }
/// <inheritdoc /> /// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Records"); name: "Records");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Layers"); name: "Layers");
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "DataSets", name: "DataSets",
columns: table => new columns: table => new
{ {
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
CreatedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false), CreatedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ModifiedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false), ModifiedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false), CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
IsDeleted = table.Column<bool>(type: "bit", nullable: false), IsDeleted = table.Column<bool>(type: "bit", nullable: false),
ModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false), ModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false), Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
Number = table.Column<int>(type: "int", nullable: false), Number = table.Column<int>(type: "int", nullable: false),
Source = table.Column<string>(type: "nvarchar(max)", nullable: false) Source = table.Column<string>(type: "nvarchar(max)", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_DataSets", x => x.Id); table.PrimaryKey("PK_DataSets", x => x.Id);
table.ForeignKey( table.ForeignKey(
name: "FK_DataSets_Users_CreatedById", name: "FK_DataSets_Users_CreatedById",
column: x => x.CreatedById, column: x => x.CreatedById,
principalTable: "Users", principalTable: "Users",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.NoAction); onDelete: ReferentialAction.NoAction);
table.ForeignKey( table.ForeignKey(
name: "FK_DataSets_Users_ModifiedById", name: "FK_DataSets_Users_ModifiedById",
column: x => x.ModifiedById, column: x => x.ModifiedById,
principalTable: "Users", principalTable: "Users",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.NoAction); onDelete: ReferentialAction.NoAction);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "DataRows", name: "DataRows",
columns: table => new columns: table => new
{ {
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
CreatedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false), CreatedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ModifiedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false), ModifiedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Code = table.Column<string>(type: "nvarchar(max)", nullable: false), Code = table.Column<string>(type: "nvarchar(max)", nullable: false),
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false), CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
DataSetId = table.Column<Guid>(type: "uniqueidentifier", nullable: false), DataSetId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Desc1 = table.Column<string>(type: "nvarchar(max)", nullable: true), Desc1 = table.Column<string>(type: "nvarchar(max)", nullable: true),
Desc2 = table.Column<string>(type: "nvarchar(max)", nullable: true), Desc2 = table.Column<string>(type: "nvarchar(max)", nullable: true),
Desc3 = table.Column<string>(type: "nvarchar(max)", nullable: true), Desc3 = table.Column<string>(type: "nvarchar(max)", nullable: true),
Desc4 = table.Column<string>(type: "nvarchar(max)", nullable: true), Desc4 = table.Column<string>(type: "nvarchar(max)", nullable: true),
Desc5 = table.Column<string>(type: "nvarchar(max)", nullable: true), Desc5 = table.Column<string>(type: "nvarchar(max)", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false), IsDeleted = table.Column<bool>(type: "bit", nullable: false),
ModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false), ModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
Value = table.Column<float>(type: "real", nullable: false) Value = table.Column<float>(type: "real", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_DataRows", x => x.Id); table.PrimaryKey("PK_DataRows", x => x.Id);
table.ForeignKey( table.ForeignKey(
name: "FK_DataRows_DataSets_DataSetId", name: "FK_DataRows_DataSets_DataSetId",
column: x => x.DataSetId, column: x => x.DataSetId,
principalTable: "DataSets", principalTable: "DataSets",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.NoAction); onDelete: ReferentialAction.NoAction);
table.ForeignKey( table.ForeignKey(
name: "FK_DataRows_Users_CreatedById", name: "FK_DataRows_Users_CreatedById",
column: x => x.CreatedById, column: x => x.CreatedById,
principalTable: "Users", principalTable: "Users",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.NoAction); onDelete: ReferentialAction.NoAction);
table.ForeignKey( table.ForeignKey(
name: "FK_DataRows_Users_ModifiedById", name: "FK_DataRows_Users_ModifiedById",
column: x => x.ModifiedById, column: x => x.ModifiedById,
principalTable: "Users", principalTable: "Users",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.NoAction); onDelete: ReferentialAction.NoAction);
}); });
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_DataRows_CreatedById", name: "IX_DataRows_CreatedById",
table: "DataRows", table: "DataRows",
column: "CreatedById"); column: "CreatedById");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_DataRows_DataSetId", name: "IX_DataRows_DataSetId",
table: "DataRows", table: "DataRows",
column: "DataSetId"); column: "DataSetId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_DataRows_ModifiedById", name: "IX_DataRows_ModifiedById",
table: "DataRows", table: "DataRows",
column: "ModifiedById"); column: "ModifiedById");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_DataSets_CreatedById", name: "IX_DataSets_CreatedById",
table: "DataSets", table: "DataSets",
column: "CreatedById"); column: "CreatedById");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_DataSets_ModifiedById", name: "IX_DataSets_ModifiedById",
table: "DataSets", table: "DataSets",
column: "ModifiedById"); column: "ModifiedById");
} }
} }
} }

View File

@@ -5,8 +5,8 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using DiunaBI.Core.Models; using DiunaBI.Domain.Entities;
using DiunaBI.Core.Database.Context; using DiunaBI.Infrastructure.Data;
#nullable disable #nullable disable
@@ -17,7 +17,7 @@ namespace DiunaBI.Core.Migrations
partial class LayerType partial class LayerType
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder

View File

@@ -2,7 +2,7 @@
#nullable disable #nullable disable
namespace DiunaBI.Core.Migrations namespace DiunaBI.Infrastructure.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class LayerType : Migration public partial class LayerType : Migration

View File

@@ -5,8 +5,8 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using DiunaBI.Core.Models; using DiunaBI.Domain.Entities;
using DiunaBI.Core.Database.Context; using DiunaBI.Infrastructure.Data;
#nullable disable #nullable disable
@@ -17,7 +17,7 @@ namespace DiunaBI.Core.Migrations
partial class RecordValues partial class RecordValues
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder

View File

@@ -2,7 +2,7 @@
#nullable disable #nullable disable
namespace DiunaBI.Core.Migrations namespace DiunaBI.Infrastructure.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class RecordValues : Migration public partial class RecordValues : Migration

View File

@@ -5,8 +5,8 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using DiunaBI.Core.Models; using DiunaBI.Domain.Entities;
using DiunaBI.Core.Database.Context; using DiunaBI.Infrastructure.Data;
#nullable disable #nullable disable
@@ -17,7 +17,7 @@ namespace DiunaBI.Core.Migrations
partial class Layerparent partial class Layerparent
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder

View File

@@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable #nullable disable
namespace DiunaBI.Core.Migrations namespace DiunaBI.Infrastructure.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class Layerparent : Migration public partial class Layerparent : Migration

View File

@@ -5,8 +5,8 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using DiunaBI.Core.Models; using DiunaBI.Domain.Entities;
using DiunaBI.Core.Database.Context; using DiunaBI.Infrastructure.Data;
#nullable disable #nullable disable
@@ -17,7 +17,7 @@ namespace DiunaBI.Core.Migrations
partial class ProcessSource partial class ProcessSource
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder

View File

@@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable #nullable disable
namespace DiunaBI.Core.Migrations namespace DiunaBI.Infrastructure.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class ProcessSource : Migration public partial class ProcessSource : Migration

View File

@@ -6,8 +6,8 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using DiunaBI.Core.Models; using DiunaBI.Domain.Entities;
using DiunaBI.Core.Database.Context; using DiunaBI.Infrastructure.Data;
#nullable disable #nullable disable
@@ -18,7 +18,7 @@ namespace DiunaBI.Core.Migrations
partial class TypeO partial class TypeO
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder

View File

@@ -2,7 +2,7 @@
#nullable disable #nullable disable
namespace DiunaBI.Core.Migrations namespace DiunaBI.Infrastructure.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class TypeO : Migration public partial class TypeO : Migration

View File

@@ -5,8 +5,8 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using DiunaBI.Core.Models; using DiunaBI.Domain.Entities;
using DiunaBI.Core.Database.Context; using DiunaBI.Infrastructure.Data;
#nullable disable #nullable disable
@@ -17,7 +17,7 @@ namespace DiunaBI.Core.Migrations
partial class RecordValue32 partial class RecordValue32
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder

View File

@@ -2,7 +2,7 @@
#nullable disable #nullable disable
namespace DiunaBI.Core.Migrations namespace DiunaBI.Infrastructure.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class RecordValue32 : Migration public partial class RecordValue32 : Migration

View File

@@ -5,8 +5,8 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using DiunaBI.Core.Models; using DiunaBI.Domain.Entities;
using DiunaBI.Core.Database.Context; using DiunaBI.Infrastructure.Data;
#nullable disable #nullable disable
@@ -17,7 +17,7 @@ namespace DiunaBI.Core.Migrations
partial class Changerecordvaluetype partial class Changerecordvaluetype
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder

View File

@@ -2,7 +2,7 @@
#nullable disable #nullable disable
namespace DiunaBI.Core.Migrations namespace DiunaBI.Infrastructure.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class Changerecordvaluetype : Migration public partial class Changerecordvaluetype : Migration

View File

@@ -5,8 +5,8 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using DiunaBI.Core.Models; using DiunaBI.Domain.Entities;
using DiunaBI.Core.Database.Context; using DiunaBI.Infrastructure.Data;
#nullable disable #nullable disable
@@ -17,7 +17,7 @@ namespace DiunaBI.Core.Migrations
partial class AfterCodeRefactor partial class AfterCodeRefactor
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder

View File

@@ -2,7 +2,7 @@
#nullable disable #nullable disable
namespace DiunaBI.Core.Migrations namespace DiunaBI.Infrastructure.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class AfterCodeRefactor : Migration public partial class AfterCodeRefactor : Migration

View File

@@ -5,8 +5,8 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using DiunaBI.Core.Models; using DiunaBI.Domain.Entities;
using DiunaBI.Core.Database.Context; using DiunaBI.Infrastructure.Data;
#nullable disable #nullable disable
@@ -17,7 +17,7 @@ namespace DiunaBI.Core.Migrations
partial class DataInboxModel partial class DataInboxModel
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder

View File

@@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable #nullable disable
namespace DiunaBI.Core.Migrations namespace DiunaBI.Infrastructure.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class DataInboxModel : Migration public partial class DataInboxModel : Migration

View File

@@ -5,8 +5,8 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using DiunaBI.Core.Models; using DiunaBI.Domain.Entities;
using DiunaBI.Core.Database.Context; using DiunaBI.Infrastructure.Data;
#nullable disable #nullable disable
@@ -17,7 +17,7 @@ namespace DiunaBI.Core.Migrations
partial class QueueJobs partial class QueueJobs
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder

View File

@@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable #nullable disable
namespace DiunaBI.Core.Migrations namespace DiunaBI.Infrastructure.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class QueueJobs : Migration public partial class QueueJobs : Migration

View File

@@ -5,8 +5,8 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using DiunaBI.Core.Models; using DiunaBI.Domain.Entities;
using DiunaBI.Core.Database.Context; using DiunaBI.Infrastructure.Data;
#nullable disable #nullable disable
@@ -17,7 +17,7 @@ namespace DiunaBI.Core.Migrations
partial class LongerDesc1 partial class LongerDesc1
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder

View File

@@ -2,7 +2,7 @@
#nullable disable #nullable disable
namespace DiunaBI.Core.Migrations namespace DiunaBI.Infrastructure.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class LongerDesc1 : Migration public partial class LongerDesc1 : Migration

View File

@@ -5,8 +5,8 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using DiunaBI.Core.Models; using DiunaBI.Domain.Entities;
using DiunaBI.Core.Database.Context; using DiunaBI.Infrastructure.Data;
#nullable disable #nullable disable
@@ -17,7 +17,7 @@ namespace DiunaBI.Core.Migrations
partial class LayersIsCancelled partial class LayersIsCancelled
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder

View File

@@ -2,7 +2,7 @@
#nullable disable #nullable disable
namespace DiunaBI.Core.Migrations namespace DiunaBI.Infrastructure.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class LayersIsCancelled : Migration public partial class LayersIsCancelled : Migration

View File

@@ -1,11 +1,12 @@
// <auto-generated /> // <auto-generated />
using System; using System;
using DiunaBI.Core.Database.Context;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using DiunaBI.Domain.Entities;
using DiunaBI.Infrastructure.Data;
#nullable disable #nullable disable
@@ -16,7 +17,7 @@ namespace DiunaBI.Core.Migrations
partial class QueueJobRefactor partial class QueueJobRefactor
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder

View File

@@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable #nullable disable
namespace DiunaBI.Core.Migrations namespace DiunaBI.Infrastructure.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class QueueJobRefactor : Migration public partial class QueueJobRefactor : Migration

View File

@@ -1,11 +1,12 @@
// <auto-generated /> // <auto-generated />
using System; using System;
using DiunaBI.Core.Database.Context;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using DiunaBI.Domain.Entities;
using DiunaBI.Infrastructure.Data;
#nullable disable #nullable disable
@@ -16,7 +17,7 @@ namespace DiunaBI.Core.Migrations
partial class DataInboxLayerId partial class DataInboxLayerId
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder

View File

@@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable #nullable disable
namespace DiunaBI.Core.Migrations namespace DiunaBI.Infrastructure.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class DataInboxLayerId : Migration public partial class DataInboxLayerId : Migration

View File

@@ -1,11 +1,12 @@
// <auto-generated /> // <auto-generated />
using System; using System;
using DiunaBI.Core.Database.Context;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using DiunaBI.Domain.Entities;
using DiunaBI.Infrastructure.Data;
#nullable disable #nullable disable
@@ -16,7 +17,7 @@ namespace DiunaBI.Core.Migrations
partial class RemoveDataInboxLayerId partial class RemoveDataInboxLayerId
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder

View File

@@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable #nullable disable
namespace DiunaBI.Core.Migrations namespace DiunaBI.Infrastructure.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class RemoveDataInboxLayerId : Migration public partial class RemoveDataInboxLayerId : Migration

View File

@@ -1,6 +1,6 @@
// <auto-generated /> // <auto-generated />
using System; using System;
using DiunaBI.Core.Database.Context; using DiunaBI.Infrastructure.Data;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
@@ -8,7 +8,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable #nullable disable
namespace DiunaBI.Core.Migrations namespace DiunaBI.Infrastructure.Migrations
{ {
[DbContext(typeof(AppDbContext))] [DbContext(typeof(AppDbContext))]
partial class AppDbContextModelSnapshot : ModelSnapshot partial class AppDbContextModelSnapshot : ModelSnapshot

View File

@@ -1,11 +1,8 @@
using System;
using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq;
using AngouriMath; using AngouriMath;
using DiunaBI.Core.Models; using DiunaBI.Domain.Entities;
namespace DiunaBI.Core.Services.Calculations; namespace DiunaBI.Infrastructure.Services.Calculations;
public class BaseCalc public class BaseCalc
{ {

View File

@@ -1,37 +1,36 @@
using Google.Apis.Auth.OAuth2; using Google.Apis.Auth.OAuth2;
using Google.Apis.Drive.v3; using Google.Apis.Drive.v3;
using Google.Apis.Services; using Google.Apis.Services;
using System.IO;
namespace DiunaBI.Core.Services;
public class GoogleDriveHelper namespace DiunaBI.Infrastructure.Services;
{
public DriveService? Service { get; private set; } public class GoogleDriveHelper
private const string ApplicationName = "Diuna"; {
private static readonly string[] Scopes = [DriveService.Scope.Drive]; public DriveService? Service { get; private set; }
public GoogleDriveHelper() private const string ApplicationName = "Diuna";
{ private static readonly string[] Scopes = [DriveService.Scope.Drive];
InitializeService(); public GoogleDriveHelper()
} {
private void InitializeService() InitializeService();
{ }
var credential = GetCredentialsFromFile(); private void InitializeService()
Service = new DriveService(new BaseClientService.Initializer {
{ var credential = GetCredentialsFromFile();
HttpClientInitializer = credential, Service = new DriveService(new BaseClientService.Initializer
ApplicationName = ApplicationName {
}); HttpClientInitializer = credential,
} ApplicationName = ApplicationName
private static GoogleCredential GetCredentialsFromFile() });
{ }
// ReSharper disable once RedundantAssignment private static GoogleCredential GetCredentialsFromFile()
var fileName = "client_secrets.json"; {
#if DEBUG // ReSharper disable once RedundantAssignment
fileName = "client_secrets.Development.json"; var fileName = "client_secrets.json";
#endif #if DEBUG
using var stream = new FileStream(fileName, FileMode.Open, FileAccess.Read); fileName = "client_secrets.Development.json";
var credential = GoogleCredential.FromStream(stream).CreateScoped(Scopes); #endif
return credential; using var stream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
} var credential = GoogleCredential.FromStream(stream).CreateScoped(Scopes);
return credential;
}
} }

View File

@@ -1,36 +1,35 @@
using Google.Apis.Auth.OAuth2; using Google.Apis.Auth.OAuth2;
using Google.Apis.Services; using Google.Apis.Services;
using Google.Apis.Sheets.v4; using Google.Apis.Sheets.v4;
using System.IO;
namespace DiunaBI.Core.Services; namespace DiunaBI.Infrastructure.Services;
public class GoogleSheetsHelper public class GoogleSheetsHelper
{ {
public SheetsService? Service { get; private set; } public SheetsService? Service { get; private set; }
private const string ApplicationName = "Diuna"; private const string ApplicationName = "Diuna";
private static readonly string[] Scopes = [SheetsService.Scope.Spreadsheets]; private static readonly string[] Scopes = [SheetsService.Scope.Spreadsheets];
public GoogleSheetsHelper() public GoogleSheetsHelper()
{ {
InitializeService(); InitializeService();
} }
private void InitializeService() private void InitializeService()
{ {
var credential = GetCredentialsFromFile(); var credential = GetCredentialsFromFile();
Service = new SheetsService(new BaseClientService.Initializer Service = new SheetsService(new BaseClientService.Initializer
{ {
HttpClientInitializer = credential, HttpClientInitializer = credential,
ApplicationName = ApplicationName ApplicationName = ApplicationName
}); });
} }
private static GoogleCredential GetCredentialsFromFile() private static GoogleCredential GetCredentialsFromFile()
{ {
var fileName = "client_secrets.json"; var fileName = "client_secrets.json";
#if DEBUG #if DEBUG
fileName = "client_secrets.Development.json"; fileName = "client_secrets.Development.json";
#endif #endif
using var stream = new FileStream(fileName, FileMode.Open, FileAccess.Read); using var stream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
var credential = GoogleCredential.FromStream(stream).CreateScoped(Scopes); var credential = GoogleCredential.FromStream(stream).CreateScoped(Scopes);
return credential; return credential;
} }
} }

View File

@@ -1,13 +1,9 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection; using System.Reflection;
using DiunaBI.Core.Interfaces; using DiunaBI.Infrastructure.Interfaces;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace DiunaBI.Core.Services; namespace DiunaBI.Infrastructure.Services;
public class PluginManager public class PluginManager
{ {

View File

@@ -1,9 +1,7 @@
using System; using System.Text.RegularExpressions;
using System.Collections.Generic; using DiunaBI.Domain.Entities;
using System.Text.RegularExpressions;
using DiunaBI.Core.Models;
namespace DiunaBI.Core.Services; namespace DiunaBI.Infrastructure.Services;
public static class ProcessHelper public static class ProcessHelper
{ {

View File

@@ -11,6 +11,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\DiunaBI.Core\DiunaBI.Core.csproj" /> <ProjectReference Include="..\DiunaBI.Domain\DiunaBI.Domain.csproj" />
<ProjectReference Include="..\DiunaBI.Infrastructure\DiunaBI.Infrastructure.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -1,5 +1,5 @@
using DiunaBI.Core.Interfaces; using DiunaBI.Domain.Entities;
using DiunaBI.Core.Models; using DiunaBI.Infrastructure.Interfaces;
namespace DiunaBI.Plugins.Morska.Exporters; namespace DiunaBI.Plugins.Morska.Exporters;

View File

@@ -1,11 +1,11 @@
using System.Globalization; using System.Globalization;
using DiunaBI.Domain.Entities;
using DiunaBI.Infrastructure.Services;
using Google.Apis.Sheets.v4; using Google.Apis.Sheets.v4;
using Google.Apis.Sheets.v4.Data; using Google.Apis.Sheets.v4.Data;
using DiunaBI.Core.Models;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using DiunaBI.Plugins.Morska.Exporters;
namespace DiunaBI.Core.Services.Exports; namespace DiunaBI.Plugins.Morska.Exporters;
public class GoogleSheetExport : MorskaBaseExporter public class GoogleSheetExport : MorskaBaseExporter
{ {

View File

@@ -1,5 +1,5 @@
using DiunaBI.Core.Interfaces; using DiunaBI.Domain.Entities;
using DiunaBI.Core.Models; using DiunaBI.Infrastructure.Interfaces;
namespace DiunaBI.Plugins.Morska.Importers; namespace DiunaBI.Plugins.Morska.Importers;

View File

@@ -1,9 +1,10 @@
using System.Globalization; using System.Globalization;
using DiunaBI.Domain.Entities;
using DiunaBI.Infrastructure.Data;
using Google.Apis.Sheets.v4; using Google.Apis.Sheets.v4;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using DiunaBI.Core.Models;
using DiunaBI.Core.Database.Context;
namespace DiunaBI.Plugins.Morska.Importers; namespace DiunaBI.Plugins.Morska.Importers;

View File

@@ -1,11 +1,11 @@
using System.Globalization; using System.Globalization;
using System.Text; using System.Text;
using System.Text.Json; using System.Text.Json;
using DiunaBI.Domain.Entities;
using DiunaBI.Infrastructure.Data;
using DiunaBI.Infrastructure.Services;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using DiunaBI.Core.Models;
using DiunaBI.Core.Database.Context;
using DiunaBI.Core.Services;
using Google.Apis.Sheets.v4; using Google.Apis.Sheets.v4;
using Google.Apis.Sheets.v4.Data; using Google.Apis.Sheets.v4.Data;

View File

@@ -1,9 +1,9 @@
using System.Globalization; using System.Globalization;
using DiunaBI.Domain.Entities;
using DiunaBI.Infrastructure.Data;
using Google.Apis.Sheets.v4; using Google.Apis.Sheets.v4;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using DiunaBI.Core.Models;
using DiunaBI.Core.Database.Context;
namespace DiunaBI.Plugins.Morska.Importers; namespace DiunaBI.Plugins.Morska.Importers;

View File

@@ -1,9 +1,10 @@
using System.Globalization; using System.Globalization;
using DiunaBI.Domain.Entities;
using DiunaBI.Infrastructure.Data;
using Google.Apis.Sheets.v4; using Google.Apis.Sheets.v4;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using DiunaBI.Core.Models;
using DiunaBI.Core.Database.Context;
namespace DiunaBI.Plugins.Morska.Importers; namespace DiunaBI.Plugins.Morska.Importers;

View File

@@ -1,6 +1,5 @@
using DiunaBI.Core.Interfaces; using DiunaBI.Domain.Entities;
using DiunaBI.Core.Models; using DiunaBI.Infrastructure.Interfaces;
using Microsoft.Extensions.Logging;
namespace DiunaBI.Plugins.Morska.Processors; namespace DiunaBI.Plugins.Morska.Processors;

View File

@@ -1,12 +1,11 @@
using System.Globalization; using System.Globalization;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using DiunaBI.Core.Services; using DiunaBI.Domain.Entities;
using DiunaBI.Infrastructure.Data;
using DiunaBI.Infrastructure.Services.Calculations;
using Google.Apis.Sheets.v4; using Google.Apis.Sheets.v4;
using Google.Apis.Sheets.v4.Data; using Google.Apis.Sheets.v4.Data;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using DiunaBI.Core.Models;
using DiunaBI.Core.Database.Context;
using DiunaBI.Core.Services.Calculations;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace DiunaBI.Plugins.Morska.Processors; namespace DiunaBI.Plugins.Morska.Processors;

View File

@@ -1,11 +1,11 @@
using System.Globalization; using System.Globalization;
using DiunaBI.Domain.Entities;
using DiunaBI.Infrastructure.Data;
using DiunaBI.Infrastructure.Services;
using DiunaBI.Infrastructure.Services.Calculations;
using Google.Apis.Sheets.v4; using Google.Apis.Sheets.v4;
using Google.Apis.Sheets.v4.Data; using Google.Apis.Sheets.v4.Data;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using DiunaBI.Core.Models;
using DiunaBI.Core.Database.Context;
using DiunaBI.Core.Services;
using DiunaBI.Core.Services.Calculations;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace DiunaBI.Plugins.Morska.Processors; namespace DiunaBI.Plugins.Morska.Processors;

View File

@@ -1,11 +1,11 @@
using System.Globalization; using System.Globalization;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using DiunaBI.Core.Services; using DiunaBI.Domain.Entities;
using DiunaBI.Infrastructure.Data;
using DiunaBI.Infrastructure.Services;
using Google.Apis.Sheets.v4; using Google.Apis.Sheets.v4;
using Google.Apis.Sheets.v4.Data; using Google.Apis.Sheets.v4.Data;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using DiunaBI.Core.Models;
using DiunaBI.Core.Database.Context;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace DiunaBI.Plugins.Morska.Processors; namespace DiunaBI.Plugins.Morska.Processors;

View File

@@ -1,7 +1,7 @@
using DiunaBI.Core.Services; using DiunaBI.Domain.Entities;
using DiunaBI.Infrastructure.Data;
using DiunaBI.Infrastructure.Services;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using DiunaBI.Core.Models;
using DiunaBI.Core.Database.Context;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace DiunaBI.Plugins.Morska.Processors; namespace DiunaBI.Plugins.Morska.Processors;

View File

@@ -1,7 +1,7 @@
using DiunaBI.Core.Services; using DiunaBI.Domain.Entities;
using DiunaBI.Infrastructure.Data;
using DiunaBI.Infrastructure.Services;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using DiunaBI.Core.Models;
using DiunaBI.Core.Database.Context;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace DiunaBI.Plugins.Morska.Processors; namespace DiunaBI.Plugins.Morska.Processors;

View File

@@ -1,9 +1,9 @@
using DiunaBI.Core.Services; using DiunaBI.Domain.Entities;
using DiunaBI.Infrastructure.Data;
using DiunaBI.Infrastructure.Services;
using DiunaBI.Infrastructure.Services.Calculations;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using DiunaBI.Core.Models;
using DiunaBI.Core.Database.Context;
using DiunaBI.Core.Services.Calculations;
namespace DiunaBI.Plugins.Morska.Processors; namespace DiunaBI.Plugins.Morska.Processors;

View File

@@ -1,9 +1,9 @@
using Microsoft.EntityFrameworkCore; using DiunaBI.Domain.Entities;
using DiunaBI.Infrastructure.Data;
using DiunaBI.Infrastructure.Services;
using DiunaBI.Infrastructure.Services.Calculations;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using DiunaBI.Core.Models;
using DiunaBI.Core.Database.Context;
using DiunaBI.Core.Services;
using DiunaBI.Core.Services.Calculations;
namespace DiunaBI.Plugins.Morska.Processors; namespace DiunaBI.Plugins.Morska.Processors;

View File

@@ -1,7 +1,7 @@
using Microsoft.EntityFrameworkCore; using DiunaBI.Domain.Entities;
using DiunaBI.Core.Models; using DiunaBI.Infrastructure.Data;
using DiunaBI.Core.Database.Context; using DiunaBI.Infrastructure.Services;
using DiunaBI.Core.Services; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Google.Apis.Sheets.v4; using Google.Apis.Sheets.v4;

View File

@@ -1,9 +1,9 @@
using Microsoft.EntityFrameworkCore; using DiunaBI.Domain.Entities;
using DiunaBI.Infrastructure.Data;
using DiunaBI.Infrastructure.Services;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Google.Apis.Sheets.v4; using Google.Apis.Sheets.v4;
using DiunaBI.Core.Models;
using DiunaBI.Core.Database.Context;
using DiunaBI.Core.Services;
namespace DiunaBI.Plugins.Morska.Processors; namespace DiunaBI.Plugins.Morska.Processors;

View File

@@ -1,11 +1,11 @@
using System.Globalization; using System.Globalization;
using DiunaBI.Domain.Entities;
using DiunaBI.Infrastructure.Data;
using DiunaBI.Infrastructure.Services;
using Google.Apis.Sheets.v4; using Google.Apis.Sheets.v4;
using Google.Apis.Sheets.v4.Data; using Google.Apis.Sheets.v4.Data;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using DiunaBI.Core.Models;
using DiunaBI.Core.Database.Context;
using DiunaBI.Core.Services;
namespace DiunaBI.Plugins.Morska.Processors; namespace DiunaBI.Plugins.Morska.Processors;

View File

@@ -1,8 +1,8 @@
using Microsoft.EntityFrameworkCore; using DiunaBI.Domain.Entities;
using DiunaBI.Infrastructure.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Google.Apis.Sheets.v4; using Google.Apis.Sheets.v4;
using DiunaBI.Core.Models;
using DiunaBI.Core.Database.Context;
namespace DiunaBI.Plugins.Morska.Processors; namespace DiunaBI.Plugins.Morska.Processors;

View File

@@ -1,7 +1,7 @@
using DiunaBI.Core.Services; using DiunaBI.Domain.Entities;
using DiunaBI.Infrastructure.Data;
using DiunaBI.Infrastructure.Services;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using DiunaBI.Core.Models;
using DiunaBI.Core.Database.Context;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace DiunaBI.Plugins.Morska.Processors; namespace DiunaBI.Plugins.Morska.Processors;

View File

@@ -18,7 +18,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\DiunaBI.WebAPI\DiunaBI.WebAPI.csproj" /> <ProjectReference Include="..\DiunaBI.API\DiunaBI.API.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -3,14 +3,18 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59 VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiunaBI.WebAPI", "DiunaBI.WebAPI\DiunaBI.WebAPI.csproj", "{D468D3FD-2B0F-4E1E-9BFC-AE32DD3BB4C6}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiunaBI.API", "DiunaBI.API\DiunaBI.API.csproj", "{D468D3FD-2B0F-4E1E-9BFC-AE32DD3BB4C6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiunaBI.Core", "DiunaBI.Core\DiunaBI.Core.csproj", "{0282E3CC-3BE1-4610-B65F-BC266A2FCA6E}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiunaBI.Plugins.Morska", "DiunaBI.Plugins.Morska\DiunaBI.Plugins.Morska.csproj", "{B5416A3F-550A-468D-852F-20B24243FD68}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiunaBI.Plugins.Morska", "DiunaBI.Plugins.Morska\DiunaBI.Plugins.Morska.csproj", "{B5416A3F-550A-468D-852F-20B24243FD68}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiunaBI.Tests", "DiunaBI.Tests\DiunaBI.Tests.csproj", "{7D99AF7E-1FC7-4EC0-A320-F1A81D396F93}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiunaBI.Tests", "DiunaBI.Tests\DiunaBI.Tests.csproj", "{7D99AF7E-1FC7-4EC0-A320-F1A81D396F93}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiunaBI.Domain", "DiunaBI.Domain\DiunaBI.Domain.csproj", "{8C701560-EF39-4203-8EB9-16AB32CA2CAB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiunaBI.Application", "DiunaBI.Application\DiunaBI.Application.csproj", "{5F8C40E9-F51E-48A5-840F-4309C873C6C6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiunaBI.Infrastructure", "DiunaBI.Infrastructure\DiunaBI.Infrastructure.csproj", "{0B2E03F3-A1F7-4C7F-BCA7-386979C93346}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@@ -24,10 +28,6 @@ Global
{D468D3FD-2B0F-4E1E-9BFC-AE32DD3BB4C6}.Debug|Any CPU.Build.0 = Debug|Any CPU {D468D3FD-2B0F-4E1E-9BFC-AE32DD3BB4C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D468D3FD-2B0F-4E1E-9BFC-AE32DD3BB4C6}.Release|Any CPU.ActiveCfg = Release|Any CPU {D468D3FD-2B0F-4E1E-9BFC-AE32DD3BB4C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D468D3FD-2B0F-4E1E-9BFC-AE32DD3BB4C6}.Release|Any CPU.Build.0 = Release|Any CPU {D468D3FD-2B0F-4E1E-9BFC-AE32DD3BB4C6}.Release|Any CPU.Build.0 = Release|Any CPU
{0282E3CC-3BE1-4610-B65F-BC266A2FCA6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0282E3CC-3BE1-4610-B65F-BC266A2FCA6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0282E3CC-3BE1-4610-B65F-BC266A2FCA6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0282E3CC-3BE1-4610-B65F-BC266A2FCA6E}.Release|Any CPU.Build.0 = Release|Any CPU
{B5416A3F-550A-468D-852F-20B24243FD68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B5416A3F-550A-468D-852F-20B24243FD68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B5416A3F-550A-468D-852F-20B24243FD68}.Debug|Any CPU.Build.0 = Debug|Any CPU {B5416A3F-550A-468D-852F-20B24243FD68}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B5416A3F-550A-468D-852F-20B24243FD68}.Release|Any CPU.ActiveCfg = Release|Any CPU {B5416A3F-550A-468D-852F-20B24243FD68}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -40,5 +40,17 @@ Global
{7D99AF7E-1FC7-4EC0-A320-F1A81D396F93}.Debug|Any CPU.Build.0 = Debug|Any CPU {7D99AF7E-1FC7-4EC0-A320-F1A81D396F93}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7D99AF7E-1FC7-4EC0-A320-F1A81D396F93}.Release|Any CPU.ActiveCfg = Release|Any CPU {7D99AF7E-1FC7-4EC0-A320-F1A81D396F93}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7D99AF7E-1FC7-4EC0-A320-F1A81D396F93}.Release|Any CPU.Build.0 = Release|Any CPU {7D99AF7E-1FC7-4EC0-A320-F1A81D396F93}.Release|Any CPU.Build.0 = Release|Any CPU
{8C701560-EF39-4203-8EB9-16AB32CA2CAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8C701560-EF39-4203-8EB9-16AB32CA2CAB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8C701560-EF39-4203-8EB9-16AB32CA2CAB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8C701560-EF39-4203-8EB9-16AB32CA2CAB}.Release|Any CPU.Build.0 = Release|Any CPU
{5F8C40E9-F51E-48A5-840F-4309C873C6C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5F8C40E9-F51E-48A5-840F-4309C873C6C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5F8C40E9-F51E-48A5-840F-4309C873C6C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5F8C40E9-F51E-48A5-840F-4309C873C6C6}.Release|Any CPU.Build.0 = Release|Any CPU
{0B2E03F3-A1F7-4C7F-BCA7-386979C93346}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0B2E03F3-A1F7-4C7F-BCA7-386979C93346}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0B2E03F3-A1F7-4C7F-BCA7-386979C93346}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0B2E03F3-A1F7-4C7F-BCA7-386979C93346}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal