Merge branch 'main' of http://student.git.athene.tech/maxnes3/Case_accounting
This commit is contained in:
commit
3aa0265de4
@ -1,7 +1,10 @@
|
||||
using CaseAccountingDataModels.Models;
|
||||
using CaseAccountingContracts.ViewModels;
|
||||
using CaseAccountingDataModels.Models;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@ -17,12 +20,28 @@ namespace CaseAccountingContracts.BindingModels
|
||||
|
||||
public int Experience { get; set; }
|
||||
|
||||
public int SpecializationId { get; set; }
|
||||
public int? SpecializationId { get; set; }
|
||||
|
||||
public int UserId { get; set; }
|
||||
|
||||
public int Id { get; set; }
|
||||
|
||||
public Dictionary<int, ICaseModel> Cases { get; set; } = new();
|
||||
|
||||
public List<CaseViewModel> CaseViewModels { get; set; } = new();
|
||||
|
||||
public Dictionary<int, IContractModel> Contracts { get; set; } = new();
|
||||
|
||||
public List<ContractViewModel> ContractViewModels { get; set; } = new();
|
||||
|
||||
public LawyerBindingModel() { }
|
||||
|
||||
[JsonConstructor]
|
||||
public LawyerBindingModel(Dictionary<int, ContractViewModel> Contracts, Dictionary<int, CaseViewModel> Cases)
|
||||
{
|
||||
this.Contracts = Contracts.ToDictionary(x => x.Key, x => (IContractModel)x.Value);
|
||||
this.Cases = Cases.ToDictionary(x => x.Key, x => (ICaseModel)x.Value);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -18,11 +18,13 @@ namespace CaseAccountingContracts.ViewModels
|
||||
public string Patronymic { get; set; } = string.Empty;
|
||||
[DisplayName("Опыт работы")]
|
||||
public int Experience { get; set; }
|
||||
public int SpecializationId { get; set; }
|
||||
public int? SpecializationId { get; set; }
|
||||
[DisplayName("Специализация")]
|
||||
public string Specialization { get; set; } = string.Empty;
|
||||
public int UserId { get; set; }
|
||||
public int Id { get; set; }
|
||||
public Dictionary<int, IContractModel> Contracts { get; set; } = new();
|
||||
|
||||
public Dictionary<int, ICaseModel> Cases { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
using CaseAccountingContracts.BindingModels;
|
||||
using CaseAccountingContracts.ViewModels;
|
||||
using CaseAccountingDataModels.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace CaseAccountingCustomerView.Controllers
|
||||
@ -23,6 +24,14 @@ namespace CaseAccountingCustomerView.Controllers
|
||||
throw new Exception("403");
|
||||
}
|
||||
lawyerModel.UserId = APIUser.User.Id;
|
||||
lawyerModel.SpecializationId = null;
|
||||
var dict = new Dictionary<int, IContractModel>();
|
||||
foreach (var element in lawyerModel.ContractViewModels)
|
||||
{
|
||||
var contract = APIUser.GetRequest<ContractViewModel>($"api/contract/get?id={element.Id}");
|
||||
dict.Add(element.Id, contract);
|
||||
}
|
||||
lawyerModel.Contracts = dict;
|
||||
APIUser.PostRequest("api/lawyer/create", lawyerModel);
|
||||
Response.Redirect("/Home/Lawyers");
|
||||
}
|
||||
@ -45,6 +54,13 @@ namespace CaseAccountingCustomerView.Controllers
|
||||
throw new Exception("403");
|
||||
}
|
||||
lawyerModel.UserId = APIUser.User.Id;
|
||||
var dict = new Dictionary<int, ICaseModel>();
|
||||
foreach (var element in lawyerModel.CaseViewModels)
|
||||
{
|
||||
var _case = APIUser.GetRequest<CaseViewModel>($"api/case/get?id={element.Id}");
|
||||
dict.Add(element.Id, _case);
|
||||
}
|
||||
lawyerModel.Cases = dict;
|
||||
APIUser.PostRequest("api/lawyer/update", lawyerModel);
|
||||
Response.Redirect("/Home/Lawyers");
|
||||
}
|
||||
@ -70,16 +86,6 @@ namespace CaseAccountingCustomerView.Controllers
|
||||
return lawyers ?? new();
|
||||
}
|
||||
|
||||
/*public List<EducationGroupViewModel> GetAllCases()
|
||||
{
|
||||
if (APIUser.User == null)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
List<EducationGroupViewModel>? group = APIUser.GetRequest<List<EducationGroupViewModel>>("api/lawyer/GetAllCases");
|
||||
return group ?? new();
|
||||
}*/
|
||||
|
||||
public LawyerViewModel? Get(int id)
|
||||
{
|
||||
if (APIUser.User == null)
|
||||
@ -100,6 +106,16 @@ namespace CaseAccountingCustomerView.Controllers
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Bind([FromBody] LawyerBindingModel lawyerModel)
|
||||
{
|
||||
if (APIUser.User == null)
|
||||
{
|
||||
throw new Exception("403");
|
||||
}
|
||||
APIUser.PostRequest("api/lawyer/update", lawyerModel);
|
||||
}
|
||||
|
||||
public List<LawyerViewModel> GetAllByUserAndSpecialization(int specialization)
|
||||
{
|
||||
if (APIUser.User == null)
|
||||
@ -109,6 +125,17 @@ namespace CaseAccountingCustomerView.Controllers
|
||||
List<LawyerViewModel>? lawyers = APIUser.GetRequest<List<LawyerViewModel>>($"api/lawyer/getallbyuserandspecialization?userId={APIUser.User.Id}&specialization={specialization}");
|
||||
return lawyers ?? new();
|
||||
}
|
||||
|
||||
public List<CaseViewModel> GetAllCases()
|
||||
{
|
||||
if (APIUser.User == null)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
List<CaseViewModel>? _case = APIUser.GetRequest<List<CaseViewModel>>("api/lawyer/GetAllCases");
|
||||
return _case ?? new();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,16 +79,24 @@ namespace CaseAccountingCustomerView.Controllers
|
||||
SpecializationViewModel? specialization = APIUser.GetRequest<SpecializationViewModel>($"api/specialization/get?id={id}");
|
||||
return specialization;
|
||||
}
|
||||
|
||||
public List<SpecializationViewModel> GetAll()
|
||||
public IActionResult AddLawyer(int id)
|
||||
{
|
||||
if (APIUser.User == null)
|
||||
{
|
||||
return new();
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
List<SpecializationViewModel>? specializations = APIUser.GetRequest<List<SpecializationViewModel>>($"api/specialization/getall");
|
||||
return specializations ?? new();
|
||||
ViewBag.SpecializationId = id;
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void AddLawyer([FromBody] LawyerBindingModel lawyerModel)
|
||||
{
|
||||
if (APIUser.User == null)
|
||||
{
|
||||
throw new Exception("403");
|
||||
}
|
||||
APIUser.PostRequest("api/lawyer/update", lawyerModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
return;
|
||||
}
|
||||
<div>
|
||||
<a class="btn btn-secondary" asp-controller="Lawyer" asp-action="Create">Добавить юриста</a>
|
||||
<a class="btn btn-secondary" asp-controller="Lawyers" asp-action="Create">Добавить юриста</a>
|
||||
</div>
|
||||
<table class="table">
|
||||
<thead>
|
||||
@ -46,13 +46,16 @@
|
||||
@item.Name @item.Surname @item.Patronymic
|
||||
</td>
|
||||
<td>
|
||||
@item.StudentCard
|
||||
@item.Experience
|
||||
</td>
|
||||
<td>
|
||||
@item.EducationStatusName
|
||||
@item.Specialization
|
||||
</td>
|
||||
<td>
|
||||
<a id="update-button-@item.Id" class="btn btn-secondary" asp-controller="Lawyer" asp-action="Update" asp-route-id="@item.Id">Изменить</a>
|
||||
<a id="update-button-@item.Id" class="btn btn-secondary" asp-controller="Lawyers" asp-action="Bind" asp-route-id="@item.Id">Привязка</a>
|
||||
</td>
|
||||
<td>
|
||||
<a id="update-button-@item.Id" class="btn btn-secondary" asp-controller="Lawyers" asp-action="Update" asp-route-id="@item.Id">Изменить</a>
|
||||
</td>
|
||||
<td>
|
||||
<a id="remove-button-@item.Id" class="btn btn-secondary remove-btn" data-id="@item.Id">Удалить</a>
|
||||
@ -64,4 +67,4 @@
|
||||
}
|
||||
</div>
|
||||
|
||||
<script src="~/js/lawyer/lawyers.js" asp-append-version="true"></script>
|
||||
<script src="~/js/Lawyers/lawyers.js" asp-append-version="true"></script>
|
@ -44,6 +44,9 @@
|
||||
<td>
|
||||
@item.Name
|
||||
</td>
|
||||
<td>
|
||||
<a id="add-lawyer-button-@item.Id" class="btn btn-secondary" asp-controller="Specializations" asp-action="AddLawyer" asp-route-id="@item.Id">Назначить специализацию для юриста</a>
|
||||
</td>
|
||||
<td>
|
||||
<a id="update-button-@item.Id" class="btn btn-secondary" asp-controller="Specialization" asp-action="Update" asp-route-id="@item.Id">Изменить</a>
|
||||
</td>
|
||||
@ -57,4 +60,4 @@
|
||||
}
|
||||
</div>
|
||||
|
||||
<script src="~/js/specialization/specializations.js" asp-append-version="true"></script>
|
||||
<script src="~/js/Specializations/specializations.js" asp-append-version="true"></script>
|
@ -12,7 +12,7 @@
|
||||
</div>
|
||||
|
||||
<p class="mb-0">Название:</p>
|
||||
<input type="text" readonly value="@ViewBag.Document.Name" id="name-input" name="name" class="form-control mb-3" />
|
||||
<input type="text" readonly value="@ViewBag.Lawyer.Name" id="name-input" name="name" class="form-control mb-3" />
|
||||
|
||||
<button id="create-button" type="button" class="button-primary text-button">
|
||||
Сохранить привязку
|
||||
@ -23,7 +23,7 @@
|
||||
<table class="table table-bordered">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>Название группы:</th>
|
||||
<th>Название дела:</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="scrollable-table__tbody">
|
||||
@ -32,4 +32,4 @@
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
<script src="~/js/document/document-bind.js" asp-append-version="true"></script>
|
||||
<script src="~/js/Lawyers/lawyer-bind.js" asp-append-version="true"></script>
|
@ -19,8 +19,24 @@
|
||||
<p class="mb-0">Опыт работы:</p>
|
||||
<input type="number" id="experience-input" name="experience" class="form-control mb-3" />
|
||||
|
||||
<div>
|
||||
<div class="scrollable-table">
|
||||
<table class="table table-bordered">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>Услуга</th>
|
||||
<th>Цена</th>
|
||||
<th>Дата</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="scrollable-table__tbody">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button id="create-button" type="button" class="button-primary text-button">
|
||||
Создать
|
||||
</button>
|
||||
|
||||
<script src="~/js/lawyer/lawyer-create.js" asp-append-version="true"></script>
|
||||
<script src="~/js/Lawyers/lawyer-create.js" asp-append-version="true"></script>
|
@ -33,4 +33,4 @@
|
||||
</button>
|
||||
}
|
||||
|
||||
<script src="~/js/lawyer/lawyer-update.js" asp-append-version="true"></script>
|
||||
<script src="~/js/Lawyers/lawyer-update.js" asp-append-version="true"></script>
|
@ -54,4 +54,4 @@
|
||||
</div>
|
||||
}
|
||||
|
||||
<script src="~/js/Specializations/specialization-add-student.js" asp-append-version="true"></script>
|
||||
<script src="~/js/Specializations/specializations-add-lawyer.js" asp-append-version="true"></script>
|
@ -4,48 +4,54 @@ const nameInput = document.getElementById("name-input");
|
||||
const currentLawyerId = document.getElementById("lawyer-data").dataset.id;
|
||||
var cases = [];
|
||||
var dataArray = [];
|
||||
var currentlawyer = null;
|
||||
var currentLawyer = null;
|
||||
|
||||
window.addEventListener('load', async () => {
|
||||
await $.ajax({
|
||||
url: "/lawyer/getallgroups",
|
||||
url: "/lawyers/getallcases",
|
||||
type: "GET",
|
||||
contentType: "json"
|
||||
}).done((result) => {
|
||||
groups = result;
|
||||
console.log(groups)
|
||||
cases = result;
|
||||
console.log(cases)
|
||||
});
|
||||
await $.ajax({
|
||||
url: `/document/get?id=${currentDocumentId}`,
|
||||
url: `/lawyers/get?id=${currentLawyerId}`,
|
||||
type: "GET",
|
||||
contentType: "json"
|
||||
}).done((result) => {
|
||||
currentDocument = result;
|
||||
console.log(currentDocument)
|
||||
currentLawyer = result;
|
||||
});
|
||||
groups.forEach((group) => createRowForGroupsTable(group));
|
||||
cases.forEach((_case) => createRowForCasesTable(_case));
|
||||
})
|
||||
|
||||
createBtn.addEventListener('click', () => {
|
||||
var documentGroupsUpdate = {
|
||||
"Id": currentDocument.id,
|
||||
"Name": currentDocument.name,
|
||||
"Date": currentDocument.date,
|
||||
"DocumentStudents": currentDocument.documentStudents,
|
||||
"DocumentGroups": dataArray,
|
||||
console.log("My data:")
|
||||
console.log(currentLawyer);
|
||||
console.log(dataArray);
|
||||
var lawyerCasesUpdate = {
|
||||
"Id": currentLawyer.id,
|
||||
"Name": currentLawyer.name,
|
||||
"Surname": currentLawyer.surname,
|
||||
"Patronymic": currentLawyer.patronymic,
|
||||
"SpecializationId": currentLawyer.specializationId,
|
||||
"Experience": currentLawyer.experience,
|
||||
"ContractViewModels": currentLawyer.contractViewModels,
|
||||
"CaseViewModels": dataArray,
|
||||
}
|
||||
console.log(lawyerCasesUpdate);
|
||||
$.ajax({
|
||||
url: "/document/update",
|
||||
url: "/lawyers/update",
|
||||
type: "POST",
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify(documentGroupsUpdate)
|
||||
data: JSON.stringify(lawyerCasesUpdate)
|
||||
}).done(() => {
|
||||
window.location.href = "/Home/Documents";
|
||||
window.location.href = "/Home/Lawyers";
|
||||
});
|
||||
})
|
||||
|
||||
const createRowForGroupsTable = (group) => {
|
||||
const { id, name } = group;
|
||||
const createRowForCasesTable = (_case) => {
|
||||
const { id, name, applicant, defendant, annotation, date, specializationId } = _case;
|
||||
const row = tbody.insertRow();
|
||||
row.setAttribute("data-id", id);
|
||||
|
||||
@ -54,10 +60,10 @@ const createRowForGroupsTable = (group) => {
|
||||
const cell = row.insertCell();
|
||||
cell.textContent = value;
|
||||
});
|
||||
console.log(currentDocument)
|
||||
if (currentDocument.documentEdGroups?.find(x => parseInt(x.id) === parseInt(group.id))) {
|
||||
console.log(currentLawyer)
|
||||
if (currentLawyer.lawyerCases?.find(x => parseInt(x.id) === parseInt(_case.id))) {
|
||||
row.classList.add("bg-success");
|
||||
dataArray.push(group);
|
||||
dataArray.push(_case);
|
||||
}
|
||||
|
||||
row.addEventListener('click', () => addAndRemoveFromList(row));
|
||||
@ -73,9 +79,9 @@ const formatDate = (dateString) => {
|
||||
|
||||
const addAndRemoveFromList = (row) => {
|
||||
var id = parseInt(row.dataset.id);
|
||||
var index = dataArray.indexOf(groups.find(x => x.id === id));
|
||||
var index = dataArray.indexOf(cases.find(x => x.id === id));
|
||||
if (index === -1) {
|
||||
dataArray.push(groups.find(x => x.id === id));
|
||||
dataArray.push(cases.find(x => x.id === id));
|
||||
row.classList.add("bg-success");
|
||||
} else {
|
||||
dataArray.splice(index, 1);
|
||||
|
@ -10,12 +10,12 @@ var dataArray = [];
|
||||
|
||||
window.addEventListener('load', () => {
|
||||
$.ajax({
|
||||
url: "/contract/getallbyuser",
|
||||
url: "/contracts/getallbyuser",
|
||||
type: "GET",
|
||||
contentType: "json"
|
||||
}).done((result) => {
|
||||
contracts = result;
|
||||
contracts.forEach((contract) => createRowForStudentsTable(contract));
|
||||
contracts.forEach((contract) => createRowForContractsTable(contract));
|
||||
});
|
||||
})
|
||||
|
||||
@ -25,10 +25,11 @@ createBtn.addEventListener('click', () => {
|
||||
"Surname": surnameInput.value,
|
||||
"Patronymic": patronymicInput.value,
|
||||
"Experience": parseInt(experienceInput.value),
|
||||
"LawyerContracts": dataArray,
|
||||
"ContractViewModels": dataArray,
|
||||
}
|
||||
console.log(lawyer);
|
||||
$.ajax({
|
||||
url: "/lawyer/create",
|
||||
url: "/lawyers/create",
|
||||
type: "POST",
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify(lawyer)
|
||||
|
@ -9,14 +9,14 @@ var currentLawyer = null;
|
||||
|
||||
window.addEventListener('load', async () => {
|
||||
await $.ajax({
|
||||
url: "/contract/getallbyuser",
|
||||
url: "/contracts/getallbyuser",
|
||||
type: "GET",
|
||||
contentType: "json"
|
||||
}).done((result) => {
|
||||
contracts = result;
|
||||
});
|
||||
await $.ajax({
|
||||
url: `/lawyer/get?id=${currentLawyerId}`,
|
||||
url: `/lawyers/get?id=${currentLawyerId}`,
|
||||
type: "GET",
|
||||
contentType: "json"
|
||||
}).done((result) => {
|
||||
@ -25,13 +25,13 @@ window.addEventListener('load', async () => {
|
||||
contracts.forEach((contract) => createRowForContractsTable(contract));
|
||||
})
|
||||
|
||||
/*createBtn.addEventListener('click', () => {
|
||||
createBtn.addEventListener('click', () => {
|
||||
var lawyerCasesUpdate = {
|
||||
"Id": currentLawyer.id,
|
||||
"Service": serviceInput.value,
|
||||
"Coast": coastInput.value,
|
||||
"Date": currentLawyer.date,
|
||||
"LawyerContracts": dataArray,
|
||||
"ContractViewModels": dataArray,
|
||||
"LawyerCases": currentLawyer.lawyerCases,
|
||||
}
|
||||
$.ajax({
|
||||
@ -42,7 +42,7 @@ window.addEventListener('load', async () => {
|
||||
}).done(() => {
|
||||
window.location.href = "/Home/Lawyers";
|
||||
});
|
||||
})*/
|
||||
})
|
||||
|
||||
const createRowForContractsTable = (contract) => {
|
||||
const { id, service, coast, date} = contract;
|
||||
|
@ -10,7 +10,7 @@ removeButtons.forEach(function (button) {
|
||||
var result = confirm("Вы уверены, что хотите удалить эту запись?");
|
||||
if (result) {
|
||||
$.ajax({
|
||||
url: "/lawyer/delete",
|
||||
url: "/lawyers/delete",
|
||||
type: "POST",
|
||||
data: { Id: id }
|
||||
}).done(() => {
|
||||
|
@ -16,6 +16,7 @@ window.addEventListener("load", async () => {
|
||||
});
|
||||
lawyers = lawyersResponse;
|
||||
|
||||
console.log(lawyers);
|
||||
lawyers.forEach((lawyer) => {
|
||||
createLawyerOption(lawyer);
|
||||
});
|
||||
|
@ -18,8 +18,8 @@ namespace CaseAccountingDataBaseImplement
|
||||
Host=localhost;
|
||||
Port=5432;
|
||||
Database=CaseAccountingDatabase;
|
||||
Username=courseuser;
|
||||
Password=courseuser");
|
||||
Username=postgres;
|
||||
Password=postgres");
|
||||
}
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
}
|
||||
|
@ -123,9 +123,12 @@ namespace CaseAccountingDataBaseImplement.Implements
|
||||
{
|
||||
return null;
|
||||
}
|
||||
lawyer.Update(model);
|
||||
lawyer.Update(context, model);
|
||||
context.SaveChanges();
|
||||
if (model.Cases.Count > 0)
|
||||
{
|
||||
lawyer.UpdateContracts(context, model);
|
||||
}
|
||||
transaction.Commit();
|
||||
return lawyer.GetViewModel;
|
||||
}
|
||||
|
@ -0,0 +1,554 @@
|
||||
// <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("20230519143905_migrSpecializationNull")]
|
||||
partial class migrSpecializationNull
|
||||
{
|
||||
/// <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")
|
||||
.IsRequired()
|
||||
.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.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>("Role")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
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.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.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,22 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CaseAccountingDataBaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class migrSpecializationNull : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,551 @@
|
||||
// <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("20230519145356_migrSpecializationNullAttempt2")]
|
||||
partial class migrSpecializationNullAttempt2
|
||||
{
|
||||
/// <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.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>("Role")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
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");
|
||||
|
||||
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.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.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,59 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CaseAccountingDataBaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class migrSpecializationNullAttempt2 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Lawyers_Specializations_SpecializationId",
|
||||
table: "Lawyers");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "SpecializationId",
|
||||
table: "Lawyers",
|
||||
type: "integer",
|
||||
nullable: true,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "integer");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Lawyers_Specializations_SpecializationId",
|
||||
table: "Lawyers",
|
||||
column: "SpecializationId",
|
||||
principalTable: "Specializations",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Lawyers_Specializations_SpecializationId",
|
||||
table: "Lawyers");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "SpecializationId",
|
||||
table: "Lawyers",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "integer",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Lawyers_Specializations_SpecializationId",
|
||||
table: "Lawyers",
|
||||
column: "SpecializationId",
|
||||
principalTable: "Specializations",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
551
CaseAccounting/CaseAccountingDataBaseImplement/Migrations/20230519162440_migrBindTry1.Designer.cs
generated
Normal file
551
CaseAccounting/CaseAccountingDataBaseImplement/Migrations/20230519162440_migrBindTry1.Designer.cs
generated
Normal file
@ -0,0 +1,551 @@
|
||||
// <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("20230519162440_migrBindTry1")]
|
||||
partial class migrBindTry1
|
||||
{
|
||||
/// <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.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>("Role")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
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");
|
||||
|
||||
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.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.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,22 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CaseAccountingDataBaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class migrBindTry1 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
551
CaseAccounting/CaseAccountingDataBaseImplement/Migrations/20230519172138_migrBindTry2.Designer.cs
generated
Normal file
551
CaseAccounting/CaseAccountingDataBaseImplement/Migrations/20230519172138_migrBindTry2.Designer.cs
generated
Normal file
@ -0,0 +1,551 @@
|
||||
// <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("20230519172138_migrBindTry2")]
|
||||
partial class migrBindTry2
|
||||
{
|
||||
/// <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.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>("Role")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
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");
|
||||
|
||||
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.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.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,22 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CaseAccountingDataBaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class migrBindTry2 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -239,7 +239,7 @@ namespace CaseAccountingDataBaseImplement.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SpecializationId")
|
||||
b.Property<int?>("SpecializationId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Surname")
|
||||
@ -448,9 +448,7 @@ namespace CaseAccountingDataBaseImplement.Migrations
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Specialization", "Specialization")
|
||||
.WithMany("Lawyers")
|
||||
.HasForeignKey("SpecializationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
.HasForeignKey("SpecializationId");
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Lawyers")
|
||||
|
@ -27,9 +27,8 @@ namespace CaseAccountingDataBaseImplement.Models
|
||||
[Required]
|
||||
public int Experience { get; set; }
|
||||
|
||||
[Required]
|
||||
public int SpecializationId { get; set; }
|
||||
public virtual Specialization Specialization { get; set; } = new();
|
||||
public int? SpecializationId { get; set; }
|
||||
public virtual Specialization? Specialization { get; set; } = new();
|
||||
|
||||
[Required]
|
||||
public int UserId { get; set; }
|
||||
@ -38,6 +37,22 @@ namespace CaseAccountingDataBaseImplement.Models
|
||||
[ForeignKey("LawyerId")]
|
||||
public virtual List<CaseLawyer> CaseLawyers { get; set; } = new();
|
||||
|
||||
private Dictionary<int, ICaseModel>? _cases;
|
||||
|
||||
[NotMapped]
|
||||
public Dictionary<int, ICaseModel> Cases
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_cases == null)
|
||||
{
|
||||
_cases = CaseLawyers.ToDictionary(
|
||||
x => x.CaseId, x => x.Case as ICaseModel);
|
||||
}
|
||||
return _cases;
|
||||
}
|
||||
}
|
||||
|
||||
[ForeignKey("LawyerId")]
|
||||
public virtual List<LawyerContract> LawyerContracts { get; set; } = new();
|
||||
|
||||
@ -71,13 +86,17 @@ namespace CaseAccountingDataBaseImplement.Models
|
||||
Patronymic = model.Patronymic,
|
||||
Experience = model.Experience,
|
||||
SpecializationId = model.SpecializationId,
|
||||
Specialization = context.Specializations.FirstOrDefault(x => x.Id == model.SpecializationId) ?? throw new Exception("specialization not found"),
|
||||
Specialization = context.Specializations.FirstOrDefault(x => model.SpecializationId.HasValue && x.Id == model.SpecializationId),
|
||||
UserId = model.UserId,
|
||||
User = context.Users.FirstOrDefault(x => x.Id == model.UserId) ?? throw new Exception("User not found")
|
||||
User = context.Users.FirstOrDefault(x => x.Id == model.UserId) ?? throw new Exception("User not found"),
|
||||
LawyerContracts = model.Contracts.Select(x => new LawyerContract
|
||||
{
|
||||
Contract = context.Contracts.First(y => y.Id == x.Key)
|
||||
}).ToList()
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(LawyerBindingModel? model)
|
||||
public void Update(CaseAccountingDatabase context, LawyerBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
@ -88,6 +107,13 @@ namespace CaseAccountingDataBaseImplement.Models
|
||||
Patronymic = model.Patronymic;
|
||||
Experience = model.Experience;
|
||||
SpecializationId = model.SpecializationId;
|
||||
if (model.Cases.Count > 0)
|
||||
{
|
||||
CaseLawyers = model.Cases.Select(x => new CaseLawyer
|
||||
{
|
||||
Case = context.Cases.First(y => y.Id == x.Key)
|
||||
}).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateContracts(CaseAccountingDatabase context, LawyerBindingModel model)
|
||||
@ -122,6 +148,38 @@ namespace CaseAccountingDataBaseImplement.Models
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateCases(CaseAccountingDatabase context, LawyerBindingModel model)
|
||||
{
|
||||
var lawyerCases = context.CaseLawyers
|
||||
.Where(x => x.LawyerId == model.Id)
|
||||
.ToList();
|
||||
if (lawyerCases != null)
|
||||
{
|
||||
context.CaseLawyers
|
||||
.RemoveRange(lawyerCases
|
||||
.Where(x => !model.Cases
|
||||
.ContainsKey(x.CaseId))
|
||||
);
|
||||
context.SaveChanges();
|
||||
var lawyer = context.Lawyers
|
||||
.First(x => x.Id == Id);
|
||||
foreach (var lc in lawyerCases)
|
||||
{
|
||||
model.Cases.Remove(lc.CaseId);
|
||||
}
|
||||
foreach (var lc in model.Cases)
|
||||
{
|
||||
context.CaseLawyers.Add(new CaseLawyer
|
||||
{
|
||||
Lawyer = lawyer,
|
||||
Case = context.Cases.First(x => x.Id == lc.Key),
|
||||
});
|
||||
context.SaveChanges();
|
||||
}
|
||||
_contracts = null;
|
||||
}
|
||||
}
|
||||
|
||||
public LawyerViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
@ -130,7 +188,8 @@ namespace CaseAccountingDataBaseImplement.Models
|
||||
Patronymic = Patronymic,
|
||||
Experience = Experience,
|
||||
SpecializationId = SpecializationId,
|
||||
UserId = UserId
|
||||
UserId = UserId,
|
||||
Specialization = Specialization?.Name ?? "Не указан"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ namespace CaseAccountingDataModels.Models
|
||||
string Surname { get; }
|
||||
string Patronymic { get; }
|
||||
int Experience { get; }
|
||||
int SpecializationId { get; }
|
||||
int? SpecializationId { get; }
|
||||
int UserId { get; }
|
||||
Dictionary<int, IContractModel> Contracts { get; }
|
||||
}
|
||||
|
@ -12,9 +12,12 @@ namespace CaseAccountingRestApi.Controllers
|
||||
{
|
||||
private readonly ILawyerLogic lawyerLogic;
|
||||
|
||||
public LawyerController(ILawyerLogic logic)
|
||||
private readonly ICaseLogic _caseLogic;
|
||||
|
||||
public LawyerController(ILawyerLogic logic, ICaseLogic caseLogic)
|
||||
{
|
||||
lawyerLogic = logic;
|
||||
_caseLogic = caseLogic;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
@ -81,5 +84,31 @@ namespace CaseAccountingRestApi.Controllers
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public List<CaseViewModel>? GetAllCases()
|
||||
{
|
||||
try
|
||||
{
|
||||
return _caseLogic.ReadList(null);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public List<LawyerViewModel>? GetAllByUserAndSpecialization(int userId, int specialization)
|
||||
{
|
||||
try
|
||||
{
|
||||
return lawyerLogic.ReadList(new LawyerSearchModel { UserId = userId, SpecializationId = specialization });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user