Updated admin page to be more streamlined and added the beginning of the blogging features

This commit is contained in:
Vincent Allen
2025-10-21 13:32:39 -04:00
parent 0e24ce2073
commit b34449808f
224 changed files with 27064 additions and 396 deletions

View File

@@ -26,10 +26,21 @@ public class ApplicationDbContext(DbContextOptions<ApplicationDbContext> options
public DbSet<ArtifactType> ArtifactTypes { get; set; }
public DbSet<ArtifactGroupingViewCount> ArtifactGroupingViewCounts { get; set; }
public DbSet<BlogPost> BlogPosts { get; set; }
public DbSet<BlogPostTag> BlogPostTags { get; set; }
/// <summary>
/// Configuration for what featured artifacts will be show on the homepage of the search page
/// </summary>
public DbSet<SearchPageSliderEntry> SearchPageSliderEntries { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<ArtifactEntry>()
.HasMany(a => a.RelatedTo)
.WithMany(a => a.RelatedBy)
@@ -39,10 +50,15 @@ public class ApplicationDbContext(DbContextOptions<ApplicationDbContext> options
.HasOne(a => a.StorageLocation)
.WithMany(l => l.ArtifactEntries);
modelBuilder.Entity<ArtifactGroupingViewCount>()
.HasOne(vc => vc.Grouping)
.WithOne(g => g.ViewCount)
.HasForeignKey<ArtifactGroupingViewCount>(vc => vc.ArtifactGroupingId);
modelBuilder.Entity<ArtifactGrouping>()
.OwnsOne(p => p.IdentifierFields)
.ToJson();
modelBuilder.Entity<ArtifactGrouping>()
.HasMany(grouping => grouping.ChildArtifactEntries)
.WithOne(entry => entry.ArtifactGrouping)
@@ -69,11 +85,12 @@ public class ApplicationDbContext(DbContextOptions<ApplicationDbContext> options
sourceDictionary => new Dictionary<string, string>(sourceDictionary)
);
// Create the search vector columns for artifat groupings
modelBuilder.Entity<ArtifactGrouping>()
.HasGeneratedTsVectorColumn(
p => p.AllSearchVector,
"english",
p => p.AllSearchString
p => p.AllSearchString
)
.HasIndex(p => p.AllSearchVector)
.HasMethod("GIN");
@@ -141,6 +158,37 @@ public class ApplicationDbContext(DbContextOptions<ApplicationDbContext> options
.HasIndex(p => p.FileContentSearchVector)
.HasMethod("GIN");
// Create the search vector columns for blog posts
modelBuilder.Entity<BlogPost>()
.HasGeneratedTsVectorColumn(
p => p.ContentSearchVector,
"english",
p => p.Content)
.HasIndex(p => p.ContentSearchVector)
.HasMethod("GIN");
modelBuilder.Entity<BlogPost>()
.HasGeneratedTsVectorColumn(
p => p.TitleSearchVector,
"english",
p => p.Title)
.HasIndex(p => p.TitleSearchVector)
.HasMethod("GIN");
modelBuilder.Entity<BlogPost>()
.HasGeneratedTsVectorColumn(
p => p.TagsSearchVector,
"english",
p => p.TagsSearchString)
.HasIndex(p => p.TagsSearchVector)
.HasMethod("GIN");
modelBuilder.Entity<BlogPost>()
.HasGeneratedTsVectorColumn(
p => p.AllSearchVector,
"english",
p => p.AllSearchString)
.HasIndex(p => p.AllSearchVector)
.HasMethod("GIN");
}
}

View File

@@ -0,0 +1,855 @@
// <auto-generated />
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using NpgsqlTypes;
using OpenArchival.DataAccess;
#nullable disable
namespace OpenArchival.DataAccess.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20251016133832_AddedArtifactEntryQuantity")]
partial class AddedArtifactEntryQuantity
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("ArtifactDefectArtifactEntry", b =>
{
b.Property<int>("ArtifactEntriesId")
.HasColumnType("integer");
b.Property<int>("DefectsId")
.HasColumnType("integer");
b.HasKey("ArtifactEntriesId", "DefectsId");
b.HasIndex("DefectsId");
b.ToTable("ArtifactDefectArtifactEntry");
});
modelBuilder.Entity("ArtifactEntryArtifactEntry", b =>
{
b.Property<int>("RelatedById")
.HasColumnType("integer");
b.Property<int>("RelatedToId")
.HasColumnType("integer");
b.HasKey("RelatedById", "RelatedToId");
b.HasIndex("RelatedToId");
b.ToTable("ArtifactRelationships", (string)null);
});
modelBuilder.Entity("ArtifactEntryArtifactEntryTag", b =>
{
b.Property<int>("ArtifactEntriesId")
.HasColumnType("integer");
b.Property<int>("TagsId")
.HasColumnType("integer");
b.HasKey("ArtifactEntriesId", "TagsId");
b.HasIndex("TagsId");
b.ToTable("ArtifactEntryArtifactEntryTag");
});
modelBuilder.Entity("ArtifactEntryListedName", b =>
{
b.Property<int>("ArtifactEntriesId")
.HasColumnType("integer");
b.Property<int>("ListedNamesId")
.HasColumnType("integer");
b.HasKey("ArtifactEntriesId", "ListedNamesId");
b.HasIndex("ListedNamesId");
b.ToTable("ArtifactEntryListedName");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("text");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("text");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("text");
b.Property<string>("ProviderKey")
.HasColumnType("text");
b.Property<string>("ProviderDisplayName")
.HasColumnType("text");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("text");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("text");
b.Property<string>("RoleId")
.HasColumnType("text");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("text");
b.Property<string>("LoginProvider")
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("text");
b.Property<string>("Value")
.HasColumnType("text");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("OpenArchival.DataAccess.ApplicationUser", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<int>("AccessFailedCount")
.HasColumnType("integer");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("boolean");
b.Property<bool>("LockoutEnabled")
.HasColumnType("boolean");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("timestamp with time zone");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("PasswordHash")
.HasColumnType("text");
b.Property<string>("PermissionLevel")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("boolean");
b.Property<string>("SecurityStamp")
.HasColumnType("text");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("boolean");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("OpenArchival.DataAccess.ArchiveCategory", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Description")
.HasColumnType("text");
b.PrimitiveCollection<List<string>>("FieldDescriptions")
.IsRequired()
.HasColumnType("text[]");
b.PrimitiveCollection<List<string>>("FieldNames")
.IsRequired()
.HasColumnType("text[]");
b.Property<string>("FieldSeparator")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArchiveCategories");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactDefect", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactDefects");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("ArtifactGroupingId")
.HasColumnType("integer");
b.Property<string>("ArtifactNumber")
.HasColumnType("text");
b.PrimitiveCollection<List<DateTime>>("AssociatedDates")
.HasColumnType("timestamp with time zone[]");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("FileTextContent")
.HasColumnType("text");
b.Property<bool>("IsPubliclyVisible")
.HasColumnType("boolean");
b.PrimitiveCollection<List<string>>("Links")
.HasColumnType("text[]");
b.Property<int>("Quantity")
.HasColumnType("integer");
b.Property<int>("StorageLocationId")
.HasColumnType("integer");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<int>("TypeId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ArtifactGroupingId");
b.HasIndex("StorageLocationId");
b.HasIndex("TypeId");
b.ToTable("ArtifactEntries");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntryTag", 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("ArtifactEntryTags");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("AllSearchString")
.IsRequired()
.HasColumnType("text");
b.Property<NpgsqlTsVector>("AllSearchVector")
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("tsvector")
.HasAnnotation("Npgsql:TsVectorConfig", "english")
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "AllSearchString" });
b.Property<int>("CategoryId")
.HasColumnType("integer");
b.Property<string>("DefectsSearchString")
.IsRequired()
.HasColumnType("text");
b.Property<NpgsqlTsVector>("DefectsSearchVector")
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("tsvector")
.HasAnnotation("Npgsql:TsVectorConfig", "english")
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "DefectsSearchString" });
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("DescriptionSearchString")
.IsRequired()
.HasColumnType("text");
b.Property<NpgsqlTsVector>("DescriptionSearchVector")
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("tsvector")
.HasAnnotation("Npgsql:TsVectorConfig", "english")
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "DescriptionSearchString" });
b.Property<string>("FileContentSearchString")
.IsRequired()
.HasColumnType("text");
b.Property<NpgsqlTsVector>("FileContentSearchVector")
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("tsvector")
.HasAnnotation("Npgsql:TsVectorConfig", "english")
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "FileContentSearchString" });
b.Property<string>("FilenamesSearchString")
.IsRequired()
.HasColumnType("text");
b.Property<NpgsqlTsVector>("FilenamesSearchVector")
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("tsvector")
.HasAnnotation("Npgsql:TsVectorConfig", "english")
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "FilenamesSearchString" });
b.Property<bool>("IsPublicallyVisible")
.HasColumnType("boolean");
b.Property<string>("ListedNamesSearchString")
.IsRequired()
.HasColumnType("text");
b.Property<NpgsqlTsVector>("ListedNamesSearchVector")
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("tsvector")
.HasAnnotation("Npgsql:TsVectorConfig", "english")
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "ListedNamesSearchString" });
b.Property<string>("TagsSearchString")
.IsRequired()
.HasColumnType("text");
b.Property<NpgsqlTsVector>("TagsSearchVector")
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("tsvector")
.HasAnnotation("Npgsql:TsVectorConfig", "english")
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "TagsSearchString" });
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<string>("TitleSearchString")
.IsRequired()
.HasColumnType("text");
b.Property<NpgsqlTsVector>("TitleSearchVector")
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("tsvector")
.HasAnnotation("Npgsql:TsVectorConfig", "english")
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "TitleSearchString" });
b.Property<int>("TypeId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("AllSearchVector");
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("AllSearchVector"), "GIN");
b.HasIndex("CategoryId");
b.HasIndex("DefectsSearchVector");
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("DefectsSearchVector"), "GIN");
b.HasIndex("DescriptionSearchVector");
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("DescriptionSearchVector"), "GIN");
b.HasIndex("FileContentSearchVector");
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("FileContentSearchVector"), "GIN");
b.HasIndex("FilenamesSearchVector");
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("FilenamesSearchVector"), "GIN");
b.HasIndex("ListedNamesSearchVector");
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("ListedNamesSearchVector"), "GIN");
b.HasIndex("TagsSearchVector");
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("TagsSearchVector"), "GIN");
b.HasIndex("TitleSearchVector");
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("TitleSearchVector"), "GIN");
b.HasIndex("TypeId");
b.ToTable("ArtifactGroupings");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactStorageLocation", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Location")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactStorageLocations");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactType", 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("ArtifactTypes");
});
modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int?>("ArtifactGroupingId")
.HasColumnType("integer");
b.Property<string>("OriginalName")
.IsRequired()
.HasColumnType("text");
b.Property<int?>("ParentArtifactEntryId")
.HasColumnType("integer");
b.Property<string>("Path")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ArtifactGroupingId");
b.HasIndex("ParentArtifactEntryId");
b.ToTable("ArtifactFilePaths");
});
modelBuilder.Entity("OpenArchival.DataAccess.ListedName", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Value")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactAssociatedNames");
});
modelBuilder.Entity("ArtifactDefectArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("ArtifactEntriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactDefect", null)
.WithMany()
.HasForeignKey("DefectsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ArtifactEntryArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("RelatedById")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("RelatedToId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ArtifactEntryArtifactEntryTag", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("ArtifactEntriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactEntryTag", null)
.WithMany()
.HasForeignKey("TagsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ArtifactEntryListedName", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("ArtifactEntriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ListedName", null)
.WithMany()
.HasForeignKey("ListedNamesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", "ArtifactGrouping")
.WithMany("ChildArtifactEntries")
.HasForeignKey("ArtifactGroupingId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactStorageLocation", "StorageLocation")
.WithMany("ArtifactEntries")
.HasForeignKey("StorageLocationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactType", "Type")
.WithMany("ArtifactEntries")
.HasForeignKey("TypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ArtifactGrouping");
b.Navigation("StorageLocation");
b.Navigation("Type");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.HasOne("OpenArchival.DataAccess.ArchiveCategory", "Category")
.WithMany()
.HasForeignKey("CategoryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactType", "Type")
.WithMany()
.HasForeignKey("TypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.OwnsOne("OpenArchival.DataAccess.IdentifierFields", "IdentifierFields", b1 =>
{
b1.Property<int>("ArtifactGroupingId")
.HasColumnType("integer");
b1.PrimitiveCollection<List<string>>("Values")
.IsRequired()
.HasColumnType("text[]");
b1.HasKey("ArtifactGroupingId");
b1.ToTable("ArtifactGroupings");
b1.ToJson("IdentifierFields");
b1.WithOwner()
.HasForeignKey("ArtifactGroupingId");
});
b.Navigation("Category");
b.Navigation("IdentifierFields")
.IsRequired();
b.Navigation("Type");
});
modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", null)
.WithMany("ChildFilePathListings")
.HasForeignKey("ArtifactGroupingId");
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", "ParentArtifactEntry")
.WithMany("Files")
.HasForeignKey("ParentArtifactEntryId")
.OnDelete(DeleteBehavior.Cascade);
b.Navigation("ParentArtifactEntry");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.Navigation("Files");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.Navigation("ChildArtifactEntries");
b.Navigation("ChildFilePathListings");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactStorageLocation", b =>
{
b.Navigation("ArtifactEntries");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactType", b =>
{
b.Navigation("ArtifactEntries");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace OpenArchival.DataAccess.Migrations
{
/// <inheritdoc />
public partial class AddedArtifactEntryQuantity : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "Quantity",
table: "ArtifactEntries",
type: "integer",
nullable: false,
defaultValue: 0);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Quantity",
table: "ArtifactEntries");
}
}
}

