Catalog
This commit is contained in:
parent
504f431937
commit
cdb9a26d2c
16 changed files with 301 additions and 59 deletions
|
|
@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
using isnd.Data;
|
||||
using isnd.Data.ApiKeys;
|
||||
using isnd.Data.Catalog;
|
||||
|
||||
namespace isnd.Data
|
||||
{
|
||||
|
|
@ -28,5 +29,6 @@ namespace isnd.Data
|
|||
public DbSet<ApiKey> ApiKeys { get; set; }
|
||||
public DbSet<Package> Packages { get; set; }
|
||||
public DbSet<PackageVersion> PackageVersions { get; set; }
|
||||
public DbSet<Commit> Commits { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
24
src/isnd/Data/Catalog/CatalogIndex.cs
Normal file
24
src/isnd/Data/Catalog/CatalogIndex.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace isnd.Data.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; }
|
||||
public string CommitId { get; set; }
|
||||
public DateTime CommitTimeStamp { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
32
src/isnd/Data/Catalog/Commit.cs
Normal file
32
src/isnd/Data/Catalog/Commit.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace isnd.Data.Catalog
|
||||
{
|
||||
public enum PackageAction
|
||||
{
|
||||
DeletePackage,
|
||||
PublishPackage
|
||||
}
|
||||
|
||||
public class Commit : IObject
|
||||
{
|
||||
[Key][Required,DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public long Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public DateTime TimeStamp{ get; set; }
|
||||
|
||||
[Required]
|
||||
public PackageAction Action { get; set; }
|
||||
|
||||
[Required]
|
||||
public string PackageId { get; set; }
|
||||
[ForeignKey("PackageId")]
|
||||
|
||||
public virtual Package Package{ get; set; }
|
||||
public string CommitId { get => Id.ToString(); }
|
||||
public DateTime CommitTimeStamp { get => TimeStamp; }
|
||||
}
|
||||
}
|
||||
14
src/isnd/Data/Catalog/IObject.cs
Normal file
14
src/isnd/Data/Catalog/IObject.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
using System;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace isnd.Data.Catalog
|
||||
{
|
||||
public interface IObject
|
||||
{
|
||||
[JsonProperty("commitId")]
|
||||
string CommitId { get; }
|
||||
|
||||
[JsonProperty("commitTimeStamp")]
|
||||
DateTime CommitTimeStamp { get; }
|
||||
}
|
||||
}
|
||||
34
src/isnd/Data/Catalog/PackageRef.cs
Normal file
34
src/isnd/Data/Catalog/PackageRef.cs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace isnd.Data.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; }
|
||||
|
||||
[JsonProperty("nuget:id")]
|
||||
public string Id { get; set; }
|
||||
|
||||
[JsonProperty("nuget:version")]
|
||||
public string Version { get; set; }
|
||||
public string CommitId { get; set; }
|
||||
public DateTime CommitTimeStamp { get; set; }
|
||||
}
|
||||
}
|
||||
20
src/isnd/Data/Catalog/Page.cs
Normal file
20
src/isnd/Data/Catalog/Page.cs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace isnd.Data.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; }
|
||||
}
|
||||
}
|
||||
26
src/isnd/Data/Catalog/PageRef.cs
Normal file
26
src/isnd/Data/Catalog/PageRef.cs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
using System;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace isnd.Data.Catalog
|
||||
{
|
||||
public class PageRef : IObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Page Url
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonProperty("@id")]
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Page entry count
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonProperty("count")]
|
||||
public int Count { get; set; }
|
||||
public string CommitId { get; set; }
|
||||
public DateTime CommitTimeStamp { get; set; }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,11 +1,13 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using isnd.Data.Catalog;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace isnd.Data
|
||||
{
|
||||
public class Package
|
||||
public class Package : IObject
|
||||
{
|
||||
[Key][Required]
|
||||
public string Id { get; set; }
|
||||
|
|
@ -17,11 +19,15 @@ namespace isnd.Data
|
|||
[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; }
|
||||
public string CommitId { get; set; }
|
||||
public DateTime CommitTimeStamp { get; set; }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue