gestion des versions :
* dossier des versions = FullString * Suppressioni de versions
This commit is contained in:
96
src/nuget-host/Controllers/PackageVersionController.cs
Normal file
96
src/nuget-host/Controllers/PackageVersionController.cs
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Security.Claims;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using nuget_host.Data;
|
||||||
|
using nuget_host.ViewModels;
|
||||||
|
|
||||||
|
namespace nuget_host
|
||||||
|
{
|
||||||
|
[AllowAnonymous]
|
||||||
|
public class PackageVersionController : Controller
|
||||||
|
{
|
||||||
|
private readonly ApplicationDbContext _context;
|
||||||
|
|
||||||
|
public PackageVersionController(ApplicationDbContext context)
|
||||||
|
{
|
||||||
|
_context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET: PackageVersion
|
||||||
|
public async Task<IActionResult> Index(PackageVersionIndexViewModel model)
|
||||||
|
{
|
||||||
|
var applicationDbContext = _context.PackageVersions.Include(p => p.Package).Where(p => p.PackageId == model.PackageId);
|
||||||
|
|
||||||
|
model.Versions = await applicationDbContext.ToListAsync();
|
||||||
|
|
||||||
|
return View(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET: PackageVersion/Details/5
|
||||||
|
public async Task<IActionResult> Details(string pkgid, string version)
|
||||||
|
{
|
||||||
|
if (pkgid == null || version == null)
|
||||||
|
{
|
||||||
|
return NotFound();
|
||||||
|
}
|
||||||
|
|
||||||
|
var packageVersion = await _context.PackageVersions
|
||||||
|
.Include(p => p.Package)
|
||||||
|
.FirstOrDefaultAsync(m => m.PackageId == pkgid && m.FullString == version);
|
||||||
|
if (packageVersion == null)
|
||||||
|
{
|
||||||
|
return NotFound();
|
||||||
|
}
|
||||||
|
|
||||||
|
return View(packageVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Authorize]
|
||||||
|
public async Task<IActionResult> Delete(string pkgid, string version)
|
||||||
|
{
|
||||||
|
if (pkgid == null || version == null)
|
||||||
|
{
|
||||||
|
return NotFound();
|
||||||
|
}
|
||||||
|
|
||||||
|
var packageVersion = await _context.PackageVersions
|
||||||
|
.Include(p => p.Package)
|
||||||
|
.FirstOrDefaultAsync(m => m.PackageId == pkgid && m.FullString == version);
|
||||||
|
if (packageVersion == null)
|
||||||
|
{
|
||||||
|
return NotFound();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!IsOwner(packageVersion)) return Unauthorized();
|
||||||
|
|
||||||
|
return View(packageVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsOwner(PackageVersion v)
|
||||||
|
{
|
||||||
|
var userId = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||||
|
return v.Package.OwnerId == userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
// POST: PackageVersion/Delete/5
|
||||||
|
[HttpPost, ActionName("Delete")]
|
||||||
|
[ValidateAntiForgeryToken]
|
||||||
|
public async Task<IActionResult> DeleteConfirmed(string PackageId, string FullString)
|
||||||
|
{
|
||||||
|
var packageVersion = await _context.PackageVersions.Include(p => p.Package)
|
||||||
|
.FirstOrDefaultAsync(m => m.PackageId == PackageId && m.FullString == FullString);
|
||||||
|
if (packageVersion == null) return NotFound();
|
||||||
|
if (!IsOwner(packageVersion)) return Unauthorized();
|
||||||
|
|
||||||
|
_context.PackageVersions.Remove(packageVersion);
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
return RedirectToAction(nameof(Index));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -84,7 +84,7 @@ namespace nuget_host.Controllers
|
|||||||
var version = reader.GetVersion();
|
var version = reader.GetVersion();
|
||||||
string pkgidpath = Path.Combine(nugetSettings.PackagesRootDir,
|
string pkgidpath = Path.Combine(nugetSettings.PackagesRootDir,
|
||||||
pkgid);
|
pkgid);
|
||||||
string pkgpath = Path.Combine(pkgidpath, version.Version.ToString());
|
string pkgpath = Path.Combine(pkgidpath, version.ToFullString());
|
||||||
string name = $"{pkgid}-{version}.nupkg";
|
string name = $"{pkgid}-{version}.nupkg";
|
||||||
string fullpath = Path.Combine(pkgpath, name);
|
string fullpath = Path.Combine(pkgpath, name);
|
||||||
Package package;
|
Package package;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using Microsoft.AspNetCore.Identity;
|
||||||
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using nuget_host.Data;
|
using nuget_host.Data;
|
||||||
@ -14,7 +15,15 @@ namespace nuget_host.Data
|
|||||||
: base(options)
|
: base(options)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
base.OnModelCreating(modelBuilder);
|
||||||
|
modelBuilder.Entity<PackageVersion>().HasKey(v => new
|
||||||
|
{
|
||||||
|
v.PackageId,
|
||||||
|
v.FullString
|
||||||
|
});
|
||||||
|
}
|
||||||
public DbSet<ApiKey> ApiKeys { get; set; }
|
public DbSet<ApiKey> ApiKeys { get; set; }
|
||||||
public DbSet<Package> Packages { get; set; }
|
public DbSet<Package> Packages { get; set; }
|
||||||
public DbSet<PackageVersion> PackageVersions { get; set; }
|
public DbSet<PackageVersion> PackageVersions { get; set; }
|
||||||
|
@ -18,8 +18,8 @@ namespace nuget_host.Data
|
|||||||
[Required]
|
[Required]
|
||||||
public int Patch { get; set; }
|
public int Patch { get; set; }
|
||||||
|
|
||||||
[StringLength(32)]
|
[StringLength(256)]
|
||||||
[Required][Key]
|
[Required]
|
||||||
public string FullString { get; set; }
|
public string FullString { get; set; }
|
||||||
public bool IsPrerelease { get; set; }
|
public bool IsPrerelease { get; set; }
|
||||||
|
|
||||||
|
312
src/nuget-host/Migrations/20210522194803_packageVersionKey.Designer.cs
generated
Normal file
312
src/nuget-host/Migrations/20210522194803_packageVersionKey.Designer.cs
generated
Normal file
@ -0,0 +1,312 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
using nuget_host.Data;
|
||||||
|
|
||||||
|
namespace nugethost.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(ApplicationDbContext))]
|
||||||
|
[Migration("20210522194803_packageVersionKey")]
|
||||||
|
partial class packageVersionKey
|
||||||
|
{
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn)
|
||||||
|
.HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("Id")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<string>("ConcurrencyStamp")
|
||||||
|
.IsConcurrencyToken();
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasMaxLength(256);
|
||||||
|
|
||||||
|
b.Property<string>("NormalizedName")
|
||||||
|
.HasMaxLength(256);
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("NormalizedName")
|
||||||
|
.IsUnique()
|
||||||
|
.HasName("RoleNameIndex");
|
||||||
|
|
||||||
|
b.ToTable("AspNetRoles");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<string>("ClaimType");
|
||||||
|
|
||||||
|
b.Property<string>("ClaimValue");
|
||||||
|
|
||||||
|
b.Property<string>("RoleId")
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("RoleId");
|
||||||
|
|
||||||
|
b.ToTable("AspNetRoleClaims");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<string>("ClaimType");
|
||||||
|
|
||||||
|
b.Property<string>("ClaimValue");
|
||||||
|
|
||||||
|
b.Property<string>("UserId")
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("AspNetUserClaims");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("LoginProvider");
|
||||||
|
|
||||||
|
b.Property<string>("ProviderKey");
|
||||||
|
|
||||||
|
b.Property<string>("ProviderDisplayName");
|
||||||
|
|
||||||
|
b.Property<string>("UserId")
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasKey("LoginProvider", "ProviderKey");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("AspNetUserLogins");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("UserId");
|
||||||
|
|
||||||
|
b.Property<string>("RoleId");
|
||||||
|
|
||||||
|
b.HasKey("UserId", "RoleId");
|
||||||
|
|
||||||
|
b.HasIndex("RoleId");
|
||||||
|
|
||||||
|
b.ToTable("AspNetUserRoles");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("UserId");
|
||||||
|
|
||||||
|
b.Property<string>("LoginProvider");
|
||||||
|
|
||||||
|
b.Property<string>("Name");
|
||||||
|
|
||||||
|
b.Property<string>("Value");
|
||||||
|
|
||||||
|
b.HasKey("UserId", "LoginProvider", "Name");
|
||||||
|
|
||||||
|
b.ToTable("AspNetUserTokens");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("nuget_host.Data.ApiKeys.ApiKey", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("Id")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreationDate");
|
||||||
|
|
||||||
|
b.Property<string>("Name");
|
||||||
|
|
||||||
|
b.Property<string>("UserId")
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Property<int>("ValidityPeriodInDays");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("ApiKeys");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("nuget_host.Data.ApplicationUser", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("Id")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<int>("AccessFailedCount");
|
||||||
|
|
||||||
|
b.Property<string>("ConcurrencyStamp")
|
||||||
|
.IsConcurrencyToken();
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.HasMaxLength(256);
|
||||||
|
|
||||||
|
b.Property<bool>("EmailConfirmed");
|
||||||
|
|
||||||
|
b.Property<string>("FullName");
|
||||||
|
|
||||||
|
b.Property<bool>("LockoutEnabled");
|
||||||
|
|
||||||
|
b.Property<DateTimeOffset?>("LockoutEnd");
|
||||||
|
|
||||||
|
b.Property<string>("NormalizedEmail")
|
||||||
|
.HasMaxLength(256);
|
||||||
|
|
||||||
|
b.Property<string>("NormalizedUserName")
|
||||||
|
.HasMaxLength(256);
|
||||||
|
|
||||||
|
b.Property<string>("PasswordHash");
|
||||||
|
|
||||||
|
b.Property<string>("PhoneNumber");
|
||||||
|
|
||||||
|
b.Property<bool>("PhoneNumberConfirmed");
|
||||||
|
|
||||||
|
b.Property<string>("SecurityStamp");
|
||||||
|
|
||||||
|
b.Property<bool>("TwoFactorEnabled");
|
||||||
|
|
||||||
|
b.Property<string>("UserName")
|
||||||
|
.HasMaxLength(256);
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("NormalizedEmail")
|
||||||
|
.HasName("EmailIndex");
|
||||||
|
|
||||||
|
b.HasIndex("NormalizedUserName")
|
||||||
|
.IsUnique()
|
||||||
|
.HasName("UserNameIndex");
|
||||||
|
|
||||||
|
b.ToTable("AspNetUsers");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("nuget_host.Data.Package", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("Id")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<string>("Description");
|
||||||
|
|
||||||
|
b.Property<string>("OwnerId")
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("OwnerId");
|
||||||
|
|
||||||
|
b.ToTable("Packages");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("nuget_host.Data.PackageVersion", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("PackageId");
|
||||||
|
|
||||||
|
b.Property<string>("FullString")
|
||||||
|
.HasMaxLength(256);
|
||||||
|
|
||||||
|
b.Property<bool>("IsPrerelease");
|
||||||
|
|
||||||
|
b.Property<int>("Major");
|
||||||
|
|
||||||
|
b.Property<int>("Minor");
|
||||||
|
|
||||||
|
b.Property<int>("Patch");
|
||||||
|
|
||||||
|
b.HasKey("PackageId", "FullString");
|
||||||
|
|
||||||
|
b.ToTable("PackageVersions");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("RoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("nuget_host.Data.ApplicationUser")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("nuget_host.Data.ApplicationUser")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("RoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
|
||||||
|
b.HasOne("nuget_host.Data.ApplicationUser")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("nuget_host.Data.ApplicationUser")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("nuget_host.Data.ApiKeys.ApiKey", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("nuget_host.Data.ApplicationUser", "User")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("nuget_host.Data.Package", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("nuget_host.Data.ApplicationUser", "Owner")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("OwnerId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("nuget_host.Data.PackageVersion", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("nuget_host.Data.Package", "Package")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("PackageId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace nugethost.Migrations
|
||||||
|
{
|
||||||
|
public partial class packageVersionKey : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropPrimaryKey(
|
||||||
|
name: "PK_PackageVersions",
|
||||||
|
table: "PackageVersions");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_PackageVersions_PackageId",
|
||||||
|
table: "PackageVersions");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "FullString",
|
||||||
|
table: "PackageVersions",
|
||||||
|
maxLength: 256,
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldMaxLength: 32);
|
||||||
|
|
||||||
|
migrationBuilder.AddPrimaryKey(
|
||||||
|
name: "PK_PackageVersions",
|
||||||
|
table: "PackageVersions",
|
||||||
|
columns: new[] { "PackageId", "FullString" });
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropPrimaryKey(
|
||||||
|
name: "PK_PackageVersions",
|
||||||
|
table: "PackageVersions");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "FullString",
|
||||||
|
table: "PackageVersions",
|
||||||
|
maxLength: 32,
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldMaxLength: 256);
|
||||||
|
|
||||||
|
migrationBuilder.AddPrimaryKey(
|
||||||
|
name: "PK_PackageVersions",
|
||||||
|
table: "PackageVersions",
|
||||||
|
column: "FullString");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PackageVersions_PackageId",
|
||||||
|
table: "PackageVersions",
|
||||||
|
column: "PackageId");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -218,9 +218,10 @@ namespace nugethost.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("nuget_host.Data.PackageVersion", b =>
|
modelBuilder.Entity("nuget_host.Data.PackageVersion", b =>
|
||||||
{
|
{
|
||||||
|
b.Property<string>("PackageId");
|
||||||
|
|
||||||
b.Property<string>("FullString")
|
b.Property<string>("FullString")
|
||||||
.ValueGeneratedOnAdd()
|
.HasMaxLength(256);
|
||||||
.HasMaxLength(32);
|
|
||||||
|
|
||||||
b.Property<bool>("IsPrerelease");
|
b.Property<bool>("IsPrerelease");
|
||||||
|
|
||||||
@ -228,14 +229,9 @@ namespace nugethost.Migrations
|
|||||||
|
|
||||||
b.Property<int>("Minor");
|
b.Property<int>("Minor");
|
||||||
|
|
||||||
b.Property<string>("PackageId")
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Property<int>("Patch");
|
b.Property<int>("Patch");
|
||||||
|
|
||||||
b.HasKey("FullString");
|
b.HasKey("PackageId", "FullString");
|
||||||
|
|
||||||
b.HasIndex("PackageId");
|
|
||||||
|
|
||||||
b.ToTable("PackageVersions");
|
b.ToTable("PackageVersions");
|
||||||
});
|
});
|
||||||
|
@ -30,7 +30,6 @@ namespace nuget_host
|
|||||||
}
|
}
|
||||||
|
|
||||||
public IConfiguration Configuration { get; }
|
public IConfiguration Configuration { get; }
|
||||||
public static string RootApiKeySecret { get; private set; }
|
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to add services to the container.
|
// This method gets called by the runtime. Use this method to add services to the container.
|
||||||
public void ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
|
11
src/nuget-host/ViewModels/PackageVersionIndexViewModel.cs
Normal file
11
src/nuget-host/ViewModels/PackageVersionIndexViewModel.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using nuget_host.Data;
|
||||||
|
|
||||||
|
namespace nuget_host.ViewModels
|
||||||
|
{
|
||||||
|
public class PackageVersionIndexViewModel
|
||||||
|
{
|
||||||
|
public List<PackageVersion> Versions {get; set;}
|
||||||
|
public string PackageId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
52
src/nuget-host/Views/PackageVersion/Delete.cshtml
Normal file
52
src/nuget-host/Views/PackageVersion/Delete.cshtml
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
@model nuget_host.Data.PackageVersion
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Delete";
|
||||||
|
}
|
||||||
|
|
||||||
|
<h2>Delete</h2>
|
||||||
|
|
||||||
|
<h3>Are you sure you want to delete this?</h3>
|
||||||
|
<div>
|
||||||
|
<h4>PackageVersion</h4>
|
||||||
|
<hr />
|
||||||
|
<dl class="dl-horizontal">
|
||||||
|
<dt>
|
||||||
|
@Html.DisplayNameFor(model => model.Major)
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
@Html.DisplayFor(model => model.Major)
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
@Html.DisplayNameFor(model => model.Minor)
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
@Html.DisplayFor(model => model.Minor)
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
@Html.DisplayNameFor(model => model.Patch)
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
@Html.DisplayFor(model => model.Patch)
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
@Html.DisplayNameFor(model => model.IsPrerelease)
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
@Html.DisplayFor(model => model.IsPrerelease)
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
@Html.DisplayNameFor(model => model.Package)
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
@Html.DisplayFor(model => model.Package.Id)
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<form asp-action="Delete">
|
||||||
|
<input type="hidden" asp-for="PackageId" />
|
||||||
|
<input type="hidden" asp-for="FullString" />
|
||||||
|
<input type="submit" value="Delete" class="btn btn-default" /> |
|
||||||
|
<a asp-action="Index">Back to List</a>
|
||||||
|
</form>
|
||||||
|
</div>
|
48
src/nuget-host/Views/PackageVersion/Details.cshtml
Normal file
48
src/nuget-host/Views/PackageVersion/Details.cshtml
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
@model nuget_host.Data.PackageVersion
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Details";
|
||||||
|
}
|
||||||
|
|
||||||
|
<h2>Details</h2>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h4>PackageVersion</h4>
|
||||||
|
<hr />
|
||||||
|
<dl class="dl-horizontal">
|
||||||
|
<dt>
|
||||||
|
@Html.DisplayNameFor(model => model.Major)
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
@Html.DisplayFor(model => model.Major)
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
@Html.DisplayNameFor(model => model.Minor)
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
@Html.DisplayFor(model => model.Minor)
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
@Html.DisplayNameFor(model => model.Patch)
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
@Html.DisplayFor(model => model.Patch)
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
@Html.DisplayNameFor(model => model.IsPrerelease)
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
@Html.DisplayFor(model => model.IsPrerelease)
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
@Html.DisplayNameFor(model => model.Package)
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
@Html.DisplayFor(model => model.Package.Id)
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
@Html.ActionLink("Edit", "Edit", new { /* id = Model.PrimaryKey */ }) |
|
||||||
|
<a asp-action="Index">Back to List</a>
|
||||||
|
</div>
|
66
src/nuget-host/Views/PackageVersion/Index.cshtml
Normal file
66
src/nuget-host/Views/PackageVersion/Index.cshtml
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
@model PackageVersionIndexViewModel
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Index";
|
||||||
|
}
|
||||||
|
|
||||||
|
<h2>Index</h2>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<form method="get">
|
||||||
|
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label asp-for="PackageId" class="control-label"></label>
|
||||||
|
<input asp-for="PackageId" class="form-control" />
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="submit" value="Find" class="btn btn-default" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
@Html.DisplayNameFor(model => model.Versions[0].Major)
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
@Html.DisplayNameFor(model => model.Versions[0].Minor)
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
@Html.DisplayNameFor(model => model.Versions[0].Patch)
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
@Html.DisplayNameFor(model => model.Versions[0].IsPrerelease)
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
@Html.DisplayNameFor(model => model.Versions[0].Package)
|
||||||
|
</th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach (var item in Model.Versions) {
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.Major)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.Minor)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.Patch)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.IsPrerelease)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.ActionLink("Details", "Details", new { pkgid = Model.PackageId, version = item.FullString }) |
|
||||||
|
@Html.ActionLink("Delete", "Delete", new { pkgid = Model.PackageId, version = item.FullString })
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
@ -1,2 +1,3 @@
|
|||||||
@using nuget_host.Data
|
@using nuget_host.Data
|
||||||
|
@using nuget_host.ViewModels
|
||||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||||
|
BIN
src/nuget-host/packages/nuget-cli/1.0.0/nuget-cli-1.0.0.nupkg
vendored
Normal file
BIN
src/nuget-host/packages/nuget-cli/1.0.0/nuget-cli-1.0.0.nupkg
vendored
Normal file
Binary file not shown.
Reference in New Issue
Block a user