This commit is contained in:
2025-07-07 13:07:02 +01:00
parent dc54df19a6
commit 9f357b4b0e
5 changed files with 25 additions and 13 deletions

View File

@ -10,14 +10,14 @@
"rollForward": false "rollForward": false
}, },
"gitversion.tool": { "gitversion.tool": {
"version": "5.10.1", "version": "6.3.0",
"commands": [ "commands": [
"dotnet-gitversion" "dotnet-gitversion"
], ],
"rollForward": false "rollForward": false
}, },
"gitreleasemanager.tool": { "gitreleasemanager.tool": {
"version": "0.13.0", "version": "0.20.0",
"commands": [ "commands": [
"dotnet-gitreleasemanager" "dotnet-gitreleasemanager"
], ],

View File

@ -21,5 +21,10 @@ namespace isnd.Data.Catalog
[JsonProperty("take")] [JsonProperty("take")]
public int Take { get; set; } = 25; public int Take { get; set; } = 25;
override public string ToString()
{
return $"[PackageRegistrationQuery Query:{Query} Prerelease:{Prerelease} Skip:{Skip} Take:{Take}]";
}
} }
} }

View File

@ -177,7 +177,7 @@ namespace isnd.Migrations
b.HasIndex("UserId"); b.HasIndex("UserId");
b.ToTable("ApiKeys"); b.ToTable("ApiKeys", (string)null);
}); });
modelBuilder.Entity("isnd.Data.ApplicationUser", b => modelBuilder.Entity("isnd.Data.ApplicationUser", b =>
@ -272,7 +272,7 @@ namespace isnd.Migrations
b.HasIndex("DependencyGroupId"); b.HasIndex("DependencyGroupId");
b.ToTable("Dependencies"); b.ToTable("Dependencies", (string)null);
}); });
modelBuilder.Entity("isnd.Data.PackageDependencyGroup", b => modelBuilder.Entity("isnd.Data.PackageDependencyGroup", b =>
@ -297,7 +297,7 @@ namespace isnd.Migrations
b.HasIndex("PackageId", "PackageVersionFullString"); b.HasIndex("PackageId", "PackageVersionFullString");
b.ToTable("PackageDependencyGroups"); b.ToTable("PackageDependencyGroups", (string)null);
}); });
modelBuilder.Entity("isnd.Data.PackageVersion", b => modelBuilder.Entity("isnd.Data.PackageVersion", b =>
@ -344,7 +344,7 @@ namespace isnd.Migrations
b.HasIndex("CommitNId"); b.HasIndex("CommitNId");
b.ToTable("PackageVersions"); b.ToTable("PackageVersions", (string)null);
}); });
modelBuilder.Entity("isnd.Data.Packages.Commit", b => modelBuilder.Entity("isnd.Data.Packages.Commit", b =>
@ -363,7 +363,7 @@ namespace isnd.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("Commits"); b.ToTable("Commits", (string)null);
}); });
modelBuilder.Entity("isnd.Data.Packages.Package", b => modelBuilder.Entity("isnd.Data.Packages.Package", b =>
@ -392,7 +392,7 @@ namespace isnd.Migrations
b.HasIndex("OwnerId"); b.HasIndex("OwnerId");
b.ToTable("Packages"); b.ToTable("Packages", (string)null);
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>

View File

@ -20,6 +20,8 @@ using System.Xml;
using System.Xml.Linq; using System.Xml.Linq;
using NuGet.Protocol; using NuGet.Protocol;
using System.ComponentModel; using System.ComponentModel;
using Microsoft.Extensions.Logging;
using System.Diagnostics;
namespace isnd.Services namespace isnd.Services
{ {
@ -29,11 +31,13 @@ namespace isnd.Services
readonly ApplicationDbContext dbContext; readonly ApplicationDbContext dbContext;
public PackageManager(ApplicationDbContext dbContext, public PackageManager(ApplicationDbContext dbContext,
IOptions<IsndSettings> siteConfigOptionsOptions) IOptions<IsndSettings> siteConfigOptionsOptions,
ILoggerFactory loggerFactory)
{ {
this.dbContext = dbContext; this.dbContext = dbContext;
isndSettings = siteConfigOptionsOptions.Value; isndSettings = siteConfigOptionsOptions.Value;
apiBase = isndSettings.ExternalUrl + Constants.ApiVersionPrefix; apiBase = isndSettings.ExternalUrl + Constants.ApiVersionPrefix;
this.logger = loggerFactory.CreateLogger<PackageManager>();
} }
public IEnumerable<Resource> GetResources() public IEnumerable<Resource> GetResources()
@ -173,6 +177,7 @@ namespace isnd.Services
private IsndSettings isndSettings; private IsndSettings isndSettings;
private readonly string apiBase; private readonly string apiBase;
private readonly ILogger<PackageManager> logger;
public virtual async Task<Catalog> GetCatalogIndexAsync() public virtual async Task<Catalog> GetCatalogIndexAsync()
{ {
@ -357,6 +362,8 @@ namespace isnd.Services
public async Task<PackageSearchResult> SearchPackageAsync(PackageRegistrationQuery query) public async Task<PackageSearchResult> SearchPackageAsync(PackageRegistrationQuery query)
{ {
Debug.Assert(query != null);
logger.LogInformation(query.ToString());
string bid = $"{apiBase}{ApiConfig.Registration}"; string bid = $"{apiBase}{ApiConfig.Registration}";
if (string.IsNullOrWhiteSpace(query.Query)) if (string.IsNullOrWhiteSpace(query.Query))
{ {
@ -371,9 +378,11 @@ namespace isnd.Services
.Where(p => p.Versions.Count >= 0); .Where(p => p.Versions.Count >= 0);
var count = await allPackages.CountAsync(); var count = await allPackages.CountAsync();
logger.LogInformation($" total hits : {count}");
var packages = await allPackages var packages = await allPackages
.Skip(query.Skip).Take(query.Take).ToArrayAsync(); .Skip(query.Skip).Take(query.Take).ToArrayAsync();
foreach (var package in packages) foreach (var package in packages)
foreach (var version in package.Versions) foreach (var version in package.Versions)
{ {
@ -381,6 +390,7 @@ namespace isnd.Services
.Where(d => d.PackageVersionFullString == version.FullString && d.PackageId == version.PackageId) .Where(d => d.PackageVersionFullString == version.FullString && d.PackageId == version.PackageId)
.ToList(); .ToList();
logger.LogInformation($" version: {version.PackageId} {version.FullString} {version.DependencyGroups.Count}");
} }
return new PackageSearchResult(packages, apiBase, count); return new PackageSearchResult(packages, apiBase, count);

View File

@ -34,12 +34,9 @@ namespace isnd.ViewModels
public PackageSearchResult(IEnumerable<Package> result, string apiBase, int totalHit) public PackageSearchResult(IEnumerable<Package> result, string apiBase, int totalHit)
{ {
this.result = result; this.result = result;
this.ApiBase = apiBase; this.ApiBase = apiBase;
data = result.Select(p=> NewPackageHit(apiBase, p)).ToArray();
data = (totalHit>0) ? result.Select(p=> NewPackageHit(apiBase, p)).ToArray()
: new PackageHit[0];
this.totalHits = totalHit; this.totalHits = totalHit;
} }