From a7ea749d2c8494e9811f98cab3c28b2892caad81 Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Sun, 11 Dec 2022 14:54:47 +0000 Subject: [PATCH] Nothing concrete . --- .build | 2 +- src/isnd/Data/Catalog/RegistrationPage.cs | 2 +- .../Data/Catalog/RegistrationPageIndex.cs | 22 ++++++++++++------- src/isnd/Services/PackageManager.cs | 3 ++- src/isnd/Startup.cs | 2 -- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/.build b/.build index c03868d..9d167a3 100644 --- a/.build +++ b/.build @@ -18,7 +18,7 @@ - + diff --git a/src/isnd/Data/Catalog/RegistrationPage.cs b/src/isnd/Data/Catalog/RegistrationPage.cs index bb1b1fb..d6b7622 100644 --- a/src/isnd/Data/Catalog/RegistrationPage.cs +++ b/src/isnd/Data/Catalog/RegistrationPage.cs @@ -29,7 +29,7 @@ namespace isnd.Data.Catalog public RegistrationPage (string bid, string pkgid, string dlBase, IEnumerable items) { Bid = bid; - Parent = Bid + "/index.json"; + Parent = Bid + $"/{pkgid}/index.json"; DlBase = dlBase; this.items = new List(items); this.Id = Bid + "/" + pkgid + "/index.json"; diff --git a/src/isnd/Data/Catalog/RegistrationPageIndex.cs b/src/isnd/Data/Catalog/RegistrationPageIndex.cs index f7097a4..2e58a17 100644 --- a/src/isnd/Data/Catalog/RegistrationPageIndex.cs +++ b/src/isnd/Data/Catalog/RegistrationPageIndex.cs @@ -21,14 +21,20 @@ namespace isnd.Data.Catalog public RegistrationPageIndex(string bid, string id, string dlBase, IEnumerable pkgs) { - // leaves; - this.Items = new List - (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(); + var pkgsGroups = pkgs.GroupBy(l => l.Id); + // Pour tous les groupes par Id + foreach (var gsp in pkgsGroups) + { + var pkgsbi = gsp.ToArray(); + List versions = new List(); + + foreach(var l in pkgsbi.Select(p => p.Versions)) + { + versions.AddRange(l); + } + Items.Add(new RegistrationPage(bid, gsp.Key, dlBase, versions)); + } } [JsonProperty("count")] diff --git a/src/isnd/Services/PackageManager.cs b/src/isnd/Services/PackageManager.cs index 3a11ab1..e9f57de 100644 --- a/src/isnd/Services/PackageManager.cs +++ b/src/isnd/Services/PackageManager.cs @@ -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}"; diff --git a/src/isnd/Startup.cs b/src/isnd/Startup.cs index eeb891e..2441cd0 100644 --- a/src/isnd/Startup.cs +++ b/src/isnd/Startup.cs @@ -111,8 +111,6 @@ namespace isnd app.UseHsts(); dbContext.Database.Migrate(); } - - // app.UseHttpsRedirection(); app.UseStatusCodePages().UseStaticFiles().UseAuthentication().UseMvc(routes => { routes.MapRoute(