Skip to content

Commit

Permalink
Update octokit related code and entities to use long instead of int
Browse files Browse the repository at this point in the history
  • Loading branch information
juliangiebel committed Jun 12, 2024
1 parent c36411a commit 824cd50
Show file tree
Hide file tree
Showing 6 changed files with 327 additions and 10 deletions.
2 changes: 1 addition & 1 deletion SS14.MapServer/Controllers/GitHubWebhookController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ await _githubApiService.UpdateCommentWithTemplate(
}
}

private void SavePrComment(int? commentId, IssueIdentifier issue)
private void SavePrComment(long? commentId, IssueIdentifier issue)
{
if (!commentId.HasValue)
return;
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,50 @@
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace SS14.MapServer.Migrations
{
/// <inheritdoc />
public partial class PullRequestCommentIntToLong : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<long>(
name: "CommentId",
table: "PullRequestComment",
type: "bigint",
nullable: false,
oldClrType: typeof(int),
oldType: "integer");

migrationBuilder.AlterColumn<long>(
name: "IssueNumber",
table: "PullRequestComment",
type: "bigint",
nullable: false,
oldClrType: typeof(int),
oldType: "integer");
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<int>(
name: "CommentId",
table: "PullRequestComment",
type: "integer",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint");

migrationBuilder.AlterColumn<int>(
name: "IssueNumber",
table: "PullRequestComment",
type: "integer",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint");
}
}
}
10 changes: 5 additions & 5 deletions SS14.MapServer/Migrations/ContextModelSnapshot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.5")
.HasAnnotation("ProductVersion", "8.0.6")
.HasAnnotation("Relational:MaxIdentifierLength", 63);

NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
Expand Down Expand Up @@ -122,11 +122,11 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property<string>("Repository")
.HasColumnType("text");

b.Property<int>("IssueNumber")
.HasColumnType("integer");
b.Property<long>("IssueNumber")
.HasColumnType("bigint");

b.Property<int>("CommentId")
.HasColumnType("integer");
b.Property<long>("CommentId")
.HasColumnType("bigint");

b.HasKey("Owner", "Repository", "IssueNumber");

Expand Down
4 changes: 2 additions & 2 deletions SS14.MapServer/Models/Entities/PullRequestComment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class PullRequestComment
[Required]
public string Repository { get; set; } = default!;
[Required]
public int IssueNumber { get; set; }
public long IssueNumber { get; set; }
[Required]
public int CommentId { get; set; }
public long CommentId { get; set; }
}
4 changes: 2 additions & 2 deletions SS14.MapServer/Services/Github/GithubApiService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public async Task<IEnumerable<string>> GetChangedFilesBetweenCommits(Installatio
return compareResult.Files.Select(file => file.Filename);
}

public async Task<int?> CreateCommentWithTemplate(InstallationIdentifier installation, IssueIdentifier issue, string templateName, object model)
public async Task<long?> CreateCommentWithTemplate(InstallationIdentifier installation, IssueIdentifier issue, string templateName, object model)
{
if (!await CheckRateLimit(installation))
return null;
Expand All @@ -51,7 +51,7 @@ public async Task<IEnumerable<string>> GetChangedFilesBetweenCommits(Installatio
return null;
}

public async Task UpdateCommentWithTemplate(InstallationIdentifier installation, IssueIdentifier issue, int commentId, string templateName, object model)
public async Task UpdateCommentWithTemplate(InstallationIdentifier installation, IssueIdentifier issue, long commentId, string templateName, object model)
{
if (!await CheckRateLimit(installation))
return;
Expand Down

0 comments on commit 824cd50

Please sign in to comment.