View File

@@ -0,0 +1,890 @@
// <auto-generated />
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using NpgsqlTypes;
using OpenArchival.DataAccess;
#nullable disable
namespace OpenArchival.DataAccess.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20251016135424_AddedViewCountObject")]
partial class AddedViewCountObject
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("ArtifactDefectArtifactEntry", b =>
{
b.Property<int>("ArtifactEntriesId")
.HasColumnType("integer");
b.Property<int>("DefectsId")
.HasColumnType("integer");
b.HasKey("ArtifactEntriesId", "DefectsId");
b.HasIndex("DefectsId");
b.ToTable("ArtifactDefectArtifactEntry");
});
modelBuilder.Entity("ArtifactEntryArtifactEntry", b =>
{
b.Property<int>("RelatedById")
.HasColumnType("integer");
b.Property<int>("RelatedToId")
.HasColumnType("integer");
b.HasKey("RelatedById", "RelatedToId");
b.HasIndex("RelatedToId");
b.ToTable("ArtifactRelationships", (string)null);
});
modelBuilder.Entity("ArtifactEntryArtifactEntryTag", b =>
{
b.Property<int>("ArtifactEntriesId")
.HasColumnType("integer");
b.Property<int>("TagsId")
.HasColumnType("integer");
b.HasKey("ArtifactEntriesId", "TagsId");
b.HasIndex("TagsId");
b.ToTable("ArtifactEntryArtifactEntryTag");
});
modelBuilder.Entity("ArtifactEntryListedName", b =>
{
b.Property<int>("ArtifactEntriesId")
.HasColumnType("integer");
b.Property<int>("ListedNamesId")
.HasColumnType("integer");
b.HasKey("ArtifactEntriesId", "ListedNamesId");
b.HasIndex("ListedNamesId");
b.ToTable("ArtifactEntryListedName");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("text");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("text");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("text");
b.Property<string>("ProviderKey")
.HasColumnType("text");
b.Property<string>("ProviderDisplayName")
.HasColumnType("text");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("text");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("text");
b.Property<string>("RoleId")
.HasColumnType("text");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("text");
b.Property<string>("LoginProvider")
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("text");
b.Property<string>("Value")
.HasColumnType("text");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("OpenArchival.DataAccess.ApplicationUser", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<int>("AccessFailedCount")
.HasColumnType("integer");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("boolean");
b.Property<bool>("LockoutEnabled")
.HasColumnType("boolean");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("timestamp with time zone");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("PasswordHash")
.HasColumnType("text");
b.Property<string>("PermissionLevel")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("boolean");
b.Property<string>("SecurityStamp")
.HasColumnType("text");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("boolean");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("OpenArchival.DataAccess.ArchiveCategory", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Description")
.HasColumnType("text");
b.PrimitiveCollection<List<string>>("FieldDescriptions")
.IsRequired()
.HasColumnType("text[]");
b.PrimitiveCollection<List<string>>("FieldNames")
.IsRequired()
.HasColumnType("text[]");
b.Property<string>("FieldSeparator")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArchiveCategories");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactDefect", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactDefects");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("ArtifactGroupingId")
.HasColumnType("integer");
b.Property<string>("ArtifactNumber")
.HasColumnType("text");
b.PrimitiveCollection<List<DateTime>>("AssociatedDates")
.HasColumnType("timestamp with time zone[]");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("FileTextContent")
.HasColumnType("text");
b.Property<bool>("IsPubliclyVisible")
.HasColumnType("boolean");
b.PrimitiveCollection<List<string>>("Links")
.HasColumnType("text[]");
b.Property<int>("Quantity")
.HasColumnType("integer");
b.Property<int>("StorageLocationId")
.HasColumnType("integer");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<int>("TypeId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ArtifactGroupingId");
b.HasIndex("StorageLocationId");
b.HasIndex("TypeId");
b.ToTable("ArtifactEntries");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntryTag", 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("ArtifactEntryTags");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("AllSearchString")
.IsRequired()
.HasColumnType("text");
b.Property<NpgsqlTsVector>("AllSearchVector")
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("tsvector")
.HasAnnotation("Npgsql:TsVectorConfig", "english")
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "AllSearchString" });
b.Property<int>("CategoryId")
.HasColumnType("integer");
b.Property<string>("DefectsSearchString")
.IsRequired()
.HasColumnType("text");
b.Property<NpgsqlTsVector>("DefectsSearchVector")
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("tsvector")
.HasAnnotation("Npgsql:TsVectorConfig", "english")
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "DefectsSearchString" });
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("DescriptionSearchString")
.IsRequired()
.HasColumnType("text");
b.Property<NpgsqlTsVector>("DescriptionSearchVector")
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("tsvector")
.HasAnnotation("Npgsql:TsVectorConfig", "english")
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "DescriptionSearchString" });
b.Property<string>("FileContentSearchString")
.IsRequired()
.HasColumnType("text");
b.Property<NpgsqlTsVector>("FileContentSearchVector")
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("tsvector")
.HasAnnotation("Npgsql:TsVectorConfig", "english")
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "FileContentSearchString" });
b.Property<string>("FilenamesSearchString")
.IsRequired()
.HasColumnType("text");
b.Property<NpgsqlTsVector>("FilenamesSearchVector")
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("tsvector")
.HasAnnotation("Npgsql:TsVectorConfig", "english")
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "FilenamesSearchString" });
b.Property<bool>("IsPublicallyVisible")
.HasColumnType("boolean");
b.Property<string>("ListedNamesSearchString")
.IsRequired()
.HasColumnType("text");
b.Property<NpgsqlTsVector>("ListedNamesSearchVector")
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("tsvector")
.HasAnnotation("Npgsql:TsVectorConfig", "english")
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "ListedNamesSearchString" });
b.Property<string>("TagsSearchString")
.IsRequired()
.HasColumnType("text");
b.Property<NpgsqlTsVector>("TagsSearchVector")
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("tsvector")
.HasAnnotation("Npgsql:TsVectorConfig", "english")
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "TagsSearchString" });
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<string>("TitleSearchString")
.IsRequired()
.HasColumnType("text");
b.Property<NpgsqlTsVector>("TitleSearchVector")
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("tsvector")
.HasAnnotation("Npgsql:TsVectorConfig", "english")
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "TitleSearchString" });
b.Property<int>("TypeId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("AllSearchVector");
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("AllSearchVector"), "GIN");
b.HasIndex("CategoryId");
b.HasIndex("DefectsSearchVector");
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("DefectsSearchVector"), "GIN");
b.HasIndex("DescriptionSearchVector");
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("DescriptionSearchVector"), "GIN");
b.HasIndex("FileContentSearchVector");
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("FileContentSearchVector"), "GIN");
b.HasIndex("FilenamesSearchVector");
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("FilenamesSearchVector"), "GIN");
b.HasIndex("ListedNamesSearchVector");
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("ListedNamesSearchVector"), "GIN");
b.HasIndex("TagsSearchVector");
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("TagsSearchVector"), "GIN");
b.HasIndex("TitleSearchVector");
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("TitleSearchVector"), "GIN");
b.HasIndex("TypeId");
b.ToTable("ArtifactGroupings");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGroupingViewCount", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("ArtifactGroupingId")
.HasColumnType("integer");
b.Property<int>("Views")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ArtifactGroupingId")
.IsUnique();
b.ToTable("ArtifactGroupingViewCounts");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactStorageLocation", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Location")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactStorageLocations");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactType", 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("ArtifactTypes");
});
modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int?>("ArtifactGroupingId")
.HasColumnType("integer");
b.Property<string>("OriginalName")
.IsRequired()
.HasColumnType("text");
b.Property<int?>("ParentArtifactEntryId")
.HasColumnType("integer");
b.Property<string>("Path")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ArtifactGroupingId");
b.HasIndex("ParentArtifactEntryId");
b.ToTable("ArtifactFilePaths");
});
modelBuilder.Entity("OpenArchival.DataAccess.ListedName", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Value")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactAssociatedNames");
});
modelBuilder.Entity("ArtifactDefectArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("ArtifactEntriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactDefect", null)
.WithMany()
.HasForeignKey("DefectsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ArtifactEntryArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("RelatedById")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("RelatedToId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ArtifactEntryArtifactEntryTag", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("ArtifactEntriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactEntryTag", null)
.WithMany()
.HasForeignKey("TagsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ArtifactEntryListedName", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("ArtifactEntriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ListedName", null)
.WithMany()
.HasForeignKey("ListedNamesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", "ArtifactGrouping")
.WithMany("ChildArtifactEntries")
.HasForeignKey("ArtifactGroupingId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactStorageLocation", "StorageLocation")
.WithMany("ArtifactEntries")
.HasForeignKey("StorageLocationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactType", "Type")
.WithMany("ArtifactEntries")
.HasForeignKey("TypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ArtifactGrouping");
b.Navigation("StorageLocation");
b.Navigation("Type");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.HasOne("OpenArchival.DataAccess.ArchiveCategory", "Category")
.WithMany()
.HasForeignKey("CategoryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactType", "Type")
.WithMany()
.HasForeignKey("TypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.OwnsOne("OpenArchival.DataAccess.IdentifierFields", "IdentifierFields", b1 =>
{
b1.Property<int>("ArtifactGroupingId")
.HasColumnType("integer");
b1.PrimitiveCollection<List<string>>("Values")
.IsRequired()
.HasColumnType("text[]");
b1.HasKey("ArtifactGroupingId");
b1.ToTable("ArtifactGroupings");
b1.ToJson("IdentifierFields");
b1.WithOwner()
.HasForeignKey("ArtifactGroupingId");
});
b.Navigation("Category");
b.Navigation("IdentifierFields")
.IsRequired();
b.Navigation("Type");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGroupingViewCount", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", "Grouping")
.WithOne("ViewCount")
.HasForeignKey("OpenArchival.DataAccess.ArtifactGroupingViewCount", "ArtifactGroupingId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Grouping");
});
modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", null)
.WithMany("ChildFilePathListings")
.HasForeignKey("ArtifactGroupingId");
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", "ParentArtifactEntry")
.WithMany("Files")
.HasForeignKey("ParentArtifactEntryId")
.OnDelete(DeleteBehavior.Cascade);
b.Navigation("ParentArtifactEntry");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.Navigation("Files");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.Navigation("ChildArtifactEntries");
b.Navigation("ChildFilePathListings");
b.Navigation("ViewCount");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactStorageLocation", b =>
{
b.Navigation("ArtifactEntries");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactType", b =>
{
b.Navigation("ArtifactEntries");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,48 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace OpenArchival.DataAccess.Migrations
{
/// <inheritdoc />
public partial class AddedViewCountObject : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ArtifactGroupingViewCounts",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ArtifactGroupingId = table.Column<int>(type: "integer", nullable: false),
Views = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ArtifactGroupingViewCounts", x => x.Id);
table.ForeignKey(
name: "FK_ArtifactGroupingViewCounts_ArtifactGroupings_ArtifactGroupi~",
column: x => x.ArtifactGroupingId,
principalTable: "ArtifactGroupings",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_ArtifactGroupingViewCounts_ArtifactGroupingId",
table: "ArtifactGroupingViewCounts",
column: "ArtifactGroupingId",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ArtifactGroupingViewCounts");
}
}
}

View File

@@ -0,0 +1,944 @@
// <auto-generated />
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using NpgsqlTypes;
using OpenArchival.DataAccess;
#nullable disable
namespace OpenArchival.DataAccess.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20251019173125_SearchPageSliderEntries")]
partial class SearchPageSliderEntries
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("ArtifactDefectArtifactEntry", b =>
{
b.Property<int>("ArtifactEntriesId")
.HasColumnType("integer");
b.Property<int>("DefectsId")
.HasColumnType("integer");
b.HasKey("ArtifactEntriesId", "DefectsId");
b.HasIndex("DefectsId");
b.ToTable("ArtifactDefectArtifactEntry");
});
modelBuilder.Entity("ArtifactEntryArtifactEntry", b =>
{
b.Property<int>("RelatedById")
.HasColumnType("integer");
b.Property<int>("RelatedToId")
.HasColumnType("integer");
b.HasKey("RelatedById", "RelatedToId");
b.HasIndex("RelatedToId");
b.ToTable("ArtifactRelationships", (string)null);
});
modelBuilder.Entity("ArtifactEntryArtifactEntryTag", b =>
{
b.Property<int>("ArtifactEntriesId")
.HasColumnType("integer");
b.Property<int>("TagsId")
.HasColumnType("integer");
b.HasKey("ArtifactEntriesId", "TagsId");
b.HasIndex("TagsId");
b.ToTable("ArtifactEntryArtifactEntryTag");
});
modelBuilder.Entity("ArtifactEntryListedName", b =>
{
b.Property<int>("ArtifactEntriesId")
.HasColumnType("integer");
b.Property<int>("ListedNamesId")
.HasColumnType("integer");
b.HasKey("ArtifactEntriesId", "ListedNamesId");
b.HasIndex("ListedNamesId");
b.ToTable("ArtifactEntryListedName");
});
modelBuilder.Entity("ArtifactEntryTagSearchPageSliderEntry", b =>
{
b.Property<int>("FilterTagsId")
.HasColumnType("integer");
b.Property<int>("SearchPageSlidersId")
.HasColumnType("integer");
b.HasKey("FilterTagsId", "SearchPageSlidersId");
b.HasIndex("SearchPageSlidersId");
b.ToTable("ArtifactEntryTagSearchPageSliderEntry");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("text");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("text");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("text");
b.Property<string>("ProviderKey")
.HasColumnType("text");
b.Property<string>("ProviderDisplayName")
.HasColumnType("text");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("text");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("text");
b.Property<string>("RoleId")
.HasColumnType("text");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("text");
b.Property<string>("LoginProvider")
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("text");
b.Property<string>("Value")
.HasColumnType("text");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("OpenArchival.DataAccess.ApplicationUser", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<int>("AccessFailedCount")
.HasColumnType("integer");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("boolean");
b.Property<bool>("LockoutEnabled")
.HasColumnType("boolean");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("timestamp with time zone");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("PasswordHash")
.HasColumnType("text");
b.Property<string>("PermissionLevel")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("boolean");
b.Property<string>("SecurityStamp")
.HasColumnType("text");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("boolean");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("OpenArchival.DataAccess.ArchiveCategory", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Description")
.HasColumnType("text");
b.PrimitiveCollection<List<string>>("FieldDescriptions")
.IsRequired()
.HasColumnType("text[]");
b.PrimitiveCollection<List<string>>("FieldNames")
.IsRequired()
.HasColumnType("text[]");
b.Property<string>("FieldSeparator")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArchiveCategories");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactDefect", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactDefects");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("ArtifactGroupingId")
.HasColumnType("integer");
b.Property<string>("ArtifactNumber")
.HasColumnType("text");
b.PrimitiveCollection<List<DateTime>>("AssociatedDates")
.HasColumnType("timestamp with time zone[]");
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("FileTextContent")
.HasColumnType("text");
b.Property<bool>("IsPubliclyVisible")
.HasColumnType("boolean");
b.PrimitiveCollection<List<string>>("Links")
.HasColumnType("text[]");
b.Property<int>("Quantity")
.HasColumnType("integer");
b.Property<int>("StorageLocationId")
.HasColumnType("integer");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<int>("TypeId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ArtifactGroupingId");
b.HasIndex("StorageLocationId");
b.HasIndex("TypeId");
b.ToTable("ArtifactEntries");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntryTag", 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("ArtifactEntryTags");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("AllSearchString")
.IsRequired()
.HasColumnType("text");
b.Property<NpgsqlTsVector>("AllSearchVector")
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("tsvector")
.HasAnnotation("Npgsql:TsVectorConfig", "english")
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "AllSearchString" });
b.Property<int>("CategoryId")
.HasColumnType("integer");
b.Property<string>("DefectsSearchString")
.IsRequired()
.HasColumnType("text");
b.Property<NpgsqlTsVector>("DefectsSearchVector")
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("tsvector")
.HasAnnotation("Npgsql:TsVectorConfig", "english")
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "DefectsSearchString" });
b.Property<string>("Description")
.HasColumnType("text");
b.Property<string>("DescriptionSearchString")
.IsRequired()
.HasColumnType("text");
b.Property<NpgsqlTsVector>("DescriptionSearchVector")
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("tsvector")
.HasAnnotation("Npgsql:TsVectorConfig", "english")
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "DescriptionSearchString" });
b.Property<string>("FileContentSearchString")
.IsRequired()
.HasColumnType("text");
b.Property<NpgsqlTsVector>("FileContentSearchVector")
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("tsvector")
.HasAnnotation("Npgsql:TsVectorConfig", "english")
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "FileContentSearchString" });
b.Property<string>("FilenamesSearchString")
.IsRequired()
.HasColumnType("text");
b.Property<NpgsqlTsVector>("FilenamesSearchVector")
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("tsvector")
.HasAnnotation("Npgsql:TsVectorConfig", "english")
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "FilenamesSearchString" });
b.Property<bool>("IsPublicallyVisible")
.HasColumnType("boolean");
b.Property<string>("ListedNamesSearchString")
.IsRequired()
.HasColumnType("text");
b.Property<NpgsqlTsVector>("ListedNamesSearchVector")
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("tsvector")
.HasAnnotation("Npgsql:TsVectorConfig", "english")
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "ListedNamesSearchString" });
b.Property<string>("TagsSearchString")
.IsRequired()
.HasColumnType("text");
b.Property<NpgsqlTsVector>("TagsSearchVector")
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("tsvector")
.HasAnnotation("Npgsql:TsVectorConfig", "english")
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "TagsSearchString" });
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<string>("TitleSearchString")
.IsRequired()
.HasColumnType("text");
b.Property<NpgsqlTsVector>("TitleSearchVector")
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("tsvector")
.HasAnnotation("Npgsql:TsVectorConfig", "english")
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "TitleSearchString" });
b.Property<int>("TypeId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("AllSearchVector");
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("AllSearchVector"), "GIN");
b.HasIndex("CategoryId");
b.HasIndex("DefectsSearchVector");
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("DefectsSearchVector"), "GIN");
b.HasIndex("DescriptionSearchVector");
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("DescriptionSearchVector"), "GIN");
b.HasIndex("FileContentSearchVector");
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("FileContentSearchVector"), "GIN");
b.HasIndex("FilenamesSearchVector");
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("FilenamesSearchVector"), "GIN");
b.HasIndex("ListedNamesSearchVector");
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("ListedNamesSearchVector"), "GIN");
b.HasIndex("TagsSearchVector");
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("TagsSearchVector"), "GIN");
b.HasIndex("TitleSearchVector");
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("TitleSearchVector"), "GIN");
b.HasIndex("TypeId");
b.ToTable("ArtifactGroupings");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGroupingViewCount", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("ArtifactGroupingId")
.HasColumnType("integer");
b.Property<int>("Views")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ArtifactGroupingId")
.IsUnique();
b.ToTable("ArtifactGroupingViewCounts");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactStorageLocation", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Location")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactStorageLocations");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactType", 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("ArtifactTypes");
});
modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int?>("ArtifactGroupingId")
.HasColumnType("integer");
b.Property<string>("OriginalName")
.IsRequired()
.HasColumnType("text");
b.Property<int?>("ParentArtifactEntryId")
.HasColumnType("integer");
b.Property<string>("Path")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ArtifactGroupingId");
b.HasIndex("ParentArtifactEntryId");
b.ToTable("ArtifactFilePaths");
});
modelBuilder.Entity("OpenArchival.DataAccess.ListedName", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Value")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("ArtifactAssociatedNames");
});
modelBuilder.Entity("OpenArchival.DataAccess.SearchPageSliderEntry", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<int>("MaxCount")
.HasColumnType("integer");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("SearchPageSliderEntries");
});
modelBuilder.Entity("ArtifactDefectArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("ArtifactEntriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactDefect", null)
.WithMany()
.HasForeignKey("DefectsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ArtifactEntryArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("RelatedById")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("RelatedToId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ArtifactEntryArtifactEntryTag", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("ArtifactEntriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactEntryTag", null)
.WithMany()
.HasForeignKey("TagsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ArtifactEntryListedName", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
.WithMany()
.HasForeignKey("ArtifactEntriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ListedName", null)
.WithMany()
.HasForeignKey("ListedNamesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ArtifactEntryTagSearchPageSliderEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntryTag", null)
.WithMany()
.HasForeignKey("FilterTagsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.SearchPageSliderEntry", null)
.WithMany()
.HasForeignKey("SearchPageSlidersId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("OpenArchival.DataAccess.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", "ArtifactGrouping")
.WithMany("ChildArtifactEntries")
.HasForeignKey("ArtifactGroupingId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactStorageLocation", "StorageLocation")
.WithMany("ArtifactEntries")
.HasForeignKey("StorageLocationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactType", "Type")
.WithMany("ArtifactEntries")
.HasForeignKey("TypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ArtifactGrouping");
b.Navigation("StorageLocation");
b.Navigation("Type");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.HasOne("OpenArchival.DataAccess.ArchiveCategory", "Category")
.WithMany()
.HasForeignKey("CategoryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.ArtifactType", "Type")
.WithMany()
.HasForeignKey("TypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.OwnsOne("OpenArchival.DataAccess.IdentifierFields", "IdentifierFields", b1 =>
{
b1.Property<int>("ArtifactGroupingId")
.HasColumnType("integer");
b1.PrimitiveCollection<List<string>>("Values")
.IsRequired()
.HasColumnType("text[]");
b1.HasKey("ArtifactGroupingId");
b1.ToTable("ArtifactGroupings");
b1.ToJson("IdentifierFields");
b1.WithOwner()
.HasForeignKey("ArtifactGroupingId");
});
b.Navigation("Category");
b.Navigation("IdentifierFields")
.IsRequired();
b.Navigation("Type");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGroupingViewCount", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", "Grouping")
.WithOne("ViewCount")
.HasForeignKey("OpenArchival.DataAccess.ArtifactGroupingViewCount", "ArtifactGroupingId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Grouping");
});
modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", null)
.WithMany("ChildFilePathListings")
.HasForeignKey("ArtifactGroupingId");
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", "ParentArtifactEntry")
.WithMany("Files")
.HasForeignKey("ParentArtifactEntryId")
.OnDelete(DeleteBehavior.Cascade);
b.Navigation("ParentArtifactEntry");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.Navigation("Files");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGrouping", b =>
{
b.Navigation("ChildArtifactEntries");
b.Navigation("ChildFilePathListings");
b.Navigation("ViewCount");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactStorageLocation", b =>
{
b.Navigation("ArtifactEntries");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactType", b =>
{
b.Navigation("ArtifactEntries");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,69 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace OpenArchival.DataAccess.Migrations
{
/// <inheritdoc />
public partial class SearchPageSliderEntries : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "SearchPageSliderEntries",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Title = table.Column<string>(type: "text", nullable: false),
Description = table.Column<string>(type: "text", nullable: false),
MaxCount = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SearchPageSliderEntries", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ArtifactEntryTagSearchPageSliderEntry",
columns: table => new
{
FilterTagsId = table.Column<int>(type: "integer", nullable: false),
SearchPageSlidersId = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ArtifactEntryTagSearchPageSliderEntry", x => new { x.FilterTagsId, x.SearchPageSlidersId });
table.ForeignKey(
name: "FK_ArtifactEntryTagSearchPageSliderEntry_ArtifactEntryTags_Fil~",
column: x => x.FilterTagsId,
principalTable: "ArtifactEntryTags",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ArtifactEntryTagSearchPageSliderEntry_SearchPageSliderEntri~",
column: x => x.SearchPageSlidersId,
principalTable: "SearchPageSliderEntries",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_ArtifactEntryTagSearchPageSliderEntry_SearchPageSlidersId",
table: "ArtifactEntryTagSearchPageSliderEntry",
column: "SearchPageSlidersId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ArtifactEntryTagSearchPageSliderEntry");
migrationBuilder.DropTable(
name: "SearchPageSliderEntries");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,148 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using NpgsqlTypes;
#nullable disable
namespace OpenArchival.DataAccess.Migrations
{
/// <inheritdoc />
public partial class BlogPostModel : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "BlogPosts",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Title = table.Column<string>(type: "text", nullable: false),
Content = table.Column<string>(type: "text", nullable: false),
CreationTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
ModifiedTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
ContentSearchVector = table.Column<NpgsqlTsVector>(type: "tsvector", nullable: false)
.Annotation("Npgsql:TsVectorConfig", "english")
.Annotation("Npgsql:TsVectorProperties", new[] { "Content" }),
TitleSearchVector = table.Column<NpgsqlTsVector>(type: "tsvector", nullable: false)
.Annotation("Npgsql:TsVectorConfig", "english")
.Annotation("Npgsql:TsVectorProperties", new[] { "Title" }),
TagsSearchString = table.Column<string>(type: "text", nullable: false),
TagsSearchVector = table.Column<NpgsqlTsVector>(type: "tsvector", nullable: false)
.Annotation("Npgsql:TsVectorConfig", "english")
.Annotation("Npgsql:TsVectorProperties", new[] { "TagsSearchString" }),
AllSearchString = table.Column<string>(type: "text", nullable: false),
AllSearchVector = table.Column<NpgsqlTsVector>(type: "tsvector", nullable: false)
.Annotation("Npgsql:TsVectorConfig", "english")
.Annotation("Npgsql:TsVectorProperties", new[] { "AllSearchString" })
},
constraints: table =>
{
table.PrimaryKey("PK_BlogPosts", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ArtifactGroupingBlogPost",
columns: table => new
{
ArtifactGroupingsId = table.Column<int>(type: "integer", nullable: false),
BlogPostsId = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ArtifactGroupingBlogPost", x => new { x.ArtifactGroupingsId, x.BlogPostsId });
table.ForeignKey(
name: "FK_ArtifactGroupingBlogPost_ArtifactGroupings_ArtifactGrouping~",
column: x => x.ArtifactGroupingsId,
principalTable: "ArtifactGroupings",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ArtifactGroupingBlogPost_BlogPosts_BlogPostsId",
column: x => x.BlogPostsId,
principalTable: "BlogPosts",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "BlogPostTags",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "text", nullable: false),
BlogPostId = table.Column<int>(type: "integer", nullable: true),
BlogPostTagId = table.Column<int>(type: "integer", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_BlogPostTags", x => x.Id);
table.ForeignKey(
name: "FK_BlogPostTags_BlogPostTags_BlogPostTagId",
column: x => x.BlogPostTagId,
principalTable: "BlogPostTags",
principalColumn: "Id");
table.ForeignKey(
name: "FK_BlogPostTags_BlogPosts_BlogPostId",
column: x => x.BlogPostId,
principalTable: "BlogPosts",
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_ArtifactGroupingBlogPost_BlogPostsId",
table: "ArtifactGroupingBlogPost",
column: "BlogPostsId");
migrationBuilder.CreateIndex(
name: "IX_BlogPosts_AllSearchVector",
table: "BlogPosts",
column: "AllSearchVector")
.Annotation("Npgsql:IndexMethod", "GIN");
migrationBuilder.CreateIndex(
name: "IX_BlogPosts_ContentSearchVector",
table: "BlogPosts",
column: "ContentSearchVector")
.Annotation("Npgsql:IndexMethod", "GIN");
migrationBuilder.CreateIndex(
name: "IX_BlogPosts_TagsSearchVector",
table: "BlogPosts",
column: "TagsSearchVector")
.Annotation("Npgsql:IndexMethod", "GIN");
migrationBuilder.CreateIndex(
name: "IX_BlogPosts_TitleSearchVector",
table: "BlogPosts",
column: "TitleSearchVector")
.Annotation("Npgsql:IndexMethod", "GIN");
migrationBuilder.CreateIndex(
name: "IX_BlogPostTags_BlogPostId",
table: "BlogPostTags",
column: "BlogPostId");
migrationBuilder.CreateIndex(
name: "IX_BlogPostTags_BlogPostTagId",
table: "BlogPostTags",
column: "BlogPostTagId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ArtifactGroupingBlogPost");
migrationBuilder.DropTable(
name: "BlogPostTags");
migrationBuilder.DropTable(
name: "BlogPosts");
}
}
}

View File

@@ -84,6 +84,36 @@ namespace OpenArchival.DataAccess.Migrations
b.ToTable("ArtifactEntryListedName");
});
modelBuilder.Entity("ArtifactEntryTagSearchPageSliderEntry", b =>
{
b.Property<int>("FilterTagsId")
.HasColumnType("integer");
b.Property<int>("SearchPageSlidersId")
.HasColumnType("integer");
b.HasKey("FilterTagsId", "SearchPageSlidersId");
b.HasIndex("SearchPageSlidersId");
b.ToTable("ArtifactEntryTagSearchPageSliderEntry");
});
modelBuilder.Entity("ArtifactGroupingBlogPost", b =>
{
b.Property<int>("ArtifactGroupingsId")
.HasColumnType("integer");
b.Property<int>("BlogPostsId")
.HasColumnType("integer");
b.HasKey("ArtifactGroupingsId", "BlogPostsId");
b.HasIndex("BlogPostsId");
b.ToTable("ArtifactGroupingBlogPost");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
@@ -362,6 +392,9 @@ namespace OpenArchival.DataAccess.Migrations
b.PrimitiveCollection<List<string>>("Links")
.HasColumnType("text[]");
b.Property<int>("Quantity")
.HasColumnType("integer");
b.Property<int>("StorageLocationId")
.HasColumnType("integer");
@@ -547,6 +580,28 @@ namespace OpenArchival.DataAccess.Migrations
b.ToTable("ArtifactGroupings");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGroupingViewCount", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("ArtifactGroupingId")
.HasColumnType("integer");
b.Property<int>("Views")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ArtifactGroupingId")
.IsUnique();
b.ToTable("ArtifactGroupingViewCounts");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactStorageLocation", b =>
{
b.Property<int>("Id")
@@ -581,6 +636,85 @@ namespace OpenArchival.DataAccess.Migrations
b.ToTable("ArtifactTypes");
});
modelBuilder.Entity("OpenArchival.DataAccess.BlogPost", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("AllSearchString")
.IsRequired()
.HasColumnType("text");
b.Property<NpgsqlTsVector>("AllSearchVector")
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("tsvector")
.HasAnnotation("Npgsql:TsVectorConfig", "english")
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "AllSearchString" });
b.Property<string>("Content")
.IsRequired()
.HasColumnType("text");
b.Property<NpgsqlTsVector>("ContentSearchVector")
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("tsvector")
.HasAnnotation("Npgsql:TsVectorConfig", "english")
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "Content" });
b.Property<DateTime>("CreationTime")
.HasColumnType("timestamp with time zone");
b.Property<DateTime>("ModifiedTime")
.HasColumnType("timestamp with time zone");
b.Property<string>("TagsSearchString")
.IsRequired()
.HasColumnType("text");
b.Property<NpgsqlTsVector>("TagsSearchVector")
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("tsvector")
.HasAnnotation("Npgsql:TsVectorConfig", "english")
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "TagsSearchString" });
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.Property<NpgsqlTsVector>("TitleSearchVector")
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("tsvector")
.HasAnnotation("Npgsql:TsVectorConfig", "english")
.HasAnnotation("Npgsql:TsVectorProperties", new[] { "Title" });
b.HasKey("Id");
b.HasIndex("AllSearchVector");
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("AllSearchVector"), "GIN");
b.HasIndex("ContentSearchVector");
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("ContentSearchVector"), "GIN");
b.HasIndex("TagsSearchVector");
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("TagsSearchVector"), "GIN");
b.HasIndex("TitleSearchVector");
NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("TitleSearchVector"), "GIN");
b.ToTable("BlogPosts");
});
modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b =>
{
b.Property<int>("Id")
@@ -629,6 +763,57 @@ namespace OpenArchival.DataAccess.Migrations
b.ToTable("ArtifactAssociatedNames");
});
modelBuilder.Entity("OpenArchival.DataAccess.Models.BlogPostTag", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int?>("BlogPostId")
.HasColumnType("integer");
b.Property<int?>("BlogPostTagId")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("BlogPostId");
b.HasIndex("BlogPostTagId");
b.ToTable("BlogPostTags");
});
modelBuilder.Entity("OpenArchival.DataAccess.SearchPageSliderEntry", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<int>("MaxCount")
.HasColumnType("integer");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("SearchPageSliderEntries");
});
modelBuilder.Entity("ArtifactDefectArtifactEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntry", null)
@@ -689,6 +874,36 @@ namespace OpenArchival.DataAccess.Migrations
.IsRequired();
});
modelBuilder.Entity("ArtifactEntryTagSearchPageSliderEntry", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactEntryTag", null)
.WithMany()
.HasForeignKey("FilterTagsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.SearchPageSliderEntry", null)
.WithMany()
.HasForeignKey("SearchPageSlidersId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ArtifactGroupingBlogPost", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", null)
.WithMany()
.HasForeignKey("ArtifactGroupingsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("OpenArchival.DataAccess.BlogPost", null)
.WithMany()
.HasForeignKey("BlogPostsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
@@ -808,6 +1023,17 @@ namespace OpenArchival.DataAccess.Migrations
b.Navigation("Type");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactGroupingViewCount", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", "Grouping")
.WithOne("ViewCount")
.HasForeignKey("OpenArchival.DataAccess.ArtifactGroupingViewCount", "ArtifactGroupingId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Grouping");
});
modelBuilder.Entity("OpenArchival.DataAccess.FilePathListing", b =>
{
b.HasOne("OpenArchival.DataAccess.ArtifactGrouping", null)
@@ -822,6 +1048,17 @@ namespace OpenArchival.DataAccess.Migrations
b.Navigation("ParentArtifactEntry");
});
modelBuilder.Entity("OpenArchival.DataAccess.Models.BlogPostTag", b =>
{
b.HasOne("OpenArchival.DataAccess.BlogPost", null)
.WithMany("Tags")
.HasForeignKey("BlogPostId");
b.HasOne("OpenArchival.DataAccess.Models.BlogPostTag", null)
.WithMany("BlogPostTags")
.HasForeignKey("BlogPostTagId");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactEntry", b =>
{
b.Navigation("Files");
@@ -832,6 +1069,8 @@ namespace OpenArchival.DataAccess.Migrations
b.Navigation("ChildArtifactEntries");
b.Navigation("ChildFilePathListings");
b.Navigation("ViewCount");
});
modelBuilder.Entity("OpenArchival.DataAccess.ArtifactStorageLocation", b =>
@@ -843,6 +1082,16 @@ namespace OpenArchival.DataAccess.Migrations
{
b.Navigation("ArtifactEntries");
});
modelBuilder.Entity("OpenArchival.DataAccess.BlogPost", b =>
{
b.Navigation("Tags");
});
modelBuilder.Entity("OpenArchival.DataAccess.Models.BlogPostTag", b =>
{
b.Navigation("BlogPostTags");
});
#pragma warning restore 612, 618
}
}

