Чето поменял
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
@using BlazorWebAssemblyVisaApiClient.ErrorHandling
|
||||
|
||||
<GlobalErrorHandler >
|
||||
<Router AppAssembly="@typeof(App).Assembly">
|
||||
<Found Context="routeData">
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
@using BlazorWebAssemblyVisaApiClient.ErrorHandling
|
||||
@using BlazorWebAssemblyVisaApiClient.Infrastructure.Services.UserDataProvider
|
||||
@using VisaApiClient
|
||||
|
||||
@code {
|
||||
public static AuthData? AuthData;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
@using BlazorWebAssemblyVisaApiClient.ErrorHandling
|
||||
@using VisaApiClient
|
||||
|
||||
@code
|
||||
{
|
||||
[CascadingParameter] protected GlobalErrorHandler ErrorHandler { get; set; } = null!;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
@using VisaApiClient
|
||||
|
||||
<div>
|
||||
<div >
|
||||
<label >
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
@using VisaApiClient
|
||||
|
||||
<div>
|
||||
<div >
|
||||
<label >
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
@using VisaApiClient
|
||||
|
||||
<div>
|
||||
<div >
|
||||
<label>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
@using BlazorWebAssemblyVisaApiClient.Infrastructure.Services.DateTimeProvider
|
||||
@using VisaApiClient
|
||||
|
||||
<div>
|
||||
<div >
|
||||
<label>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
@using System.Linq.Expressions
|
||||
@typeparam TItem where TItem : class
|
||||
@using System.Linq.Expressions
|
||||
@using System.Reflection
|
||||
@using BlazorWebAssemblyVisaApiClient.Infrastructure.Helpers
|
||||
@typeparam TItem where TItem : class
|
||||
@typeparam TMember where TMember : struct, Enum
|
||||
|
||||
<InputSelect TValue="TMember" @bind-Value="selected">
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
@using BlazorWebAssemblyVisaApiClient.Infrastructure.Services.DateTimeProvider
|
||||
@using VisaApiClient
|
||||
|
||||
<div>
|
||||
<label>
|
||||
Issuer:<br/>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
@using BlazorWebAssemblyVisaApiClient.Infrastructure.Services.DateTimeProvider
|
||||
@using VisaApiClient
|
||||
|
||||
<div>
|
||||
<label>
|
||||
Number:<br/>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
@using System.Net
|
||||
@using BlazorWebAssemblyVisaApiClient.Common.Exceptions
|
||||
@using VisaApiClient
|
||||
|
||||
<CascadingValue Value="this">
|
||||
<Modal @ref="modal">
|
||||
<BodyTemplate>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
@page "/authorities/add"
|
||||
@using AutoMapper
|
||||
@using BlazorWebAssemblyVisaApiClient.Validation.Applicants.Models
|
||||
@using VisaApiClient
|
||||
@using BlazorWebAssemblyVisaApiClient.Components
|
||||
@using BlazorWebAssemblyVisaApiClient.Infrastructure.Helpers
|
||||
@using BlazorWebAssemblyVisaApiClient.Validation.Applicants.Models
|
||||
@using FluentValidation
|
||||
@using VisaApiClient
|
||||
@inherits BlazorWebAssemblyVisaApiClient.Components.Base.VisaClientComponentBase
|
||||
|
||||
<EditForm Model="requestModel" class="with-centered-content">
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
@page "/"
|
||||
@using BlazorWebAssemblyVisaApiClient.Components.Auth
|
||||
@using VisaApiClient
|
||||
@using BlazorWebAssemblyVisaApiClient.Components.FormComponents.Applicants
|
||||
@using BlazorWebAssemblyVisaApiClient.Components
|
||||
@using BlazorWebAssemblyVisaApiClient.Components.Auth
|
||||
@using BlazorWebAssemblyVisaApiClient.Components.FormComponents.Applicants
|
||||
@using VisaApiClient
|
||||
@inherits BlazorWebAssemblyVisaApiClient.Components.Base.VisaClientComponentBase
|
||||
|
||||
<PageTitle>Authentication</PageTitle>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
@page "/authorities/{authorityId}/{oldEmail}"
|
||||
@inherits BlazorWebAssemblyVisaApiClient.Components.Base.VisaClientComponentBase
|
||||
@using BlazorWebAssemblyVisaApiClient.Common.Exceptions
|
||||
@using BlazorWebAssemblyVisaApiClient.Infrastructure.Services.UserDataProvider
|
||||
@using VisaApiClient
|
||||
@using BlazorWebAssemblyVisaApiClient.Components
|
||||
@using BlazorWebAssemblyVisaApiClient.Infrastructure.Helpers
|
||||
@using BlazorWebAssemblyVisaApiClient.Infrastructure.Services.UserDataProvider
|
||||
@using FluentValidation
|
||||
@using VisaApiClient
|
||||
@inherits BlazorWebAssemblyVisaApiClient.Components.Base.VisaClientComponentBase
|
||||
|
||||
<EditForm Model="model" class="with-centered-content">
|
||||
<div >
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
@page "/applications/new"
|
||||
@using System.Net
|
||||
@using AutoMapper
|
||||
@using BlazorWebAssemblyVisaApiClient.Validation.VisaApplications.Models
|
||||
@using VisaApiClient
|
||||
@using BlazorWebAssemblyVisaApiClient.Components
|
||||
@using BlazorWebAssemblyVisaApiClient.Components.FormComponents
|
||||
@using BlazorWebAssemblyVisaApiClient.Components.FormComponents.VisaApplications
|
||||
@using BlazorWebAssemblyVisaApiClient.Infrastructure.Helpers
|
||||
@using BlazorWebAssemblyVisaApiClient.Infrastructure.Services.DateTimeProvider
|
||||
@using BlazorWebAssemblyVisaApiClient.Infrastructure.Services.UserDataProvider
|
||||
@using BlazorWebAssemblyVisaApiClient.Validation
|
||||
@using BlazorWebAssemblyVisaApiClient.Validation.VisaApplications.Models
|
||||
@using FluentValidation
|
||||
@using Newtonsoft.Json.Linq
|
||||
@using BlazorWebAssemblyVisaApiClient.Components.FormComponents
|
||||
@using VisaApiClient
|
||||
@inherits BlazorWebAssemblyVisaApiClient.Components.Base.VisaClientComponentBase
|
||||
|
||||
<PageTitle>New Application</PageTitle>
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
@page "/register"
|
||||
@using System.Net
|
||||
@using AutoMapper
|
||||
@using VisaApiClient
|
||||
@using BlazorWebAssemblyVisaApiClient.Components.FormComponents.Applicants
|
||||
@using global::FluentValidation
|
||||
@using Newtonsoft.Json
|
||||
@using Newtonsoft.Json.Linq
|
||||
@using BlazorWebAssemblyVisaApiClient.Components
|
||||
@using BlazorWebAssemblyVisaApiClient.Components.FormComponents
|
||||
@using BlazorWebAssemblyVisaApiClient.Components.FormComponents.Applicants
|
||||
@using BlazorWebAssemblyVisaApiClient.Infrastructure.Helpers
|
||||
@using BlazorWebAssemblyVisaApiClient.Validation
|
||||
@using BlazorWebAssemblyVisaApiClient.Validation.Applicants.Models
|
||||
@using BlazorWebAssemblyVisaApiClient.Components.FormComponents
|
||||
@using FluentValidation
|
||||
@using Newtonsoft.Json
|
||||
@using Newtonsoft.Json.Linq
|
||||
@using VisaApiClient
|
||||
@inherits BlazorWebAssemblyVisaApiClient.Components.Base.VisaClientComponentBase
|
||||
|
||||
<PageTitle>Registration</PageTitle>
|
||||
|
||||
@@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Infrastructure.Database;
|
||||
|
||||
public class DbContext(DbContextOptions<DbContext> opts) : Microsoft.EntityFrameworkCore.DbContext(opts), IGenericWriter, IGenericReader, IUnitOfWork
|
||||
public class DatabaseContext(DbContextOptions<DatabaseContext> opts) : DbContext(opts), IGenericWriter, IGenericReader, IUnitOfWork
|
||||
{
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
@@ -4,6 +4,7 @@ using ApplicationLayer.Services.Applicants.NeededServices;
|
||||
using ApplicationLayer.Services.AuthServices.NeededServices;
|
||||
using ApplicationLayer.Services.VisaApplications.NeededServices;
|
||||
using Infrastructure.Common;
|
||||
using Infrastructure.Database;
|
||||
using Infrastructure.Database.Applicants.Repositories;
|
||||
using Infrastructure.Database.Generic;
|
||||
using Infrastructure.Database.Users.Repositories;
|
||||
@@ -12,7 +13,6 @@ using Infrastructure.EntityToExcelTemplateWriter;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using DbContext = Infrastructure.Database.DbContext;
|
||||
|
||||
namespace Infrastructure;
|
||||
|
||||
@@ -26,12 +26,12 @@ public static class DependencyInjection
|
||||
{
|
||||
var databaseName = isDevelopment ? "developmentDB" : "normal'naya database";
|
||||
|
||||
services.AddDbContext<DbContext>(opts =>
|
||||
opts.UseSqlServer(configurationManager.GetConnectionString(databaseName)));
|
||||
services.AddDbContext<DatabaseContext>(opts =>
|
||||
opts.UseNpgsql(configurationManager.GetConnectionString(databaseName)));
|
||||
|
||||
services.AddScoped<IGenericReader>(serviceProvider => serviceProvider.GetRequiredService<DbContext>());
|
||||
services.AddScoped<IGenericWriter>(serviceProvider => serviceProvider.GetRequiredService<DbContext>());
|
||||
services.AddScoped<IUnitOfWork>(serviceProvider => serviceProvider.GetRequiredService<DbContext>());
|
||||
services.AddScoped<IGenericReader>(serviceProvider => serviceProvider.GetRequiredService<DatabaseContext>());
|
||||
services.AddScoped<IGenericWriter>(serviceProvider => serviceProvider.GetRequiredService<DatabaseContext>());
|
||||
services.AddScoped<IUnitOfWork>(serviceProvider => serviceProvider.GetRequiredService<DatabaseContext>());
|
||||
|
||||
services.AddScoped<IApplicantsRepository, ApplicantsRepository>();
|
||||
services.AddScoped<IVisaApplicationsRepository, VisaApplicationsRepository>();
|
||||
|
||||
@@ -13,9 +13,17 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DocumentFormat.OpenXml" Version="3.1.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.8" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.0-preview.7.24405.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.0-preview.7.24405.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.0-preview.7.24405.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.4" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -8,6 +8,14 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0"/>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"AllowedHosts": "*",
|
||||
|
||||
"ConnectionStrings": {
|
||||
"developmentDB": "Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=visadb;Integrated Security=True;",
|
||||
"developmentDB": "Host=localhost;Port=5432;Database=visa;Username=postgres;Password=Qwerty123456!",
|
||||
"normal'naya db": ""
|
||||
},
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,5 @@
|
||||
using System.Text;
|
||||
|
||||
// ReSharper disable UnusedParameter.Local
|
||||
|
||||
namespace VisaApiClient;
|
||||
|
||||
@@ -24,7 +24,7 @@ public class RegisterRequestValidatorTests
|
||||
/// </summary>
|
||||
/// <param name="context">db context</param>
|
||||
/// <returns>RegisterRequest validator</returns>
|
||||
private static IValidator<RegisterRequest> GetValidator(DbContext context)
|
||||
private static IValidator<RegisterRequest> GetValidator(DatabaseContext context)
|
||||
{
|
||||
var repository = new UsersRepository(context, context);
|
||||
return new RegisterRequestValidator(repository, authDataValidator);
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Infrastructure.Database;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Diagnostics;
|
||||
using DbContext = Infrastructure.Database.DbContext;
|
||||
|
||||
namespace VisaApi.Tests.Infrastructure.Database;
|
||||
|
||||
public static class InMemoryContextProvider
|
||||
{
|
||||
private static DbContextOptions<DbContext> opts = new DbContextOptionsBuilder<DbContext>()
|
||||
private static DbContextOptions<DatabaseContext> opts = new DbContextOptionsBuilder<DatabaseContext>()
|
||||
.UseInMemoryDatabase("VisaApiDB")
|
||||
.ConfigureWarnings(b => b.Ignore(InMemoryEventId.TransactionIgnoredWarning))
|
||||
.Options;
|
||||
|
||||
public static DbContext GetDbContext()
|
||||
public static DatabaseContext GetDbContext()
|
||||
{
|
||||
var result = new DbContext(opts);
|
||||
var result = new DatabaseContext(opts);
|
||||
|
||||
result.Database.EnsureDeleted();
|
||||
result.Database.EnsureCreated();
|
||||
|
||||
@@ -20,7 +20,7 @@ public class ApplicantsRepositoryTests
|
||||
/// <summary> Returns <see cref="IApplicantsRepository"/> </summary>
|
||||
/// <param name="context"> Database context </param>
|
||||
/// <returns>Repository</returns>
|
||||
private static IApplicantsRepository GetRepository(DbContext context)
|
||||
private static IApplicantsRepository GetRepository(DatabaseContext context)
|
||||
=> new ApplicantsRepository(context, context);
|
||||
|
||||
/// <summary> Returns <see cref="IDateTimeProvider"/> </summary>
|
||||
|
||||
@@ -13,7 +13,7 @@ public class GenericRepositoryTests
|
||||
/// <summary> Returns <see cref="GenericRepository{T}"/> </summary>
|
||||
/// <param name="context"> Database context </param>
|
||||
/// <returns>Repository</returns>
|
||||
private static GenericRepository<User> GetRepository(DbContext context) => new TestGenericRepository(context, context);
|
||||
private static GenericRepository<User> GetRepository(DatabaseContext context) => new TestGenericRepository(context, context);
|
||||
|
||||
/// <summary> Test for <see cref="GenericRepository{T}.GetAllAsync"/> method that should return empty collection if nothing added </summary>
|
||||
[Fact]
|
||||
|
||||
@@ -17,7 +17,7 @@ public class UsersRepositoryTests
|
||||
/// <summary> Returns <see cref="IVisaApplicationsRepository"/> </summary>
|
||||
/// <param name="context"> Database context </param>
|
||||
/// <returns>Repository</returns>
|
||||
private static IUsersRepository GetRepository(DbContext context)
|
||||
private static IUsersRepository GetRepository(DatabaseContext context)
|
||||
=> new UsersRepository(context, context);
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -23,7 +23,7 @@ public class VisaApplicationsRepositoryTests
|
||||
/// <summary> Returns <see cref="IVisaApplicationsRepository"/> </summary>
|
||||
/// <param name="context"> Database context </param>
|
||||
/// <returns>Repository</returns>
|
||||
private static IVisaApplicationsRepository GetRepository(DbContext context)
|
||||
private static IVisaApplicationsRepository GetRepository(DatabaseContext context)
|
||||
=> new VisaApplicationsRepository(context, context);
|
||||
|
||||
/// <summary> Returns <see cref="IDateTimeProvider"/> </summary>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Bogus" Version="35.6.1" />
|
||||
<PackageReference Include="FluentAssertions" Version="6.12.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.8" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="9.0.2" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.0"/>
|
||||
<PackageReference Include="xunit" Version="2.4.2"/>
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
|
||||
|
||||
Reference in New Issue
Block a user