From 55e407d9518502f7d83481e83179f3098e158251 Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Fri, 27 Aug 2021 21:22:34 +0100 Subject: [PATCH] commit version --- .vs/isn/xs/UserPrefs.xml | 44 +++ .vscode/settings.json | 6 +- README.md | 5 + src/isnd/Controllers/HomeController.cs | 8 - src/isnd/Data/Catalog/Commit.cs | 6 +- src/isnd/Data/Catalog/PackageRef.cs | 9 + src/isnd/Entities/IsndSettings.cs | 5 + .../20210827201859_commitVersion.Designer.cs | 349 ++++++++++++++++++ .../20210827201859_commitVersion.cs | 73 ++++ .../ApplicationDbContextModelSnapshot.cs | 61 ++- src/isnd/Services/PackageManager.cs | 78 +++- src/isnd/Startup.cs | 2 +- src/isnd/appsettings.json | 3 +- test/isn.tests/isn.tests.csproj | 5 +- test/isnd.tests/isnd.tests.csproj | 1 + 15 files changed, 614 insertions(+), 41 deletions(-) create mode 100644 .vs/isn/xs/UserPrefs.xml create mode 100644 src/isnd/Migrations/20210827201859_commitVersion.Designer.cs create mode 100644 src/isnd/Migrations/20210827201859_commitVersion.cs diff --git a/.vs/isn/xs/UserPrefs.xml b/.vs/isn/xs/UserPrefs.xml new file mode 100644 index 0000000..d3ad2cc --- /dev/null +++ b/.vs/isn/xs/UserPrefs.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 99c8e78..47e2fe9 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,7 @@ { - "dotnet-test-explorer.testProjectPath": "**/*.@(csproj)" + "dotnet-test-explorer.testProjectPath": "**/*.sln", + "dotnet-test-explorer.runInParallel": false, + "dotnet-test-explorer.showCodeLens": true, + "dotnet-test-explorer.testArguments": "", + "nxunitExplorer.nunit": "" } \ No newline at end of file diff --git a/README.md b/README.md index c9dc4f8..ec5324b 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,11 @@ sudo chmod +x /usr/local/lib/isn/isn.exe ## TODO ````bash + +Failed to retrieve information about 'Yavsc.Abstract' from remote source 'http://isn.pschneider.fr/package/FindPackagesById()?id='Yavsc.Abstract'&semVerLevel=2.0.0'. + Response status code does not indicate success: 404 (Not Found). + + isn set-api-key isn add isn sources diff --git a/src/isnd/Controllers/HomeController.cs b/src/isnd/Controllers/HomeController.cs index 219ba4f..4537075 100644 --- a/src/isnd/Controllers/HomeController.cs +++ b/src/isnd/Controllers/HomeController.cs @@ -1,17 +1,10 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Options; -using isnd.Entities; using isnd.Data; using System.Linq; using isnd.ViewModels; -using Unleash.ClientFactory; using Unleash; -using isnd.Entities; -using System; -using System.Collections.Generic; -using isnd.Helpers; namespace isnd.Controllers { @@ -30,7 +23,6 @@ namespace isnd.Controllers _logger = logger; _dbContext = dbContext; _unleashĈlient = unleashĈlient; - // _unleashĈlient = env.CreateUnleahClient(unleashClientSettings.Value); } public IActionResult Index() diff --git a/src/isnd/Data/Catalog/Commit.cs b/src/isnd/Data/Catalog/Commit.cs index c0c23fb..ce23269 100644 --- a/src/isnd/Data/Catalog/Commit.cs +++ b/src/isnd/Data/Catalog/Commit.cs @@ -22,10 +22,10 @@ namespace isnd.Data.Catalog public PackageAction Action { get; set; } [Required] - public string PackageId { get; set; } - [ForeignKey("PackageId")] + public string PackageVersionId { get; set; } + [ForeignKey("PackageVersionId")] - public virtual Package Package{ get; set; } + public virtual PackageVersion PackageVersion{ get; set; } public string CommitId { get => Id.ToString(); } public DateTime CommitTimeStamp { get => TimeStamp; } } diff --git a/src/isnd/Data/Catalog/PackageRef.cs b/src/isnd/Data/Catalog/PackageRef.cs index 8b86bfd..77ea023 100644 --- a/src/isnd/Data/Catalog/PackageRef.cs +++ b/src/isnd/Data/Catalog/PackageRef.cs @@ -23,8 +23,17 @@ namespace isnd.Data.Catalog [JsonProperty("@type")] public string RefType { get; set; } + /// + /// The NuGet Id + /// + /// [JsonProperty("nuget:id")] public string Id { get; set; } + + /// + /// The NuGet version + /// + /// [JsonProperty("nuget:version")] public string Version { get; set; } diff --git a/src/isnd/Entities/IsndSettings.cs b/src/isnd/Entities/IsndSettings.cs index 2680eee..4bb7f74 100644 --- a/src/isnd/Entities/IsndSettings.cs +++ b/src/isnd/Entities/IsndSettings.cs @@ -1,3 +1,5 @@ +using System; + namespace isnd.Entities { public class IsndSettings @@ -8,6 +10,9 @@ namespace isnd.Entities public string PackagesRootDir {get; set;} public string CatalogDir {get; set;} public int MaxUserKeyCount {get; set;} + public int CatalogPageLen {get; set;} + public TimeSpan DisplayDeletionLen {get; set;} + } } \ No newline at end of file diff --git a/src/isnd/Migrations/20210827201859_commitVersion.Designer.cs b/src/isnd/Migrations/20210827201859_commitVersion.Designer.cs new file mode 100644 index 0000000..54b77dc --- /dev/null +++ b/src/isnd/Migrations/20210827201859_commitVersion.Designer.cs @@ -0,0 +1,349 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using isnd.Data; + +namespace isndhost.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20210827201859_commitVersion")] + partial class commitVersion + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn) + .HasAnnotation("ProductVersion", "2.2.6-servicing-10079") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken(); + + b.Property("Name") + .HasMaxLength(256); + + b.Property("NormalizedName") + .HasMaxLength(256); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasName("RoleNameIndex"); + + b.ToTable("AspNetRoles"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClaimType"); + + b.Property("ClaimValue"); + + b.Property("RoleId") + .IsRequired(); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClaimType"); + + b.Property("ClaimValue"); + + b.Property("UserId") + .IsRequired(); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider"); + + b.Property("ProviderKey"); + + b.Property("ProviderDisplayName"); + + b.Property("UserId") + .IsRequired(); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId"); + + b.Property("RoleId"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId"); + + b.Property("LoginProvider"); + + b.Property("Name"); + + b.Property("Value"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens"); + }); + + modelBuilder.Entity("isnd.Data.ApiKeys.ApiKey", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("CreationDate"); + + b.Property("Name"); + + b.Property("UserId") + .IsRequired(); + + b.Property("ValidityPeriodInDays"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("ApiKeys"); + }); + + modelBuilder.Entity("isnd.Data.ApplicationUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AccessFailedCount"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken(); + + b.Property("Email") + .HasMaxLength(256); + + b.Property("EmailConfirmed"); + + b.Property("FullName"); + + b.Property("LockoutEnabled"); + + b.Property("LockoutEnd"); + + b.Property("NormalizedEmail") + .HasMaxLength(256); + + b.Property("NormalizedUserName") + .HasMaxLength(256); + + b.Property("PasswordHash"); + + b.Property("PhoneNumber"); + + b.Property("PhoneNumberConfirmed"); + + b.Property("SecurityStamp"); + + b.Property("TwoFactorEnabled"); + + b.Property("UserName") + .HasMaxLength(256); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasName("UserNameIndex"); + + b.ToTable("AspNetUsers"); + }); + + modelBuilder.Entity("isnd.Data.Catalog.Commit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Action"); + + b.Property("PackageId") + .IsRequired(); + + b.Property("TimeStamp"); + + b.HasKey("Id"); + + b.HasIndex("PackageId"); + + b.ToTable("Commits"); + }); + + modelBuilder.Entity("isnd.Data.Package", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("CommitId"); + + b.Property("CommitTimeStamp"); + + b.Property("Description") + .HasMaxLength(1024); + + b.Property("OwnerId") + .IsRequired(); + + b.Property("Public"); + + b.HasKey("Id"); + + b.HasIndex("OwnerId"); + + b.ToTable("Packages"); + }); + + modelBuilder.Entity("isnd.Data.PackageVersion", b => + { + b.Property("PackageId"); + + b.Property("FullString") + .HasMaxLength(256); + + b.Property("Type") + .HasMaxLength(256); + + b.Property("IsPrerelease"); + + b.Property("Major"); + + b.Property("Minor"); + + b.Property("Patch"); + + b.HasKey("PackageId", "FullString", "Type"); + + b.ToTable("PackageVersions"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("isnd.Data.ApplicationUser") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("isnd.Data.ApplicationUser") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("isnd.Data.ApplicationUser") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("isnd.Data.ApplicationUser") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("isnd.Data.ApiKeys.ApiKey", b => + { + b.HasOne("isnd.Data.ApplicationUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("isnd.Data.Catalog.Commit", b => + { + b.HasOne("isnd.Data.Package", "Package") + .WithMany() + .HasForeignKey("PackageId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("isnd.Data.Package", b => + { + b.HasOne("isnd.Data.ApplicationUser", "Owner") + .WithMany() + .HasForeignKey("OwnerId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("isnd.Data.PackageVersion", b => + { + b.HasOne("isnd.Data.Package", "Package") + .WithMany("Versions") + .HasForeignKey("PackageId") + .OnDelete(DeleteBehavior.Cascade); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/isnd/Migrations/20210827201859_commitVersion.cs b/src/isnd/Migrations/20210827201859_commitVersion.cs new file mode 100644 index 0000000..9641a64 --- /dev/null +++ b/src/isnd/Migrations/20210827201859_commitVersion.cs @@ -0,0 +1,73 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +namespace isndhost.Migrations +{ + public partial class commitVersion : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "CommitId", + table: "Packages", + nullable: true); + + migrationBuilder.AddColumn( + name: "CommitTimeStamp", + table: "Packages", + nullable: false, + defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + migrationBuilder.AddColumn( + name: "Public", + table: "Packages", + nullable: false, + defaultValue: false); + + migrationBuilder.CreateTable( + name: "Commits", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn), + TimeStamp = table.Column(nullable: false), + Action = table.Column(nullable: false), + PackageId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Commits", x => x.Id); + table.ForeignKey( + name: "FK_Commits_Packages_PackageId", + column: x => x.PackageId, + principalTable: "Packages", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_Commits_PackageId", + table: "Commits", + column: "PackageId"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Commits"); + + migrationBuilder.DropColumn( + name: "CommitId", + table: "Packages"); + + migrationBuilder.DropColumn( + name: "CommitTimeStamp", + table: "Packages"); + + migrationBuilder.DropColumn( + name: "Public", + table: "Packages"); + } + } +} diff --git a/src/isnd/Migrations/ApplicationDbContextModelSnapshot.cs b/src/isnd/Migrations/ApplicationDbContextModelSnapshot.cs index 5fc1ca9..c516ea3 100644 --- a/src/isnd/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/src/isnd/Migrations/ApplicationDbContextModelSnapshot.cs @@ -126,7 +126,7 @@ namespace isndhost.Migrations b.ToTable("AspNetUserTokens"); }); - modelBuilder.Entity("isn.Data.ApiKeys.ApiKey", b => + modelBuilder.Entity("isnd.Data.ApiKeys.ApiKey", b => { b.Property("Id") .ValueGeneratedOnAdd(); @@ -147,7 +147,7 @@ namespace isndhost.Migrations b.ToTable("ApiKeys"); }); - modelBuilder.Entity("isn.Data.ApplicationUser", b => + modelBuilder.Entity("isnd.Data.ApplicationUser", b => { b.Property("Id") .ValueGeneratedOnAdd(); @@ -199,17 +199,42 @@ namespace isndhost.Migrations b.ToTable("AspNetUsers"); }); - modelBuilder.Entity("isn.Data.Package", b => + modelBuilder.Entity("isnd.Data.Catalog.Commit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Action"); + + b.Property("PackageId") + .IsRequired(); + + b.Property("TimeStamp"); + + b.HasKey("Id"); + + b.HasIndex("PackageId"); + + b.ToTable("Commits"); + }); + + modelBuilder.Entity("isnd.Data.Package", b => { b.Property("Id") .ValueGeneratedOnAdd(); + b.Property("CommitId"); + + b.Property("CommitTimeStamp"); + b.Property("Description") .HasMaxLength(1024); b.Property("OwnerId") .IsRequired(); + b.Property("Public"); + b.HasKey("Id"); b.HasIndex("OwnerId"); @@ -217,7 +242,7 @@ namespace isndhost.Migrations b.ToTable("Packages"); }); - modelBuilder.Entity("isn.Data.PackageVersion", b => + modelBuilder.Entity("isnd.Data.PackageVersion", b => { b.Property("PackageId"); @@ -250,7 +275,7 @@ namespace isndhost.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => { - b.HasOne("isn.Data.ApplicationUser") + b.HasOne("isnd.Data.ApplicationUser") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade); @@ -258,7 +283,7 @@ namespace isndhost.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => { - b.HasOne("isn.Data.ApplicationUser") + b.HasOne("isnd.Data.ApplicationUser") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade); @@ -271,7 +296,7 @@ namespace isndhost.Migrations .HasForeignKey("RoleId") .OnDelete(DeleteBehavior.Cascade); - b.HasOne("isn.Data.ApplicationUser") + b.HasOne("isnd.Data.ApplicationUser") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade); @@ -279,31 +304,39 @@ namespace isndhost.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => { - b.HasOne("isn.Data.ApplicationUser") + b.HasOne("isnd.Data.ApplicationUser") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade); }); - modelBuilder.Entity("isn.Data.ApiKeys.ApiKey", b => + modelBuilder.Entity("isnd.Data.ApiKeys.ApiKey", b => { - b.HasOne("isn.Data.ApplicationUser", "User") + b.HasOne("isnd.Data.ApplicationUser", "User") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade); }); - modelBuilder.Entity("isn.Data.Package", b => + modelBuilder.Entity("isnd.Data.Catalog.Commit", b => + { + b.HasOne("isnd.Data.Package", "Package") + .WithMany() + .HasForeignKey("PackageId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("isnd.Data.Package", b => { - b.HasOne("isn.Data.ApplicationUser", "Owner") + b.HasOne("isnd.Data.ApplicationUser", "Owner") .WithMany() .HasForeignKey("OwnerId") .OnDelete(DeleteBehavior.Cascade); }); - modelBuilder.Entity("isn.Data.PackageVersion", b => + modelBuilder.Entity("isnd.Data.PackageVersion", b => { - b.HasOne("isn.Data.Package", "Package") + b.HasOne("isnd.Data.Package", "Package") .WithMany("Versions") .HasForeignKey("PackageId") .OnDelete(DeleteBehavior.Cascade); diff --git a/src/isnd/Services/PackageManager.cs b/src/isnd/Services/PackageManager.cs index 1a261ae..e0cfd86 100644 --- a/src/isnd/Services/PackageManager.cs +++ b/src/isnd/Services/PackageManager.cs @@ -19,11 +19,13 @@ namespace isnd.Services public class PackageManager : IPackageManager { ApplicationDbContext dbContext; - public PackageManager(ApplicationDbContext dbContext, IOptions pmConfigOptions) + public PackageManager(ApplicationDbContext dbContext, + IOptions siteConfigOptionsOptions) { this.dbContext = dbContext; CurrentCatalogIndex = GetCatalogIndex(); - this.pmConfigOptions = pmConfigOptions.Value; + pmConfigOptions = siteConfigOptionsOptions.Value; + extApiUrl = pmConfigOptions.ExternalUrl + "/package"; } @@ -138,8 +140,10 @@ namespace isnd.Services } public static CatalogIndex CurrentCatalogIndex { get; protected set; } + public static List CurrentCatalogPages { get; protected set; } private IsndSettings pmConfigOptions; + private string extApiUrl; public virtual CatalogIndex GetCatalogIndex() { @@ -151,7 +155,59 @@ namespace isnd.Services } void LoadCatalogFromDb() { - dbContext.Commits.OrderBy(c => c.TimeStamp); + int i=0; + int p=0; + var oldIndex = CurrentCatalogIndex; + var oldPages = CurrentCatalogPages; + CurrentCatalogIndex = new CatalogIndex + { + + }; + CurrentCatalogPages = new List(); + + var scope = dbContext.Commits.OrderBy(c => c.TimeStamp); + Commit last = null; + PageRef pageRef = null; + Page page = null; + i=pmConfigOptions.CatalogPageLen; + foreach (var commit in scope) + { + if (i >= this.pmConfigOptions.CatalogPageLen) + { + page = new Page{ + Parent = pmConfigOptions.ExternalUrl + "/package", + CommitId = commit.CommitId, + CommitTimeStamp = commit.CommitTimeStamp, + Id = this.pmConfigOptions.ExternalUrl + "/package/index-" + p++ + + }; + CurrentCatalogPages.Add(page); + pageRef = new PageRef{ + Id = page.Id + }; + CurrentCatalogIndex.Items.Add(pageRef); + i = 0; + } + PackageRef packageref = new PackageRef + { + CommitId = commit.Id.ToString(), + Id = commit.PackageVersionId, + + + CommitTimeStamp = commit.CommitTimeStamp, + RefType = commit.Action == PackageAction.PublishPackage ? + "nuget:PackageDetails" : "nuget:PackageDelete" + }; + + page.Items.Add(packageref); + last = commit; + i++; + } + + if (last!=null) + { + CurrentCatalogIndex.CommitId = last.CommitId; + } throw new NotImplementedException(); } @@ -182,35 +238,35 @@ namespace isnd.Services public IEnumerable GetResources(IUnleash unleashClient) { var res = new List(); - if (unleashClient.IsEnabled("pkg-push")) + if (unleashClient.IsEnabled("pkg-push", true)) res.Add( new Resource { - id = "package", + id = extApiUrl, type = "PackagePublish/2.0.0", comment = "Package Publish service" }); - if (unleashClient.IsEnabled("pkg-get")) + if (unleashClient.IsEnabled("pkg-get", false)) res.Add( new Resource { - id = "package", + id = extApiUrl, type = "PackageBaseAddress/3.0.0", comment = "Package Base Address service" }); - if (unleashClient.IsEnabled("pkg-autocomplete")) + if (unleashClient.IsEnabled("pkg-autocomplete", false)) res.Add( new Resource { - id = "package", + id = extApiUrl, type = "SearchAutocompleteService/3.5.0", comment = "Auto complete service" }); - if (unleashClient.IsEnabled("pkg-search")) + if (unleashClient.IsEnabled("pkg-search", false)) res.Add( new Resource { - id = "package", + id = extApiUrl, type = "SearchQueryService/3.5.0", comment = "Search Query service" }); diff --git a/src/isnd/Startup.cs b/src/isnd/Startup.cs index 5068155..fa9b3fe 100644 --- a/src/isnd/Startup.cs +++ b/src/isnd/Startup.cs @@ -71,7 +71,7 @@ namespace isnd var config = s.GetRequiredService>(); return s.GetRequiredService().CreateUnleahClient(config.Value); }); - services.AddSingleton(); + services.AddTransient(); // _unleashĈlient = env.CreateUnleahClient(unleashClientSettings.Value); var smtpSettingsconf = Configuration.GetSection("Smtp"); diff --git a/src/isnd/appsettings.json b/src/isnd/appsettings.json index 325cb20..61e4a9b 100644 --- a/src/isnd/appsettings.json +++ b/src/isnd/appsettings.json @@ -8,7 +8,8 @@ "ExternalUrl": "", "PackagesRootDir" : "", "ProtectionTitle": "protected-data-v1", - "MaxUserKeyCount": 1 + "MaxUserKeyCount": 1, + "CatalogPageLen": 480 }, "ConnectionStrings": { "DefaultConnection": "Server=;Port=;Database=;Username=;Password=;" diff --git a/test/isn.tests/isn.tests.csproj b/test/isn.tests/isn.tests.csproj index 54aff13..03f81f5 100644 --- a/test/isn.tests/isn.tests.csproj +++ b/test/isn.tests/isn.tests.csproj @@ -10,11 +10,12 @@ + - - + + diff --git a/test/isnd.tests/isnd.tests.csproj b/test/isnd.tests/isnd.tests.csproj index 09601a9..e61f62c 100644 --- a/test/isnd.tests/isnd.tests.csproj +++ b/test/isnd.tests/isnd.tests.csproj @@ -12,6 +12,7 @@ +