Merge branch 'main' into HelpBench
This commit is contained in:
commit
f1e340788e
@ -17,7 +17,7 @@ namespace CaseAccountingBusinessLogic.BusinessLogics
|
||||
private readonly ILogger _logger;
|
||||
private readonly IUserStorage _userStorage;
|
||||
|
||||
public UserLogic(ILogger logger, IUserStorage userStorage)
|
||||
public UserLogic(ILogger<UserLogic> logger, IUserStorage userStorage)
|
||||
{
|
||||
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||
_userStorage = userStorage ?? throw new ArgumentNullException(nameof(userStorage));
|
||||
|
@ -7,8 +7,12 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.4" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.5" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.5">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -18,8 +18,8 @@ namespace CaseAccountingDataBaseImplement
|
||||
Host=localhost;
|
||||
Port=5432;
|
||||
Database=CaseAccountingDatabase;
|
||||
Username=postgres;
|
||||
Password=postgres");
|
||||
Username=courseuser;
|
||||
Password=courseuser");
|
||||
}
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
}
|
||||
|
588
CaseAccounting/CaseAccountingDataBaseImplement/Migrations/20230517203108_Init.Designer.cs
generated
Normal file
588
CaseAccounting/CaseAccountingDataBaseImplement/Migrations/20230517203108_Init.Designer.cs
generated
Normal file
@ -0,0 +1,588 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using CaseAccountingDataBaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CaseAccountingDataBaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(CaseAccountingDatabase))]
|
||||
[Migration("20230517203108_Init")]
|
||||
partial class Init
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.5")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Annotation")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Applicant")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Defendant")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SpecializationId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SpecializationId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Cases");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseDeal", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("DealId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("DealId");
|
||||
|
||||
b.ToTable("CaseDeals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseLawyer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("LawyerId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("LawyerId");
|
||||
|
||||
b.ToTable("CaseLawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Contract", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<decimal>("Coast")
|
||||
.HasColumnType("numeric");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Service")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Contracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Deal", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Responsibilities")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Subject")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Deals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.DealContract", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ContractId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("DealId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ContractId");
|
||||
|
||||
b.HasIndex("DealId");
|
||||
|
||||
b.ToTable("DealContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Hearing", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Information")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Hearings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Experience")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Patronymic")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SpecializationId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Surname")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SpecializationId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Lawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.LawyerContract", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ContractId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("LawyerId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ContractId");
|
||||
|
||||
b.HasIndex("LawyerId");
|
||||
|
||||
b.ToTable("LawyerContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Role", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Roles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Specialization", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Specializations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.User", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Specialization", "Specialization")
|
||||
.WithMany("Cases")
|
||||
.HasForeignKey("SpecializationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Cases")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Specialization");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseDeal", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Case", "Case")
|
||||
.WithMany("Deals")
|
||||
.HasForeignKey("CaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Deal", "Deal")
|
||||
.WithMany("CaseDeals")
|
||||
.HasForeignKey("DealId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Case");
|
||||
|
||||
b.Navigation("Deal");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseLawyer", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Case", "Case")
|
||||
.WithMany("CaseLawyers")
|
||||
.HasForeignKey("CaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Lawyer", "Lawyer")
|
||||
.WithMany("CaseLawyers")
|
||||
.HasForeignKey("LawyerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Case");
|
||||
|
||||
b.Navigation("Lawyer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Contract", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Contracts")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Deal", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Deals")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.DealContract", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Contract", "Contract")
|
||||
.WithMany("DealContracts")
|
||||
.HasForeignKey("ContractId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Deal", "Deal")
|
||||
.WithMany("Contracts")
|
||||
.HasForeignKey("DealId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Contract");
|
||||
|
||||
b.Navigation("Deal");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Hearing", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Case", "Case")
|
||||
.WithMany("Hearings")
|
||||
.HasForeignKey("CaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Hearings")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Case");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Specialization", "Specialization")
|
||||
.WithMany("Lawyers")
|
||||
.HasForeignKey("SpecializationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Lawyers")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Specialization");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.LawyerContract", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Contract", "Contract")
|
||||
.WithMany("LawyerContracts")
|
||||
.HasForeignKey("ContractId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Lawyer", "Lawyer")
|
||||
.WithMany("LawyerContracts")
|
||||
.HasForeignKey("LawyerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Contract");
|
||||
|
||||
b.Navigation("Lawyer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Specialization", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Specializations")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.User", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Role", "Role")
|
||||
.WithMany("Users")
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Role");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.Navigation("CaseLawyers");
|
||||
|
||||
b.Navigation("Deals");
|
||||
|
||||
b.Navigation("Hearings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Contract", b =>
|
||||
{
|
||||
b.Navigation("DealContracts");
|
||||
|
||||
b.Navigation("LawyerContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Deal", b =>
|
||||
{
|
||||
b.Navigation("CaseDeals");
|
||||
|
||||
b.Navigation("Contracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.Navigation("CaseLawyers");
|
||||
|
||||
b.Navigation("LawyerContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Role", b =>
|
||||
{
|
||||
b.Navigation("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Specialization", b =>
|
||||
{
|
||||
b.Navigation("Cases");
|
||||
|
||||
b.Navigation("Lawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.User", b =>
|
||||
{
|
||||
b.Navigation("Cases");
|
||||
|
||||
b.Navigation("Contracts");
|
||||
|
||||
b.Navigation("Deals");
|
||||
|
||||
b.Navigation("Hearings");
|
||||
|
||||
b.Navigation("Lawyers");
|
||||
|
||||
b.Navigation("Specializations");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,437 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CaseAccountingDataBaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Init : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Roles",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Name = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Roles", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Users",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Login = table.Column<string>(type: "text", nullable: false),
|
||||
Password = table.Column<string>(type: "text", nullable: false),
|
||||
RoleId = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Users", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Users_Roles_RoleId",
|
||||
column: x => x.RoleId,
|
||||
principalTable: "Roles",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Contracts",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Service = table.Column<string>(type: "text", nullable: false),
|
||||
Coast = table.Column<decimal>(type: "numeric", nullable: false),
|
||||
Date = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
UserId = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Contracts", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Contracts_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Deals",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Subject = table.Column<string>(type: "text", nullable: false),
|
||||
Responsibilities = table.Column<string>(type: "text", nullable: false),
|
||||
Date = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
UserId = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Deals", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Deals_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Specializations",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Name = table.Column<string>(type: "text", nullable: false),
|
||||
UserId = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Specializations", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Specializations_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "DealContracts",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
DealId = table.Column<int>(type: "integer", nullable: false),
|
||||
ContractId = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_DealContracts", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_DealContracts_Contracts_ContractId",
|
||||
column: x => x.ContractId,
|
||||
principalTable: "Contracts",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_DealContracts_Deals_DealId",
|
||||
column: x => x.DealId,
|
||||
principalTable: "Deals",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Cases",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Name = table.Column<string>(type: "text", nullable: false),
|
||||
Applicant = table.Column<string>(type: "text", nullable: false),
|
||||
Defendant = table.Column<string>(type: "text", nullable: false),
|
||||
Annotation = table.Column<string>(type: "text", nullable: false),
|
||||
Date = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
SpecializationId = table.Column<int>(type: "integer", nullable: false),
|
||||
UserId = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Cases", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Cases_Specializations_SpecializationId",
|
||||
column: x => x.SpecializationId,
|
||||
principalTable: "Specializations",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Cases_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Lawyers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Name = table.Column<string>(type: "text", nullable: false),
|
||||
Surname = table.Column<string>(type: "text", nullable: false),
|
||||
Patronymic = table.Column<string>(type: "text", nullable: false),
|
||||
Experience = table.Column<int>(type: "integer", nullable: false),
|
||||
SpecializationId = table.Column<int>(type: "integer", nullable: false),
|
||||
UserId = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Lawyers", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Lawyers_Specializations_SpecializationId",
|
||||
column: x => x.SpecializationId,
|
||||
principalTable: "Specializations",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Lawyers_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "CaseDeals",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
CaseId = table.Column<int>(type: "integer", nullable: false),
|
||||
DealId = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CaseDeals", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_CaseDeals_Cases_CaseId",
|
||||
column: x => x.CaseId,
|
||||
principalTable: "Cases",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_CaseDeals_Deals_DealId",
|
||||
column: x => x.DealId,
|
||||
principalTable: "Deals",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Hearings",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Information = table.Column<string>(type: "text", nullable: false),
|
||||
Date = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
CaseId = table.Column<int>(type: "integer", nullable: false),
|
||||
UserId = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Hearings", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Hearings_Cases_CaseId",
|
||||
column: x => x.CaseId,
|
||||
principalTable: "Cases",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Hearings_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "CaseLawyers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
CaseId = table.Column<int>(type: "integer", nullable: false),
|
||||
LawyerId = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CaseLawyers", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_CaseLawyers_Cases_CaseId",
|
||||
column: x => x.CaseId,
|
||||
principalTable: "Cases",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_CaseLawyers_Lawyers_LawyerId",
|
||||
column: x => x.LawyerId,
|
||||
principalTable: "Lawyers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "LawyerContracts",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
LawyerId = table.Column<int>(type: "integer", nullable: false),
|
||||
ContractId = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_LawyerContracts", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_LawyerContracts_Contracts_ContractId",
|
||||
column: x => x.ContractId,
|
||||
principalTable: "Contracts",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_LawyerContracts_Lawyers_LawyerId",
|
||||
column: x => x.LawyerId,
|
||||
principalTable: "Lawyers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CaseDeals_CaseId",
|
||||
table: "CaseDeals",
|
||||
column: "CaseId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CaseDeals_DealId",
|
||||
table: "CaseDeals",
|
||||
column: "DealId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CaseLawyers_CaseId",
|
||||
table: "CaseLawyers",
|
||||
column: "CaseId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CaseLawyers_LawyerId",
|
||||
table: "CaseLawyers",
|
||||
column: "LawyerId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Cases_SpecializationId",
|
||||
table: "Cases",
|
||||
column: "SpecializationId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Cases_UserId",
|
||||
table: "Cases",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Contracts_UserId",
|
||||
table: "Contracts",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_DealContracts_ContractId",
|
||||
table: "DealContracts",
|
||||
column: "ContractId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_DealContracts_DealId",
|
||||
table: "DealContracts",
|
||||
column: "DealId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Deals_UserId",
|
||||
table: "Deals",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Hearings_CaseId",
|
||||
table: "Hearings",
|
||||
column: "CaseId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Hearings_UserId",
|
||||
table: "Hearings",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LawyerContracts_ContractId",
|
||||
table: "LawyerContracts",
|
||||
column: "ContractId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LawyerContracts_LawyerId",
|
||||
table: "LawyerContracts",
|
||||
column: "LawyerId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Lawyers_SpecializationId",
|
||||
table: "Lawyers",
|
||||
column: "SpecializationId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Lawyers_UserId",
|
||||
table: "Lawyers",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Specializations_UserId",
|
||||
table: "Specializations",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Users_RoleId",
|
||||
table: "Users",
|
||||
column: "RoleId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "CaseDeals");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "CaseLawyers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "DealContracts");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Hearings");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "LawyerContracts");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Deals");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Cases");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Contracts");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Lawyers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Specializations");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Users");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Roles");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,585 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using CaseAccountingDataBaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CaseAccountingDataBaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(CaseAccountingDatabase))]
|
||||
partial class CaseAccountingDatabaseModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.5")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Annotation")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Applicant")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Defendant")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SpecializationId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SpecializationId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Cases");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseDeal", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("DealId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("DealId");
|
||||
|
||||
b.ToTable("CaseDeals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseLawyer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("LawyerId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("LawyerId");
|
||||
|
||||
b.ToTable("CaseLawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Contract", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<decimal>("Coast")
|
||||
.HasColumnType("numeric");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Service")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Contracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Deal", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Responsibilities")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Subject")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Deals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.DealContract", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ContractId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("DealId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ContractId");
|
||||
|
||||
b.HasIndex("DealId");
|
||||
|
||||
b.ToTable("DealContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Hearing", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Information")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Hearings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Experience")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Patronymic")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SpecializationId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Surname")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SpecializationId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Lawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.LawyerContract", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ContractId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("LawyerId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ContractId");
|
||||
|
||||
b.HasIndex("LawyerId");
|
||||
|
||||
b.ToTable("LawyerContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Role", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Roles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Specialization", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Specializations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.User", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Specialization", "Specialization")
|
||||
.WithMany("Cases")
|
||||
.HasForeignKey("SpecializationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Cases")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Specialization");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseDeal", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Case", "Case")
|
||||
.WithMany("Deals")
|
||||
.HasForeignKey("CaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Deal", "Deal")
|
||||
.WithMany("CaseDeals")
|
||||
.HasForeignKey("DealId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Case");
|
||||
|
||||
b.Navigation("Deal");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseLawyer", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Case", "Case")
|
||||
.WithMany("CaseLawyers")
|
||||
.HasForeignKey("CaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Lawyer", "Lawyer")
|
||||
.WithMany("CaseLawyers")
|
||||
.HasForeignKey("LawyerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Case");
|
||||
|
||||
b.Navigation("Lawyer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Contract", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Contracts")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Deal", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Deals")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.DealContract", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Contract", "Contract")
|
||||
.WithMany("DealContracts")
|
||||
.HasForeignKey("ContractId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Deal", "Deal")
|
||||
.WithMany("Contracts")
|
||||
.HasForeignKey("DealId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Contract");
|
||||
|
||||
b.Navigation("Deal");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Hearing", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Case", "Case")
|
||||
.WithMany("Hearings")
|
||||
.HasForeignKey("CaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Hearings")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Case");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Specialization", "Specialization")
|
||||
.WithMany("Lawyers")
|
||||
.HasForeignKey("SpecializationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Lawyers")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Specialization");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.LawyerContract", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Contract", "Contract")
|
||||
.WithMany("LawyerContracts")
|
||||
.HasForeignKey("ContractId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Lawyer", "Lawyer")
|
||||
.WithMany("LawyerContracts")
|
||||
.HasForeignKey("LawyerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Contract");
|
||||
|
||||
b.Navigation("Lawyer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Specialization", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Specializations")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.User", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Role", "Role")
|
||||
.WithMany("Users")
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Role");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.Navigation("CaseLawyers");
|
||||
|
||||
b.Navigation("Deals");
|
||||
|
||||
b.Navigation("Hearings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Contract", b =>
|
||||
{
|
||||
b.Navigation("DealContracts");
|
||||
|
||||
b.Navigation("LawyerContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Deal", b =>
|
||||
{
|
||||
b.Navigation("CaseDeals");
|
||||
|
||||
b.Navigation("Contracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.Navigation("CaseLawyers");
|
||||
|
||||
b.Navigation("LawyerContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Role", b =>
|
||||
{
|
||||
b.Navigation("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Specialization", b =>
|
||||
{
|
||||
b.Navigation("Cases");
|
||||
|
||||
b.Navigation("Lawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.User", b =>
|
||||
{
|
||||
b.Navigation("Cases");
|
||||
|
||||
b.Navigation("Contracts");
|
||||
|
||||
b.Navigation("Deals");
|
||||
|
||||
b.Navigation("Hearings");
|
||||
|
||||
b.Navigation("Lawyers");
|
||||
|
||||
b.Navigation("Specializations");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -7,6 +7,11 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.5">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="6.1.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -0,0 +1,85 @@
|
||||
using CaseAccountingContracts.BindingModels;
|
||||
using CaseAccountingContracts.BusinessLogicContracts;
|
||||
using CaseAccountingContracts.SearchModels;
|
||||
using CaseAccountingContracts.ViewModels;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace CaseAccountingRestApi.Controllers
|
||||
{
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class HearingController : Controller
|
||||
{
|
||||
private readonly IHearingLogic _logic;
|
||||
|
||||
public HearingController(IHearingLogic logic)
|
||||
{
|
||||
_logic = logic;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HearingViewModel? Get(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _logic.ReadElement(new HearingSearchModel { Id = id });
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public List<HearingViewModel>? GetAllByUser(int userId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _logic.ReadList(null);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Create(HearingBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logic.Create(model);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Update(HearingBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logic.Update(model);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Delete(HearingBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logic.Delete(new() { Id = model.Id });
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -6,8 +6,8 @@ using Microsoft.OpenApi.Models;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
//builder.Logging.SetMinimumLevel(LogLevel.Trace);
|
||||
//builder.Logging.AddLog4Net("log4net.config");
|
||||
builder.Logging.SetMinimumLevel(LogLevel.Trace);
|
||||
builder.Logging.AddLog4Net("log4net.config");
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddTransient<ICaseStorage, CaseStorage>();
|
||||
|
Loading…
Reference in New Issue
Block a user