commit version
This commit is contained in:
44
.vs/isn/xs/UserPrefs.xml
Normal file
44
.vs/isn/xs/UserPrefs.xml
Normal file
@ -0,0 +1,44 @@
|
||||
<Properties StartupConfiguration="{9D758F00-17FF-433D-B088-F9C2D97C9BD1}|Default">
|
||||
<MonoDevelop.Ide.Workbench ActiveDocument="../../../../usr/share/dotnet/sdk/5.0.400/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets">
|
||||
<Files>
|
||||
<File FileName="../../../../usr/share/dotnet/sdk/5.0.400/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets" Line="54" Column="5" />
|
||||
<File FileName="src/isn/isn.1.0.0.nupkg" />
|
||||
<File FileName="src/isn/Program.cs" Line="54" Column="9" />
|
||||
</Files>
|
||||
<Pads>
|
||||
<Pad Id="ProjectPad">
|
||||
<State name="__root__">
|
||||
<Node name="isn" expanded="True">
|
||||
<Node name="src" expanded="True">
|
||||
<Node name="isn" expanded="True" />
|
||||
</Node>
|
||||
<Node name="test" expanded="True">
|
||||
<Node name="isn.tests" selected="True" />
|
||||
</Node>
|
||||
</Node>
|
||||
</State>
|
||||
</Pad>
|
||||
<Pad Id="MonoDevelop.UnitTesting.TestPad">
|
||||
<State name="__root__">
|
||||
<Node name="isn" expanded="True">
|
||||
<Node name="test" expanded="True">
|
||||
<Node name="isn.tests" expanded="True">
|
||||
<Node name="isn" expanded="True">
|
||||
<Node name="Tests" expanded="True" />
|
||||
</Node>
|
||||
</Node>
|
||||
<Node name="isnd.tests" selected="True" />
|
||||
</Node>
|
||||
</Node>
|
||||
</State>
|
||||
</Pad>
|
||||
</Pads>
|
||||
</MonoDevelop.Ide.Workbench>
|
||||
<MonoDevelop.Ide.DebuggingService.PinnedWatches />
|
||||
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
|
||||
<MonoDevelop.Ide.ItemProperties.test.isnd.tests PreferredExecutionTarget="MonoDevelop.Default" />
|
||||
<MonoDevelop.Ide.DebuggingService.Breakpoints>
|
||||
<BreakpointStore />
|
||||
</MonoDevelop.Ide.DebuggingService.Breakpoints>
|
||||
<MultiItemStartupConfigurations />
|
||||
</Properties>
|
6
.vscode/settings.json
vendored
6
.vscode/settings.json
vendored
@ -1,3 +1,7 @@
|
||||
{
|
||||
"dotnet-test-explorer.testProjectPath": "**/*.@(csproj)"
|
||||
"dotnet-test-explorer.testProjectPath": "**/*.sln",
|
||||
"dotnet-test-explorer.runInParallel": false,
|
||||
"dotnet-test-explorer.showCodeLens": true,
|
||||
"dotnet-test-explorer.testArguments": "",
|
||||
"nxunitExplorer.nunit": ""
|
||||
}
|
@ -81,6 +81,11 @@ sudo chmod +x /usr/local/lib/isn/isn.exe
|
||||
## TODO
|
||||
|
||||
````bash
|
||||
|
||||
Failed to retrieve information about 'Yavsc.Abstract' from remote source 'http://isn.pschneider.fr/package/FindPackagesById()?id='Yavsc.Abstract'&semVerLevel=2.0.0'.
|
||||
Response status code does not indicate success: 404 (Not Found).
|
||||
|
||||
|
||||
isn set-api-key
|
||||
isn add
|
||||
isn sources
|
||||
|
@ -1,17 +1,10 @@
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using isnd.Entities;
|
||||
using isnd.Data;
|
||||
using System.Linq;
|
||||
using isnd.ViewModels;
|
||||
using Unleash.ClientFactory;
|
||||
using Unleash;
|
||||
using isnd.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using isnd.Helpers;
|
||||
|
||||
namespace isnd.Controllers
|
||||
{
|
||||
@ -30,7 +23,6 @@ namespace isnd.Controllers
|
||||
_logger = logger;
|
||||
_dbContext = dbContext;
|
||||
_unleashĈlient = unleashĈlient;
|
||||
// _unleashĈlient = env.CreateUnleahClient(unleashClientSettings.Value);
|
||||
}
|
||||
|
||||
public IActionResult Index()
|
||||
|
@ -22,10 +22,10 @@ namespace isnd.Data.Catalog
|
||||
public PackageAction Action { get; set; }
|
||||
|
||||
[Required]
|
||||
public string PackageId { get; set; }
|
||||
[ForeignKey("PackageId")]
|
||||
public string PackageVersionId { get; set; }
|
||||
[ForeignKey("PackageVersionId")]
|
||||
|
||||
public virtual Package Package{ get; set; }
|
||||
public virtual PackageVersion PackageVersion{ get; set; }
|
||||
public string CommitId { get => Id.ToString(); }
|
||||
public DateTime CommitTimeStamp { get => TimeStamp; }
|
||||
}
|
||||
|
@ -23,8 +23,17 @@ namespace isnd.Data.Catalog
|
||||
[JsonProperty("@type")]
|
||||
public string RefType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The NuGet Id
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonProperty("nuget:id")]
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The NuGet version
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
|
||||
[JsonProperty("nuget:version")]
|
||||
public string Version { get; set; }
|
||||
|
@ -1,3 +1,5 @@
|
||||
using System;
|
||||
|
||||
namespace isnd.Entities
|
||||
{
|
||||
public class IsndSettings
|
||||
@ -8,6 +10,9 @@ namespace isnd.Entities
|
||||
public string PackagesRootDir {get; set;}
|
||||
public string CatalogDir {get; set;}
|
||||
public int MaxUserKeyCount {get; set;}
|
||||
public int CatalogPageLen {get; set;}
|
||||
public TimeSpan DisplayDeletionLen {get; set;}
|
||||
|
||||
|
||||
}
|
||||
}
|
349
src/isnd/Migrations/20210827201859_commitVersion.Designer.cs
generated
Normal file
349
src/isnd/Migrations/20210827201859_commitVersion.Designer.cs
generated
Normal file
@ -0,0 +1,349 @@
|
||||
// <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 isnd.Data;
|
||||
|
||||
namespace isndhost.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationDbContext))]
|
||||
[Migration("20210827201859_commitVersion")]
|
||||
partial class commitVersion
|
||||
{
|
||||
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("isnd.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("isnd.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("isnd.Data.Catalog.Commit", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<int>("Action");
|
||||
|
||||
b.Property<string>("PackageId")
|
||||
.IsRequired();
|
||||
|
||||
b.Property<DateTime>("TimeStamp");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PackageId");
|
||||
|
||||
b.ToTable("Commits");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("isnd.Data.Package", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("CommitId");
|
||||
|
||||
b.Property<DateTime>("CommitTimeStamp");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasMaxLength(1024);
|
||||
|
||||
b.Property<string>("OwnerId")
|
||||
.IsRequired();
|
||||
|
||||
b.Property<bool>("Public");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OwnerId");
|
||||
|
||||
b.ToTable("Packages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("isnd.Data.PackageVersion", b =>
|
||||
{
|
||||
b.Property<string>("PackageId");
|
||||
|
||||
b.Property<string>("FullString")
|
||||
.HasMaxLength(256);
|
||||
|
||||
b.Property<string>("Type")
|
||||
.HasMaxLength(256);
|
||||
|
||||
b.Property<bool>("IsPrerelease");
|
||||
|
||||
b.Property<int>("Major");
|
||||
|
||||
b.Property<int>("Minor");
|
||||
|
||||
b.Property<int>("Patch");
|
||||
|
||||
b.HasKey("PackageId", "FullString", "Type");
|
||||
|
||||
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("isnd.Data.ApplicationUser")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||
{
|
||||
b.HasOne("isnd.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("isnd.Data.ApplicationUser")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||
{
|
||||
b.HasOne("isnd.Data.ApplicationUser")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("isnd.Data.ApiKeys.ApiKey", b =>
|
||||
{
|
||||
b.HasOne("isnd.Data.ApplicationUser", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("isnd.Data.Catalog.Commit", b =>
|
||||
{
|
||||
b.HasOne("isnd.Data.Package", "Package")
|
||||
.WithMany()
|
||||
.HasForeignKey("PackageId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("isnd.Data.Package", b =>
|
||||
{
|
||||
b.HasOne("isnd.Data.ApplicationUser", "Owner")
|
||||
.WithMany()
|
||||
.HasForeignKey("OwnerId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("isnd.Data.PackageVersion", b =>
|
||||
{
|
||||
b.HasOne("isnd.Data.Package", "Package")
|
||||
.WithMany("Versions")
|
||||
.HasForeignKey("PackageId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
73
src/isnd/Migrations/20210827201859_commitVersion.cs
Normal file
73
src/isnd/Migrations/20210827201859_commitVersion.cs
Normal file
@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace isndhost.Migrations
|
||||
{
|
||||
public partial class commitVersion : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "CommitId",
|
||||
table: "Packages",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "CommitTimeStamp",
|
||||
table: "Packages",
|
||||
nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "Public",
|
||||
table: "Packages",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Commits",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
|
||||
TimeStamp = table.Column<DateTime>(nullable: false),
|
||||
Action = table.Column<int>(nullable: false),
|
||||
PackageId = table.Column<string>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Commits", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Commits_Packages_PackageId",
|
||||
column: x => x.PackageId,
|
||||
principalTable: "Packages",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Commits_PackageId",
|
||||
table: "Commits",
|
||||
column: "PackageId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Commits");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CommitId",
|
||||
table: "Packages");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CommitTimeStamp",
|
||||
table: "Packages");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Public",
|
||||
table: "Packages");
|
||||
}
|
||||
}
|
||||
}
|
@ -126,7 +126,7 @@ namespace isndhost.Migrations
|
||||
b.ToTable("AspNetUserTokens");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("isn.Data.ApiKeys.ApiKey", b =>
|
||||
modelBuilder.Entity("isnd.Data.ApiKeys.ApiKey", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
@ -147,7 +147,7 @@ namespace isndhost.Migrations
|
||||
b.ToTable("ApiKeys");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("isn.Data.ApplicationUser", b =>
|
||||
modelBuilder.Entity("isnd.Data.ApplicationUser", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
@ -199,17 +199,42 @@ namespace isndhost.Migrations
|
||||
b.ToTable("AspNetUsers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("isn.Data.Package", b =>
|
||||
modelBuilder.Entity("isnd.Data.Catalog.Commit", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<int>("Action");
|
||||
|
||||
b.Property<string>("PackageId")
|
||||
.IsRequired();
|
||||
|
||||
b.Property<DateTime>("TimeStamp");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PackageId");
|
||||
|
||||
b.ToTable("Commits");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("isnd.Data.Package", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("CommitId");
|
||||
|
||||
b.Property<DateTime>("CommitTimeStamp");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasMaxLength(1024);
|
||||
|
||||
b.Property<string>("OwnerId")
|
||||
.IsRequired();
|
||||
|
||||
b.Property<bool>("Public");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OwnerId");
|
||||
@ -217,7 +242,7 @@ namespace isndhost.Migrations
|
||||
b.ToTable("Packages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("isn.Data.PackageVersion", b =>
|
||||
modelBuilder.Entity("isnd.Data.PackageVersion", b =>
|
||||
{
|
||||
b.Property<string>("PackageId");
|
||||
|
||||
@ -250,7 +275,7 @@ namespace isndhost.Migrations
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||
{
|
||||
b.HasOne("isn.Data.ApplicationUser")
|
||||
b.HasOne("isnd.Data.ApplicationUser")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
@ -258,7 +283,7 @@ namespace isndhost.Migrations
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||
{
|
||||
b.HasOne("isn.Data.ApplicationUser")
|
||||
b.HasOne("isnd.Data.ApplicationUser")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
@ -271,7 +296,7 @@ namespace isndhost.Migrations
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.HasOne("isn.Data.ApplicationUser")
|
||||
b.HasOne("isnd.Data.ApplicationUser")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
@ -279,31 +304,39 @@ namespace isndhost.Migrations
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||
{
|
||||
b.HasOne("isn.Data.ApplicationUser")
|
||||
b.HasOne("isnd.Data.ApplicationUser")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("isn.Data.ApiKeys.ApiKey", b =>
|
||||
modelBuilder.Entity("isnd.Data.ApiKeys.ApiKey", b =>
|
||||
{
|
||||
b.HasOne("isn.Data.ApplicationUser", "User")
|
||||
b.HasOne("isnd.Data.ApplicationUser", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("isn.Data.Package", b =>
|
||||
modelBuilder.Entity("isnd.Data.Catalog.Commit", b =>
|
||||
{
|
||||
b.HasOne("isn.Data.ApplicationUser", "Owner")
|
||||
b.HasOne("isnd.Data.Package", "Package")
|
||||
.WithMany()
|
||||
.HasForeignKey("PackageId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("isnd.Data.Package", b =>
|
||||
{
|
||||
b.HasOne("isnd.Data.ApplicationUser", "Owner")
|
||||
.WithMany()
|
||||
.HasForeignKey("OwnerId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("isn.Data.PackageVersion", b =>
|
||||
modelBuilder.Entity("isnd.Data.PackageVersion", b =>
|
||||
{
|
||||
b.HasOne("isn.Data.Package", "Package")
|
||||
b.HasOne("isnd.Data.Package", "Package")
|
||||
.WithMany("Versions")
|
||||
.HasForeignKey("PackageId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
@ -19,11 +19,13 @@ namespace isnd.Services
|
||||
public class PackageManager : IPackageManager
|
||||
{
|
||||
ApplicationDbContext dbContext;
|
||||
public PackageManager(ApplicationDbContext dbContext, IOptions<IsndSettings> pmConfigOptions)
|
||||
public PackageManager(ApplicationDbContext dbContext,
|
||||
IOptions<IsndSettings> siteConfigOptionsOptions)
|
||||
{
|
||||
this.dbContext = dbContext;
|
||||
CurrentCatalogIndex = GetCatalogIndex();
|
||||
this.pmConfigOptions = pmConfigOptions.Value;
|
||||
pmConfigOptions = siteConfigOptionsOptions.Value;
|
||||
extApiUrl = pmConfigOptions.ExternalUrl + "/package";
|
||||
}
|
||||
|
||||
|
||||
@ -138,8 +140,10 @@ namespace isnd.Services
|
||||
}
|
||||
|
||||
public static CatalogIndex CurrentCatalogIndex { get; protected set; }
|
||||
public static List<Page> CurrentCatalogPages { get; protected set; }
|
||||
|
||||
private IsndSettings pmConfigOptions;
|
||||
private string extApiUrl;
|
||||
|
||||
public virtual CatalogIndex GetCatalogIndex()
|
||||
{
|
||||
@ -151,7 +155,59 @@ namespace isnd.Services
|
||||
}
|
||||
void LoadCatalogFromDb()
|
||||
{
|
||||
dbContext.Commits.OrderBy(c => c.TimeStamp);
|
||||
int i=0;
|
||||
int p=0;
|
||||
var oldIndex = CurrentCatalogIndex;
|
||||
var oldPages = CurrentCatalogPages;
|
||||
CurrentCatalogIndex = new CatalogIndex
|
||||
{
|
||||
|
||||
};
|
||||
CurrentCatalogPages = new List<Page>();
|
||||
|
||||
var scope = dbContext.Commits.OrderBy(c => c.TimeStamp);
|
||||
Commit last = null;
|
||||
PageRef pageRef = null;
|
||||
Page page = null;
|
||||
i=pmConfigOptions.CatalogPageLen;
|
||||
foreach (var commit in scope)
|
||||
{
|
||||
if (i >= this.pmConfigOptions.CatalogPageLen)
|
||||
{
|
||||
page = new Page{
|
||||
Parent = pmConfigOptions.ExternalUrl + "/package",
|
||||
CommitId = commit.CommitId,
|
||||
CommitTimeStamp = commit.CommitTimeStamp,
|
||||
Id = this.pmConfigOptions.ExternalUrl + "/package/index-" + p++
|
||||
|
||||
};
|
||||
CurrentCatalogPages.Add(page);
|
||||
pageRef = new PageRef{
|
||||
Id = page.Id
|
||||
};
|
||||
CurrentCatalogIndex.Items.Add(pageRef);
|
||||
i = 0;
|
||||
}
|
||||
PackageRef packageref = new PackageRef
|
||||
{
|
||||
CommitId = commit.Id.ToString(),
|
||||
Id = commit.PackageVersionId,
|
||||
|
||||
|
||||
CommitTimeStamp = commit.CommitTimeStamp,
|
||||
RefType = commit.Action == PackageAction.PublishPackage ?
|
||||
"nuget:PackageDetails" : "nuget:PackageDelete"
|
||||
};
|
||||
|
||||
page.Items.Add(packageref);
|
||||
last = commit;
|
||||
i++;
|
||||
}
|
||||
|
||||
if (last!=null)
|
||||
{
|
||||
CurrentCatalogIndex.CommitId = last.CommitId;
|
||||
}
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
@ -182,35 +238,35 @@ namespace isnd.Services
|
||||
public IEnumerable<Resource> GetResources(IUnleash unleashClient)
|
||||
{
|
||||
var res = new List<Resource>();
|
||||
if (unleashClient.IsEnabled("pkg-push"))
|
||||
if (unleashClient.IsEnabled("pkg-push", true))
|
||||
res.Add(
|
||||
new Resource
|
||||
{
|
||||
id = "package",
|
||||
id = extApiUrl,
|
||||
type = "PackagePublish/2.0.0",
|
||||
comment = "Package Publish service"
|
||||
});
|
||||
if (unleashClient.IsEnabled("pkg-get"))
|
||||
if (unleashClient.IsEnabled("pkg-get", false))
|
||||
res.Add(
|
||||
new Resource
|
||||
{
|
||||
id = "package",
|
||||
id = extApiUrl,
|
||||
type = "PackageBaseAddress/3.0.0",
|
||||
comment = "Package Base Address service"
|
||||
});
|
||||
if (unleashClient.IsEnabled("pkg-autocomplete"))
|
||||
if (unleashClient.IsEnabled("pkg-autocomplete", false))
|
||||
res.Add(
|
||||
new Resource
|
||||
{
|
||||
id = "package",
|
||||
id = extApiUrl,
|
||||
type = "SearchAutocompleteService/3.5.0",
|
||||
comment = "Auto complete service"
|
||||
});
|
||||
if (unleashClient.IsEnabled("pkg-search"))
|
||||
if (unleashClient.IsEnabled("pkg-search", false))
|
||||
res.Add(
|
||||
new Resource
|
||||
{
|
||||
id = "package",
|
||||
id = extApiUrl,
|
||||
type = "SearchQueryService/3.5.0",
|
||||
comment = "Search Query service"
|
||||
});
|
||||
|
@ -71,7 +71,7 @@ namespace isnd
|
||||
var config = s.GetRequiredService<IOptions<UnleashClientSettings>>();
|
||||
return s.GetRequiredService<Microsoft.AspNetCore.Hosting.IHostingEnvironment>().CreateUnleahClient(config.Value);
|
||||
});
|
||||
services.AddSingleton<IPackageManager, PackageManager>();
|
||||
services.AddTransient<IPackageManager, PackageManager>();
|
||||
|
||||
// _unleashĈlient = env.CreateUnleahClient(unleashClientSettings.Value);
|
||||
var smtpSettingsconf = Configuration.GetSection("Smtp");
|
||||
|
@ -8,7 +8,8 @@
|
||||
"ExternalUrl": "<lame-server>",
|
||||
"PackagesRootDir" : "<your-Source-dir>",
|
||||
"ProtectionTitle": "protected-data-v1",
|
||||
"MaxUserKeyCount": 1
|
||||
"MaxUserKeyCount": 1,
|
||||
"CatalogPageLen": 480
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"DefaultConnection": "Server=<pgserver>;Port=<pgport>;Database=<dbname>;Username=<dbusername>;Password=<dbpass>;"
|
||||
|
@ -10,11 +10,12 @@
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
|
||||
<PackageReference Include="NUnit" Version="3.13.1" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
||||
|
||||
<PackageReference Include="coverlet.collector" Version="3.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\isn\isn.csproj" />
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\isn\isn.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -12,6 +12,7 @@
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
|
||||
<PackageReference Include="xunit" Version="2.4.0" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
|
||||
<PackageReference Include="xunit.runner.console" Version="2.4.1" />
|
||||
<PackageReference Include="coverlet.collector" Version="1.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
Reference in New Issue
Block a user