View File

@@ -64,6 +64,11 @@ public class ArtifactEntry
public int ArtifactGroupingId { get; set; }
public required ArtifactGrouping ArtifactGrouping { get; set; }
/// <summary>
/// For keeping track of how many of this artifact are owned
/// </summary>
public int Quantity { get; set; }
public override string ToString()
{

View File

@@ -19,6 +19,7 @@ public class ArtifactEntryTag
public List<ArtifactEntry> ArtifactEntries { get; set; } = [];
public List<SearchPageSliderEntry> SearchPageSliders { get; set; } = [];
public override string ToString()
{
return Name;

View File

@@ -62,6 +62,13 @@ public class ArtifactGrouping
public required List<ArtifactEntry> ChildArtifactEntries { get; set; } = new();
public ArtifactGroupingViewCount? ViewCount { get; set; }
/// <summary>
/// The list of all blog posts about this grouping
/// </summary>
public List<BlogPost> BlogPosts { get; set; } = [];
public override string ToString()
{
var sb = new StringBuilder();

View File

@@ -0,0 +1,12 @@
namespace OpenArchival.DataAccess;
public class ArtifactGroupingViewCount
{
public int Id { get; set; }
public required ArtifactGrouping Grouping { get; set; }
public int ArtifactGroupingId { get; set; }
public int Views { get; set; }
}

View File

@@ -0,0 +1,39 @@
using NpgsqlTypes;
using System.ComponentModel.DataAnnotations;
namespace OpenArchival.DataAccess;
public class BlogPost
{
[Key]
public int Id { get; set; }
/// <summary>
/// The title of the blog post
/// </summary>
public string Title { get; set; } = "";
/// <summary>
/// The HTML content of the post
/// </summary>
public string Content { get; set; } = "";
public DateTime CreationTime { get; set; }
public DateTime ModifiedTime { get; set; }
public List<BlogPostTag> Tags { get; set; } = [];
public List<ArtifactGrouping> ArtifactGroupings { get; set; } = [];
public NpgsqlTsVector ContentSearchVector { get; set; } = default!;
public NpgsqlTsVector TitleSearchVector { get; set; } = default!;
public string TagsSearchString { get; set; } = "";
public NpgsqlTsVector TagsSearchVector { get; set; } = default!;
public string AllSearchString { get; set; } = "";
public NpgsqlTsVector AllSearchVector { get; set; } = default!;
}

View File

@@ -0,0 +1,24 @@
using System.ComponentModel.DataAnnotations;
namespace OpenArchival.DataAccess;
public class BlogPostTag
{
[Key]
public int Id { get; set; }
/// <summary>
/// The name of this tags
/// </summary>
public string Name { get; set; } = "";
/// <summary>
/// Blog posts assocaited with this tag
/// </summary>
public List<BlogPostTag> BlogPostTags { get; set; } = [];
public override string ToString()
{
return Name;
}
}

View File

@@ -0,0 +1,26 @@
using System.ComponentModel.DataAnnotations;
namespace OpenArchival.DataAccess;
/// <summary>
/// Used to display sliders of featured artifacts on the search page before a search is entered.
/// </summary>
public class SearchPageSliderEntry
{
[Key]
public int Id { get; set; }
public string Title { get; set; } = "";
public string Description { get; set; } = "";
/// <summary>
/// The tags used to find artifacts for the slider
/// </summary>
public List<ArtifactEntryTag> FilterTags { get; set; } = [];
/// <summary>
/// The maximum number of artifact entries that should be pulled for this slider
/// </summary>
public int MaxCount { get; set; } = 10;
}

View File

@@ -35,6 +35,7 @@ public class ArtifactGroupingProvider : IArtifactGroupingProvider
.ThenInclude(e => e.ListedNames)
.Include(g => g.ChildArtifactEntries)
.ThenInclude(e => e.Defects)
.Include(g => g.ViewCount)
.Where(g => g.Id == id)
.FirstOrDefaultAsync();
}
@@ -258,7 +259,6 @@ public class ArtifactGroupingProvider : IArtifactGroupingProvider
if (existingGrouping == null)
{
// The grouping does not exist. You may want to throw an exception or handle this case.
return;
}
@@ -324,6 +324,7 @@ public class ArtifactGroupingProvider : IArtifactGroupingProvider
existingEntry.AssociatedDates = updatedEntry.AssociatedDates;
existingEntry.FileTextContent = updatedEntry.FileTextContent;
existingEntry.Files = updatedEntry.Files;
existingEntry.Quantity = updatedEntry.Quantity;
// The relations on updatedEntry are already de-duplicated, so just assign them.
existingEntry.StorageLocation = updatedEntry.StorageLocation;

View File

@@ -15,7 +15,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("OpenArchival.DataAccess")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+5a5038296c6394acc02e12422dfad4d5d4ce60dc")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+0e24ce207395fb1c32a87d10049c1d81dc4784fe")]
[assembly: System.Reflection.AssemblyProductAttribute("OpenArchival.DataAccess")]
[assembly: System.Reflection.AssemblyTitleAttribute("OpenArchival.DataAccess")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@@ -1 +1 @@
3f99571895e9c7a4faa243c03b7c5e8c835e8004b292021dbf1b65d9a0ea1412
3f63cb108adc17bfa27d0622bbf15d2937e58fed8f86008fc1461833055c58d3

View File

@@ -1 +1 @@
b91d184d6f7942ee86930fd67b2b3ac3f498001fb262c9385b4b3ac87ec4aa40
11dc38805417dc3f89c6608bce90685224cf6a7b9f5c762daaabf19b37910e67

View File

@@ -145,10 +145,10 @@ C:\Users\vtall\source\repos\vtallen\Open-Archival\OpenArchival.DataAccess\obj\De
C:\Users\vtall\source\repos\vtallen\Open-Archival\OpenArchival.DataAccess\obj\Debug\net9.0\staticwebassets.build.json.cache
C:\Users\vtall\source\repos\vtallen\Open-Archival\OpenArchival.DataAccess\obj\Debug\net9.0\staticwebassets.development.json
C:\Users\vtall\source\repos\vtallen\Open-Archival\OpenArchival.DataAccess\obj\Debug\net9.0\staticwebassets.build.endpoints.json
C:\Users\vtall\source\repos\vtallen\Open-Archival\OpenArchival.DataAccess\obj\Debug\net9.0\staticwebassets.upToDateCheck.txt
C:\Users\vtall\source\repos\vtallen\Open-Archival\OpenArchival.DataAccess\obj\Debug\net9.0\OpenArch.D40B5A94.Up2Date
C:\Users\vtall\source\repos\vtallen\Open-Archival\OpenArchival.DataAccess\obj\Debug\net9.0\OpenArchival.DataAccess.dll
C:\Users\vtall\source\repos\vtallen\Open-Archival\OpenArchival.DataAccess\obj\Debug\net9.0\refint\OpenArchival.DataAccess.dll
C:\Users\vtall\source\repos\vtallen\Open-Archival\OpenArchival.DataAccess\obj\Debug\net9.0\OpenArchival.DataAccess.pdb
C:\Users\vtall\source\repos\vtallen\Open-Archival\OpenArchival.DataAccess\obj\Debug\net9.0\OpenArchival.DataAccess.genruntimeconfig.cache
C:\Users\vtall\source\repos\vtallen\Open-Archival\OpenArchival.DataAccess\obj\Debug\net9.0\ref\OpenArchival.DataAccess.dll
C:\Users\vtall\source\repos\vtallen\Open-Archival\OpenArchival.DataAccess\obj\Debug\net9.0\staticwebassets.upToDateCheck.txt

View File

@@ -1 +1 @@
{"documents":{"C:\\Users\\vtall\\source\\repos\\vtallen\\Open-Archival\\*":"https://raw.githubusercontent.com/vtallen/Open-Archival/5a5038296c6394acc02e12422dfad4d5d4ce60dc/*"}}
{"documents":{"C:\\Users\\vtall\\source\\repos\\vtallen\\Open-Archival\\*":"https://raw.githubusercontent.com/vtallen/Open-Archival/0e24ce207395fb1c32a87d10049c1d81dc4784fe/*"}}

View File

@@ -1 +1 @@
{"GlobalPropertiesHash":"vveeLoVRblwaOOqBmVqvQ4HG2rSqMixgk7cSXmvYrIw=","FingerprintPatternsHash":"8ZRc1sGeVrPBx4lD717BgRaQekyh78QKV9SKsdt638U=","PropertyOverridesHash":"8ZRc1sGeVrPBx4lD717BgRaQekyh78QKV9SKsdt638U=","InputHashes":["qgBHL5R0mKXCiq65NnDep\u002B28SIMEandMOx72nKFCKds=","CFcBWGOCg2CGlH8Oj1fZ3/w1ogRq/hhCDREdOMIEOHQ=","Hr\u002BB4WdW5mUpJzexRlKmP0C1QEmXneDFbO2G0grhu4w=","VbxE6SYbM1pJW04yq\u002Bfq4M8OBlK1C2/Axp7HGmyEC6E=","1gUQG\u002Bt5PW3tkLIRs50/EVx2cV84/P7kxwGNzQl3fNc="],"CachedAssets":{},"CachedCopyCandidates":{}}
{"GlobalPropertiesHash":"vveeLoVRblwaOOqBmVqvQ4HG2rSqMixgk7cSXmvYrIw=","FingerprintPatternsHash":"8ZRc1sGeVrPBx4lD717BgRaQekyh78QKV9SKsdt638U=","PropertyOverridesHash":"8ZRc1sGeVrPBx4lD717BgRaQekyh78QKV9SKsdt638U=","InputHashes":["qgBHL5R0mKXCiq65NnDep\u002B28SIMEandMOx72nKFCKds=","CFcBWGOCg2CGlH8Oj1fZ3/w1ogRq/hhCDREdOMIEOHQ=","Hr\u002BB4WdW5mUpJzexRlKmP0C1QEmXneDFbO2G0grhu4w=","VbxE6SYbM1pJW04yq\u002Bfq4M8OBlK1C2/Axp7HGmyEC6E=","3CYls0lW78ZWU7\u002B\u002BhcuHLrhzWPjkpzBO4vSiJszmFxE="],"CachedAssets":{},"CachedCopyCandidates":{}}

View File

@@ -1 +1 @@
{"GlobalPropertiesHash":"BfdHfTJ1ZLXND4Gm4lkRtokO7tG9qdxvlfpLGsYryFY=","FingerprintPatternsHash":"8ZRc1sGeVrPBx4lD717BgRaQekyh78QKV9SKsdt638U=","PropertyOverridesHash":"8ZRc1sGeVrPBx4lD717BgRaQekyh78QKV9SKsdt638U=","InputHashes":["qgBHL5R0mKXCiq65NnDep\u002B28SIMEandMOx72nKFCKds=","CFcBWGOCg2CGlH8Oj1fZ3/w1ogRq/hhCDREdOMIEOHQ=","Hr\u002BB4WdW5mUpJzexRlKmP0C1QEmXneDFbO2G0grhu4w=","VbxE6SYbM1pJW04yq\u002Bfq4M8OBlK1C2/Axp7HGmyEC6E=","1gUQG\u002Bt5PW3tkLIRs50/EVx2cV84/P7kxwGNzQl3fNc="],"CachedAssets":{},"CachedCopyCandidates":{}}
{"GlobalPropertiesHash":"BfdHfTJ1ZLXND4Gm4lkRtokO7tG9qdxvlfpLGsYryFY=","FingerprintPatternsHash":"8ZRc1sGeVrPBx4lD717BgRaQekyh78QKV9SKsdt638U=","PropertyOverridesHash":"8ZRc1sGeVrPBx4lD717BgRaQekyh78QKV9SKsdt638U=","InputHashes":["qgBHL5R0mKXCiq65NnDep\u002B28SIMEandMOx72nKFCKds=","CFcBWGOCg2CGlH8Oj1fZ3/w1ogRq/hhCDREdOMIEOHQ=","Hr\u002BB4WdW5mUpJzexRlKmP0C1QEmXneDFbO2G0grhu4w=","VbxE6SYbM1pJW04yq\u002Bfq4M8OBlK1C2/Axp7HGmyEC6E=","3CYls0lW78ZWU7\u002B\u002BhcuHLrhzWPjkpzBO4vSiJszmFxE="],"CachedAssets":{},"CachedCopyCandidates":{}}

View File

@@ -15,7 +15,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("OpenArchival.DataAccess")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+5a5038296c6394acc02e12422dfad4d5d4ce60dc")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+0e24ce207395fb1c32a87d10049c1d81dc4784fe")]
[assembly: System.Reflection.AssemblyProductAttribute("OpenArchival.DataAccess")]
[assembly: System.Reflection.AssemblyTitleAttribute("OpenArchival.DataAccess")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@@ -1 +1 @@
85c0296fbb5c9f5ca57451e47bd81d3cbfaead97bf6d015e2a4db5e72cce19a1
ea2650fc565e6528cef7709cd3672d874e774c89ca5c7f50512bec882c4099c1