Nothing concrete .

net6
Paul Schneider 2 years ago
parent 95600facf4
commit a7ea749d2c
5 changed files with 18 additions and 13 deletions

@ -18,7 +18,7 @@
<target name="build" description="build all">
<exec program="dotnet" commandline="build" />
</target>
<target name="test" description="build all">
<target name="test" description="test all">
<exec program="dotnet" commandline="test" />
</target>
</project>

@ -29,7 +29,7 @@ namespace isnd.Data.Catalog
public RegistrationPage (string bid, string pkgid, string dlBase, IEnumerable<PackageVersion> items)
{
Bid = bid;
Parent = Bid + "/index.json";
Parent = Bid + $"/{pkgid}/index.json";
DlBase = dlBase;
this.items = new List<PackageVersion>(items);
this.Id = Bid + "/" + pkgid + "/index.json";

@ -21,14 +21,20 @@ namespace isnd.Data.Catalog
public RegistrationPageIndex(string bid, string id, string dlBase, IEnumerable<Package> pkgs)
{
// leaves;
this.Items = new List<RegistrationPage>
(pkgs.GroupBy(l => l.Id)
.Select(lg => new RegistrationPage
(bid, lg.Key, dlBase, lg.ToArray()
.Select(p => p.Versions).Aggregate
((l, m) => { l.AddRange(m); return l.ToList(); })
)));
Items = new List<RegistrationPage>();
var pkgsGroups = pkgs.GroupBy(l => l.Id);
// Pour tous les groupes par Id
foreach (var gsp in pkgsGroups)
{
var pkgsbi = gsp.ToArray();
List<PackageVersion> versions = new List<PackageVersion>();
foreach(var l in pkgsbi.Select(p => p.Versions))
{
versions.AddRange(l);
}
Items.Add(new RegistrationPage(bid, gsp.Key, dlBase, versions));
}
}
[JsonProperty("count")]

@ -336,7 +336,8 @@ namespace isnd.Services
// RegistrationPageIndexAndQuery
var scope = dbContext.Packages.Include(p => p.Versions).Include(p => p.Owner)
.Where(p => p.Id.Equals(query.Query, StringComparison.InvariantCultureIgnoreCase)
&& (query.Prerelease || p.Versions.Any(v => !v.IsPrerelease)));
&& (query.Prerelease || p.Versions.Any(v => !v.IsPrerelease))
&& p.Versions.Count() > 0);
var total = scope.Count();
var pkgs = scope.Skip(query.Skip).Take(query.Take).ToArray();
string bid = $"{extUrl}v3.4.0/{ApiConfig.Registration}";

@ -111,8 +111,6 @@ namespace isnd
app.UseHsts();
dbContext.Database.Migrate();
}
// app.UseHttpsRedirection();
app.UseStatusCodePages().UseStaticFiles().UseAuthentication().UseMvc(routes =>
{
routes.MapRoute(

Loading…