|
|
|
@ -186,7 +186,7 @@ namespace isnd.Services
|
|
|
|
|
string baseid = extUrl + ApiConfig.Catalog;
|
|
|
|
|
string bidreg = $"{extUrl}v3.4.0/{ApiConfig.Registration}";
|
|
|
|
|
string basepageid = extUrl + ApiConfig.CatalogPage;
|
|
|
|
|
CurrentCatalogIndex = new RegistrationPageIndex(baseid,"index");
|
|
|
|
|
CurrentCatalogIndex = new RegistrationPageIndex();
|
|
|
|
|
CurrentCatalogPages = new List<RegistrationPage>();
|
|
|
|
|
|
|
|
|
|
var scope = dbContext.Commits.OrderBy(c => c.TimeStamp);
|
|
|
|
@ -199,7 +199,6 @@ namespace isnd.Services
|
|
|
|
|
{
|
|
|
|
|
page = new RegistrationPage(basepageid, extUrl)
|
|
|
|
|
{
|
|
|
|
|
Parent = baseid,
|
|
|
|
|
CommitId = commit.CommitId,
|
|
|
|
|
CommitTimeStamp = commit.CommitTimeStamp
|
|
|
|
|
};
|
|
|
|
@ -317,10 +316,10 @@ namespace isnd.Services
|
|
|
|
|
.Include(v => v.Package)
|
|
|
|
|
.Include(v => v.Package.Owner)
|
|
|
|
|
.Include(v => v.LatestCommit)
|
|
|
|
|
.Where(v => v.PackageId == pkgId && semver.Equals(v.FullString, StringComparison.OrdinalIgnoreCase)
|
|
|
|
|
.Where(v => v.PackageId.Equals(pkgId, StringComparison.InvariantCultureIgnoreCase) && semver.Equals(v.FullString, StringComparison.InvariantCultureIgnoreCase)
|
|
|
|
|
&& (pkgType == null || pkgType == v.Type))
|
|
|
|
|
.OrderByDescending(p=> p.CommitId)
|
|
|
|
|
.Select(p => p.Package.ToLeave(bid))
|
|
|
|
|
.OrderByDescending(p=> p.CommitNId)
|
|
|
|
|
.Select(p => p.ToLeave(bid, extUrl))
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
public PackageVersion GetPackage(string pkgId, string semver, string pkgType)
|
|
|
|
@ -336,8 +335,7 @@ namespace isnd.Services
|
|
|
|
|
{
|
|
|
|
|
// RegistrationPageIndexAndQuery
|
|
|
|
|
var scope = dbContext.Packages.Include(p => p.Versions).Include(p => p.Owner)
|
|
|
|
|
.Where(p => (PackageIdHelpers.CamelCaseMatch(p.Id, query.Query)
|
|
|
|
|
|| PackageIdHelpers.SeparatedByMinusMatch(p.Id, query.Query))
|
|
|
|
|
.Where(p => p.Id.Equals(query.Query, StringComparison.InvariantCultureIgnoreCase)
|
|
|
|
|
&& (query.Prerelease || p.Versions.Any(v => !v.IsPrerelease)));
|
|
|
|
|
var total = scope.Count();
|
|
|
|
|
var pkgs = scope.Skip(query.Skip).Take(query.Take).ToArray();
|
|
|
|
@ -345,5 +343,20 @@ namespace isnd.Services
|
|
|
|
|
return
|
|
|
|
|
new RegistrationPageIndex(bid, query.Query, extUrl, pkgs);
|
|
|
|
|
}
|
|
|
|
|
public RegistrationPageIndex SearchPackage(RegistrationPageIndexQuery query)
|
|
|
|
|
{
|
|
|
|
|
string bid = $"{extUrl}v3.4.0/{ApiConfig.Registration}";
|
|
|
|
|
// RegistrationPageIndexAndQuery
|
|
|
|
|
if (query.Query == null) query.Query = "";
|
|
|
|
|
var scope = dbContext.Packages.Include(p => p.Versions).Include(p => p.Owner)
|
|
|
|
|
.Where(p => p.Id.StartsWith(query.Query, StringComparison.InvariantCultureIgnoreCase)
|
|
|
|
|
&& (query.Prerelease || p.Versions.Any(v => !v.IsPrerelease)))
|
|
|
|
|
.Where(p => p.Versions.Count>0);
|
|
|
|
|
var total = scope.Count();
|
|
|
|
|
var pkgs = scope.Skip(query.Skip).Take(query.Take).ToArray();
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
new RegistrationPageIndex(bid, query.Query, extUrl, pkgs);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|