Skip to content

Commit

Permalink
Add release notes (#438)
Browse files Browse the repository at this point in the history
Add the ability to view packages' release notes.
  • Loading branch information
pratik vasa authored and loic-sharma committed Jan 22, 2020
1 parent df8a805 commit 9d58ca5
Show file tree
Hide file tree
Showing 23 changed files with 1,006 additions and 40 deletions.
1 change: 1 addition & 0 deletions src/BaGet.Azure/Table/PackageEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public PackageEntity()
public DateTime Published { get; set; }
public bool RequireLicenseAcceptance { get; set; }
public int SemVerLevel { get; set; }
public string ReleaseNotes { get; set; }
public string Summary { get; set; }
public string Title { get; set; }

Expand Down
1 change: 1 addition & 0 deletions src/BaGet.Azure/Table/TableOperationBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public TableOperation AddPackage(Package package)
Title = package.Title,
IconUrl = package.IconUrlString,
LicenseUrl = package.LicenseUrlString,
ReleaseNotes = package.ReleaseNotes,
ProjectUrl = package.ProjectUrlString,
RepositoryUrl = package.RepositoryUrlString,
RepositoryType = package.RepositoryType,
Expand Down
1 change: 1 addition & 0 deletions src/BaGet.Azure/Table/TablePackageService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ private Package AsPackage(PackageEntity entity)
SemVerLevel = (SemVerLevel)entity.SemVerLevel,
Summary = entity.Summary,
Title = entity.Title,
ReleaseNotes = entity.ReleaseNotes,
IconUrl = ParseUri(entity.IconUrl),
LicenseUrl = ParseUri(entity.LicenseUrl),
ProjectUrl = ParseUri(entity.ProjectUrl),
Expand Down
4 changes: 4 additions & 0 deletions src/BaGet.Core/Entities/AbstractContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ private void BuildPackageEntity(EntityTypeBuilder<Package> package)
.HasColumnName("OriginalVersion")
.HasMaxLength(MaxPackageVersionLength);

package.Property(p => p.ReleaseNotes)
.HasColumnName("ReleaseNotes")
.HasMaxLength(DefaultMaxStringLength);

package.Property(p => p.Authors)
.HasMaxLength(DefaultMaxStringLength)
.HasConversion(StringArrayToJsonConverter.Instance)
Expand Down
1 change: 1 addition & 0 deletions src/BaGet.Core/Entities/Package.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public NuGetVersion Version
public long Downloads { get; set; }
public bool HasReadme { get; set; }
public bool IsPrerelease { get; set; }
public string ReleaseNotes { get; set; }
public string Language { get; set; }
public bool Listed { get; set; }
public string MinClientVersion { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public static Package GetPackageMetadata(this PackageArchiveReader packageReader
HasReadme = packageReader.HasReadme(),
IsPrerelease = nuspec.GetVersion().IsPrerelease,
Language = nuspec.GetLanguage() ?? string.Empty,
ReleaseNotes = nuspec.GetReleaseNotes() ?? string.Empty,
Listed = true,
MinClientVersion = nuspec.GetMinClientVersion()?.ToNormalizedString() ?? string.Empty,
Published = DateTime.UtcNow,
Expand Down
7 changes: 7 additions & 0 deletions src/BaGet.Core/Metadata/BaGetPackageMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,17 @@ public class BaGetPackageMetadata : PackageMetadata
[JsonProperty("packageTypes")]
public IReadOnlyList<string> PackageTypes { get; set; }

/// <summary>
/// The package's release notes.
/// </summary>
[JsonProperty("releaseNotes")]
public string ReleaseNotes { get; set; }

[JsonProperty("repositoryUrl")]
public string RepositoryUrl { get; set; }

[JsonProperty("repositoryType")]
public string RepositoryType { get; set; }

}
}
1 change: 1 addition & 0 deletions src/BaGet.Core/Metadata/RegistrationBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ private RegistrationIndexPageItem ToRegistrationIndexPageItem(Package package) =
LicenseUrl = package.LicenseUrlString,
Listed = package.Listed,
MinClientVersion = package.MinClientVersion,
ReleaseNotes = package.ReleaseNotes,
PackageContentUrl = _url.GetPackageDownloadUrl(package.Id, package.Version),
PackageTypes = package.PackageTypes.Select(t => t.Name).ToList(),
ProjectUrl = package.ProjectUrlString,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace BaGet.Database.MySql.Migrations
{
public partial class AddReleaseNotesStringColumn : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<DateTime>(
name: "RowVersion",
table: "Packages",
rowVersion: true,
nullable: true,
oldClrType: typeof(DateTime),
oldNullable: true);

migrationBuilder.AddColumn<string>(
name: "ReleaseNotes",
table: "Packages",
maxLength: 4000,
nullable: true);
}

protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ReleaseNotes",
table: "Packages");

