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"> <target name="build" description="build all">
<exec program="dotnet" commandline="build" /> <exec program="dotnet" commandline="build" />
</target> </target>
<target name="test" description="build all"> <target name="test" description="test all">
<exec program="dotnet" commandline="test" /> <exec program="dotnet" commandline="test" />
</target> </target>
</project> </project>

@ -29,7 +29,7 @@ namespace isnd.Data.Catalog
public RegistrationPage (string bid, string pkgid, string dlBase, IEnumerable<PackageVersion> items) public RegistrationPage (string bid, string pkgid, string dlBase, IEnumerable<PackageVersion> items)
{ {
Bid = bid; Bid = bid;
Parent = Bid + "/index.json"; Parent = Bid + $"/{pkgid}/index.json";
DlBase = dlBase; DlBase = dlBase;
this.items = new List<PackageVersion>(items); this.items = new List<PackageVersion>(items);
this.Id = Bid + "/" + pkgid + "/index.json"; 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) public RegistrationPageIndex(string bid, string id, string dlBase, IEnumerable<Package> pkgs)
{ {
// leaves; Items = new List<RegistrationPage>();
this.Items = new List<RegistrationPage> var pkgsGroups = pkgs.GroupBy(l => l.Id);
(pkgs.GroupBy(l => l.Id) // Pour tous les groupes par Id
.Select(lg => new RegistrationPage foreach (var gsp in pkgsGroups)
(bid, lg.Key, dlBase, lg.ToArray() {
.Select(p => p.Versions).Aggregate var pkgsbi = gsp.ToArray();
((l, m) => { l.AddRange(m); return l.ToList(); }) 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")] [JsonProperty("count")]

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

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

Loading…