Add database models for document, book and magazine scans (cover, backcover, etc).

This commit is contained in:
2020-08-12 02:31:17 +01:00
parent 8cc6542980
commit 17a6eb7bd7
15 changed files with 8043 additions and 1 deletions

View File

@@ -533,4 +533,10 @@ namespace Marechai.Database
MouldSid = 3, MasteringCode = 4, Barcode = 5,
Toolstamp = 6
}
public enum DocumentScanType : uint
{
Page = 0, Cover = 1, BackCover = 2,
TableOfContents = 3, Index = 4, CopyrightPage = 5
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,238 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Marechai.Database.Migrations
{
public partial class AddDocumentScans : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable("BookScans", table => new
{
Id = table.Column<Guid>(nullable: false),
CreatedOn = table.Column<DateTime>(nullable: false).
Annotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.IdentityColumn),
UpdatedOn = table.Column<DateTime>(nullable: false).
Annotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.ComputedColumn),
Author = table.Column<string>(nullable: true),
ColorSpace = table.Column<ushort>(nullable: true),
Comments = table.Column<string>(nullable: true),
CreationDate = table.Column<DateTime>(nullable: true),
ExifVersion = table.Column<string>(nullable: true),
HorizontalResolution = table.Column<double>(nullable: true),
ResolutionUnit = table.Column<ushort>(nullable: true),
ScannerManufacturer = table.Column<string>(nullable: true),
ScannerModel = table.Column<string>(nullable: true),
SoftwareUsed = table.Column<string>(nullable: true),
UploadDate = table.Column<DateTime>(nullable: false).
Annotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.ComputedColumn),
VerticalResolution = table.Column<double>(nullable: true),
OriginalExtension = table.Column<string>(nullable: true),
UserId = table.Column<string>(nullable: true),
Type = table.Column<uint>(nullable: false),
Page = table.Column<uint>(nullable: true),
BookId = table.Column<long>(nullable: false)
}, constraints: table =>
{
table.PrimaryKey("PK_BookScans", x => x.Id);
table.ForeignKey("FK_BookScans_Books_BookId", x => x.BookId, "Books", "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey("FK_BookScans_AspNetUsers_UserId", x => x.UserId, "AspNetUsers", "Id",
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateTable("DocumentScans", table => new
{
Id = table.Column<Guid>(nullable: false),
CreatedOn = table.Column<DateTime>(nullable: false).
Annotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.IdentityColumn),
UpdatedOn = table.Column<DateTime>(nullable: false).
Annotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.ComputedColumn),
Author = table.Column<string>(nullable: true),
ColorSpace = table.Column<ushort>(nullable: true),
Comments = table.Column<string>(nullable: true),
CreationDate = table.Column<DateTime>(nullable: true),
ExifVersion = table.Column<string>(nullable: true),
HorizontalResolution = table.Column<double>(nullable: true),
ResolutionUnit = table.Column<ushort>(nullable: true),
ScannerManufacturer = table.Column<string>(nullable: true),
ScannerModel = table.Column<string>(nullable: true),
SoftwareUsed = table.Column<string>(nullable: true),
UploadDate = table.Column<DateTime>(nullable: false).
Annotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.ComputedColumn),
VerticalResolution = table.Column<double>(nullable: true),
OriginalExtension = table.Column<string>(nullable: true),
UserId = table.Column<string>(nullable: true),
Type = table.Column<uint>(nullable: false),
Page = table.Column<uint>(nullable: true),
DocumentId = table.Column<long>(nullable: false)
}, constraints: table =>
{
table.PrimaryKey("PK_DocumentScans", x => x.Id);
table.ForeignKey("FK_DocumentScans_Documents_DocumentId", x => x.DocumentId, "Documents", "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey("FK_DocumentScans_AspNetUsers_UserId", x => x.UserId, "AspNetUsers", "Id",
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateTable("MagazineScans", table => new
{
Id = table.Column<Guid>(nullable: false),
CreatedOn = table.Column<DateTime>(nullable: false).
Annotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.IdentityColumn),
UpdatedOn = table.Column<DateTime>(nullable: false).
Annotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.ComputedColumn),
Author = table.Column<string>(nullable: true),
ColorSpace = table.Column<ushort>(nullable: true),
Comments = table.Column<string>(nullable: true),
CreationDate = table.Column<DateTime>(nullable: true),
ExifVersion = table.Column<string>(nullable: true),
HorizontalResolution = table.Column<double>(nullable: true),
ResolutionUnit = table.Column<ushort>(nullable: true),
ScannerManufacturer = table.Column<string>(nullable: true),
ScannerModel = table.Column<string>(nullable: true),
SoftwareUsed = table.Column<string>(nullable: true),
UploadDate = table.Column<DateTime>(nullable: false).
Annotation("MySql:ValueGenerationStrategy",
MySqlValueGenerationStrategy.ComputedColumn),
VerticalResolution = table.Column<double>(nullable: true),
OriginalExtension = table.Column<string>(nullable: true),
UserId = table.Column<string>(nullable: true),
Type = table.Column<uint>(nullable: false),
Page = table.Column<uint>(nullable: true),
MagazineId = table.Column<long>(nullable: false)
}, constraints: table =>
{
table.PrimaryKey("PK_MagazineScans", x => x.Id);
table.ForeignKey("FK_MagazineScans_MagazineIssues_MagazineId", x => x.MagazineId, "MagazineIssues",
"Id", onDelete: ReferentialAction.Cascade);
table.ForeignKey("FK_MagazineScans_AspNetUsers_UserId", x => x.UserId, "AspNetUsers", "Id",
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateIndex("IX_BookScans_Author", "BookScans", "Author");
migrationBuilder.CreateIndex("IX_BookScans_BookId", "BookScans", "BookId");
migrationBuilder.CreateIndex("IX_BookScans_ColorSpace", "BookScans", "ColorSpace");
migrationBuilder.CreateIndex("IX_BookScans_Comments", "BookScans", "Comments");
migrationBuilder.CreateIndex("IX_BookScans_CreationDate", "BookScans", "CreationDate");
migrationBuilder.CreateIndex("IX_BookScans_ExifVersion", "BookScans", "ExifVersion");
migrationBuilder.CreateIndex("IX_BookScans_HorizontalResolution", "BookScans", "HorizontalResolution");
migrationBuilder.CreateIndex("IX_BookScans_Page", "BookScans", "Page");
migrationBuilder.CreateIndex("IX_BookScans_ResolutionUnit", "BookScans", "ResolutionUnit");
migrationBuilder.CreateIndex("IX_BookScans_ScannerManufacturer", "BookScans", "ScannerManufacturer");
migrationBuilder.CreateIndex("IX_BookScans_ScannerModel", "BookScans", "ScannerModel");
migrationBuilder.CreateIndex("IX_BookScans_SoftwareUsed", "BookScans", "SoftwareUsed");
migrationBuilder.CreateIndex("IX_BookScans_Type", "BookScans", "Type");
migrationBuilder.CreateIndex("IX_BookScans_UploadDate", "BookScans", "UploadDate");
migrationBuilder.CreateIndex("IX_BookScans_UserId", "BookScans", "UserId");
migrationBuilder.CreateIndex("IX_BookScans_VerticalResolution", "BookScans", "VerticalResolution");
migrationBuilder.CreateIndex("IX_DocumentScans_Author", "DocumentScans", "Author");
migrationBuilder.CreateIndex("IX_DocumentScans_ColorSpace", "DocumentScans", "ColorSpace");
migrationBuilder.CreateIndex("IX_DocumentScans_Comments", "DocumentScans", "Comments");
migrationBuilder.CreateIndex("IX_DocumentScans_CreationDate", "DocumentScans", "CreationDate");
migrationBuilder.CreateIndex("IX_DocumentScans_DocumentId", "DocumentScans", "DocumentId");
migrationBuilder.CreateIndex("IX_DocumentScans_ExifVersion", "DocumentScans", "ExifVersion");
migrationBuilder.CreateIndex("IX_DocumentScans_HorizontalResolution", "DocumentScans",
"HorizontalResolution");
migrationBuilder.CreateIndex("IX_DocumentScans_Page", "DocumentScans", "Page");
migrationBuilder.CreateIndex("IX_DocumentScans_ResolutionUnit", "DocumentScans", "ResolutionUnit");
migrationBuilder.CreateIndex("IX_DocumentScans_ScannerManufacturer", "DocumentScans",
"ScannerManufacturer");
migrationBuilder.CreateIndex("IX_DocumentScans_ScannerModel", "DocumentScans", "ScannerModel");
migrationBuilder.CreateIndex("IX_DocumentScans_SoftwareUsed", "DocumentScans", "SoftwareUsed");
migrationBuilder.CreateIndex("IX_DocumentScans_Type", "DocumentScans", "Type");
migrationBuilder.CreateIndex("IX_DocumentScans_UploadDate", "DocumentScans", "UploadDate");
migrationBuilder.CreateIndex("IX_DocumentScans_UserId", "DocumentScans", "UserId");
migrationBuilder.CreateIndex("IX_DocumentScans_VerticalResolution", "DocumentScans", "VerticalResolution");
migrationBuilder.CreateIndex("IX_MagazineScans_Author", "MagazineScans", "Author");
migrationBuilder.CreateIndex("IX_MagazineScans_ColorSpace", "MagazineScans", "ColorSpace");
migrationBuilder.CreateIndex("IX_MagazineScans_Comments", "MagazineScans", "Comments");
migrationBuilder.CreateIndex("IX_MagazineScans_CreationDate", "MagazineScans", "CreationDate");
migrationBuilder.CreateIndex("IX_MagazineScans_ExifVersion", "MagazineScans", "ExifVersion");
migrationBuilder.CreateIndex("IX_MagazineScans_HorizontalResolution", "MagazineScans",
"HorizontalResolution");
migrationBuilder.CreateIndex("IX_MagazineScans_MagazineId", "MagazineScans", "MagazineId");
migrationBuilder.CreateIndex("IX_MagazineScans_Page", "MagazineScans", "Page");
migrationBuilder.CreateIndex("IX_MagazineScans_ResolutionUnit", "MagazineScans", "ResolutionUnit");
migrationBuilder.CreateIndex("IX_MagazineScans_ScannerManufacturer", "MagazineScans",
"ScannerManufacturer");
migrationBuilder.CreateIndex("IX_MagazineScans_ScannerModel", "MagazineScans", "ScannerModel");
migrationBuilder.CreateIndex("IX_MagazineScans_SoftwareUsed", "MagazineScans", "SoftwareUsed");
migrationBuilder.CreateIndex("IX_MagazineScans_Type", "MagazineScans", "Type");
migrationBuilder.CreateIndex("IX_MagazineScans_UploadDate", "MagazineScans", "UploadDate");
migrationBuilder.CreateIndex("IX_MagazineScans_UserId", "MagazineScans", "UserId");
migrationBuilder.CreateIndex("IX_MagazineScans_VerticalResolution", "MagazineScans", "VerticalResolution");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable("BookScans");
migrationBuilder.DropTable("DocumentScans");
migrationBuilder.DropTable("MagazineScans");
}
}
}