migrationBuilder.AlterColumn<DateTime>(
name: "RowVersion",
table: "Packages",
nullable: true,
oldClrType: typeof(DateTime),
oldRowVersion: true,
oldNullable: true);
}
}
}
24 changes: 14 additions & 10 deletions src/BaGet.Database.MySql/Migrations/MySqlContextModelSnapshot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
.HasAnnotation("Relational:MaxIdentifierLength", 64);

modelBuilder.Entity("BaGet.Core.Entities.Package", b =>
modelBuilder.Entity("BaGet.Core.Package", b =>
{
b.Property<int>("Key")
.ValueGeneratedOnAdd();
Expand Down Expand Up @@ -66,6 +66,10 @@ protected override void BuildModel(ModelBuilder modelBuilder)

b.Property<DateTime>("Published");

b.Property<string>("ReleaseNotes")
.HasColumnName("ReleaseNotes")
.HasMaxLength(4000);

b.Property<string>("RepositoryType")
.HasMaxLength(100);

Expand Down Expand Up @@ -99,7 +103,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.ToTable("Packages");
});

modelBuilder.Entity("BaGet.Core.Entities.PackageDependency", b =>
modelBuilder.Entity("BaGet.Core.PackageDependency", b =>
{
b.Property<int>("Key")
.ValueGeneratedOnAdd();
Expand All @@ -124,7 +128,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.ToTable("PackageDependencies");
});

modelBuilder.Entity("BaGet.Core.Entities.PackageType", b =>
modelBuilder.Entity("BaGet.Core.PackageType", b =>
{
b.Property<int>("Key")
.ValueGeneratedOnAdd();
Expand All @@ -146,7 +150,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.ToTable("PackageTypes");
});

modelBuilder.Entity("BaGet.Core.Entities.TargetFramework", b =>
modelBuilder.Entity("BaGet.Core.TargetFramework", b =>
{
b.Property<int>("Key")
.ValueGeneratedOnAdd();
Expand All @@ -165,24 +169,24 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.ToTable("TargetFrameworks");
});

modelBuilder.Entity("BaGet.Core.Entities.PackageDependency", b =>
modelBuilder.Entity("BaGet.Core.PackageDependency", b =>
{
b.HasOne("BaGet.Core.Entities.Package", "Package")
b.HasOne("BaGet.Core.Package", "Package")
.WithMany("Dependencies")
.HasForeignKey("PackageKey");
});

modelBuilder.Entity("BaGet.Core.Entities.PackageType", b =>
modelBuilder.Entity("BaGet.Core.PackageType", b =>
{
b.HasOne("BaGet.Core.Entities.Package", "Package")
b.HasOne("BaGet.Core.Package", "Package")
.WithMany("PackageTypes")
.HasForeignKey("PackageKey")
.OnDelete(DeleteBehavior.Cascade);
});

modelBuilder.Entity("BaGet.Core.Entities.TargetFramework", b =>
modelBuilder.Entity("BaGet.Core.TargetFramework", b =>
{
b.HasOne("BaGet.Core.Entities.Package", "Package")
b.HasOne("BaGet.Core.Package", "Package")
.WithMany("TargetFrameworks")
.HasForeignKey("PackageKey")
.OnDelete(DeleteBehavior.Cascade);
Expand Down
Loading

0 comments on commit 9d58ca5

Please sign in to comment.