Fixed bug where deletes of artifact groupings would not cascade
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text;
|
||||
using NpgsqlTypes;
|
||||
using Persic;
|
||||
|
||||
namespace OpenArchival.DataAccess;
|
||||
|
||||
@@ -11,22 +9,22 @@ public class ArtifactEntry
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// This value gets appended on the end of the contianing ArtifactGrouping's
|
||||
/// Category value
|
||||
/// </summary>
|
||||
public string? ArtifactIdentifier
|
||||
public string? ArtifactIdentifier
|
||||
{
|
||||
get
|
||||
{
|
||||
return (ArtifactGrouping is not null)
|
||||
? ModelHelpers.MakeIdentifier(ArtifactGrouping.IdentifierFields.Values, ArtifactGrouping.Category.FieldSeparator, ArtifactNumber)
|
||||
return (ArtifactGrouping is not null)
|
||||
? ModelHelpers.MakeIdentifier(ArtifactGrouping.IdentifierFields.Values, ArtifactGrouping.Category.FieldSeparator, ArtifactNumber)
|
||||
: null;
|
||||
}
|
||||
}
|
||||
|
||||
public string? ArtifactNumber { get; set; }
|
||||
public string? ArtifactNumber { get; set; }
|
||||
|
||||
public required string Title { get; set; }
|
||||
|
||||
@@ -45,7 +43,7 @@ public class ArtifactEntry
|
||||
public List<ArtifactDefect>? Defects { get; set; } = [];
|
||||
|
||||
public List<string>? Links { get; set; } = [];
|
||||
|
||||
|
||||
public required List<FilePathListing> Files { get; set; } = [];
|
||||
|
||||
public string? FileTextContent { get; set; } = null;
|
||||
@@ -54,6 +52,8 @@ public class ArtifactEntry
|
||||
|
||||
public bool IsPubliclyVisible { get; set; }
|
||||
|
||||
public int Quantity { get; set; }
|
||||
|
||||
|
||||
// Relationships this artifact has TO other artifacts
|
||||
public List<ArtifactEntry> RelatedTo { get; set; } = [];
|
||||
@@ -61,14 +61,10 @@ public class ArtifactEntry
|
||||
// Relationships other artifacts have TO this artifact
|
||||
public List<ArtifactEntry> RelatedBy { get; set; } = [];
|
||||
|
||||
|
||||
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()
|
||||
{
|
||||
|
||||
@@ -21,6 +21,7 @@ public class ArtifactGrouping
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public List<FilePathListing> ChildFilePathListings
|
||||
{
|
||||
get
|
||||
|
||||
@@ -7,12 +7,12 @@ 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>
|
||||
@@ -24,6 +24,10 @@ public class BlogPost
|
||||
|
||||
public List<BlogPostTag> Tags { get; set; } = [];
|
||||
|
||||
public BlogPostViewCount Views { get; set; } = default!;
|
||||
|
||||
public FilePathListing MainPhoto { get; set; } = default!;
|
||||
|
||||
public List<ArtifactGrouping> ArtifactGroupings { get; set; } = [];
|
||||
|
||||
public NpgsqlTsVector ContentSearchVector { get; set; } = default!;
|
||||
|
||||
@@ -15,7 +15,7 @@ public class BlogPostTag
|
||||
/// <summary>
|
||||
/// Blog posts assocaited with this tag
|
||||
/// </summary>
|
||||
public List<BlogPostTag> BlogPostTags { get; set; } = [];
|
||||
public List<BlogPost> BlogPosts { get; set; } = [];
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
|
||||
12
OpenArchival.DataAccess/Models/Blog/BlogViewCount.cs
Normal file
12
OpenArchival.DataAccess/Models/Blog/BlogViewCount.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace OpenArchival.DataAccess;
|
||||
|
||||
public class BlogPostViewCount
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public required BlogPost Post { get; set; }
|
||||
|
||||
public int BlogPostId { get; set; }
|
||||
|
||||
public int Views { get; set; }
|
||||
}
|
||||
@@ -9,8 +9,14 @@ public class FilePathListing
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
|
||||
public int? ParentArtifactEntryId { get; set; }
|
||||
|
||||
public ArtifactEntry? ParentArtifactEntry { get; set; }
|
||||
|
||||
public BlogPost? ParentBlogPost { get; set; }
|
||||
|
||||
public int? ParentBlogPostId { get; set; }
|
||||
|
||||
public required string OriginalName { get; set; }
|
||||
|
||||
public required string Path { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user