diff --git a/dotnet-tools.json b/dotnet-tools.json index 36ef729..ae373b8 100644 --- a/dotnet-tools.json +++ b/dotnet-tools.json @@ -10,14 +10,14 @@ "rollForward": false }, "gitversion.tool": { - "version": "5.10.1", + "version": "6.3.0", "commands": [ "dotnet-gitversion" ], "rollForward": false }, "gitreleasemanager.tool": { - "version": "0.13.0", + "version": "0.20.0", "commands": [ "dotnet-gitreleasemanager" ], diff --git a/src/isnd/Data/Catalog/PackageRegistrationQuery.cs b/src/isnd/Data/Catalog/PackageRegistrationQuery.cs index 75414dc..f57e584 100644 --- a/src/isnd/Data/Catalog/PackageRegistrationQuery.cs +++ b/src/isnd/Data/Catalog/PackageRegistrationQuery.cs @@ -21,5 +21,10 @@ namespace isnd.Data.Catalog [JsonProperty("take")] public int Take { get; set; } = 25; + + override public string ToString() + { + return $"[PackageRegistrationQuery Query:{Query} Prerelease:{Prerelease} Skip:{Skip} Take:{Take}]"; + } } } \ No newline at end of file diff --git a/src/isnd/Migrations/ApplicationDbContextModelSnapshot.cs b/src/isnd/Migrations/ApplicationDbContextModelSnapshot.cs index 64c2c58..b94a744 100644 --- a/src/isnd/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/src/isnd/Migrations/ApplicationDbContextModelSnapshot.cs @@ -177,7 +177,7 @@ namespace isnd.Migrations b.HasIndex("UserId"); - b.ToTable("ApiKeys"); + b.ToTable("ApiKeys", (string)null); }); modelBuilder.Entity("isnd.Data.ApplicationUser", b => @@ -272,7 +272,7 @@ namespace isnd.Migrations b.HasIndex("DependencyGroupId"); - b.ToTable("Dependencies"); + b.ToTable("Dependencies", (string)null); }); modelBuilder.Entity("isnd.Data.PackageDependencyGroup", b => @@ -297,7 +297,7 @@ namespace isnd.Migrations b.HasIndex("PackageId", "PackageVersionFullString"); - b.ToTable("PackageDependencyGroups"); + b.ToTable("PackageDependencyGroups", (string)null); }); modelBuilder.Entity("isnd.Data.PackageVersion", b => @@ -344,7 +344,7 @@ namespace isnd.Migrations b.HasIndex("CommitNId"); - b.ToTable("PackageVersions"); + b.ToTable("PackageVersions", (string)null); }); modelBuilder.Entity("isnd.Data.Packages.Commit", b => @@ -363,7 +363,7 @@ namespace isnd.Migrations b.HasKey("Id"); - b.ToTable("Commits"); + b.ToTable("Commits", (string)null); }); modelBuilder.Entity("isnd.Data.Packages.Package", b => @@ -392,7 +392,7 @@ namespace isnd.Migrations b.HasIndex("OwnerId"); - b.ToTable("Packages"); + b.ToTable("Packages", (string)null); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => diff --git a/src/isnd/Services/PackageManager.cs b/src/isnd/Services/PackageManager.cs index 5cefdae..c90da17 100644 --- a/src/isnd/Services/PackageManager.cs +++ b/src/isnd/Services/PackageManager.cs @@ -20,6 +20,8 @@ using System.Xml; using System.Xml.Linq; using NuGet.Protocol; using System.ComponentModel; +using Microsoft.Extensions.Logging; +using System.Diagnostics; namespace isnd.Services { @@ -29,11 +31,13 @@ namespace isnd.Services readonly ApplicationDbContext dbContext; public PackageManager(ApplicationDbContext dbContext, - IOptions siteConfigOptionsOptions) + IOptions siteConfigOptionsOptions, + ILoggerFactory loggerFactory) { this.dbContext = dbContext; isndSettings = siteConfigOptionsOptions.Value; apiBase = isndSettings.ExternalUrl + Constants.ApiVersionPrefix; + this.logger = loggerFactory.CreateLogger(); } public IEnumerable GetResources() @@ -173,6 +177,7 @@ namespace isnd.Services private IsndSettings isndSettings; private readonly string apiBase; + private readonly ILogger logger; public virtual async Task GetCatalogIndexAsync() { @@ -357,6 +362,8 @@ namespace isnd.Services public async Task SearchPackageAsync(PackageRegistrationQuery query) { + Debug.Assert(query != null); + logger.LogInformation(query.ToString()); string bid = $"{apiBase}{ApiConfig.Registration}"; if (string.IsNullOrWhiteSpace(query.Query)) { @@ -371,9 +378,11 @@ namespace isnd.Services .Where(p => p.Versions.Count >= 0); var count = await allPackages.CountAsync(); + logger.LogInformation($" total hits : {count}"); var packages = await allPackages .Skip(query.Skip).Take(query.Take).ToArrayAsync(); + foreach (var package in packages) foreach (var version in package.Versions) { @@ -381,6 +390,7 @@ namespace isnd.Services .Where(d => d.PackageVersionFullString == version.FullString && d.PackageId == version.PackageId) .ToList(); + logger.LogInformation($" version: {version.PackageId} {version.FullString} {version.DependencyGroups.Count}"); } return new PackageSearchResult(packages, apiBase, count); diff --git a/src/isnd/ViewModels/PackageSearchResult.cs b/src/isnd/ViewModels/PackageSearchResult.cs index c3ddddb..3ac438c 100644 --- a/src/isnd/ViewModels/PackageSearchResult.cs +++ b/src/isnd/ViewModels/PackageSearchResult.cs @@ -34,12 +34,9 @@ namespace isnd.ViewModels public PackageSearchResult(IEnumerable result, string apiBase, int totalHit) { - this.result = result; this.ApiBase = apiBase; - - data = (totalHit>0) ? result.Select(p=> NewPackageHit(apiBase, p)).ToArray() - : new PackageHit[0]; + data = result.Select(p=> NewPackageHit(apiBase, p)).ToArray(); this.totalHits = totalHit; }