RestAPI + migration + начало интерфейса для поставщика
This commit is contained in:
parent
0d808aa2be
commit
8388b39941
@ -13,7 +13,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UniversityContracts", "Univ
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UniversityBusinessLogic", "UniversityBusinessLogic\UniversityBusinessLogic.csproj", "{1F4D08DA-C856-42E5-8E1A-634B6EDB4C9D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversityProvider", "UniversityProvider\UniversityProvider.csproj", "{3EC7CE2C-9D59-4570-B66B-746076D00A03}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UniversityProvider", "UniversityProvider\UniversityProvider.csproj", "{3EC7CE2C-9D59-4570-B66B-746076D00A03}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversityRestAPI", "UniversityRestAPI\UniversityRestAPI.csproj", "{24344F5E-3066-4B9B-82FC-F58608D0751D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -45,6 +47,10 @@ Global
|
||||
{3EC7CE2C-9D59-4570-B66B-746076D00A03}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3EC7CE2C-9D59-4570-B66B-746076D00A03}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3EC7CE2C-9D59-4570-B66B-746076D00A03}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{24344F5E-3066-4B9B-82FC-F58608D0751D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{24344F5E-3066-4B9B-82FC-F58608D0751D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{24344F5E-3066-4B9B-82FC-F58608D0751D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{24344F5E-3066-4B9B-82FC-F58608D0751D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -10,7 +10,7 @@ namespace UniversityDataBaseImplemet
|
||||
{
|
||||
if (optionsBuilder.IsConfigured == false)
|
||||
{
|
||||
optionsBuilder.UseNpgsql("Host=localhost;Port=5432;Database=University;Username=postgres;Password=postgres");
|
||||
optionsBuilder.UseNpgsql("Host=localhost;Port=5432;Database=University;Username=postgres;Password=123");
|
||||
}
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
}
|
||||
|
539
UniversityDataBaseImplemet/Migrations/20230515162605_lastStageStart.Designer.cs
generated
Normal file
539
UniversityDataBaseImplemet/Migrations/20230515162605_lastStageStart.Designer.cs
generated
Normal file
@ -0,0 +1,539 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using UniversityDataBaseImplemet;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace UniversityDataBaseImplemet.Migrations
|
||||
{
|
||||
[DbContext(typeof(Database))]
|
||||
[Migration("20230515162605_lastStageStart")]
|
||||
partial class lastStageStart
|
||||
{
|
||||
/// <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("UniversityDataBaseImplemet.Models.Discipline", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Hours")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("MarkType")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("StreamId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("StreamId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Discipline");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Document", 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>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Documents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroup", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("NumberOfStudent")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("EducationGroups");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroupDocument", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("DocumentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("EducationGroupId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DocumentId");
|
||||
|
||||
b.HasIndex("EducationGroupId");
|
||||
|
||||
b.ToTable("EducationGroupsDocuments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroupStream", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("EducationGroupId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("StreamId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("EducationGroupId");
|
||||
|
||||
b.HasIndex("StreamId");
|
||||
|
||||
b.ToTable("EducationGroupsStreams");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationStatus", 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("EducationStatuses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.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("UniversityDataBaseImplemet.Models.Stream", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Course")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Streams");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Student", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("DateOfBirth")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("EducationStatusId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("StudentCard")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Surname")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("EducationStatusId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Students");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.StudentDocument", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("DocumentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("StudentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DocumentId");
|
||||
|
||||
b.HasIndex("StudentId");
|
||||
|
||||
b.ToTable("StudentDocuments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.StudentStream", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("StreamId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("StudentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("StreamId");
|
||||
|
||||
b.HasIndex("StudentId");
|
||||
|
||||
b.ToTable("StudentStreams");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.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("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Discipline", b =>
|
||||
{
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.Stream", "Stream")
|
||||
.WithMany()
|
||||
.HasForeignKey("StreamId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Stream");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Document", b =>
|
||||
{
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroup", b =>
|
||||
{
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroupDocument", b =>
|
||||
{
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.Document", "Document")
|
||||
.WithMany("EducationGroupDocument")
|
||||
.HasForeignKey("DocumentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.EducationGroup", "EducationGroup")
|
||||
.WithMany("EducationGroupDocument")
|
||||
.HasForeignKey("EducationGroupId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Document");
|
||||
|
||||
b.Navigation("EducationGroup");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroupStream", b =>
|
||||
{
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.EducationGroup", "EducationGroup")
|
||||
.WithMany("EducationGroupStream")
|
||||
.HasForeignKey("EducationGroupId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.Stream", "Stream")
|
||||
.WithMany("EducationGroupStream")
|
||||
.HasForeignKey("StreamId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("EducationGroup");
|
||||
|
||||
b.Navigation("Stream");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationStatus", b =>
|
||||
{
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Stream", b =>
|
||||
{
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Student", b =>
|
||||
{
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.EducationStatus", "EducationStatus")
|
||||
.WithMany("Students")
|
||||
.HasForeignKey("EducationStatusId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("EducationStatus");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.StudentDocument", b =>
|
||||
{
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.Document", "Document")
|
||||
.WithMany("Students")
|
||||
.HasForeignKey("DocumentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.Student", "Student")
|
||||
.WithMany("DocumentStudents")
|
||||
.HasForeignKey("StudentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Document");
|
||||
|
||||
b.Navigation("Student");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.StudentStream", b =>
|
||||
{
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.Stream", "Stream")
|
||||
.WithMany("StreamStudents")
|
||||
.HasForeignKey("StreamId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.Student", "Student")
|
||||
.WithMany("StudentStream")
|
||||
.HasForeignKey("StudentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Stream");
|
||||
|
||||
b.Navigation("Student");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.User", b =>
|
||||
{
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.Role", "Role")
|
||||
.WithMany("Users")
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Role");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Document", b =>
|
||||
{
|
||||
b.Navigation("EducationGroupDocument");
|
||||
|
||||
b.Navigation("Students");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroup", b =>
|
||||
{
|
||||
b.Navigation("EducationGroupDocument");
|
||||
|
||||
b.Navigation("EducationGroupStream");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationStatus", b =>
|
||||
{
|
||||
b.Navigation("Students");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Role", b =>
|
||||
{
|
||||
b.Navigation("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Stream", b =>
|
||||
{
|
||||
b.Navigation("EducationGroupStream");
|
||||
|
||||
b.Navigation("StreamStudents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Student", b =>
|
||||
{
|
||||
b.Navigation("DocumentStudents");
|
||||
|
||||
b.Navigation("StudentStream");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,421 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace UniversityDataBaseImplemet.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class lastStageStart : 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: "User",
|
||||
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_User", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_User_Roles_RoleId",
|
||||
column: x => x.RoleId,
|
||||
principalTable: "Roles",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Documents",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Name = 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_Documents", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Documents_User_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "User",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "EducationGroups",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
NumberOfStudent = table.Column<int>(type: "integer", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: false),
|
||||
UserId = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_EducationGroups", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_EducationGroups_User_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "User",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "EducationStatuses",
|
||||
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_EducationStatuses", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_EducationStatuses_User_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "User",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Streams",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Name = table.Column<string>(type: "text", nullable: false),
|
||||
Course = table.Column<int>(type: "integer", nullable: false),
|
||||
UserId = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Streams", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Streams_User_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "User",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "EducationGroupsDocuments",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
EducationGroupId = table.Column<int>(type: "integer", nullable: false),
|
||||
DocumentId = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_EducationGroupsDocuments", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_EducationGroupsDocuments_Documents_DocumentId",
|
||||
column: x => x.DocumentId,
|
||||
principalTable: "Documents",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_EducationGroupsDocuments_EducationGroups_EducationGroupId",
|
||||
column: x => x.EducationGroupId,
|
||||
principalTable: "EducationGroups",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Students",
|
||||
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),
|
||||
DateOfBirth = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
StudentCard = table.Column<int>(type: "integer", nullable: false),
|
||||
EducationStatusId = table.Column<int>(type: "integer", nullable: false),
|
||||
UserId = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Students", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Students_EducationStatuses_EducationStatusId",
|
||||
column: x => x.EducationStatusId,
|
||||
principalTable: "EducationStatuses",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Students_User_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "User",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Discipline",
|
||||
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),
|
||||
StreamId = table.Column<int>(type: "integer", nullable: false),
|
||||
Hours = table.Column<int>(type: "integer", nullable: false),
|
||||
MarkType = table.Column<bool>(type: "boolean", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Discipline", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Discipline_Streams_StreamId",
|
||||
column: x => x.StreamId,
|
||||
principalTable: "Streams",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Discipline_User_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "User",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "EducationGroupsStreams",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
EducationGroupId = table.Column<int>(type: "integer", nullable: false),
|
||||
StreamId = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_EducationGroupsStreams", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_EducationGroupsStreams_EducationGroups_EducationGroupId",
|
||||
column: x => x.EducationGroupId,
|
||||
principalTable: "EducationGroups",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_EducationGroupsStreams_Streams_StreamId",
|
||||
column: x => x.StreamId,
|
||||
principalTable: "Streams",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "StudentDocuments",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
StudentId = table.Column<int>(type: "integer", nullable: false),
|
||||
DocumentId = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_StudentDocuments", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_StudentDocuments_Documents_DocumentId",
|
||||
column: x => x.DocumentId,
|
||||
principalTable: "Documents",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_StudentDocuments_Students_StudentId",
|
||||
column: x => x.StudentId,
|
||||
principalTable: "Students",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "StudentStreams",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
StudentId = table.Column<int>(type: "integer", nullable: false),
|
||||
StreamId = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_StudentStreams", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_StudentStreams_Streams_StreamId",
|
||||
column: x => x.StreamId,
|
||||
principalTable: "Streams",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_StudentStreams_Students_StudentId",
|
||||
column: x => x.StudentId,
|
||||
principalTable: "Students",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Discipline_StreamId",
|
||||
table: "Discipline",
|
||||
column: "StreamId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Discipline_UserId",
|
||||
table: "Discipline",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Documents_UserId",
|
||||
table: "Documents",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EducationGroups_UserId",
|
||||
table: "EducationGroups",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EducationGroupsDocuments_DocumentId",
|
||||
table: "EducationGroupsDocuments",
|
||||
column: "DocumentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EducationGroupsDocuments_EducationGroupId",
|
||||
table: "EducationGroupsDocuments",
|
||||
column: "EducationGroupId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EducationGroupsStreams_EducationGroupId",
|
||||
table: "EducationGroupsStreams",
|
||||
column: "EducationGroupId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EducationGroupsStreams_StreamId",
|
||||
table: "EducationGroupsStreams",
|
||||
column: "StreamId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EducationStatuses_UserId",
|
||||
table: "EducationStatuses",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Streams_UserId",
|
||||
table: "Streams",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_StudentDocuments_DocumentId",
|
||||
table: "StudentDocuments",
|
||||
column: "DocumentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_StudentDocuments_StudentId",
|
||||
table: "StudentDocuments",
|
||||
column: "StudentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Students_EducationStatusId",
|
||||
table: "Students",
|
||||
column: "EducationStatusId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Students_UserId",
|
||||
table: "Students",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_StudentStreams_StreamId",
|
||||
table: "StudentStreams",
|
||||
column: "StreamId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_StudentStreams_StudentId",
|
||||
table: "StudentStreams",
|
||||
column: "StudentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_User_RoleId",
|
||||
table: "User",
|
||||
column: "RoleId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Discipline");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "EducationGroupsDocuments");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "EducationGroupsStreams");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "StudentDocuments");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "StudentStreams");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "EducationGroups");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Documents");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Streams");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Students");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "EducationStatuses");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "User");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Roles");
|
||||
}
|
||||
}
|
||||
}
|
536
UniversityDataBaseImplemet/Migrations/DatabaseModelSnapshot.cs
Normal file
536
UniversityDataBaseImplemet/Migrations/DatabaseModelSnapshot.cs
Normal file
@ -0,0 +1,536 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using UniversityDataBaseImplemet;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace UniversityDataBaseImplemet.Migrations
|
||||
{
|
||||
[DbContext(typeof(Database))]
|
||||
partial class DatabaseModelSnapshot : 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("UniversityDataBaseImplemet.Models.Discipline", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Hours")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("MarkType")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("StreamId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("StreamId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Discipline");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Document", 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>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Documents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroup", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("NumberOfStudent")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("EducationGroups");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroupDocument", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("DocumentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("EducationGroupId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DocumentId");
|
||||
|
||||
b.HasIndex("EducationGroupId");
|
||||
|
||||
b.ToTable("EducationGroupsDocuments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroupStream", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("EducationGroupId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("StreamId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("EducationGroupId");
|
||||
|
||||
b.HasIndex("StreamId");
|
||||
|
||||
b.ToTable("EducationGroupsStreams");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationStatus", 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("EducationStatuses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.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("UniversityDataBaseImplemet.Models.Stream", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Course")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Streams");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Student", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("DateOfBirth")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("EducationStatusId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("StudentCard")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Surname")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("EducationStatusId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Students");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.StudentDocument", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("DocumentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("StudentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DocumentId");
|
||||
|
||||
b.HasIndex("StudentId");
|
||||
|
||||
b.ToTable("StudentDocuments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.StudentStream", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("StreamId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("StudentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("StreamId");
|
||||
|
||||
b.HasIndex("StudentId");
|
||||
|
||||
b.ToTable("StudentStreams");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.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("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Discipline", b =>
|
||||
{
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.Stream", "Stream")
|
||||
.WithMany()
|
||||
.HasForeignKey("StreamId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Stream");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Document", b =>
|
||||
{
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroup", b =>
|
||||
{
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroupDocument", b =>
|
||||
{
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.Document", "Document")
|
||||
.WithMany("EducationGroupDocument")
|
||||
.HasForeignKey("DocumentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.EducationGroup", "EducationGroup")
|
||||
.WithMany("EducationGroupDocument")
|
||||
.HasForeignKey("EducationGroupId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Document");
|
||||
|
||||
b.Navigation("EducationGroup");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroupStream", b =>
|
||||
{
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.EducationGroup", "EducationGroup")
|
||||
.WithMany("EducationGroupStream")
|
||||
.HasForeignKey("EducationGroupId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.Stream", "Stream")
|
||||
.WithMany("EducationGroupStream")
|
||||
.HasForeignKey("StreamId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("EducationGroup");
|
||||
|
||||
b.Navigation("Stream");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationStatus", b =>
|
||||
{
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Stream", b =>
|
||||
{
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Student", b =>
|
||||
{
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.EducationStatus", "EducationStatus")
|
||||
.WithMany("Students")
|
||||
.HasForeignKey("EducationStatusId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("EducationStatus");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.StudentDocument", b =>
|
||||
{
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.Document", "Document")
|
||||
.WithMany("Students")
|
||||
.HasForeignKey("DocumentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.Student", "Student")
|
||||
.WithMany("DocumentStudents")
|
||||
.HasForeignKey("StudentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Document");
|
||||
|
||||
b.Navigation("Student");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.StudentStream", b =>
|
||||
{
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.Stream", "Stream")
|
||||
.WithMany("StreamStudents")
|
||||
.HasForeignKey("StreamId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.Student", "Student")
|
||||
.WithMany("StudentStream")
|
||||
.HasForeignKey("StudentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Stream");
|
||||
|
||||
b.Navigation("Student");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.User", b =>
|
||||
{
|
||||
b.HasOne("UniversityDataBaseImplemet.Models.Role", "Role")
|
||||
.WithMany("Users")
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Role");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Document", b =>
|
||||
{
|
||||
b.Navigation("EducationGroupDocument");
|
||||
|
||||
b.Navigation("Students");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroup", b =>
|
||||
{
|
||||
b.Navigation("EducationGroupDocument");
|
||||
|
||||
b.Navigation("EducationGroupStream");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationStatus", b =>
|
||||
{
|
||||
b.Navigation("Students");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Role", b =>
|
||||
{
|
||||
b.Navigation("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Stream", b =>
|
||||
{
|
||||
b.Navigation("EducationGroupStream");
|
||||
|
||||
b.Navigation("StreamStudents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UniversityDataBaseImplemet.Models.Student", b =>
|
||||
{
|
||||
b.Navigation("DocumentStudents");
|
||||
|
||||
b.Navigation("StudentStream");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -11,8 +11,10 @@
|
||||
</ItemGroup>
|
||||
|
||||
<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.SqlServer" Version="7.0.5" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.4" />
|
||||
<PackageReference Include="System.Diagnostics.Tools" Version="4.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -6,8 +6,16 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.5">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\UniversityContracts\UniversityContracts.csproj" />
|
||||
<ProjectReference Include="..\UniversityDataBaseImplemet\UniversityDataBaseImplemet.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -1,6 +1,5 @@
|
||||
@using UniversityContracts.ViewModels
|
||||
@model List<StudentViewModel>
|
||||
@model List<EducationStatusViewModel>
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Студенты";
|
||||
|
39
UniversityRestAPI/Program.cs
Normal file
39
UniversityRestAPI/Program.cs
Normal file
@ -0,0 +1,39 @@
|
||||
using Microsoft.OpenApi.Models;
|
||||
using UniversityBusinessLogic.BusinessLogics;
|
||||
using UniversityContracts.BusinessLogicContracts;
|
||||
using UniversityContracts.StoragesContracts;
|
||||
using UniversityDataBaseImplemet.Implements;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddTransient<IUserStorage, UserStorage>();
|
||||
|
||||
builder.Services.AddTransient<IUserLogic, UserLogic>();
|
||||
|
||||
builder.Services.AddControllers();
|
||||
|
||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen(c =>
|
||||
{
|
||||
c.SwaggerDoc("v1", new OpenApiInfo { Title = "UniversityRestApi", Version = "v1" });
|
||||
});
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "UniversityRestApi"));
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
31
UniversityRestAPI/Properties/launchSettings.json
Normal file
31
UniversityRestAPI/Properties/launchSettings.json
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:57564",
|
||||
"sslPort": 44321
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"UniversityRestAPI": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "https://localhost:7038;http://localhost:5067",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
23
UniversityRestAPI/UniversityRestAPI.csproj
Normal file
23
UniversityRestAPI/UniversityRestAPI.csproj
Normal file
@ -0,0 +1,23 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Controllers\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\UniversityBusinessLogic\UniversityBusinessLogic.csproj" />
|
||||
<ProjectReference Include="..\UniversityContracts\UniversityContracts.csproj" />
|
||||
<ProjectReference Include="..\UniversityDataBaseImplemet\UniversityDataBaseImplemet.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
8
UniversityRestAPI/appsettings.Development.json
Normal file
8
UniversityRestAPI/appsettings.Development.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
9
UniversityRestAPI/appsettings.json
Normal file
9
UniversityRestAPI/appsettings.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
Loading…
Reference in New Issue
Block a user