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
},
"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"
],

View File

@ -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}]";
}
}
}

View File

@ -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<string>", b =>

View File

@ -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<IsndSettings> siteConfigOptionsOptions)
IOptions<IsndSettings> siteConfigOptionsOptions,
ILoggerFactory loggerFactory)
{
this.dbContext = dbContext;
isndSettings = siteConfigOptionsOptions.Value;
apiBase = isndSettings.ExternalUrl + Constants.ApiVersionPrefix;
this.logger = loggerFactory.CreateLogger<PackageManager>();
}
public IEnumerable<Resource> GetResources()
@ -173,6 +177,7 @@ namespace isnd.Services
private IsndSettings isndSettings;
private readonly string apiBase;
private readonly ILogger<PackageManager> logger;
public virtual async Task<Catalog> GetCatalogIndexAsync()
{
@ -357,6 +362,8 @@ namespace isnd.Services
public async Task<PackageSearchResult> 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);

View File

@ -34,12 +34,9 @@ namespace isnd.ViewModels
public PackageSearchResult(IEnumerable<Package> 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;
}