WIP reg page
This commit is contained in:
parent
14206ac477
commit
fececb327e
36 changed files with 264 additions and 211 deletions
|
|
@ -9,7 +9,7 @@ namespace isnd.Data.Catalog
|
|||
/// The URL to the document used to produce this object
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[Key][Required]
|
||||
[Key][Required,JsonRequired]
|
||||
[StringLength(1024)]
|
||||
[JsonProperty("@id")]
|
||||
public string Id { get; set; }
|
||||
|
|
@ -70,7 +70,7 @@ namespace isnd.Data.Catalog
|
|||
/// The full version string after normalization
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[Required]
|
||||
[Required,JsonRequired]
|
||||
public string version { get; set; } // string yes
|
||||
/// <summary>
|
||||
/// The security vulnerabilities of the package
|
||||
|
|
|
|||
|
|
@ -2,14 +2,11 @@ using Newtonsoft.Json;
|
|||
|
||||
namespace isnd.Data.Catalog
|
||||
{
|
||||
public class PackageRegistrationIndexViewModel
|
||||
public class PackageRegistrationIndexQuery : RegistrationPageIndex
|
||||
{
|
||||
[JsonProperty("prerelease")]
|
||||
public bool Prerelease { get; set; }
|
||||
|
||||
[JsonProperty("data")]
|
||||
public RegistrationLeaf[] Data {get; set;}
|
||||
|
||||
[JsonProperty("query")]
|
||||
public string Query { get; set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ namespace isnd.Data.Catalog
|
|||
|
||||
[JsonProperty("commitTimeStamp")]
|
||||
public DateTime CommitTimeStamp { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
51
src/isnd/Data/Catalog/RegistrationPage.cs
Normal file
51
src/isnd/Data/Catalog/RegistrationPage.cs
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
using System;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace isnd.Data.Catalog
|
||||
{
|
||||
public class RegistrationPage
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// The URL to the registration page
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonProperty("@id"), JsonRequired]
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The number of registration leaves in the page
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonProperty("count"), JsonRequired]
|
||||
public int Count { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// no The array of registration leaves and their associate metadata
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonProperty("items")]
|
||||
|
||||
public RegistrationLeaf[] Items { get; set; }
|
||||
/// <summary>
|
||||
/// The highest SemVer 2.0.0 version in the page (inclusive)
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonProperty("upper"), JsonRequired]
|
||||
public Version Upper { get; set; }
|
||||
/// <summary>
|
||||
/// The lowest SemVer 2.0.0 version in the page (inclusive)
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonProperty("lower"), JsonRequired]
|
||||
public Version Lower { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The URL to the registration index
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonProperty("parent")]
|
||||
public string Parent { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
13
src/isnd/Data/Catalog/RegistrationPageIndex.cs
Normal file
13
src/isnd/Data/Catalog/RegistrationPageIndex.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
using Newtonsoft.Json;
|
||||
|
||||
namespace isnd.Data.Catalog
|
||||
{
|
||||
public class RegistrationPageIndex
|
||||
{
|
||||
[JsonProperty("count")]
|
||||
public int Count { get => Items?.Length ?? 0; }
|
||||
|
||||
[JsonProperty("items")]
|
||||
public RegistrationPage[] Items { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
using System;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace isnd.Data.Catalog
|
||||
{
|
||||
public class RegistrationPage
|
||||
{
|
||||
/*
|
||||
@id string yes The URL to the registration page
|
||||
count integer yes The number of registration leaves in the page
|
||||
items array of objects no The array of registration leaves and their associate metadata
|
||||
lower string yes The lowest SemVer 2.0.0 version in the page (inclusive)
|
||||
parent string no The URL to the registration index
|
||||
upper string yes The highest SemVer 2.0.0 version in the page (inclusive) */
|
||||
[JsonProperty("@id")]
|
||||
public string Id { get; set; }
|
||||
[JsonProperty("count")]
|
||||
public int Count { get; set; }
|
||||
|
||||
[JsonProperty("items")]
|
||||
|
||||
public RegistrationLeaf[] Items { get; set; }
|
||||
|
||||
[JsonProperty("upper")]
|
||||
public Version Upper { get; set; }
|
||||
|
||||
[JsonProperty("lower")]
|
||||
public Version Lower { get; set; }
|
||||
|
||||
[JsonProperty("parent")]
|
||||
public string Parent { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -46,17 +46,22 @@ namespace isnd.Data.Packages
|
|||
|
||||
public virtual Commit LatestVersion{ get; set; }
|
||||
public DateTime CommitTimeStamp { get; set; }
|
||||
|
||||
internal RegistrationLeaf ToLeave()
|
||||
/// <summary>
|
||||
/// Returns the leaf
|
||||
/// </summary>
|
||||
/// <param name="bid">base url tu use for building the id property</param>
|
||||
/// <returns></returns>
|
||||
internal RegistrationLeaf ToLeave(string bid)
|
||||
{
|
||||
if (!(Versions != null &&
|
||||
Versions.Count > 0)) throw new Exception("NO VERSION");
|
||||
if (Versions.Count == 0) throw new Exception("NO VERSION");
|
||||
var v = Versions.First();
|
||||
RegistrationLeaf leave = new RegistrationLeaf
|
||||
{
|
||||
Id = bid + Id + ".json",
|
||||
PackageContent = v.NugetLink,
|
||||
Entry = new CatalogEntry
|
||||
{
|
||||
Id = bid + Id + ".json",
|
||||
idp = Id,
|
||||
version = v.FullString,
|
||||
authors = $"{Owner.FullName} <${Owner.Email}>"
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ namespace isnd.Data
|
|||
|
||||
public string CommitId { get => CommitNId.ToString(); }
|
||||
|
||||
public virtual Commit LatestCommit{ get; set; }
|
||||
public virtual Commit LatestCommit {get; set; }
|
||||
public string NugetLink => $"/{Constants.PaquetFileEstension}/{PackageId}/{FullString}/{PackageId}-{FullString}."
|
||||
+ Constants.PaquetFileEstension;
|
||||
public string NuspecLink => $"/{Constants.SpecFileEstension}/{PackageId}/{FullString}/{PackageId}-{FullString}."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue