diff --git a/.vscode/tasks.json b/.vscode/tasks.json index b56fe83..cc5e654 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -11,7 +11,8 @@ "/consoleloggerparameters:NoSummary", "--ignore-failed-sources" ], - "problemMatcher": "$msCompile" + "problemMatcher": "$msCompile", + "group": "build" }, { "label": "build", @@ -23,7 +24,8 @@ "/property:GenerateFullPaths=true", "/consoleloggerparameters:NoSummary" ], - "problemMatcher": "$msCompile" + "problemMatcher": "$msCompile", + "group": "build" }, { "label": "db-upgrade", @@ -40,9 +42,9 @@ "env": { "ASPNETCORE_ENV": "Development" } - } - - + }, + "dependsOn":["build"], + "group": "test" }, { @@ -56,7 +58,8 @@ "/consoleloggerparameters:NoSummary", "/restore" ], - "problemMatcher": "$msCompile" + "problemMatcher": "$msCompile", + "group": "build" }, { "label": "publish", @@ -73,7 +76,8 @@ "problemMatcher": "$msCompile", "options": { "cwd": "${workspaceFolder}" - } + }, + "group": "none" }, { "label": "monopublish", @@ -90,7 +94,8 @@ "label": "copyTestConfig", "command": "dotnet", "type": "process", - "args": [ "build", "/t:CopyTestConfig" ] + "args": [ "build", "/t:CopyTestConfig" ], + "group": "test" }, { "label": "test", @@ -107,7 +112,8 @@ "--logger:xunit" ], "problemMatcher": "$msCompile", - "dependsOn": [ "build", "copyTestConfig"] + "dependsOn": [ "build", "copyTestConfig"], + "group": "test" }, { "label": "watch", @@ -123,7 +129,8 @@ "ASPNETCORE_ENVIRONMENT": "Development" } }, - "problemMatcher": "$msCompile" + "problemMatcher": "$msCompile", + "group": "test" } ] } \ No newline at end of file diff --git a/src/isn.abst/ApiConfig.cs b/src/isn.abst/ApiConfig.cs index aca4e85..38b11d7 100644 --- a/src/isn.abst/ApiConfig.cs +++ b/src/isn.abst/ApiConfig.cs @@ -4,6 +4,7 @@ namespace isnd.Entities { public static class ApiConfig { + public const string Index = "/index.json"; public const string Catalog = "/catalog"; public const string Package = "/package"; public const string Search = "/search"; @@ -11,6 +12,7 @@ namespace isnd.Entities public const string Registration = "/registration"; public const string Nuspec = "/nuspec"; + public const string Content = "/content"; public const string Nuget = "/nuget"; public const string Find = "/index/FindPackagesById()"; // /FindPackagesById()?id='isn.abst'&semVerLevel=2.0.0 diff --git a/src/isnd/Controllers/Packages/ApiIndex.cs b/src/isnd/Controllers/Packages/ApiIndex.cs index 19a4502..d80fb33 100644 --- a/src/isnd/Controllers/Packages/ApiIndex.cs +++ b/src/isnd/Controllers/Packages/ApiIndex.cs @@ -4,7 +4,7 @@ using isn.Abstract; using isn.abst; using isnd.Interfaces; using System.Linq; - +using isnd.Entities; namespace isnd.Controllers { @@ -30,7 +30,7 @@ namespace isnd.Controllers /// API index /// /// - [HttpGet("~" + Constants.ApiVersionPrefix + "/index")] + [HttpGet("~" + Constants.ApiVersionPrefix + ApiConfig.Index)] public IActionResult ApiIndex() { return Ok(new ApiIndexViewModel(packageManager.CatalogBaseUrl){ Version = PackageManager.BASE_API_LEVEL, Resources = resources }); diff --git a/src/isnd/Controllers/Packages/PackagesController.GetPackage.cs b/src/isnd/Controllers/Packages/PackagesController.GetPackage.cs index e4cea10..194277b 100644 --- a/src/isnd/Controllers/Packages/PackagesController.GetPackage.cs +++ b/src/isnd/Controllers/Packages/PackagesController.GetPackage.cs @@ -13,6 +13,8 @@ namespace isnd.Controllers // Web get the paquet [HttpGet("~" + Constants.ApiVersionPrefix + ApiConfig.Nuget + "/{id}/{lower}/{idf}-{lowerf}." + Constants.PaquetFileEstension)] + [HttpGet("~" + Constants.ApiVersionPrefix + ApiConfig.Content + "/{id}/{lower}/{idf}-{lowerf}." + + Constants.PaquetFileEstension)] public IActionResult GetPackage( [FromRoute][SafeName][Required] string id, [FromRoute][SafeName][Required] string lower, diff --git a/src/isnd/Controllers/Packages/PackagesController.GetVersions.cs b/src/isnd/Controllers/Packages/PackagesController.GetVersions.cs index c6be899..e72144f 100644 --- a/src/isnd/Controllers/Packages/PackagesController.GetVersions.cs +++ b/src/isnd/Controllers/Packages/PackagesController.GetVersions.cs @@ -7,7 +7,7 @@ namespace isnd.Controllers { public partial class PackagesController { - + [HttpGet("~" + Constants.ApiVersionPrefix + ApiConfig.Find)] public IActionResult GetVersions( string id, string lower, diff --git a/src/isnd/Controllers/Packages/PackagesController.Search.cs b/src/isnd/Controllers/Packages/PackagesController.Search.cs deleted file mode 100644 index c1979d8..0000000 --- a/src/isnd/Controllers/Packages/PackagesController.Search.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System.Linq; - -using System; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using isnd.Entities; -using isn.abst; -using isnd.Data.Catalog; - -namespace isnd.Controllers -{ - - public partial class PackagesController - { - // GET {@id}?q={QUERY}&skip={SKIP}&take={TAKE}&prerelease={PRERELEASE}&semVerLevel={SEMVERLEVEL}&packageType={PACKAGETYPE} - [HttpGet("~" + Constants.ApiVersionPrefix + ApiConfig.Find)] - [HttpPost("~" + Constants.ApiVersionPrefix + ApiConfig.Find)] - public async Task Search( - string id, - bool prerelease = false, - // string packageType = null, - string semVerLevel = null, - int skip = 0, - int take = 25 - ) - { - id = id.Trim('\''); - if (semVerLevel == "2.0.0") prerelease = true; - - //packageManager.SearchCatalogEntriesById(id, semVerLevel, packageType, prerelease); - var regs = await packageManager.SearchPackageAsync( - - new PackageRegistrationQuery - { - Query = id, - Prerelease = prerelease, - Take = take, - Skip = skip - } - ); - return Ok(new { totalHits = regs.Count(), data = regs }); - } - } -} \ No newline at end of file diff --git a/src/isnd/Data/Catalog/CatalogEntry.cs b/src/isnd/Data/Catalog/CatalogEntry.cs index 6a7bc18..2082e97 100644 --- a/src/isnd/Data/Catalog/CatalogEntry.cs +++ b/src/isnd/Data/Catalog/CatalogEntry.cs @@ -56,7 +56,7 @@ namespace isnd.Data.Catalog /// The dependencies of the package, grouped by target framework /// /// array of objects - public DependencyGroup[] dependencyGroups { get; set; } + public DependencyGroup[] dependencyGroups { get; set; } = Array.Empty(); /// /// The deprecation associated with the package @@ -128,6 +128,7 @@ namespace isnd.Data.Catalog public string PackageId { get; set; } public IEnumerable DependencySets { get; set; } + = Array.Empty(); public long? DownloadCount { get; set; } diff --git a/src/isnd/Services/PackageManager.cs b/src/isnd/Services/PackageManager.cs index bd7bd44..3a47968 100644 --- a/src/isnd/Services/PackageManager.cs +++ b/src/isnd/Services/PackageManager.cs @@ -47,12 +47,12 @@ namespace isnd.Services Comment = "URI template used by NuGet Client to construct details URL for packages" }, - new Resource(apiBase + ApiConfig.Nuget, + new Resource(apiBase + ApiConfig.Content, "PackageBaseAddress/3.0.0") { Comment = "Package Base Address service - " + - "Base URL of where NuGet packages are stored, in the format " + - "https:///nupkg/{id-lower}/{version-lower}/{id-lower}.{version-lower}.nupkg" + "Base URL of where NuGet packages are stored, in the format " + // "https:///nupkg/{id-lower}/{version-lower}/{id-lower}.{version-lower}.nupkg" }, new Resource(apiBase + ApiConfig.AutoComplete, @@ -67,6 +67,7 @@ namespace isnd.Services Comment = "Search Query service" }, + new Resource(apiBase + ApiConfig.Registration, "RegistrationsBaseUrl/Versioned") { @@ -100,7 +101,7 @@ namespace isnd.Services public string[] GetVersions( string id, - NuGetVersion parsedVersion, + NuGetVersion parsedVersion = null, bool prerelease = false, string packageType = null, int skip = 0, @@ -110,7 +111,7 @@ namespace isnd.Services v => v.PackageId == id && (prerelease || !v.IsPrerelease) && (packageType == null || v.Type == packageType) - && (parsedVersion.CompareTo + && (parsedVersion==null || parsedVersion.CompareTo (new SemanticVersion(v.Major, v.Minor, v.Patch)) < 0) ) .OrderBy(v => v.NugetVersion) @@ -287,6 +288,7 @@ namespace isnd.Services .Include(p => p.LatestCommit) .Where(p => p.Id.StartsWith(query.Query) && (query.Prerelease || p.Versions.Any(p => !p.IsPrerelease))) + .OrderBy(p => p.CommitNId) .Skip(query.Skip).Take(query.Take) .ToListAsync() ); diff --git a/src/isnd/Startup.cs b/src/isnd/Startup.cs index 963e3f2..d6ff1e0 100644 --- a/src/isnd/Startup.cs +++ b/src/isnd/Startup.cs @@ -93,7 +93,8 @@ namespace isnd .AddNewtonsoftJson(s => { s.SerializerSettings.ReferenceResolverProvider = () => new NSJWebApiReferenceResolver(); - }); + }) + .AddXmlSerializerFormatters(); services.AddSwaggerGen(options => { options.SwaggerDoc("v1", new OpenApiInfo diff --git a/src/isnd/Views/Home/Index.cshtml b/src/isnd/Views/Home/Index.cshtml index 62e7d2b..50c0d68 100644 --- a/src/isnd/Views/Home/Index.cshtml +++ b/src/isnd/Views/Home/Index.cshtml @@ -8,9 +8,4 @@

@Model.PkgCount identifiant(s) de paquet dans le SI

- -
- - -
\ No newline at end of file diff --git a/test/data/test-isn/ANuGet.Config b/test/data/test-isn/ANuGet.Config index ec3aa41..e778008 100644 --- a/test/data/test-isn/ANuGet.Config +++ b/test/data/test-isn/ANuGet.Config @@ -3,6 +3,6 @@ - + diff --git a/test/data/test-isn/test-isn.csproj b/test/data/test-isn/test-isn.csproj index 9836c56..4d141a3 100644 --- a/test/data/test-isn/test-isn.csproj +++ b/test/data/test-isn/test-isn.csproj @@ -10,4 +10,7 @@ 1.0.7+Branch.main.Sha.3695c1742965d93eba0ad851656cfaa3e44ba327 1.0.7 + + + \ No newline at end of file diff --git a/test/isn.tests/PushTest.cs b/test/isn.tests/PushTest.cs index 5a7585c..057d9df 100644 --- a/test/isn.tests/PushTest.cs +++ b/test/isn.tests/PushTest.cs @@ -54,7 +54,7 @@ namespace isn.tests [Fact] public void GetServerResourcesUsingHttpClientAsyncTest() { - var model = SourceHelpers.GetServerResources("Https://isn.pschneider.fr/index.json"); + var model = SourceHelpers.GetServerResources("Https://isn.pschneider.fr/v3/index"); Console.WriteLine(JsonConvert.SerializeObject(model)); Assert.NotNull(model.Resources); var pub = model.Resources.FirstOrDefault((r) => r.Type.StartsWith("PackagePublish/")); diff --git a/test/isnd.tests/isnd.tests.csproj b/test/isnd.tests/isnd.tests.csproj index f3572a8..b5e25b5 100644 --- a/test/isnd.tests/isnd.tests.csproj +++ b/test/isnd.tests/isnd.tests.csproj @@ -10,12 +10,13 @@ 1.0.7 - + +