WIP page leaf
This commit is contained in:
25
src/isnd/Data/Packages/Catalog/CatalogIndex.cs
Normal file
25
src/isnd/Data/Packages/Catalog/CatalogIndex.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using isnd.Interfaces;
|
||||
|
||||
namespace isnd.Data.Packages.Catalog
|
||||
{
|
||||
public class CatalogIndex : IObject
|
||||
{
|
||||
[JsonProperty("@id")]
|
||||
public string Id { get; set ; }
|
||||
|
||||
[JsonProperty("items")]
|
||||
public List<PageRef> Items { get; set; }
|
||||
|
||||
|
||||
[JsonProperty("count")]
|
||||
public int Count { get => Items?.Count ?? 0; }
|
||||
public string CommitId { get; set; }
|
||||
public DateTime CommitTimeStamp { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
30
src/isnd/Data/Packages/Catalog/CatalogLeaf.cs
Normal file
30
src/isnd/Data/Packages/Catalog/CatalogLeaf.cs
Normal file
@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using isnd.Interfaces;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace isnd.Data.Packages.Catalog
|
||||
{
|
||||
public class CatalogLeaf : IObject
|
||||
{
|
||||
|
||||
[JsonProperty("@type")]
|
||||
public string[] RefType { get; set; }
|
||||
|
||||
[JsonProperty("commitId")]
|
||||
public string CommitId { get; set; }
|
||||
|
||||
[JsonProperty("commitTimeStamp")]
|
||||
public DateTime CommitTimeStamp { get; set; }
|
||||
|
||||
[JsonProperty("published")]
|
||||
public DateTime Published { get; set; }
|
||||
|
||||
[JsonProperty("id")]
|
||||
public string Id { get; set; }
|
||||
|
||||
[JsonProperty("version")]
|
||||
public string Version { get; set; }
|
||||
|
||||
}
|
||||
}
|
14
src/isnd/Data/Packages/Catalog/IObject.cs
Normal file
14
src/isnd/Data/Packages/Catalog/IObject.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace isnd.Interfaces
|
||||
{
|
||||
public interface IObject
|
||||
{
|
||||
[JsonProperty("commitId")]
|
||||
string CommitId { get; }
|
||||
|
||||
[JsonProperty("commitTimeStamp")]
|
||||
DateTime CommitTimeStamp { get; }
|
||||
}
|
||||
}
|
7
src/isnd/Data/Packages/Catalog/PackageDetail.cs
Normal file
7
src/isnd/Data/Packages/Catalog/PackageDetail.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace isnd.Data.Packages.Catalog
|
||||
{
|
||||
public class PackageDetail : CatalogLeaf
|
||||
{
|
||||
|
||||
}
|
||||
}
|
52
src/isnd/Data/Packages/Catalog/PackageRef.cs
Normal file
52
src/isnd/Data/Packages/Catalog/PackageRef.cs
Normal file
@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using isnd.Interfaces;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace isnd.Data.Packages.Catalog
|
||||
{
|
||||
/// <summary>
|
||||
/// An presence of package in a catalog,
|
||||
/// for availability, or deletion,
|
||||
///
|
||||
/// </summary>
|
||||
public class PackageRef : IObject
|
||||
{
|
||||
|
||||
|
||||
[JsonProperty("@id")]
|
||||
public string RefId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Reference type :
|
||||
/// nuget:PackageDetails vs nuget:PackageDelete
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonProperty("@type")]
|
||||
public string RefType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The NuGet Id
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonProperty("nuget:id")]
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The NuGet version
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
|
||||
[JsonProperty("nuget:version")]
|
||||
public string Version { get; set; }
|
||||
|
||||
[JsonProperty("commitId")]
|
||||
public string CommitId { get; set; }
|
||||
|
||||
[ForeignKey("CommitId"), JsonIgnore]
|
||||
public virtual Commit LastCommit { get; set; }
|
||||
|
||||
[JsonProperty("commitTimeStamp")]
|
||||
public DateTime CommitTimeStamp { get; set; }
|
||||
}
|
||||
}
|
21
src/isnd/Data/Packages/Catalog/Page.cs
Normal file
21
src/isnd/Data/Packages/Catalog/Page.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using isnd.Interfaces;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace isnd.Data.Packages.Catalog
|
||||
{
|
||||
public class Page : IObject
|
||||
{
|
||||
[JsonProperty("@id")]
|
||||
public string Id { get; set; }
|
||||
|
||||
[JsonProperty("parent")]
|
||||
public string Parent { get; set; }
|
||||
|
||||
[JsonProperty("items")]
|
||||
public virtual List<PackageRef> Items { get; set; }
|
||||
public string CommitId { get; set; }
|
||||
public DateTime CommitTimeStamp { get; set; }
|
||||
}
|
||||
}
|
39
src/isnd/Data/Packages/Commit.cs
Normal file
39
src/isnd/Data/Packages/Commit.cs
Normal file
@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Newtonsoft.Json;
|
||||
using isnd.Interfaces;
|
||||
|
||||
namespace isnd.Data.Packages
|
||||
{
|
||||
public enum PackageAction
|
||||
{
|
||||
DeletePackage,
|
||||
PublishPackage
|
||||
}
|
||||
|
||||
public class Commit : IObject
|
||||
{
|
||||
[Key,
|
||||
DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
[JsonIgnore]
|
||||
public long Id { get; set; }
|
||||
|
||||
[Required][JsonIgnore]
|
||||
public DateTime TimeStamp{ get; set; }
|
||||
|
||||
[Required]
|
||||
public PackageAction Action { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string CommitId { get => Id.ToString(); }
|
||||
|
||||
[NotMapped]
|
||||
public DateTime CommitTimeStamp { get => TimeStamp; }
|
||||
|
||||
[ForeignKey("CommitNId")]
|
||||
|
||||
public virtual List<PackageVersion> Versions { get; set; }
|
||||
}
|
||||
}
|
48
src/isnd/Data/Packages/Package.cs
Normal file
48
src/isnd/Data/Packages/Package.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using isnd.Interfaces;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace isnd.Data.Packages
|
||||
{
|
||||
public class Package : IObject
|
||||
{
|
||||
[Key][Required]
|
||||
[StringLength(1024)]
|
||||
public string Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[ForeignKey("Owner")]
|
||||
public string OwnerId { get; set; }
|
||||
|
||||
[StringLength(1024)]
|
||||
public string Description { get; set; }
|
||||
|
||||
public bool Public { get ; set;}
|
||||
|
||||
[JsonIgnore]
|
||||
virtual public ApplicationUser Owner { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
|
||||
public virtual List<PackageVersion> Versions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Latest version at put, posted,
|
||||
/// or even deletion when no more active version.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[Required][JsonIgnore]
|
||||
public long CommitNId { get; set ; }
|
||||
|
||||
[NotMapped]
|
||||
public string CommitId { get => CommitNId.ToString(); }
|
||||
|
||||
[ForeignKey("CommitNId")]
|
||||
|
||||
public virtual Commit LatestVersion{ get; set; }
|
||||
public DateTime CommitTimeStamp { get; set; }
|
||||
}
|
||||
}
|
52
src/isnd/Data/Packages/PackageVersion.cs
Normal file
52
src/isnd/Data/Packages/PackageVersion.cs
Normal file
@ -0,0 +1,52 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using isn.abst;
|
||||
using isnd.Data.Packages;
|
||||
using isnd.Data.Packages.Catalog;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace isnd.Data
|
||||
{
|
||||
public class PackageVersion
|
||||
{
|
||||
[Required]
|
||||
[ForeignKey("Package")]
|
||||
[StringLength(1024)]
|
||||
public string PackageId { get; set; }
|
||||
|
||||
[Required]
|
||||
public int Major { get; set; }
|
||||
|
||||
[Required]
|
||||
public int Minor { get; set; }
|
||||
|
||||
[Required]
|
||||
public int Patch { get; set; }
|
||||
|
||||
[StringLength(256)]
|
||||
[Required][Key]
|
||||
public string FullString { get; set; }
|
||||
public bool IsPrerelease { get; set; }
|
||||
|
||||
[StringLength(256)]
|
||||
public string Type { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual Package Package { get; set; }
|
||||
|
||||
[Required][JsonIgnore]
|
||||
[ForeignKey("LatestCommit")]
|
||||
public long CommitNId { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
|
||||
public string CommitId { get => CommitNId.ToString(); }
|
||||
|
||||
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}."
|
||||
+ Constants.SpecFileEstension;
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user