| public DbSet<SelectionLevel> SelectionLevels { get; set; } | public DbSet<SelectionLevel> SelectionLevels { get; set; } | ||||
| public DbSet<SelectionProcess> SelectionProcesses { get; set; } | public DbSet<SelectionProcess> SelectionProcesses { get; set; } | ||||
| public DbSet<Pattern> Patterns { get; set; } | public DbSet<Pattern> Patterns { get; set; } | ||||
| public DbSet<FileEntity> Files { get; set; } | |||||
| public DbSet<Category> Categories { get; set; } | |||||
| public DbSet<Tag> Tags { get; set; } | |||||
| public DatabaseContext(DbContextOptions<DatabaseContext> options) : base(options) { } | public DatabaseContext(DbContextOptions<DatabaseContext> options) : base(options) { } |
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.ComponentModel.DataAnnotations.Schema; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using System.Threading.Tasks; | |||||
| namespace Diligent.WebAPI.Data.Entities | |||||
| { | |||||
| public class Category | |||||
| { | |||||
| public int Id { get; set; } | |||||
| public string Name { get; set; } | |||||
| [ForeignKey(nameof(File))] | |||||
| public int FileId { get; set; } | |||||
| public FileEntity File { get; set; } | |||||
| } | |||||
| } |
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using System.Threading.Tasks; | |||||
| namespace Diligent.WebAPI.Data.Entities | |||||
| { | |||||
| public class FileEntity | |||||
| { | |||||
| public int Id { get; set; } | |||||
| public string Name { get; set; } | |||||
| public long Size { get; set; } | |||||
| public string Extension { get; set; } | |||||
| public List<Category> Categories { get; set; } | |||||
| public List<Tag> Tags { get; set; } | |||||
| } | |||||
| } |
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using System.Threading.Tasks; | |||||
| namespace Diligent.WebAPI.Data.Entities | |||||
| { | |||||
| public class Tag | |||||
| { | |||||
| public int Id { get; set; } | |||||
| public string Name { get; set; } | |||||
| public List<FileEntity> Files { get; set; } | |||||
| } | |||||
| } |
| using Microsoft.EntityFrameworkCore.Migrations; | |||||
| #nullable disable | |||||
| namespace Diligent.WebAPI.Data.Migrations | |||||
| { | |||||
| public partial class AddedFileEntity : Migration | |||||
| { | |||||
| protected override void Up(MigrationBuilder migrationBuilder) | |||||
| { | |||||
| migrationBuilder.CreateTable( | |||||
| name: "Files", | |||||
| columns: table => new | |||||
| { | |||||
| Id = table.Column<int>(type: "int", nullable: false) | |||||
| .Annotation("SqlServer:Identity", "1, 1"), | |||||
| Name = table.Column<string>(type: "nvarchar(max)", nullable: false), | |||||
| Size = table.Column<long>(type: "bigint", nullable: false), | |||||
| Extension = table.Column<string>(type: "nvarchar(max)", nullable: false) | |||||
| }, | |||||
| constraints: table => | |||||
| { | |||||
| table.PrimaryKey("PK_Files", x => x.Id); | |||||
| }); | |||||
| migrationBuilder.CreateTable( | |||||
| name: "Tags", | |||||
| columns: table => new | |||||
| { | |||||
| Id = table.Column<int>(type: "int", nullable: false) | |||||
| .Annotation("SqlServer:Identity", "1, 1"), | |||||
| Name = table.Column<string>(type: "nvarchar(max)", nullable: false) | |||||
| }, | |||||
| constraints: table => | |||||
| { | |||||
| table.PrimaryKey("PK_Tags", x => x.Id); | |||||
| }); | |||||
| migrationBuilder.CreateTable( | |||||
| name: "Categories", | |||||
| columns: table => new | |||||
| { | |||||
| Id = table.Column<int>(type: "int", nullable: false) | |||||
| .Annotation("SqlServer:Identity", "1, 1"), | |||||
| Name = table.Column<string>(type: "nvarchar(max)", nullable: false), | |||||
| FileId = table.Column<int>(type: "int", nullable: false) | |||||
| }, | |||||
| constraints: table => | |||||
| { | |||||
| table.PrimaryKey("PK_Categories", x => x.Id); | |||||
| table.ForeignKey( | |||||
| name: "FK_Categories_Files_FileId", | |||||
| column: x => x.FileId, | |||||
| principalTable: "Files", | |||||
| principalColumn: "Id", | |||||
| onDelete: ReferentialAction.Cascade); | |||||
| }); | |||||
| migrationBuilder.CreateTable( | |||||
| name: "FileEntityTag", | |||||
| columns: table => new | |||||
| { | |||||
| FilesId = table.Column<int>(type: "int", nullable: false), | |||||
| TagsId = table.Column<int>(type: "int", nullable: false) | |||||
| }, | |||||
| constraints: table => | |||||
| { | |||||
| table.PrimaryKey("PK_FileEntityTag", x => new { x.FilesId, x.TagsId }); | |||||
| table.ForeignKey( | |||||
| name: "FK_FileEntityTag_Files_FilesId", | |||||
| column: x => x.FilesId, | |||||
| principalTable: "Files", | |||||
| principalColumn: "Id", | |||||
| onDelete: ReferentialAction.Cascade); | |||||
| table.ForeignKey( | |||||
| name: "FK_FileEntityTag_Tags_TagsId", | |||||
| column: x => x.TagsId, | |||||
| principalTable: "Tags", | |||||
| principalColumn: "Id", | |||||
| onDelete: ReferentialAction.Cascade); | |||||
| }); | |||||
| migrationBuilder.CreateIndex( | |||||
| name: "IX_Categories_FileId", | |||||
| table: "Categories", | |||||
| column: "FileId"); | |||||
| migrationBuilder.CreateIndex( | |||||
| name: "IX_FileEntityTag_TagsId", | |||||
| table: "FileEntityTag", | |||||
| column: "TagsId"); | |||||
| } | |||||
| protected override void Down(MigrationBuilder migrationBuilder) | |||||
| { | |||||
| migrationBuilder.DropTable( | |||||
| name: "Categories"); | |||||
| migrationBuilder.DropTable( | |||||
| name: "FileEntityTag"); | |||||
| migrationBuilder.DropTable( | |||||
| name: "Files"); | |||||
| migrationBuilder.DropTable( | |||||
| name: "Tags"); | |||||
| } | |||||
| } | |||||
| } |
| b.ToTable("AspNetRoles", (string)null); | b.ToTable("AspNetRoles", (string)null); | ||||
| }); | }); | ||||
| modelBuilder.Entity("Diligent.WebAPI.Data.Entities.Category", b => | |||||
| { | |||||
| b.Property<int>("Id") | |||||
| .ValueGeneratedOnAdd() | |||||
| .HasColumnType("int"); | |||||
| SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1); | |||||
| b.Property<int>("FileId") | |||||
| .HasColumnType("int"); | |||||
| b.Property<string>("Name") | |||||
| .IsRequired() | |||||
| .HasColumnType("nvarchar(max)"); | |||||
| b.HasKey("Id"); | |||||
| b.HasIndex("FileId"); | |||||
| b.ToTable("Categories"); | |||||
| }); | |||||
| modelBuilder.Entity("Diligent.WebAPI.Data.Entities.Comment", b => | modelBuilder.Entity("Diligent.WebAPI.Data.Entities.Comment", b => | ||||
| { | { | ||||
| b.Property<int>("Id") | b.Property<int>("Id") | ||||
| b.ToTable("Comments"); | b.ToTable("Comments"); | ||||
| }); | }); | ||||
| modelBuilder.Entity("Diligent.WebAPI.Data.Entities.FileEntity", b => | |||||
| { | |||||
| b.Property<int>("Id") | |||||
| .ValueGeneratedOnAdd() | |||||
| .HasColumnType("int"); | |||||
| SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1); | |||||
| b.Property<string>("Extension") | |||||
| .IsRequired() | |||||
| .HasColumnType("nvarchar(max)"); | |||||
| b.Property<string>("Name") | |||||
| .IsRequired() | |||||
| .HasColumnType("nvarchar(max)"); | |||||
| b.Property<long>("Size") | |||||
| .HasColumnType("bigint"); | |||||
| b.HasKey("Id"); | |||||
| b.ToTable("Files"); | |||||
| }); | |||||
| modelBuilder.Entity("Diligent.WebAPI.Data.Entities.InsuranceCompany", b => | modelBuilder.Entity("Diligent.WebAPI.Data.Entities.InsuranceCompany", b => | ||||
| { | { | ||||
| b.Property<long>("Id") | b.Property<long>("Id") | ||||
| b.ToTable("SelectionProcesses"); | b.ToTable("SelectionProcesses"); | ||||
| }); | }); | ||||
| modelBuilder.Entity("Diligent.WebAPI.Data.Entities.Tag", b => | |||||
| { | |||||
| b.Property<int>("Id") | |||||
| .ValueGeneratedOnAdd() | |||||
| .HasColumnType("int"); | |||||
| SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1); | |||||
| b.Property<string>("Name") | |||||
| .IsRequired() | |||||
| .HasColumnType("nvarchar(max)"); | |||||
| b.HasKey("Id"); | |||||
| b.ToTable("Tags"); | |||||
| }); | |||||
| modelBuilder.Entity("Diligent.WebAPI.Data.Entities.Technology", b => | modelBuilder.Entity("Diligent.WebAPI.Data.Entities.Technology", b => | ||||
| { | { | ||||
| b.Property<int>("TechnologyId") | b.Property<int>("TechnologyId") | ||||
| b.ToTable("WebhookSubscriptions"); | b.ToTable("WebhookSubscriptions"); | ||||
| }); | }); | ||||
| modelBuilder.Entity("FileEntityTag", b => | |||||
| { | |||||
| b.Property<int>("FilesId") | |||||
| .HasColumnType("int"); | |||||
| b.Property<int>("TagsId") | |||||
| .HasColumnType("int"); | |||||
| b.HasKey("FilesId", "TagsId"); | |||||
| b.HasIndex("TagsId"); | |||||
| b.ToTable("FileEntityTag"); | |||||
| }); | |||||
| modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b => | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b => | ||||
| { | { | ||||
| b.Property<int>("Id") | b.Property<int>("Id") | ||||
| .IsRequired(); | .IsRequired(); | ||||
| }); | }); | ||||
| modelBuilder.Entity("Diligent.WebAPI.Data.Entities.Category", b => | |||||
| { | |||||
| b.HasOne("Diligent.WebAPI.Data.Entities.FileEntity", "File") | |||||
| .WithMany("Categories") | |||||
| .HasForeignKey("FileId") | |||||
| .OnDelete(DeleteBehavior.Cascade) | |||||
| .IsRequired(); | |||||
| b.Navigation("File"); | |||||
| }); | |||||
| modelBuilder.Entity("Diligent.WebAPI.Data.Entities.Comment", b => | modelBuilder.Entity("Diligent.WebAPI.Data.Entities.Comment", b => | ||||
| { | { | ||||
| b.HasOne("Diligent.WebAPI.Data.Entities.Applicant", "Applicant") | b.HasOne("Diligent.WebAPI.Data.Entities.Applicant", "Applicant") | ||||
| b.Navigation("WebhookDefinition"); | b.Navigation("WebhookDefinition"); | ||||
| }); | }); | ||||
| modelBuilder.Entity("FileEntityTag", b => | |||||
| { | |||||
| b.HasOne("Diligent.WebAPI.Data.Entities.FileEntity", null) | |||||
| .WithMany() | |||||
| .HasForeignKey("FilesId") | |||||
| .OnDelete(DeleteBehavior.Cascade) | |||||
| .IsRequired(); | |||||
| b.HasOne("Diligent.WebAPI.Data.Entities.Tag", null) | |||||
| .WithMany() | |||||
| .HasForeignKey("TagsId") | |||||
| .OnDelete(DeleteBehavior.Cascade) | |||||
| .IsRequired(); | |||||
| }); | |||||
| modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b => | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b => | ||||
| { | { | ||||
| b.HasOne("Diligent.WebAPI.Data.Entities.AppRole", null) | b.HasOne("Diligent.WebAPI.Data.Entities.AppRole", null) | ||||
| b.Navigation("TechnologyApplicants"); | b.Navigation("TechnologyApplicants"); | ||||
| }); | }); | ||||
| modelBuilder.Entity("Diligent.WebAPI.Data.Entities.FileEntity", b => | |||||
| { | |||||
| b.Navigation("Categories"); | |||||
| }); | |||||
| modelBuilder.Entity("Diligent.WebAPI.Data.Entities.SelectionLevel", b => | modelBuilder.Entity("Diligent.WebAPI.Data.Entities.SelectionLevel", b => | ||||
| { | { | ||||
| b.Navigation("SelectionProcesses"); | b.Navigation("SelectionProcesses"); |
| "Enrich": [ "FromLogContext", "WithMachineName", "WtihThreadId", "WithExceptionDetails" ] | "Enrich": [ "FromLogContext", "WithMachineName", "WtihThreadId", "WithExceptionDetails" ] | ||||
| }, | }, | ||||
| "ConnectionStrings": { | "ConnectionStrings": { | ||||
| "WebApi": "Server=192.168.88.105;Database=DocumentOrganizer;User Id=hrcentar;Password=administrator#2021;" | |||||
| //"WebApi": "Server=192.168.88.105;Database=DocumentOrganizer;User Id=hrcentar;Password=administrator#2021;" | |||||
| "WebApi": "Server=.;Database=DocumentOrganizer;Trusted_Connection=True;MultipleActiveResultSets=true" | |||||
| }, | }, | ||||
| "Authorization": { | "Authorization": { | ||||
| "JwtExpiredTime": "5", | "JwtExpiredTime": "5", |