Skip to content

Commit 45d5d91

Browse files
committed
Update SS14.GithubApiHelper dependency
Update octokit Fix github api related IDs being int instead of long Change usages of .Find to .Where Fix dbset nullability
1 parent c4d5e88 commit 45d5d91

9 files changed

Lines changed: 346 additions & 27 deletions

File tree

SS14.GithubApiHelper

SS14.MapServer/Controllers/GitHubWebhookController.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,11 @@ private async Task<IEnumerable<string>> CheckFiles(long installationId, long rep
186186

187187
private async Task CreateInitialPrComment(PullRequestEventPayload payload, GitReference baseCommit, List<string?> files)
188188
{
189-
// ReSharper disable once MethodHasAsyncOverload
190-
var prComment = _context.PullRequestComment?.Find(
191-
baseCommit.User.Login,
192-
baseCommit.Repository.Name,
193-
payload.PullRequest.Number);
189+
var prComment = await _context.PullRequestComment.Where(pr =>
190+
pr.Owner == baseCommit.User.Login
191+
&& pr.Repository == baseCommit.Repository.Name
192+
&& pr.IssueNumber == payload.PullRequest.Number
193+
).SingleOrDefaultAsync();
194194

195195
if (prComment != null)
196196
return;
@@ -250,10 +250,11 @@ private async Task OnPrProcessingResult(IServiceProvider serviceProvider, MapPro
250250
}
251251

252252
// ReSharper disable once MethodHasAsyncOverload
253-
var prComment = _context.PullRequestComment?.Find(
254-
pullRequest.Base.User.Login,
255-
pullRequest.Base.Repository.Name,
256-
pullRequest.Number);
253+
var prComment = await _context.PullRequestComment.Where(pr =>
254+
pr.Owner == pullRequest.Base.User.Login
255+
&& pr.Repository == pullRequest.Base.Repository.Name
256+
&& pr.IssueNumber == pullRequest.Number
257+
).SingleOrDefaultAsync();
257258

258259
var issue = new IssueIdentifier(
259260
pullRequest.Base.User.Login,
@@ -281,7 +282,7 @@ await _githubApiService.UpdateCommentWithTemplate(
281282
}
282283
}
283284

284-
private void SavePrComment(int? commentId, IssueIdentifier issue)
285+
private void SavePrComment(long? commentId, IssueIdentifier issue)
285286
{
286287
if (!commentId.HasValue)
287288
return;

SS14.MapServer/Migrations/20250225225635_VersionUpgrade.Designer.cs

Lines changed: 267 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
using Microsoft.EntityFrameworkCore.Migrations;
2+
3+
#nullable disable
4+
5+
namespace SS14.MapServer.Migrations
6+
{
7+
/// <inheritdoc />
8+
public partial class VersionUpgrade : Migration
9+
{
10+
/// <inheritdoc />
11+
protected override void Up(MigrationBuilder migrationBuilder)
12+
{
13+
migrationBuilder.AlterColumn<long>(
14+
name: "CommentId",
15+
table: "PullRequestComment",
16+
type: "bigint",
17+
nullable: false,
18+
oldClrType: typeof(int),
19+
oldType: "integer");
20+
21+
migrationBuilder.AlterColumn<long>(
22+
name: "IssueNumber",
23+
table: "PullRequestComment",
24+
type: "bigint",
25+
nullable: false,
26+
oldClrType: typeof(int),
27+
oldType: "integer");
28+
}
29+
30+
/// <inheritdoc />
31+
protected override void Down(MigrationBuilder migrationBuilder)
32+
{
33+
migrationBuilder.AlterColumn<int>(
34+
name: "CommentId",
35+
table: "PullRequestComment",
36+
type: "integer",
37+
nullable: false,
38+
oldClrType: typeof(long),
39+
oldType: "bigint");
40+
41+
migrationBuilder.AlterColumn<int>(
42+
name: "IssueNumber",
43+
table: "PullRequestComment",
44+
type: "integer",
45+
nullable: false,
46+
oldClrType: typeof(long),
47+
oldType: "bigint");
48+
}
49+
}
50+
}

SS14.MapServer/Migrations/ContextModelSnapshot.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
1919
{
2020
#pragma warning disable 612, 618
2121
modelBuilder
22-
.HasAnnotation("ProductVersion", "7.0.5")
22+
.HasAnnotation("ProductVersion", "8.0.1")
2323
.HasAnnotation("Relational:MaxIdentifierLength", 63);
2424

2525
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
@@ -122,11 +122,11 @@ protected override void BuildModel(ModelBuilder modelBuilder)
122122
b.Property<string>("Repository")
123123
.HasColumnType("text");
124124

125-
b.Property<int>("IssueNumber")
126-
.HasColumnType("integer");
125+
b.Property<long>("IssueNumber")
126+
.HasColumnType("bigint");
127127

128-
b.Property<int>("CommentId")
129-
.HasColumnType("integer");
128+
b.Property<long>("CommentId")
129+
.HasColumnType("bigint");
130130

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

0 commit comments

Comments
 (0)