DTO project fixed, events experiments
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
namespace TimetableDesigner.Backend.Services.Authentication.DTO.API;
|
||||
namespace TimetableDesigner.Backend.Services.Authentication.DTO.WebAPI;
|
||||
|
||||
public class AuthenticatePasswordRequest
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace TimetableDesigner.Backend.Services.Authentication.DTO.API;
|
||||
namespace TimetableDesigner.Backend.Services.Authentication.DTO.WebAPI;
|
||||
|
||||
public class AuthenticateResponse
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace TimetableDesigner.Backend.Services.Authentication.DTO.API;
|
||||
namespace TimetableDesigner.Backend.Services.Authentication.DTO.WebAPI;
|
||||
|
||||
public class AuthenticateTokenRequest
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace TimetableDesigner.Backend.Services.Authentication.DTO.API;
|
||||
namespace TimetableDesigner.Backend.Services.Authentication.DTO.WebAPI;
|
||||
|
||||
public record RegisterRequest(
|
||||
string Email,
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace TimetableDesigner.Backend.Services.Authentication.DTO.API;
|
||||
namespace TimetableDesigner.Backend.Services.Authentication.DTO.WebAPI;
|
||||
|
||||
public record RegisterResponse(
|
||||
long Id,
|
||||
@@ -1,9 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,34 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TimetableDesigner.Backend.Services.Authentication", "TimetableDesigner.Backend.Services.Authentication\TimetableDesigner.Backend.Services.Authentication.csproj", "{F8C0AEF3-B53F-4904-90F7-EE4A8587F023}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TimetableDesigner.Backend.Services.Authentication.DTO", "TimetableDesigner.Backend.Services.Authentication.DTO", "{B610971F-EF8F-45D2-B869-41617ED447C8}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TimetableDesigner.Backend.Services.Authentication.DTO.API", "TimetableDesigner.Backend.Services.Authentication.DTO\TimetableDesigner.Backend.Services.Authentication.DTO.API\TimetableDesigner.Backend.Services.Authentication.DTO.API.csproj", "{0639DAB9-E1B4-454E-A3E9-F7B712A697E8}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TimetableDesigner.Backend.Services.Authentication.DTO.Events", "TimetableDesigner.Backend.Services.Authentication.DTO\TimetableDesigner.Backend.Services.Authentication.DTO.Events\TimetableDesigner.Backend.Services.Authentication.DTO.Events.csproj", "{3E39EDEE-621F-49BC-B777-174BB047BCA7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{F8C0AEF3-B53F-4904-90F7-EE4A8587F023}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F8C0AEF3-B53F-4904-90F7-EE4A8587F023}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F8C0AEF3-B53F-4904-90F7-EE4A8587F023}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F8C0AEF3-B53F-4904-90F7-EE4A8587F023}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0639DAB9-E1B4-454E-A3E9-F7B712A697E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0639DAB9-E1B4-454E-A3E9-F7B712A697E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0639DAB9-E1B4-454E-A3E9-F7B712A697E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0639DAB9-E1B4-454E-A3E9-F7B712A697E8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3E39EDEE-621F-49BC-B777-174BB047BCA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3E39EDEE-621F-49BC-B777-174BB047BCA7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3E39EDEE-621F-49BC-B777-174BB047BCA7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3E39EDEE-621F-49BC-B777-174BB047BCA7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{0639DAB9-E1B4-454E-A3E9-F7B712A697E8} = {B610971F-EF8F-45D2-B869-41617ED447C8}
|
||||
{3E39EDEE-621F-49BC-B777-174BB047BCA7} = {B610971F-EF8F-45D2-B869-41617ED447C8}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
5
TimetableDesigner.Backend.Services.Authentication.slnx
Normal file
5
TimetableDesigner.Backend.Services.Authentication.slnx
Normal file
@@ -0,0 +1,5 @@
|
||||
<Solution>
|
||||
<Project Path="../TimetableDesigner.Backend.Events/TimetableDesigner.Backend.Events/TimetableDesigner.Backend.Events.csproj" />
|
||||
<Project Path="TimetableDesigner.Backend.Services.Authentication.DTO.WebAPI/TimetableDesigner.Backend.Services.Authentication.DTO.WebAPI.csproj" />
|
||||
<Project Path="TimetableDesigner.Backend.Services.Authentication/TimetableDesigner.Backend.Services.Authentication.csproj" />
|
||||
</Solution>
|
||||
@@ -1,5 +1,5 @@
|
||||
using TimetableDesigner.Backend.Services.Authentication.Database.Model;
|
||||
using TimetableDesigner.Backend.Services.Authentication.DTO.API;
|
||||
using TimetableDesigner.Backend.Services.Authentication.DTO.WebAPI;
|
||||
|
||||
namespace TimetableDesigner.Backend.Services.Authentication.Application.Commands.Register;
|
||||
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using TimetableDesigner.Backend.Services.Authentication.Database;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TimetableDesigner.Backend.Services.Authentication.Database.Migrations
|
||||
{
|
||||
[DbContext(typeof(DatabaseContext))]
|
||||
[Migration("20260114231600_Account changes")]
|
||||
partial class Accountchanges
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("TimetableDesigner.Backend.Services.Authentication.Database.Model.Account", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityAlwaysColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasMaxLength(320)
|
||||
.HasColumnType("character varying(320)");
|
||||
|
||||
b.Property<byte[]>("Password")
|
||||
.IsRequired()
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("bytea");
|
||||
|
||||
b.Property<string>("PasswordSalt")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.Property<uint>("Version")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("xid")
|
||||
.HasColumnName("xmin");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Id")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Accounts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TimetableDesigner.Backend.Services.Authentication.Database.Model.RefreshToken", b =>
|
||||
{
|
||||
b.Property<Guid>("Token")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<long>("AccountId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("ExpirationDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsExtendable")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<uint>("Version")
|
||||
.IsConcurrencyToken()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasColumnType("xid")
|
||||
.HasColumnName("xmin");
|
||||
|
||||
b.HasKey("Token");
|
||||
|
||||
b.HasIndex("AccountId");
|
||||
|
||||
b.HasIndex("Token")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("RefreshTokens");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TimetableDesigner.Backend.Services.Authentication.Database.Model.RefreshToken", b =>
|
||||
{
|
||||
b.HasOne("TimetableDesigner.Backend.Services.Authentication.Database.Model.Account", "Account")
|
||||
.WithMany("RefreshTokens")
|
||||
.HasForeignKey("AccountId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Account");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TimetableDesigner.Backend.Services.Authentication.Database.Model.Account", b =>
|
||||
{
|
||||
b.Navigation("RefreshTokens");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TimetableDesigner.Backend.Services.Authentication.Database.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Accountchanges : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PasswordSaltLeft",
|
||||
table: "Accounts");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "PasswordSaltRight",
|
||||
table: "Accounts",
|
||||
newName: "PasswordSalt");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "PasswordSalt",
|
||||
table: "Accounts",
|
||||
newName: "PasswordSaltRight");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "PasswordSaltLeft",
|
||||
table: "Accounts",
|
||||
type: "character varying(20)",
|
||||
maxLength: 20,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,12 +40,7 @@ namespace TimetableDesigner.Backend.Services.Authentication.Database.Migrations
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("bytea");
|
||||
|
||||
b.Property<string>("PasswordSaltLeft")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
b.Property<string>("PasswordSaltRight")
|
||||
b.Property<string>("PasswordSalt")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)");
|
||||
|
||||
@@ -2,6 +2,8 @@ using System.Reflection;
|
||||
using FluentValidation;
|
||||
using Microsoft.AspNetCore.Identity.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using TimetableDesigner.Backend.Events;
|
||||
using TimetableDesigner.Backend.Events.RabbitMQ;
|
||||
using TimetableDesigner.Backend.Services.Authentication.API;
|
||||
using TimetableDesigner.Backend.Services.Authentication.API.Validators;
|
||||
using TimetableDesigner.Backend.Services.Authentication.Application.Helpers;
|
||||
@@ -33,6 +35,13 @@ public static class Program
|
||||
|
||||
private static WebApplicationBuilder SetupOpenApi(this WebApplicationBuilder builder)
|
||||
{
|
||||
builder.Services.AddEventQueue<RabbitMQEventQueueBuilder>(cfg =>
|
||||
{
|
||||
cfg.Hostname = "localhost";
|
||||
cfg.Port = 5672;
|
||||
cfg.Username = "user";
|
||||
cfg.Password = "l4JxOIuSoyod86N";
|
||||
});
|
||||
builder.Services.AddOpenApi();
|
||||
return builder;
|
||||
}
|
||||
@@ -57,7 +66,7 @@ public static class Program
|
||||
|
||||
private static WebApplicationBuilder SetupValidation(this WebApplicationBuilder builder)
|
||||
{
|
||||
builder.Services.AddScoped<IValidator<TimetableDesigner.Backend.Services.Authentication.DTO.API.RegisterRequest>, RegisterRequestValidator>();
|
||||
builder.Services.AddScoped<IValidator<TimetableDesigner.Backend.Services.Authentication.DTO.WebAPI.RegisterRequest>, RegisterRequestValidator>();
|
||||
return builder;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,8 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\TimetableDesigner.Backend.Services.Authentication.DTO\TimetableDesigner.Backend.Services.Authentication.DTO.API\TimetableDesigner.Backend.Services.Authentication.DTO.API.csproj" />
|
||||
<ProjectReference Include="..\..\TimetableDesigner.Backend.Events\TimetableDesigner.Backend.Events\TimetableDesigner.Backend.Events.csproj" />
|
||||
<ProjectReference Include="..\TimetableDesigner.Backend.Services.Authentication.DTO.WebAPI\TimetableDesigner.Backend.Services.Authentication.DTO.WebAPI.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -4,7 +4,7 @@ using MediatR;
|
||||
using Microsoft.AspNetCore.Http.HttpResults;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using TimetableDesigner.Backend.Services.Authentication.Application.Commands.Register;
|
||||
using TimetableDesigner.Backend.Services.Authentication.DTO.API;
|
||||
using TimetableDesigner.Backend.Services.Authentication.DTO.WebAPI;
|
||||
|
||||
namespace TimetableDesigner.Backend.Services.Authentication.API;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using FluentValidation;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using TimetableDesigner.Backend.Services.Authentication.Database;
|
||||
using TimetableDesigner.Backend.Services.Authentication.DTO.API;
|
||||
using TimetableDesigner.Backend.Services.Authentication.DTO.WebAPI;
|
||||
|
||||
namespace TimetableDesigner.Backend.Services.Authentication.API.Validators;
|
||||
|
||||
Reference in New Issue
Block a user