Got the new ui flow working and the models updated. Need to get changes written to the database.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
using OpenArchival.Core;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using OpenArchival.DataAccess;
|
||||
|
||||
namespace OpenArchival.Blazor;
|
||||
|
||||
@@ -34,19 +34,4 @@ public class ArchiveItemValidationModel
|
||||
|
||||
public bool IsPublic { get; set; } = true;
|
||||
|
||||
public ArchiveItem ToArchiveItem(Category category)
|
||||
{
|
||||
return new ArchiveItem() {
|
||||
ArtifactType = ArtifactType,
|
||||
Category = category,
|
||||
Defects = Defects,
|
||||
Description = Description,
|
||||
AssociatedDates = AssociatedDates,
|
||||
ItemTitle = Title,
|
||||
ListedNames = AssociatedNames,
|
||||
StorageLocation = StorageLocation,
|
||||
Tags = Tags,
|
||||
IsPublic = IsPublic
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
namespace OpenArchival.Blazor;
|
||||
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using OpenArchival.DataAccess;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
public class ArtifactEntryValidationModel : IValidatableObject
|
||||
{
|
||||
[Required(AllowEmptyStrings = false, ErrorMessage = "An artifact numbering must be supplied")]
|
||||
public string? ArtifactNumber { get; set; }
|
||||
|
||||
[Required(AllowEmptyStrings = false, ErrorMessage = "A title must be provided")]
|
||||
public required string Title { get; set; }
|
||||
|
||||
public string? Description { get; set; }
|
||||
|
||||
public string? Type { get; set; }
|
||||
|
||||
public required string? StorageLocation { get; set; }
|
||||
|
||||
public List<string>? Tags { get; set; } = [];
|
||||
|
||||
public List<string>? ListedNames { get; set; } = [];
|
||||
|
||||
public List<DateTime>? AssociatedDates { get; set; } = [];
|
||||
|
||||
public List<string>? Defects { get; set; } = [];
|
||||
|
||||
public List<string>? Links { get; set; } = [];
|
||||
|
||||
public string? ArtifactType { get; set; }
|
||||
|
||||
public List<FilePathListing>? Files { get; set; } = [];
|
||||
|
||||
public Dictionary<string, string>? FileTextContent { get; set; } = [];
|
||||
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext context)
|
||||
{
|
||||
if (Links.IsNullOrEmpty() && Files.IsNullOrEmpty())
|
||||
{
|
||||
yield return new ValidationResult(
|
||||
"Either uploaded files or add content links",
|
||||
new[] {nameof(Links), nameof(Files)}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsPublicallyVisible { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using OpenArchival.DataAccess;
|
||||
|
||||
namespace OpenArchival.Blazor;
|
||||
|
||||
public class ArtifactGroupingValidationModel
|
||||
{
|
||||
public required ArchiveCategory Category { get; set; }
|
||||
|
||||
public List<string>? IdentifierFieldValues { get; set; }
|
||||
|
||||
public List<ArtifactEntryValidationModel>? ArtifactEntries { get; set; }
|
||||
|
||||
public bool IsPublicallyVisible { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user