Release !

This commit is contained in:
2023-05-09 23:44:25 +01:00
parent 7987fa04a0
commit 72839e8251
14 changed files with 42 additions and 72 deletions

View File

@ -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

View File

@ -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
/// </summary>
/// <returns></returns>
[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 });

View File

@ -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,

View File

@ -7,7 +7,7 @@ namespace isnd.Controllers
{
public partial class PackagesController
{
[HttpGet("~" + Constants.ApiVersionPrefix + ApiConfig.Find)]
public IActionResult GetVersions(
string id,
string lower,

View File

@ -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<IActionResult> 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 });
}
}
}

View File

@ -56,7 +56,7 @@ namespace isnd.Data.Catalog
/// The dependencies of the package, grouped by target framework
/// </summary>
/// <value>array of objects</value>
public DependencyGroup[] dependencyGroups { get; set; }
public DependencyGroup[] dependencyGroups { get; set; } = Array.Empty<DependencyGroup>();
/// <summary>
/// The deprecation associated with the package
@ -128,6 +128,7 @@ namespace isnd.Data.Catalog
public string PackageId { get; set; }
public IEnumerable<PackageDependencyGroup> DependencySets { get; set; }
= Array.Empty<PackageDependencyGroup>();
public long? DownloadCount { get; set; }

View File

@ -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://<host>/nupkg/{id-lower}/{version-lower}/{id-lower}.{version-lower}.nupkg"
"Base URL of where NuGet packages are stored, in the format "
// "https://<host>/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()
);

View File

@ -93,7 +93,8 @@ namespace isnd
.AddNewtonsoftJson(s =>
{
s.SerializerSettings.ReferenceResolverProvider = () => new NSJWebApiReferenceResolver();
});
})
.AddXmlSerializerFormatters();
services.AddSwaggerGen(options =>
{
options.SwaggerDoc("v1", new OpenApiInfo

View File

@ -8,9 +8,4 @@
<p>
<strong>@Model.PkgCount identifiant(s) de paquet dans le SI</strong>
</p>
</div>
<div style="text-align: center;">
<iframe width="560" height="315" src="https://crowdbunker.com/embed/i5PhucYQhBw" frameborder="0" allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen scrolling="no" ></iframe>
<iframe width="560" height="315" src="https://crowdbunker.com/embed/BumpeEansBp" frameborder="0" allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen scrolling="no" ></iframe>
<iframe width="560" height="315" src="https://crowdbunker.com/embed/admChkeiYFP" frameborder="0" allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen scrolling="no" ></iframe>
</div>