catalog impl

This commit is contained in:
2022-08-20 12:54:24 +01:00
parent fa9a12ad49
commit 14206ac477
27 changed files with 320 additions and 44 deletions

View File

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using isnd.Interfaces;
using isnd.Data.Catalog;
namespace isnd.Data.Packages.Catalog
{

View File

@ -2,6 +2,8 @@ using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using isnd.Data.Catalog;
using isnd.Interfaces;
using Newtonsoft.Json;
@ -44,5 +46,23 @@ namespace isnd.Data.Packages
public virtual Commit LatestVersion{ get; set; }
public DateTime CommitTimeStamp { get; set; }
internal RegistrationLeaf ToLeave()
{
if (!(Versions != null &&
Versions.Count > 0)) throw new Exception("NO VERSION");
var v = Versions.First();
RegistrationLeaf leave = new RegistrationLeaf
{
PackageContent = v.NugetLink,
Entry = new CatalogEntry
{
idp = Id,
version = v.FullString,
authors = $"{Owner.FullName} <${Owner.Email}>"
}
};
return leave;
}
}
}

View File

@ -12,6 +12,7 @@ namespace isnd.Data
[Required]
[ForeignKey("Package")]
[StringLength(1024)]
[JsonProperty("id")]
public string PackageId { get; set; }
[Required]