View File

@@ -168,6 +168,86 @@ namespace Marechai.Database.Migrations
b.ToTable("Books");
});
modelBuilder.Entity("Marechai.Database.Models.BookScan", b =>
{
b.Property<Guid>("Id").ValueGeneratedOnAdd().HasColumnType("char(36)");
b.Property<string>("Author").HasColumnType("varchar(255) CHARACTER SET utf8mb4");
b.Property<long>("BookId").HasColumnType("bigint");
b.Property<ushort?>("ColorSpace").HasColumnType("smallint unsigned");
b.Property<string>("Comments").HasColumnType("varchar(255) CHARACTER SET utf8mb4");
b.Property<DateTime>("CreatedOn").ValueGeneratedOnAdd().HasColumnType("datetime(6)");
b.Property<DateTime?>("CreationDate").HasColumnType("datetime(6)");
b.Property<string>("ExifVersion").HasColumnType("varchar(255) CHARACTER SET utf8mb4");
b.Property<double?>("HorizontalResolution").HasColumnType("double");
b.Property<string>("OriginalExtension").HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<uint?>("Page").HasColumnType("int unsigned");
b.Property<ushort?>("ResolutionUnit").HasColumnType("smallint unsigned");
b.Property<string>("ScannerManufacturer").HasColumnType("varchar(255) CHARACTER SET utf8mb4");
b.Property<string>("ScannerModel").HasColumnType("varchar(255) CHARACTER SET utf8mb4");
b.Property<string>("SoftwareUsed").HasColumnType("varchar(255) CHARACTER SET utf8mb4");
b.Property<uint>("Type").HasColumnType("int unsigned");
b.Property<DateTime>("UpdatedOn").ValueGeneratedOnAddOrUpdate().HasColumnType("datetime(6)");
b.Property<DateTime>("UploadDate").IsConcurrencyToken().ValueGeneratedOnAddOrUpdate().
HasColumnType("datetime(6)");
b.Property<string>("UserId").HasColumnType("varchar(255) CHARACTER SET utf8mb4");
b.Property<double?>("VerticalResolution").HasColumnType("double");
b.HasKey("Id");
b.HasIndex("Author");
b.HasIndex("BookId");
b.HasIndex("ColorSpace");
b.HasIndex("Comments");
b.HasIndex("CreationDate");
b.HasIndex("ExifVersion");
b.HasIndex("HorizontalResolution");
b.HasIndex("Page");
b.HasIndex("ResolutionUnit");
b.HasIndex("ScannerManufacturer");
b.HasIndex("ScannerModel");
b.HasIndex("SoftwareUsed");
b.HasIndex("Type");
b.HasIndex("UploadDate");
b.HasIndex("UserId");
b.HasIndex("VerticalResolution");
b.ToTable("BookScans");
});
modelBuilder.Entity("Marechai.Database.Models.BooksByMachine", b =>
{
b.Property<long>("Id").ValueGeneratedOnAdd().HasColumnType("bigint");
@@ -782,6 +862,86 @@ namespace Marechai.Database.Migrations
b.ToTable("DocumentRoles");
});
modelBuilder.Entity("Marechai.Database.Models.DocumentScan", b =>
{
b.Property<Guid>("Id").ValueGeneratedOnAdd().HasColumnType("char(36)");
b.Property<string>("Author").HasColumnType("varchar(255) CHARACTER SET utf8mb4");
b.Property<ushort?>("ColorSpace").HasColumnType("smallint unsigned");
b.Property<string>("Comments").HasColumnType("varchar(255) CHARACTER SET utf8mb4");
b.Property<DateTime>("CreatedOn").ValueGeneratedOnAdd().HasColumnType("datetime(6)");
b.Property<DateTime?>("CreationDate").HasColumnType("datetime(6)");
b.Property<long>("DocumentId").HasColumnType("bigint");
b.Property<string>("ExifVersion").HasColumnType("varchar(255) CHARACTER SET utf8mb4");
b.Property<double?>("HorizontalResolution").HasColumnType("double");
b.Property<string>("OriginalExtension").HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<uint?>("Page").HasColumnType("int unsigned");
b.Property<ushort?>("ResolutionUnit").HasColumnType("smallint unsigned");
b.Property<string>("ScannerManufacturer").HasColumnType("varchar(255) CHARACTER SET utf8mb4");
b.Property<string>("ScannerModel").HasColumnType("varchar(255) CHARACTER SET utf8mb4");
b.Property<string>("SoftwareUsed").HasColumnType("varchar(255) CHARACTER SET utf8mb4");
b.Property<uint>("Type").HasColumnType("int unsigned");
b.Property<DateTime>("UpdatedOn").ValueGeneratedOnAddOrUpdate().HasColumnType("datetime(6)");
b.Property<DateTime>("UploadDate").IsConcurrencyToken().ValueGeneratedOnAddOrUpdate().
HasColumnType("datetime(6)");
b.Property<string>("UserId").HasColumnType("varchar(255) CHARACTER SET utf8mb4");
b.Property<double?>("VerticalResolution").HasColumnType("double");
b.HasKey("Id");
b.HasIndex("Author");
b.HasIndex("ColorSpace");
b.HasIndex("Comments");
b.HasIndex("CreationDate");
b.HasIndex("DocumentId");
b.HasIndex("ExifVersion");
b.HasIndex("HorizontalResolution");
b.HasIndex("Page");
b.HasIndex("ResolutionUnit");
b.HasIndex("ScannerManufacturer");
b.HasIndex("ScannerModel");
b.HasIndex("SoftwareUsed");
b.HasIndex("Type");
b.HasIndex("UploadDate");
b.HasIndex("UserId");
b.HasIndex("VerticalResolution");
b.ToTable("DocumentScans");
});
modelBuilder.Entity("Marechai.Database.Models.DocumentsByMachine", b =>
{
b.Property<long>("Id").ValueGeneratedOnAdd().HasColumnType("bigint");
@@ -1927,6 +2087,86 @@ namespace Marechai.Database.Migrations
b.ToTable("MagazineIssues");
});
modelBuilder.Entity("Marechai.Database.Models.MagazineScan", b =>
{
b.Property<Guid>("Id").ValueGeneratedOnAdd().HasColumnType("char(36)");
b.Property<string>("Author").HasColumnType("varchar(255) CHARACTER SET utf8mb4");
b.Property<ushort?>("ColorSpace").HasColumnType("smallint unsigned");
b.Property<string>("Comments").HasColumnType("varchar(255) CHARACTER SET utf8mb4");
b.Property<DateTime>("CreatedOn").ValueGeneratedOnAdd().HasColumnType("datetime(6)");
b.Property<DateTime?>("CreationDate").HasColumnType("datetime(6)");
b.Property<string>("ExifVersion").HasColumnType("varchar(255) CHARACTER SET utf8mb4");
b.Property<double?>("HorizontalResolution").HasColumnType("double");
b.Property<long>("MagazineId").HasColumnType("bigint");
b.Property<string>("OriginalExtension").HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<uint?>("Page").HasColumnType("int unsigned");
b.Property<ushort?>("ResolutionUnit").HasColumnType("smallint unsigned");
b.Property<string>("ScannerManufacturer").HasColumnType("varchar(255) CHARACTER SET utf8mb4");
b.Property<string>("ScannerModel").HasColumnType("varchar(255) CHARACTER SET utf8mb4");
b.Property<string>("SoftwareUsed").HasColumnType("varchar(255) CHARACTER SET utf8mb4");
b.Property<uint>("Type").HasColumnType("int unsigned");
b.Property<DateTime>("UpdatedOn").ValueGeneratedOnAddOrUpdate().HasColumnType("datetime(6)");
b.Property<DateTime>("UploadDate").IsConcurrencyToken().ValueGeneratedOnAddOrUpdate().
HasColumnType("datetime(6)");
b.Property<string>("UserId").HasColumnType("varchar(255) CHARACTER SET utf8mb4");
b.Property<double?>("VerticalResolution").HasColumnType("double");
b.HasKey("Id");
b.HasIndex("Author");
b.HasIndex("ColorSpace");
b.HasIndex("Comments");
b.HasIndex("CreationDate");
b.HasIndex("ExifVersion");
b.HasIndex("HorizontalResolution");
b.HasIndex("MagazineId");
b.HasIndex("Page");
b.HasIndex("ResolutionUnit");
b.HasIndex("ScannerManufacturer");
b.HasIndex("ScannerModel");
b.HasIndex("SoftwareUsed");
b.HasIndex("Type");
b.HasIndex("UploadDate");
b.HasIndex("UserId");
b.HasIndex("VerticalResolution");
b.ToTable("MagazineScans");
});
modelBuilder.Entity("Marechai.Database.Models.MagazinesByMachine", b =>
{
b.Property<long>("Id").ValueGeneratedOnAdd().HasColumnType("bigint");
@@ -3891,6 +4131,15 @@ namespace Marechai.Database.Migrations
b.HasOne("Marechai.Database.Models.Book", "Source").WithMany("Derivates").HasForeignKey("SourceId");
});
modelBuilder.Entity("Marechai.Database.Models.BookScan", b =>
{
b.HasOne("Marechai.Database.Models.Book", "Book").WithMany("Scans").HasForeignKey("BookId").
OnDelete(DeleteBehavior.Cascade).IsRequired();
b.HasOne("Marechai.Database.Models.ApplicationUser", "User").WithMany("BookScans").
HasForeignKey("UserId").OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity("Marechai.Database.Models.BooksByMachine", b =>
{
b.HasOne("Marechai.Database.Models.Book", "Book").WithMany("Machines").HasForeignKey("BookId").
@@ -4036,6 +4285,15 @@ namespace Marechai.Database.Migrations
HasForeignKey("Marechai.Database.Models.DocumentPerson", "PersonId").OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity("Marechai.Database.Models.DocumentScan", b =>
{
b.HasOne("Marechai.Database.Models.Document", "Document").WithMany("Scans").HasForeignKey("DocumentId").
OnDelete(DeleteBehavior.Cascade).IsRequired();
b.HasOne("Marechai.Database.Models.ApplicationUser", "User").WithMany("DocumentScans").
HasForeignKey("UserId").OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity("Marechai.Database.Models.DocumentsByMachine", b =>
{
b.HasOne("Marechai.Database.Models.Document", "Document").WithMany("Machines").
@@ -4251,6 +4509,15 @@ namespace Marechai.Database.Migrations
HasForeignKey("MagazineId").OnDelete(DeleteBehavior.Cascade).IsRequired();
});
modelBuilder.Entity("Marechai.Database.Models.MagazineScan", b =>
{
b.HasOne("Marechai.Database.Models.MagazineIssue", "Magazine").WithMany("Scans").
HasForeignKey("MagazineId").OnDelete(DeleteBehavior.Cascade).IsRequired();
b.HasOne("Marechai.Database.Models.ApplicationUser", "User").WithMany("MagazineScans").
HasForeignKey("UserId").OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity("Marechai.Database.Models.MagazinesByMachine", b =>
{
b.HasOne("Marechai.Database.Models.Machine", "Machine").WithMany("Magazines").

View File

@@ -34,5 +34,8 @@ namespace Marechai.Database.Models
public virtual ICollection<OwnedMachinePhoto> OwnedMachinePhotos { get; set; }
public virtual ICollection<OwnedMachine> OwnedMachines { get; set; }
public virtual ICollection<Dump> Dumps { get; set; }
public virtual ICollection<BookScan> BookScans { get; set; }
public virtual ICollection<DocumentScan> DocumentScans { get; set; }
public virtual ICollection<MagazineScan> MagazineScans { get; set; }
}
}

View File

@@ -0,0 +1,63 @@
/******************************************************************************
// MARECHAI: Master repository of computing history artifacts information
// ----------------------------------------------------------------------------
//
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2003-2020 Natalia Portillo
*******************************************************************************/
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Marechai.Database.Models
{
public abstract class BaseScan : BaseModel<Guid>
{
public string Author { get; set; }
[DisplayName("Color space")]
public ColorSpace? ColorSpace { get; set; }
[DisplayName("User comments")]
public string Comments { get; set; }
[DisplayName("Date and time of digitizing")]
public DateTime? CreationDate { get; set; }
[DisplayName("Exif version")]
public string ExifVersion { get; set; }
[DisplayName("Horizontal resolution")]
public double? HorizontalResolution { get; set; }
[DisplayName("Resolution unit")]
public ResolutionUnit? ResolutionUnit { get; set; }
[DisplayName("Scanner manufacturer")]
public string ScannerManufacturer { get; set; }
[DisplayName("Scanner model")]
public string ScannerModel { get; set; }
[DisplayName("Software used")]
public string SoftwareUsed { get; set; }
[Timestamp]
public DateTime UploadDate { get; set; }
[DisplayName("Vertical resolution")]
public double? VerticalResolution { get; set; }
public string OriginalExtension { get; set; }
public virtual ApplicationUser User { get; set; }
public string UserId { get; set; }
}
}

View File

@@ -46,5 +46,6 @@ namespace Marechai.Database.Models
public virtual ICollection<PeopleByBook> People { get; set; }
public virtual ICollection<BooksByMachine> Machines { get; set; }
public virtual ICollection<BooksByMachineFamily> MachineFamilies { get; set; }
public virtual ICollection<BookScan> Scans { get; set; }
}
}

View File

@@ -0,0 +1,36 @@
/******************************************************************************
// MARECHAI: Master repository of computing history artifacts information
// ----------------------------------------------------------------------------
//
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2003-2020 Natalia Portillo
*******************************************************************************/
using System.ComponentModel.DataAnnotations;
namespace Marechai.Database.Models
{
public class BookScan : DocumentScanBase
{
[Required]
public virtual Book Book { get; set; }
public long BookId { get; set; }
}
}

View File

@@ -35,5 +35,6 @@ namespace Marechai.Database.Models
public virtual ICollection<CompaniesByDocument> Companies { get; set; }
public virtual ICollection<DocumentsByMachine> Machines { get; set; }
public virtual ICollection<DocumentsByMachineFamily> MachineFamilies { get; set; }
public virtual ICollection<DocumentScan> Scans { get; set; }
}
}

View File

@@ -0,0 +1,36 @@
/******************************************************************************
// MARECHAI: Master repository of computing history artifacts information
// ----------------------------------------------------------------------------
//
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2003-2020 Natalia Portillo
*******************************************************************************/
using System.ComponentModel.DataAnnotations;
namespace Marechai.Database.Models
{
public class DocumentScan : DocumentScanBase
{
[Required]
public virtual Document Document { get; set; }
public long DocumentId { get; set; }
}
}

View File

@@ -0,0 +1,33 @@
/******************************************************************************
// MARECHAI: Master repository of computing history artifacts information
// ----------------------------------------------------------------------------
//
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2003-2020 Natalia Portillo
*******************************************************************************/
namespace Marechai.Database.Models
{
public abstract class DocumentScanBase : BaseScan
{
public DocumentScanType Type { get; set; }
public uint? Page { get; set; }
}
}

View File

@@ -48,5 +48,6 @@ namespace Marechai.Database.Models
public virtual ICollection<MagazinesByMachine> Machines { get; set; }
public virtual ICollection<MagazinesByMachineFamily> MachineFamilies { get; set; }
public virtual ICollection<Media> Coverdiscs { get; set; }
public virtual ICollection<MagazineScan> Scans { get; set; }
}
}

View File

@@ -0,0 +1,36 @@
/******************************************************************************
// MARECHAI: Master repository of computing history artifacts information
// ----------------------------------------------------------------------------
//
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2003-2020 Natalia Portillo
*******************************************************************************/
using System.ComponentModel.DataAnnotations;
namespace Marechai.Database.Models
{
public class MagazineScan : DocumentScanBase
{
[Required]
public virtual MagazineIssue Magazine { get; set; }
public long MagazineId { get; set; }
}
}

View File

@@ -48,6 +48,7 @@ namespace Marechai.Database.Models
public virtual DbSet<Book> Books { get; set; }
public virtual DbSet<BooksByMachine> BooksByMachines { get; set; }
public virtual DbSet<BooksByMachineFamily> BooksByMachineFamilies { get; set; }
public virtual DbSet<BookScan> BookScans { get; set; }
public virtual DbSet<BrowserTest> BrowserTests { get; set; }
public virtual DbSet<CompaniesByBook> CompaniesByBooks { get; set; }
public virtual DbSet<CompaniesByDocument> CompaniesByDocuments { get; set; }
@@ -67,6 +68,7 @@ namespace Marechai.Database.Models
public virtual DbSet<DocumentRole> DocumentRoles { get; set; }
public virtual DbSet<DocumentsByMachine> DocumentsByMachines { get; set; }
public virtual DbSet<DocumentsByMachineFamily> DocumentsByMachineFamilies { get; set; }
public virtual DbSet<DocumentScan> DocumentScans { get; set; }
public virtual DbSet<Dump> Dumps { get; set; }
public virtual DbSet<DumpHardware> DumpHardwares { get; set; }
public virtual DbSet<FileDataStream> FileDataStreams { get; set; }
@@ -92,6 +94,7 @@ namespace Marechai.Database.Models
public virtual DbSet<MagazineIssue> MagazineIssues { get; set; }
public virtual DbSet<MagazinesByMachine> MagazinesByMachines { get; set; }
public virtual DbSet<MagazinesByMachineFamily> MagazinesByMachinesFamilies { get; set; }
public virtual DbSet<MagazineScan> MagazineScans { get; set; }
public virtual DbSet<MarechaiDb> MarechaiDb { get; set; }
public virtual DbSet<MasteringText> MasteringTexts { get; set; }
public virtual DbSet<Media> Media { get; set; }
@@ -2022,6 +2025,111 @@ namespace Marechai.Database.Models
{
entity.HasIndex(e => e.Path);
});
modelBuilder.Entity<BookScan>(entity =>
{
entity.HasIndex(e => e.Author);
entity.HasIndex(e => e.ColorSpace);
entity.HasIndex(e => e.Comments);
entity.HasIndex(e => e.CreationDate);
entity.HasIndex(e => e.ExifVersion);
entity.HasIndex(e => e.HorizontalResolution);
entity.HasIndex(e => e.ResolutionUnit);
entity.HasIndex(e => e.ScannerManufacturer);
entity.HasIndex(e => e.ScannerModel);
entity.HasIndex(e => e.SoftwareUsed);
entity.HasIndex(e => e.UploadDate);
entity.HasIndex(e => e.VerticalResolution);
entity.HasIndex(e => e.Type);
entity.HasIndex(e => e.Page);
entity.HasOne(d => d.Book).WithMany(p => p.Scans).OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.User).WithMany(p => p.BookScans).OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity<DocumentScan>(entity =>
{
entity.HasIndex(e => e.Author);
entity.HasIndex(e => e.ColorSpace);
entity.HasIndex(e => e.Comments);
entity.HasIndex(e => e.CreationDate);
entity.HasIndex(e => e.ExifVersion);
entity.HasIndex(e => e.HorizontalResolution);
entity.HasIndex(e => e.ResolutionUnit);
entity.HasIndex(e => e.ScannerManufacturer);
entity.HasIndex(e => e.ScannerModel);
entity.HasIndex(e => e.SoftwareUsed);
entity.HasIndex(e => e.UploadDate);
entity.HasIndex(e => e.VerticalResolution);
entity.HasIndex(e => e.Type);
entity.HasIndex(e => e.Page);
entity.HasOne(d => d.Document).WithMany(p => p.Scans).OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.User).WithMany(p => p.DocumentScans).OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity<MagazineScan>(entity =>
{
entity.HasIndex(e => e.Author);
entity.HasIndex(e => e.ColorSpace);
entity.HasIndex(e => e.Comments);
entity.HasIndex(e => e.CreationDate);
entity.HasIndex(e => e.ExifVersion);
entity.HasIndex(e => e.HorizontalResolution);
entity.HasIndex(e => e.ResolutionUnit);
entity.HasIndex(e => e.ScannerManufacturer);
entity.HasIndex(e => e.ScannerModel);
entity.HasIndex(e => e.SoftwareUsed);
entity.HasIndex(e => e.UploadDate);
entity.HasIndex(e => e.VerticalResolution);
entity.HasIndex(e => e.Type);
entity.HasIndex(e => e.Page);
entity.HasOne(d => d.Magazine).WithMany(p => p.Scans).OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.User).WithMany(p => p.MagazineScans).OnDelete(DeleteBehavior.SetNull);
});
}
}
}

View File

@@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Version>4.0.0.1822</Version>
<Version>4.0.0.1825</Version>
<Company>Canary Islands Computer Museum</Company>
<Copyright>Copyright © 2003-2020 Natalia Portillo</Copyright>
<Product>Canary Islands Computer Museum Website</Product>