unit tests and pkg version commits

This commit is contained in:
Paul Schneider 2021-08-28 18:41:22 +01:00
commit f6fa7a0ec9
17 changed files with 553 additions and 89 deletions

View file

@ -10,17 +10,13 @@ namespace isnd.Controllers
{
public class HomeController : Controller
{
private readonly ILogger _logger;
private readonly ApplicationDbContext _dbContext;
private readonly IHostingEnvironment _env;
private readonly IUnleash _unleashĈlient;
public HomeController(
ApplicationDbContext dbContext,
IUnleash unleashĈlient,
ILogger<HomeController> logger)
IUnleash unleashĈlient)
{
_logger = logger;
_dbContext = dbContext;
_unleashĈlient = unleashĈlient;
}

View file

@ -14,6 +14,7 @@ using NuGet.Versioning;
using isnd.Data;
using isnd.Helpers;
using Microsoft.AspNetCore.Http;
using isnd.Data.Catalog;
namespace isnd.Controllers
{
@ -39,6 +40,12 @@ namespace isnd.Controllers
_logger.LogError("403 : no api-key");
return Unauthorized();
}
Commit commit = new Commit
{
Action = PackageAction.PublishPackage,
TimeStamp = DateTime.Now
};
_dbContext.Commits.Add(commit);
foreach (IFormFile file in Request.Form.Files)
{
@ -93,7 +100,8 @@ namespace isnd.Controllers
{
Id = pkgid,
Description = pkgdesc,
OwnerId = apikey.UserId
OwnerId = apikey.UserId,
LatestVersion = commit
};
_dbContext.Packages.Add(package);
}