feat(data): worktrees.pull_request_url for the company-repo draft PR

This commit is contained in:
mika kuns
2026-10-01 11:49:30 +02:00
parent 2b2f61d7fc
commit bc0aa28afb
6 changed files with 1215 additions and 0 deletions
@@ -36,6 +36,7 @@ public class WorktreeEntityConfiguration : IEntityTypeConfiguration<WorktreeEnti
builder.Property(w => w.HeadCommit).HasColumnName("head_commit"); builder.Property(w => w.HeadCommit).HasColumnName("head_commit");
builder.Property(w => w.DiffStat).HasColumnName("diff_stat"); builder.Property(w => w.DiffStat).HasColumnName("diff_stat");
builder.Property(w => w.MergeCommit).HasColumnName("merge_commit"); builder.Property(w => w.MergeCommit).HasColumnName("merge_commit");
builder.Property(w => w.PullRequestUrl).HasColumnName("pull_request_url");
builder.Property(w => w.State).HasColumnName("state").IsRequired() builder.Property(w => w.State).HasColumnName("state").IsRequired()
.HasDefaultValue(WorktreeState.Active) .HasDefaultValue(WorktreeState.Active)
.HasConversion(StateConverter); .HasConversion(StateConverter);
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,28 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ClaudeDo.Data.Migrations
{
/// <inheritdoc />
public partial class AddWorktreePullRequestUrl : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "pull_request_url",
table: "worktrees",
type: "TEXT",
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "pull_request_url",
table: "worktrees");
}
}
}
@@ -1019,6 +1019,10 @@ namespace ClaudeDo.Data.Migrations
.HasColumnType("TEXT") .HasColumnType("TEXT")
.HasColumnName("path"); .HasColumnName("path");
b.Property<string>("PullRequestUrl")
.HasColumnType("TEXT")
.HasColumnName("pull_request_url");
b.Property<string>("State") b.Property<string>("State")
.IsRequired() .IsRequired()
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -17,6 +17,8 @@ public sealed class WorktreeEntity
public string? HeadCommit { get; set; } public string? HeadCommit { get; set; }
public string? DiffStat { get; set; } public string? DiffStat { get; set; }
public string? MergeCommit { get; set; } public string? MergeCommit { get; set; }
/// <summary>Draft-PR auf Azure DevOps, gesetzt vom Approve im Firmen-Repo.</summary>
public string? PullRequestUrl { get; set; }
public WorktreeState State { get; set; } = WorktreeState.Active; public WorktreeState State { get; set; } = WorktreeState.Active;
public required DateTime CreatedAt { get; init; } public required DateTime CreatedAt { get; init; }
@@ -47,6 +47,14 @@ public sealed class WorktreeRepository
/// <summary>Records a successful auto-rebase: the branch's fork point moves to the rebased-onto /// <summary>Records a successful auto-rebase: the branch's fork point moves to the rebased-onto
/// commit and its head moves to the new tip <c>git rebase</c> produced.</summary> /// commit and its head moves to the new tip <c>git rebase</c> produced.</summary>
/// <summary>Stores the draft PR an approve in a company repo created or reused.</summary>
public async Task SetPullRequestUrlAsync(string taskId, string url, CancellationToken ct = default)
{
await _context.Worktrees
.Where(w => w.TaskId == taskId)
.ExecuteUpdateAsync(s => s.SetProperty(w => w.PullRequestUrl, url), ct);
}
public async Task SetRebasedAsync(string taskId, string baseCommit, string headCommit, CancellationToken ct = default) public async Task SetRebasedAsync(string taskId, string baseCommit, string headCommit, CancellationToken ct = default)
{ {
await _context.Worktrees await _context.Worktrees