catalog impl

This commit is contained in:
2022-08-20 12:54:24 +01:00
parent fa9a12ad49
commit 14206ac477
27 changed files with 320 additions and 44 deletions

View File

@ -2,6 +2,7 @@ using System;
using System.Linq;
using System.Threading.Tasks;
using isnd.Data;
using isnd.Data.Catalog;
using isnd.Helpers;
using isnd.ViewModels;
using Microsoft.AspNetCore.Authorization;
@ -14,15 +15,17 @@ namespace isnd.Controllers
public partial class PackagesController
{
// Web search
public async Task<IActionResult> Index(PackageIndexViewModel model)
public async Task<IActionResult> Index(PackageRegistrationIndexViewModel model)
{
var applicationDbContext = dbContext.Packages.Include(p => p.Versions).Where(
p => ( model.Prerelease || p.Versions.Any(v => !v.IsPrerelease))
var applicationDbContext = dbContext.Packages.Include(p => p.Versions)
.Include(p => p.Owner)
.Where(
p => (model.Prerelease || p.Versions.Any(v => !v.IsPrerelease))
&& ((model.Query == null) || p.Id.StartsWith(model.Query)));
model.Data = await applicationDbContext.ToArrayAsync();
model.Data = await applicationDbContext.Select(p => p.ToLeave()).ToArrayAsync();
return View(model);
}
public async Task<IActionResult> Details(string pkgid)
{
if (pkgid == null)