From e4511a8aaac9f6900b85fc81adff93fd8b58f0ff Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Sun, 16 May 2021 14:07:14 +0100 Subject: [PATCH] owner id --- .../Controllers/AccountController.cs | 2 +- .../Controllers/ApiKeysController.cs | 4 +- src/nuget-host/Controllers/HomeController.cs | 2 +- .../Controllers/PackagesController.cs | 68 +++- .../Account/AccountOptions.cs | 2 +- .../Account/ExternalProvider.cs | 2 +- .../Account/LoggedOutViewModel.cs | 2 +- .../Account/LoginInputModel.cs | 2 +- .../Account/LoginViewModel.cs | 2 +- .../Account/LogoutInputModel.cs | 2 +- .../Account/LogoutViewModel.cs | 2 +- .../Account/RedirectViewModel.cs | 2 +- .../Account/RegisterViewModel.cs | 2 +- .../{Models => Data}/ApiKeys/ApiKey.cs | 2 +- .../ApiKeys/ApiKeyViewModel.cs | 2 +- .../{Models => Data}/ApiKeys/CreateModel.cs | 2 +- .../{Models => Data}/ApiKeys/DeleteModel.cs | 2 +- .../{Models => Data}/ApiKeys/DetailModel.cs | 2 +- .../{Models => Data}/ApiKeys/EditModel.cs | 2 +- .../{Models => Data}/ApiKeys/IndexModel.cs | 2 +- src/nuget-host/Data/ApplicationDbContext.cs | 8 +- .../{Models => Data}/ApplicationUser.cs | 2 +- src/nuget-host/Data/Package.cs | 18 + src/nuget-host/Data/PackageVersion.cs | 30 ++ src/nuget-host/Extensions/Extensions.cs | 2 +- .../20210424155323_init.Designer.cs | 10 +- .../20210502153508_api-keys.Designer.cs | 16 +- ...508012908_ApkiKey.CreationDate.Designer.cs | 16 +- .../20210516060430_packages.Designer.cs | 316 ++++++++++++++++++ .../Migrations/20210516060430_packages.cs | 70 ++++ .../ApplicationDbContextModelSnapshot.cs | 73 +++- src/nuget-host/Startup.cs | 2 +- src/nuget-host/Views/ApiKeys/Create.cshtml | 2 +- src/nuget-host/Views/ApiKeys/Delete.cshtml | 2 +- src/nuget-host/Views/ApiKeys/Details.cshtml | 2 +- src/nuget-host/Views/ApiKeys/Edit.cshtml | 2 +- src/nuget-host/Views/ApiKeys/Index.cshtml | 2 +- src/nuget-host/Views/_ViewImports.cshtml | 2 +- 38 files changed, 615 insertions(+), 68 deletions(-) rename src/nuget-host/{Models => Data}/Account/AccountOptions.cs (95%) rename src/nuget-host/{Models => Data}/Account/ExternalProvider.cs (92%) rename src/nuget-host/{Models => Data}/Account/LoggedOutViewModel.cs (95%) rename src/nuget-host/{Models => Data}/Account/LoginInputModel.cs (94%) rename src/nuget-host/{Models => Data}/Account/LoginViewModel.cs (96%) rename src/nuget-host/{Models => Data}/Account/LogoutInputModel.cs (90%) rename src/nuget-host/{Models => Data}/Account/LogoutViewModel.cs (91%) rename src/nuget-host/{Models => Data}/Account/RedirectViewModel.cs (90%) rename src/nuget-host/{Models => Data}/Account/RegisterViewModel.cs (97%) rename src/nuget-host/{Models => Data}/ApiKeys/ApiKey.cs (93%) rename src/nuget-host/{Models => Data}/ApiKeys/ApiKeyViewModel.cs (87%) rename src/nuget-host/{Models => Data}/ApiKeys/CreateModel.cs (88%) rename src/nuget-host/{Models => Data}/ApiKeys/DeleteModel.cs (69%) rename src/nuget-host/{Models => Data}/ApiKeys/DetailModel.cs (76%) rename src/nuget-host/{Models => Data}/ApiKeys/EditModel.cs (83%) rename src/nuget-host/{Models => Data}/ApiKeys/IndexModel.cs (77%) rename src/nuget-host/{Models => Data}/ApplicationUser.cs (89%) create mode 100644 src/nuget-host/Data/Package.cs create mode 100644 src/nuget-host/Data/PackageVersion.cs create mode 100644 src/nuget-host/Migrations/20210516060430_packages.Designer.cs create mode 100644 src/nuget-host/Migrations/20210516060430_packages.cs diff --git a/src/nuget-host/Controllers/AccountController.cs b/src/nuget-host/Controllers/AccountController.cs index 16dcbf2..4cebb17 100644 --- a/src/nuget-host/Controllers/AccountController.cs +++ b/src/nuget-host/Controllers/AccountController.cs @@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; -using nuget_host.Models; +using nuget_host.Data; using System; using System.Linq; using System.Threading.Tasks; diff --git a/src/nuget-host/Controllers/ApiKeysController.cs b/src/nuget-host/Controllers/ApiKeysController.cs index f4ad220..3a76bb7 100644 --- a/src/nuget-host/Controllers/ApiKeysController.cs +++ b/src/nuget-host/Controllers/ApiKeysController.cs @@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Options; using nuget_host.Data; using nuget_host.Entities; -using nuget_host.Models; -using nuget_host.Models.ApiKeys; +using nuget_host.Data; +using nuget_host.Data.ApiKeys; namespace nuget_host.Controllers diff --git a/src/nuget-host/Controllers/HomeController.cs b/src/nuget-host/Controllers/HomeController.cs index 7404240..ce9c014 100644 --- a/src/nuget-host/Controllers/HomeController.cs +++ b/src/nuget-host/Controllers/HomeController.cs @@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using nuget_host.Entities; -using nuget_host.Models; +using nuget_host.Data; namespace nuget_host.Controllers { diff --git a/src/nuget-host/Controllers/PackagesController.cs b/src/nuget-host/Controllers/PackagesController.cs index 709a203..d4580af 100644 --- a/src/nuget-host/Controllers/PackagesController.cs +++ b/src/nuget-host/Controllers/PackagesController.cs @@ -4,6 +4,7 @@ using System.IO; using System.IO.Compression; using System.Linq; using System.Security.Claims; +using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.Mvc; @@ -40,27 +41,29 @@ namespace nuget_host.Controllers } [HttpPut("packages")] - public IActionResult Put() + public async Task Put() { string path = null; var clientVersionId = Request.Headers["X-NuGet-Client-Version"]; var apiKey = Request.Headers["X-NuGet-ApiKey"]; - ViewData["clientVersionId"] = clientVersionId; + ViewData["versionId"] = typeof(PackagesController).Assembly.FullName; var files = new List(); ViewData["files"] = files; var clearkey = protector.Unprotect(apiKey); var apikey = dbContext.ApiKeys.SingleOrDefault(k => k.Id == clearkey); if (apikey == null) - return new BadRequestObjectResult(new { error = "api-key" }); + return Unauthorized(); foreach (var file in Request.Form.Files) { try { files.Add(file.Name); - string initpath = file.Name; + string initpath = Path.Combine(Environment.GetEnvironmentVariable("TEMP"), + $"nuget_host-{Guid.NewGuid()}.nupkg"); + using (FileStream fw = new FileStream(initpath, FileMode.Create)) { file.CopyTo(fw); @@ -86,15 +89,66 @@ namespace nuget_host.Controllers Path.Combine(pkgid, Path.Combine(version.Version.ToString()), $"{pkgid}-{version}.nupkg")); + var source = new FileInfo(initpath); var dest = new FileInfo(path); var destdir = new DirectoryInfo(dest.DirectoryName); if (dest.Exists) return BadRequest(new { error = "existant" }); - if (!destdir.Exists) destdir.Create(); - source.MoveTo(path); - logger.LogWarning($"200: {entry.Name}"); + if (!destdir.Exists) + { + destdir.Create(); + source.MoveTo(path); + var newpkg = new Package + { + Id = pkgid, + Description = pkgdesc, + OwnerId = apikey.UserId + }; + dbContext.Packages.Add(newpkg); + + var newversion = new PackageVersion + { + Package = newpkg, + Major = version.Major, + Minor = version.Minor, + Patch = version.Patch, + IsPrerelease = version.IsPrerelease, + FullString = version.ToFullString() + }; + dbContext.PackageVersions.Add(newversion); + + await dbContext.SaveChangesAsync(); + logger.LogInformation($"new package : {entry.Name}"); + } + else + { + var pkg = dbContext.Packages.SingleOrDefault(p => p.Id == pkgid); + if (pkg == null) + { + // TODO Choose an app policy to take ownership + // on existing package on disk. + throw new Exception("Package directory exists, but don't have any owner"); + } + + if (apikey.UserId != pkg.OwnerId) + return Unauthorized(); + + var newversion = new PackageVersion + { + PackageId = pkg.Id, + Major = version.Major, + Minor = version.Minor, + Patch = version.Patch, + IsPrerelease = version.IsPrerelease, + FullString = version.ToFullString() + }; + dbContext.PackageVersions.Add(newversion); + + await dbContext.SaveChangesAsync(); + logger.LogInformation($"new version : {entry.Name}"); + } } } } diff --git a/src/nuget-host/Models/Account/AccountOptions.cs b/src/nuget-host/Data/Account/AccountOptions.cs similarity index 95% rename from src/nuget-host/Models/Account/AccountOptions.cs rename to src/nuget-host/Data/Account/AccountOptions.cs index 82fb7d0..9c5de3f 100644 --- a/src/nuget-host/Models/Account/AccountOptions.cs +++ b/src/nuget-host/Data/Account/AccountOptions.cs @@ -4,7 +4,7 @@ using System; -namespace nuget_host.Models +namespace nuget_host.Data { public class AccountOptions { diff --git a/src/nuget-host/Models/Account/ExternalProvider.cs b/src/nuget-host/Data/Account/ExternalProvider.cs similarity index 92% rename from src/nuget-host/Models/Account/ExternalProvider.cs rename to src/nuget-host/Data/Account/ExternalProvider.cs index 95aa096..fa7f5a8 100644 --- a/src/nuget-host/Models/Account/ExternalProvider.cs +++ b/src/nuget-host/Data/Account/ExternalProvider.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. -namespace nuget_host.Models +namespace nuget_host.Data { public class ExternalProvider { diff --git a/src/nuget-host/Models/Account/LoggedOutViewModel.cs b/src/nuget-host/Data/Account/LoggedOutViewModel.cs similarity index 95% rename from src/nuget-host/Models/Account/LoggedOutViewModel.cs rename to src/nuget-host/Data/Account/LoggedOutViewModel.cs index cc64929..aefc070 100644 --- a/src/nuget-host/Models/Account/LoggedOutViewModel.cs +++ b/src/nuget-host/Data/Account/LoggedOutViewModel.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. -namespace nuget_host.Models +namespace nuget_host.Data { public class LoggedOutViewModel { diff --git a/src/nuget-host/Models/Account/LoginInputModel.cs b/src/nuget-host/Data/Account/LoginInputModel.cs similarity index 94% rename from src/nuget-host/Models/Account/LoginInputModel.cs rename to src/nuget-host/Data/Account/LoginInputModel.cs index a349d44..b85e16a 100644 --- a/src/nuget-host/Models/Account/LoginInputModel.cs +++ b/src/nuget-host/Data/Account/LoginInputModel.cs @@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations; -namespace nuget_host.Models +namespace nuget_host.Data { public class LoginInputModel { diff --git a/src/nuget-host/Models/Account/LoginViewModel.cs b/src/nuget-host/Data/Account/LoginViewModel.cs similarity index 96% rename from src/nuget-host/Models/Account/LoginViewModel.cs rename to src/nuget-host/Data/Account/LoginViewModel.cs index 50d9396..0f99475 100644 --- a/src/nuget-host/Models/Account/LoginViewModel.cs +++ b/src/nuget-host/Data/Account/LoginViewModel.cs @@ -6,7 +6,7 @@ using System; using System.Collections.Generic; using System.Linq; -namespace nuget_host.Models +namespace nuget_host.Data { public class LoginViewModel : LoginInputModel { diff --git a/src/nuget-host/Models/Account/LogoutInputModel.cs b/src/nuget-host/Data/Account/LogoutInputModel.cs similarity index 90% rename from src/nuget-host/Models/Account/LogoutInputModel.cs rename to src/nuget-host/Data/Account/LogoutInputModel.cs index 3116384..78a56b0 100644 --- a/src/nuget-host/Models/Account/LogoutInputModel.cs +++ b/src/nuget-host/Data/Account/LogoutInputModel.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. -namespace nuget_host.Models +namespace nuget_host.Data { public class LogoutInputModel { diff --git a/src/nuget-host/Models/Account/LogoutViewModel.cs b/src/nuget-host/Data/Account/LogoutViewModel.cs similarity index 91% rename from src/nuget-host/Models/Account/LogoutViewModel.cs rename to src/nuget-host/Data/Account/LogoutViewModel.cs index 7d82198..f9f73f8 100644 --- a/src/nuget-host/Models/Account/LogoutViewModel.cs +++ b/src/nuget-host/Data/Account/LogoutViewModel.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. -namespace nuget_host.Models +namespace nuget_host.Data { public class LogoutViewModel : LogoutInputModel { diff --git a/src/nuget-host/Models/Account/RedirectViewModel.cs b/src/nuget-host/Data/Account/RedirectViewModel.cs similarity index 90% rename from src/nuget-host/Models/Account/RedirectViewModel.cs rename to src/nuget-host/Data/Account/RedirectViewModel.cs index 772039c..242a854 100644 --- a/src/nuget-host/Models/Account/RedirectViewModel.cs +++ b/src/nuget-host/Data/Account/RedirectViewModel.cs @@ -3,7 +3,7 @@ -namespace nuget_host.Models +namespace nuget_host.Data { public class RedirectViewModel { diff --git a/src/nuget-host/Models/Account/RegisterViewModel.cs b/src/nuget-host/Data/Account/RegisterViewModel.cs similarity index 97% rename from src/nuget-host/Models/Account/RegisterViewModel.cs rename to src/nuget-host/Data/Account/RegisterViewModel.cs index 5e5e2c2..beb6fb0 100644 --- a/src/nuget-host/Models/Account/RegisterViewModel.cs +++ b/src/nuget-host/Data/Account/RegisterViewModel.cs @@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations; using System.Linq; using System.Threading.Tasks; -namespace nuget_host.Models +namespace nuget_host.Data { public class RegisterViewModel { diff --git a/src/nuget-host/Models/ApiKeys/ApiKey.cs b/src/nuget-host/Data/ApiKeys/ApiKey.cs similarity index 93% rename from src/nuget-host/Models/ApiKeys/ApiKey.cs rename to src/nuget-host/Data/ApiKeys/ApiKey.cs index c385cd2..dc3a91e 100644 --- a/src/nuget-host/Models/ApiKeys/ApiKey.cs +++ b/src/nuget-host/Data/ApiKeys/ApiKey.cs @@ -2,7 +2,7 @@ using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -namespace nuget_host.Models.ApiKeys +namespace nuget_host.Data.ApiKeys { public class ApiKey { diff --git a/src/nuget-host/Models/ApiKeys/ApiKeyViewModel.cs b/src/nuget-host/Data/ApiKeys/ApiKeyViewModel.cs similarity index 87% rename from src/nuget-host/Models/ApiKeys/ApiKeyViewModel.cs rename to src/nuget-host/Data/ApiKeys/ApiKeyViewModel.cs index b113f21..5944cd0 100644 --- a/src/nuget-host/Models/ApiKeys/ApiKeyViewModel.cs +++ b/src/nuget-host/Data/ApiKeys/ApiKeyViewModel.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace nuget_host.Models.ApiKeys +namespace nuget_host.Data.ApiKeys { public class ApiKeyViewModel { diff --git a/src/nuget-host/Models/ApiKeys/CreateModel.cs b/src/nuget-host/Data/ApiKeys/CreateModel.cs similarity index 88% rename from src/nuget-host/Models/ApiKeys/CreateModel.cs rename to src/nuget-host/Data/ApiKeys/CreateModel.cs index 2ea4fed..ae0b02a 100644 --- a/src/nuget-host/Models/ApiKeys/CreateModel.cs +++ b/src/nuget-host/Data/ApiKeys/CreateModel.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace nuget_host.Models.ApiKeys +namespace nuget_host.Data.ApiKeys { public class CreateModel { diff --git a/src/nuget-host/Models/ApiKeys/DeleteModel.cs b/src/nuget-host/Data/ApiKeys/DeleteModel.cs similarity index 69% rename from src/nuget-host/Models/ApiKeys/DeleteModel.cs rename to src/nuget-host/Data/ApiKeys/DeleteModel.cs index 89bb34f..b41a0a6 100644 --- a/src/nuget-host/Models/ApiKeys/DeleteModel.cs +++ b/src/nuget-host/Data/ApiKeys/DeleteModel.cs @@ -1,4 +1,4 @@ -namespace nuget_host.Models.ApiKeys +namespace nuget_host.Data.ApiKeys { public class DeleteModel { diff --git a/src/nuget-host/Models/ApiKeys/DetailModel.cs b/src/nuget-host/Data/ApiKeys/DetailModel.cs similarity index 76% rename from src/nuget-host/Models/ApiKeys/DetailModel.cs rename to src/nuget-host/Data/ApiKeys/DetailModel.cs index d44991b..4ef528b 100644 --- a/src/nuget-host/Models/ApiKeys/DetailModel.cs +++ b/src/nuget-host/Data/ApiKeys/DetailModel.cs @@ -1,4 +1,4 @@ -namespace nuget_host.Models.ApiKeys +namespace nuget_host.Data.ApiKeys { public class DetailModel : ApiKeyViewModel { diff --git a/src/nuget-host/Models/ApiKeys/EditModel.cs b/src/nuget-host/Data/ApiKeys/EditModel.cs similarity index 83% rename from src/nuget-host/Models/ApiKeys/EditModel.cs rename to src/nuget-host/Data/ApiKeys/EditModel.cs index b922d67..38545b8 100644 --- a/src/nuget-host/Models/ApiKeys/EditModel.cs +++ b/src/nuget-host/Data/ApiKeys/EditModel.cs @@ -1,4 +1,4 @@ -namespace nuget_host.Models.ApiKeys +namespace nuget_host.Data.ApiKeys { public class EditModel { diff --git a/src/nuget-host/Models/ApiKeys/IndexModel.cs b/src/nuget-host/Data/ApiKeys/IndexModel.cs similarity index 77% rename from src/nuget-host/Models/ApiKeys/IndexModel.cs rename to src/nuget-host/Data/ApiKeys/IndexModel.cs index 310809b..f6e80f1 100644 --- a/src/nuget-host/Models/ApiKeys/IndexModel.cs +++ b/src/nuget-host/Data/ApiKeys/IndexModel.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace nuget_host.Models.ApiKeys +namespace nuget_host.Data.ApiKeys { public class IndexModel { diff --git a/src/nuget-host/Data/ApplicationDbContext.cs b/src/nuget-host/Data/ApplicationDbContext.cs index a3b8a2d..757479f 100644 --- a/src/nuget-host/Data/ApplicationDbContext.cs +++ b/src/nuget-host/Data/ApplicationDbContext.cs @@ -3,8 +3,8 @@ using System.Collections.Generic; using System.Text; using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; -using nuget_host.Models; -using nuget_host.Models.ApiKeys; +using nuget_host.Data; +using nuget_host.Data.ApiKeys; namespace nuget_host.Data { @@ -14,7 +14,9 @@ namespace nuget_host.Data : base(options) { } - + public DbSet ApiKeys { get; set; } + public DbSet Packages { get; set; } + public DbSet PackageVersions { get; set; } } } diff --git a/src/nuget-host/Models/ApplicationUser.cs b/src/nuget-host/Data/ApplicationUser.cs similarity index 89% rename from src/nuget-host/Models/ApplicationUser.cs rename to src/nuget-host/Data/ApplicationUser.cs index 9c0bb95..16b01d3 100644 --- a/src/nuget-host/Models/ApplicationUser.cs +++ b/src/nuget-host/Data/ApplicationUser.cs @@ -1,6 +1,6 @@ using Microsoft.AspNetCore.Identity; -namespace nuget_host.Models +namespace nuget_host.Data { // Add profile data for application users by adding properties to the ApplicationUser class public class ApplicationUser : IdentityUser diff --git a/src/nuget-host/Data/Package.cs b/src/nuget-host/Data/Package.cs new file mode 100644 index 0000000..6e7f1b2 --- /dev/null +++ b/src/nuget-host/Data/Package.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace nuget_host.Data +{ + public class Package + { + [Key][Required] + public string Id { get; set; } + + [Required] + [ForeignKey("Owner")] + public string OwnerId { get; set; } + + public string Description { get; set; } + virtual public ApplicationUser Owner { get; set; } + } +} \ No newline at end of file diff --git a/src/nuget-host/Data/PackageVersion.cs b/src/nuget-host/Data/PackageVersion.cs new file mode 100644 index 0000000..018d34c --- /dev/null +++ b/src/nuget-host/Data/PackageVersion.cs @@ -0,0 +1,30 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace nuget_host.Data +{ + public class PackageVersion + { + [Required] + [ForeignKey("Package")] + public string PackageId { get; set; } + + [Required] + public int Major { get; set; } + + [Required] + public int Minor { get; set; } + + [Required] + public int Patch { get; set; } + + [StringLength(32)] + [Required][Key] + public string FullString { get; set; } + public bool IsPrerelease { get; set; } + + public virtual Package Package { get; set; } + + + } +} \ No newline at end of file diff --git a/src/nuget-host/Extensions/Extensions.cs b/src/nuget-host/Extensions/Extensions.cs index 4ea7aaa..0567b71 100644 --- a/src/nuget-host/Extensions/Extensions.cs +++ b/src/nuget-host/Extensions/Extensions.cs @@ -1,7 +1,7 @@ using System; using Microsoft.AspNetCore.Mvc; -namespace nuget_host.Models +namespace nuget_host.Data { public static class Extensions { diff --git a/src/nuget-host/Migrations/20210424155323_init.Designer.cs b/src/nuget-host/Migrations/20210424155323_init.Designer.cs index 798cd7d..5d3f642 100644 --- a/src/nuget-host/Migrations/20210424155323_init.Designer.cs +++ b/src/nuget-host/Migrations/20210424155323_init.Designer.cs @@ -128,7 +128,7 @@ namespace nugethost.Migrations b.ToTable("AspNetUserTokens"); }); - modelBuilder.Entity("nuget_host.Models.ApplicationUser", b => + modelBuilder.Entity("nuget_host.Data.ApplicationUser", b => { b.Property("Id") .ValueGeneratedOnAdd(); @@ -190,7 +190,7 @@ namespace nugethost.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => { - b.HasOne("nuget_host.Models.ApplicationUser") + b.HasOne("nuget_host.Data.ApplicationUser") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade); @@ -198,7 +198,7 @@ namespace nugethost.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => { - b.HasOne("nuget_host.Models.ApplicationUser") + b.HasOne("nuget_host.Data.ApplicationUser") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade); @@ -211,7 +211,7 @@ namespace nugethost.Migrations .HasForeignKey("RoleId") .OnDelete(DeleteBehavior.Cascade); - b.HasOne("nuget_host.Models.ApplicationUser") + b.HasOne("nuget_host.Data.ApplicationUser") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade); @@ -219,7 +219,7 @@ namespace nugethost.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => { - b.HasOne("nuget_host.Models.ApplicationUser") + b.HasOne("nuget_host.Data.ApplicationUser") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade); diff --git a/src/nuget-host/Migrations/20210502153508_api-keys.Designer.cs b/src/nuget-host/Migrations/20210502153508_api-keys.Designer.cs index 24ab13c..677a401 100644 --- a/src/nuget-host/Migrations/20210502153508_api-keys.Designer.cs +++ b/src/nuget-host/Migrations/20210502153508_api-keys.Designer.cs @@ -128,7 +128,7 @@ namespace nugethost.Migrations b.ToTable("AspNetUserTokens"); }); - modelBuilder.Entity("nuget_host.Models.ApiKey", b => + modelBuilder.Entity("nuget_host.Data.ApiKey", b => { b.Property("Id") .ValueGeneratedOnAdd(); @@ -143,7 +143,7 @@ namespace nugethost.Migrations b.ToTable("ApiKeys"); }); - modelBuilder.Entity("nuget_host.Models.ApplicationUser", b => + modelBuilder.Entity("nuget_host.Data.ApplicationUser", b => { b.Property("Id") .ValueGeneratedOnAdd(); @@ -205,7 +205,7 @@ namespace nugethost.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => { - b.HasOne("nuget_host.Models.ApplicationUser") + b.HasOne("nuget_host.Data.ApplicationUser") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade); @@ -213,7 +213,7 @@ namespace nugethost.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => { - b.HasOne("nuget_host.Models.ApplicationUser") + b.HasOne("nuget_host.Data.ApplicationUser") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade); @@ -226,7 +226,7 @@ namespace nugethost.Migrations .HasForeignKey("RoleId") .OnDelete(DeleteBehavior.Cascade); - b.HasOne("nuget_host.Models.ApplicationUser") + b.HasOne("nuget_host.Data.ApplicationUser") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade); @@ -234,15 +234,15 @@ namespace nugethost.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => { - b.HasOne("nuget_host.Models.ApplicationUser") + b.HasOne("nuget_host.Data.ApplicationUser") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade); }); - modelBuilder.Entity("nuget_host.Models.ApiKey", b => + modelBuilder.Entity("nuget_host.Data.ApiKey", b => { - b.HasOne("nuget_host.Models.ApplicationUser", "User") + b.HasOne("nuget_host.Data.ApplicationUser", "User") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade); diff --git a/src/nuget-host/Migrations/20210508012908_ApkiKey.CreationDate.Designer.cs b/src/nuget-host/Migrations/20210508012908_ApkiKey.CreationDate.Designer.cs index 9e62100..b3b383d 100644 --- a/src/nuget-host/Migrations/20210508012908_ApkiKey.CreationDate.Designer.cs +++ b/src/nuget-host/Migrations/20210508012908_ApkiKey.CreationDate.Designer.cs @@ -128,7 +128,7 @@ namespace nugethost.Migrations b.ToTable("AspNetUserTokens"); }); - modelBuilder.Entity("nuget_host.Models.ApiKeys.ApiKey", b => + modelBuilder.Entity("nuget_host.Data.ApiKeys.ApiKey", b => { b.Property("Id") .ValueGeneratedOnAdd(); @@ -149,7 +149,7 @@ namespace nugethost.Migrations b.ToTable("ApiKeys"); }); - modelBuilder.Entity("nuget_host.Models.ApplicationUser", b => + modelBuilder.Entity("nuget_host.Data.ApplicationUser", b => { b.Property("Id") .ValueGeneratedOnAdd(); @@ -211,7 +211,7 @@ namespace nugethost.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => { - b.HasOne("nuget_host.Models.ApplicationUser") + b.HasOne("nuget_host.Data.ApplicationUser") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade); @@ -219,7 +219,7 @@ namespace nugethost.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => { - b.HasOne("nuget_host.Models.ApplicationUser") + b.HasOne("nuget_host.Data.ApplicationUser") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade); @@ -232,7 +232,7 @@ namespace nugethost.Migrations .HasForeignKey("RoleId") .OnDelete(DeleteBehavior.Cascade); - b.HasOne("nuget_host.Models.ApplicationUser") + b.HasOne("nuget_host.Data.ApplicationUser") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade); @@ -240,15 +240,15 @@ namespace nugethost.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => { - b.HasOne("nuget_host.Models.ApplicationUser") + b.HasOne("nuget_host.Data.ApplicationUser") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade); }); - modelBuilder.Entity("nuget_host.Models.ApiKeys.ApiKey", b => + modelBuilder.Entity("nuget_host.Data.ApiKeys.ApiKey", b => { - b.HasOne("nuget_host.Models.ApplicationUser", "User") + b.HasOne("nuget_host.Data.ApplicationUser", "User") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade); diff --git a/src/nuget-host/Migrations/20210516060430_packages.Designer.cs b/src/nuget-host/Migrations/20210516060430_packages.Designer.cs new file mode 100644 index 0000000..cbfdd54 --- /dev/null +++ b/src/nuget-host/Migrations/20210516060430_packages.Designer.cs @@ -0,0 +1,316 @@ +// +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("20210516060430_packages")] + partial class packages + { + 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("Id") + .ValueGeneratedOnAdd(); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken(); + + b.Property("Name") + .HasMaxLength(256); + + b.Property("NormalizedName") + .HasMaxLength(256); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasName("RoleNameIndex"); + + b.ToTable("AspNetRoles"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClaimType"); + + b.Property("ClaimValue"); + + b.Property("RoleId") + .IsRequired(); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClaimType"); + + b.Property("ClaimValue"); + + b.Property("UserId") + .IsRequired(); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider"); + + b.Property("ProviderKey"); + + b.Property("ProviderDisplayName"); + + b.Property("UserId") + .IsRequired(); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId"); + + b.Property("RoleId"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId"); + + b.Property("LoginProvider"); + + b.Property("Name"); + + b.Property("Value"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens"); + }); + + modelBuilder.Entity("nuget_host.Data.ApiKeys.ApiKey", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("CreationDate"); + + b.Property("Name"); + + b.Property("UserId") + .IsRequired(); + + b.Property("ValidityPeriodInDays"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("ApiKeys"); + }); + + modelBuilder.Entity("nuget_host.Data.ApplicationUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AccessFailedCount"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken(); + + b.Property("Email") + .HasMaxLength(256); + + b.Property("EmailConfirmed"); + + b.Property("FullName"); + + b.Property("LockoutEnabled"); + + b.Property("LockoutEnd"); + + b.Property("NormalizedEmail") + .HasMaxLength(256); + + b.Property("NormalizedUserName") + .HasMaxLength(256); + + b.Property("PasswordHash"); + + b.Property("PhoneNumber"); + + b.Property("PhoneNumberConfirmed"); + + b.Property("SecurityStamp"); + + b.Property("TwoFactorEnabled"); + + b.Property("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("Id") + .ValueGeneratedOnAdd(); + + b.Property("Description"); + + b.Property("OwnerId") + .IsRequired(); + + b.HasKey("Id"); + + b.HasIndex("OwnerId"); + + b.ToTable("Packages"); + }); + + modelBuilder.Entity("nuget_host.Data.PackageVersion", b => + { + b.Property("FullString") + .ValueGeneratedOnAdd() + .HasMaxLength(32); + + b.Property("IsPrerelease"); + + b.Property("Major"); + + b.Property("Minor"); + + b.Property("PackageId") + .IsRequired(); + + b.Property("Patch"); + + b.HasKey("FullString"); + + b.HasIndex("PackageId"); + + b.ToTable("PackageVersions"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("nuget_host.Data.ApplicationUser") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("nuget_host.Data.ApplicationUser") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", 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", 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 + } + } +} diff --git a/src/nuget-host/Migrations/20210516060430_packages.cs b/src/nuget-host/Migrations/20210516060430_packages.cs new file mode 100644 index 0000000..4544e9f --- /dev/null +++ b/src/nuget-host/Migrations/20210516060430_packages.cs @@ -0,0 +1,70 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace nugethost.Migrations +{ + public partial class packages : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Packages", + columns: table => new + { + Id = table.Column(nullable: false), + OwnerId = table.Column(nullable: false), + Description = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Packages", x => x.Id); + table.ForeignKey( + name: "FK_Packages_AspNetUsers_OwnerId", + column: x => x.OwnerId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "PackageVersions", + columns: table => new + { + FullString = table.Column(maxLength: 32, nullable: false), + PackageId = table.Column(nullable: false), + Major = table.Column(nullable: false), + Minor = table.Column(nullable: false), + Patch = table.Column(nullable: false), + IsPrerelease = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_PackageVersions", x => x.FullString); + table.ForeignKey( + name: "FK_PackageVersions_Packages_PackageId", + column: x => x.PackageId, + principalTable: "Packages", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_Packages_OwnerId", + table: "Packages", + column: "OwnerId"); + + migrationBuilder.CreateIndex( + name: "IX_PackageVersions_PackageId", + table: "PackageVersions", + column: "PackageId"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "PackageVersions"); + + migrationBuilder.DropTable( + name: "Packages"); + } + } +} diff --git a/src/nuget-host/Migrations/ApplicationDbContextModelSnapshot.cs b/src/nuget-host/Migrations/ApplicationDbContextModelSnapshot.cs index 784d232..0815c76 100644 --- a/src/nuget-host/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/src/nuget-host/Migrations/ApplicationDbContextModelSnapshot.cs @@ -126,7 +126,7 @@ namespace nugethost.Migrations b.ToTable("AspNetUserTokens"); }); - modelBuilder.Entity("nuget_host.Models.ApiKeys.ApiKey", b => + modelBuilder.Entity("nuget_host.Data.ApiKeys.ApiKey", b => { b.Property("Id") .ValueGeneratedOnAdd(); @@ -147,7 +147,7 @@ namespace nugethost.Migrations b.ToTable("ApiKeys"); }); - modelBuilder.Entity("nuget_host.Models.ApplicationUser", b => + modelBuilder.Entity("nuget_host.Data.ApplicationUser", b => { b.Property("Id") .ValueGeneratedOnAdd(); @@ -199,6 +199,47 @@ namespace nugethost.Migrations b.ToTable("AspNetUsers"); }); + modelBuilder.Entity("nuget_host.Data.Package", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Description"); + + b.Property("OwnerId") + .IsRequired(); + + b.HasKey("Id"); + + b.HasIndex("OwnerId"); + + b.ToTable("Packages"); + }); + + modelBuilder.Entity("nuget_host.Data.PackageVersion", b => + { + b.Property("FullString") + .ValueGeneratedOnAdd() + .HasMaxLength(32); + + b.Property("IsPrerelease"); + + b.Property("Major"); + + b.Property("Minor"); + + b.Property("PackageId") + .IsRequired(); + + b.Property("Patch"); + + b.HasKey("FullString"); + + b.HasIndex("PackageId"); + + b.ToTable("PackageVersions"); + }); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => { b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") @@ -209,7 +250,7 @@ namespace nugethost.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => { - b.HasOne("nuget_host.Models.ApplicationUser") + b.HasOne("nuget_host.Data.ApplicationUser") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade); @@ -217,7 +258,7 @@ namespace nugethost.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => { - b.HasOne("nuget_host.Models.ApplicationUser") + b.HasOne("nuget_host.Data.ApplicationUser") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade); @@ -230,7 +271,7 @@ namespace nugethost.Migrations .HasForeignKey("RoleId") .OnDelete(DeleteBehavior.Cascade); - b.HasOne("nuget_host.Models.ApplicationUser") + b.HasOne("nuget_host.Data.ApplicationUser") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade); @@ -238,19 +279,35 @@ namespace nugethost.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => { - b.HasOne("nuget_host.Models.ApplicationUser") + b.HasOne("nuget_host.Data.ApplicationUser") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade); }); - modelBuilder.Entity("nuget_host.Models.ApiKeys.ApiKey", b => + modelBuilder.Entity("nuget_host.Data.ApiKeys.ApiKey", b => { - b.HasOne("nuget_host.Models.ApplicationUser", "User") + 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 } } diff --git a/src/nuget-host/Startup.cs b/src/nuget-host/Startup.cs index b7f4079..16240e3 100644 --- a/src/nuget-host/Startup.cs +++ b/src/nuget-host/Startup.cs @@ -17,7 +17,7 @@ using nuget_host.Data; using nuget_host.Interfaces; using nuget_host.Services; using nuget_host.Entities; -using nuget_host.Models; +using nuget_host.Data; using System.Reflection; namespace nuget_host diff --git a/src/nuget-host/Views/ApiKeys/Create.cshtml b/src/nuget-host/Views/ApiKeys/Create.cshtml index 6294575..8750d52 100644 --- a/src/nuget-host/Views/ApiKeys/Create.cshtml +++ b/src/nuget-host/Views/ApiKeys/Create.cshtml @@ -1,5 +1,5 @@ -@model nuget_host.Models.ApiKeys.CreateModel +@model nuget_host.Data.ApiKeys.CreateModel @{ ViewData["Title"] = "Create"; diff --git a/src/nuget-host/Views/ApiKeys/Delete.cshtml b/src/nuget-host/Views/ApiKeys/Delete.cshtml index ffc30e3..37f16ef 100644 --- a/src/nuget-host/Views/ApiKeys/Delete.cshtml +++ b/src/nuget-host/Views/ApiKeys/Delete.cshtml @@ -1,5 +1,5 @@ -@model nuget_host.Models.ApiKeys.DeleteModel +@model nuget_host.Data.ApiKeys.DeleteModel @{ ViewData["Title"] = "Delete"; diff --git a/src/nuget-host/Views/ApiKeys/Details.cshtml b/src/nuget-host/Views/ApiKeys/Details.cshtml index 55cf752..27dcc45 100644 --- a/src/nuget-host/Views/ApiKeys/Details.cshtml +++ b/src/nuget-host/Views/ApiKeys/Details.cshtml @@ -1,5 +1,5 @@ -@model nuget_host.Models.ApiKeys.DetailModel +@model nuget_host.Data.ApiKeys.DetailModel @{ ViewData["Title"] = "Details"; diff --git a/src/nuget-host/Views/ApiKeys/Edit.cshtml b/src/nuget-host/Views/ApiKeys/Edit.cshtml index 732b30d..8897962 100644 --- a/src/nuget-host/Views/ApiKeys/Edit.cshtml +++ b/src/nuget-host/Views/ApiKeys/Edit.cshtml @@ -1,5 +1,5 @@ -@model nuget_host.Models.ApiKeys.EditModel +@model nuget_host.Data.ApiKeys.EditModel @{ ViewData["Title"] = "Edit"; diff --git a/src/nuget-host/Views/ApiKeys/Index.cshtml b/src/nuget-host/Views/ApiKeys/Index.cshtml index d820414..943bc52 100644 --- a/src/nuget-host/Views/ApiKeys/Index.cshtml +++ b/src/nuget-host/Views/ApiKeys/Index.cshtml @@ -1,5 +1,5 @@ -@model nuget_host.Models.ApiKeys.IndexModel +@model nuget_host.Data.ApiKeys.IndexModel @{ ViewData["Title"] = "Index"; diff --git a/src/nuget-host/Views/_ViewImports.cshtml b/src/nuget-host/Views/_ViewImports.cshtml index 6eab924..1056335 100644 --- a/src/nuget-host/Views/_ViewImports.cshtml +++ b/src/nuget-host/Views/_ViewImports.cshtml @@ -1,2 +1,2 @@ -@using nuget_host.Models +@using nuget_host.Data @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers