Phase 9: version message (FR-13)

- ใส่คำอธิบายแบบ commit message ได้ทุก flow ที่สร้าง version (Save & Version / Start Versioning / generate จากเว็บ) + แสดงใน version history ทุกหน้า
- backend: DocumentVersion.Message (varchar 2048) + migration AddVersionMessage + BadRequest ตรวจความยาวก่อนแตะ MinIO (กัน 500 + orphan object)
- add-in: ConfirmVersionDialog เพิ่ม textarea (Start Versioning ใช้ dialog ด้วย) + แสดง message ใน VersionHistoryPanel
- web: ฟอร์มสร้างเอกสาร + หน้า detail แสดง message (desktop truncate + tooltip, mobile เต็มบรรทัด)
- sync เอกสารทั้งหมด: spec v5 (FR-13/AC-16) + plan Phase 9 + acceptance-review 1–16 + README + CLAUDE.md + web/README
- tests: backend 52 / addin 50 / web 36 — เขียวทั้งชุด

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Suphonchai Phoonsawat 2026-08-20 22:05:49 +07:00
parent b47667f918
commit 7b20f12ede
28 changed files with 928 additions and 141 deletions

View file

@ -9,7 +9,7 @@ public record UploadVersionResult(Guid VersionId, int VersionNumber);
public record GenerateResult(Guid DocumentId, Guid VersionId, int VersionNumber, string DownloadUrl);
public record VersionItem(Guid VersionId, int VersionNumber, DateTimeOffset CreatedAt, string CreatedByUserId, string ContentHash, JsonElement? Fields);
public record VersionItem(Guid VersionId, int VersionNumber, DateTimeOffset CreatedAt, string CreatedByUserId, string ContentHash, JsonElement? Fields, string? Message);
public record TemplateFieldItem(Guid Id, string Key, string Label, string Type, bool IsRequired, int SortOrder);
@ -29,9 +29,9 @@ public record DocDetail(Guid Id, string FileName, DateTimeOffset CreatedAt, Guid
public static class ApiExtensions
{
/// <summary>multipart form ของ POST versions: file + clientVersionId + fields (option)</summary>
/// <summary>multipart form ของ POST versions: file + clientVersionId + fields (option) + message (option)</summary>
public static MultipartFormDataContent VersionForm(
byte[] docx, string fileName, string clientVersionId, string? fieldsJson = null)
byte[] docx, string fileName, string clientVersionId, string? fieldsJson = null, string? message = null)
{
var form = new MultipartFormDataContent();
var file = new ByteArrayContent(docx);
@ -40,6 +40,8 @@ public static class ApiExtensions
form.Add(new StringContent(clientVersionId), "clientVersionId");
if (fieldsJson is not null)
form.Add(new StringContent(fieldsJson), "fields");
if (message is not null)
form.Add(new StringContent(message), "message");
return form;
}

View file

@ -46,12 +46,13 @@ public static class TestFlow
public static Task<GenerateResult> GenerateDocumentAsync(HttpClient client, Guid templateId) =>
GenerateDocumentAsync(client, templateId, DefaultValues);
/// <summary>generate พร้อมค่าที่กำหนดเอง (ทดสอบ validation หรือค่าเกินนิยาม)</summary>
/// <summary>generate พร้อมค่าที่กำหนดเอง (ทดสอบ validation หรือค่าเกินนิยาม)
/// + commit message ทางเลือก (FR-13)</summary>
public static async Task<GenerateResult> GenerateDocumentAsync(
HttpClient client, Guid templateId, Dictionary<string, string> values)
HttpClient client, Guid templateId, Dictionary<string, string> values, string? message = null)
{
using var response = await client.PostAsJsonAsync(
"api/documents/generate", new { templateId, values }, IntegrationTestFixture.Json);
"api/documents/generate", new { templateId, values, message }, IntegrationTestFixture.Json);
Assert.Equal(HttpStatusCode.Created, response.StatusCode);
return (await response.Content.ReadFromJsonAsync<GenerateResult>(IntegrationTestFixture.Json))!;
}

View file

@ -0,0 +1,182 @@
using System.Net;
using System.Net.Http.Json;
using Microsoft.EntityFrameworkCore;
namespace WordVersioning.Api.IntegrationTests;
/// <summary>FR-13 — commit message ต่อ version: รับจากทุก flow ที่สร้าง version (upload + generate),
/// normalize ว่าง/whitespace → null, trim, จำกัด 2048 อักขระ, echo ใน history (AC-16)</summary>
[Collection(IntegrationTestCollection.Name)]
public sealed class VersionMessageTests(IntegrationTestFixture fixture)
{
[Fact]
public async Task Upload_WithMessage_PersistsRow_AndEchoesInHistory()
{
var documentId = Guid.NewGuid();
using var client = fixture.CreateClient();
using var response = await client.PostAsync(
$"api/documents/{documentId}/versions",
ApiExtensions.VersionForm(
TestDocx.BuildPlainDocx(), "doc.docx", Guid.NewGuid().ToString(),
message: "แก้ไขข้อ 3 หลังตรวจสอบ"));
Assert.Equal(HttpStatusCode.Created, response.StatusCode);
await using var db = fixture.CreateDb();
var version = await db.DocumentVersions.AsNoTracking().SingleAsync(v => v.DocumentId == documentId);
Assert.Equal("แก้ไขข้อ 3 หลังตรวจสอบ", version.Message);
using var history = await client.GetAsync($"api/documents/{documentId}/versions");
var items = await history.Content.ReadFromJsonAsync<List<VersionItem>>(IntegrationTestFixture.Json);
Assert.Equal("แก้ไขข้อ 3 หลังตรวจสอบ", items!.Single().Message);
}
/// <summary>ไม่ส่ง / ส่งค่าว่าง / ส่ง whitespace ล้วน → เก็บ null ทั้ง DB และ history</summary>
[Theory]
[InlineData(null)]
[InlineData("")]
[InlineData(" ")]
public async Task Upload_BlankOrMissingMessage_StoredAsNull(string? sent)
{
var documentId = Guid.NewGuid();
using var client = fixture.CreateClient();
using var response = await client.PostAsync(
$"api/documents/{documentId}/versions",
ApiExtensions.VersionForm(
TestDocx.BuildPlainDocx(), "doc.docx", Guid.NewGuid().ToString(),
message: sent));
Assert.Equal(HttpStatusCode.Created, response.StatusCode);
await using var db = fixture.CreateDb();
var version = await db.DocumentVersions.AsNoTracking().SingleAsync(v => v.DocumentId == documentId);
Assert.Null(version.Message);
using var history = await client.GetAsync($"api/documents/{documentId}/versions");
var items = await history.Content.ReadFromJsonAsync<List<VersionItem>>(IntegrationTestFixture.Json);
Assert.Null(items!.Single().Message);
}
[Fact]
public async Task Upload_TrimsSurroundingWhitespace()
{
var documentId = Guid.NewGuid();
using var client = fixture.CreateClient();
using var response = await client.PostAsync(
$"api/documents/{documentId}/versions",
ApiExtensions.VersionForm(
TestDocx.BuildPlainDocx(), "doc.docx", Guid.NewGuid().ToString(),
message: " แก้ไขข้อ 3 "));
Assert.Equal(HttpStatusCode.Created, response.StatusCode);
await using var db = fixture.CreateDb();
var version = await db.DocumentVersions.AsNoTracking().SingleAsync(v => v.DocumentId == documentId);
Assert.Equal("แก้ไขข้อ 3", version.Message);
}
[Fact]
public async Task Upload_OversizeMessage_Returns400_NoSideEffect()
{
var documentId = Guid.NewGuid();
using var client = fixture.CreateClient();
using var response = await client.PostAsync(
$"api/documents/{documentId}/versions",
ApiExtensions.VersionForm(
TestDocx.BuildPlainDocx(), "doc.docx", Guid.NewGuid().ToString(),
message: new string('ก', 2049)));
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
await using var db = fixture.CreateDb();
Assert.False(await db.Documents.AsNoTracking().AnyAsync(d => d.Id == documentId)); // ไม่มี side effect
}
[Fact]
public async Task Upload_MessageExactly2048_Succeeds()
{
var documentId = Guid.NewGuid();
using var client = fixture.CreateClient();
var message = new string('ก', 2048);
using var response = await client.PostAsync(
$"api/documents/{documentId}/versions",
ApiExtensions.VersionForm(
TestDocx.BuildPlainDocx(), "doc.docx", Guid.NewGuid().ToString(),
message: message));
Assert.Equal(HttpStatusCode.Created, response.StatusCode);
await using var db = fixture.CreateDb();
var version = await db.DocumentVersions.AsNoTracking().SingleAsync(v => v.DocumentId == documentId);
Assert.Equal(message, version.Message);
}
[Fact]
public async Task SecondUpload_KeepsPerVersionMessages()
{
var documentId = Guid.NewGuid();
using var client = fixture.CreateClient();
using var first = await client.PostAsync(
$"api/documents/{documentId}/versions",
ApiExtensions.VersionForm(
TestDocx.BuildPlainDocx("v1"), "doc.docx", Guid.NewGuid().ToString(),
message: "ฉบับแรก"));
using var second = await client.PostAsync(
$"api/documents/{documentId}/versions",
ApiExtensions.VersionForm(
TestDocx.BuildPlainDocx("v2"), "doc.docx", Guid.NewGuid().ToString(),
message: "แก้ไขเงินเดือน"));
Assert.Equal(HttpStatusCode.Created, second.StatusCode);
// history ใหม่ → เก่า พร้อม message ของแต่ละ version เป็นของตัวเอง
using var history = await client.GetAsync($"api/documents/{documentId}/versions");
var items = await history.Content.ReadFromJsonAsync<List<VersionItem>>(IntegrationTestFixture.Json);
Assert.Equal(2, items!.Count);
Assert.Equal(2, items[0].VersionNumber);
Assert.Equal("แก้ไขเงินเดือน", items[0].Message);
Assert.Equal(1, items[1].VersionNumber);
Assert.Equal("ฉบับแรก", items[1].Message);
}
[Fact]
public async Task Generate_WithMessage_CreatesV1WithMessage()
{
using var client = fixture.CreateClient();
var (templateId, _) = await TestFlow.CreateConfiguredTemplateAsync(client, "msg-gen");
var generated = await TestFlow.GenerateDocumentAsync(
client, templateId, TestFlow.DefaultValues, message: "ฉบับเสนอลงนามครั้งแรก");
await using var db = fixture.CreateDb();
var version = await db.DocumentVersions.AsNoTracking()
.SingleAsync(v => v.DocumentId == generated.DocumentId);
Assert.Equal(1, version.VersionNumber);
Assert.Equal("ฉบับเสนอลงนามครั้งแรก", version.Message);
using var history = await client.GetAsync($"api/documents/{generated.DocumentId}/versions");
var items = await history.Content.ReadFromJsonAsync<List<VersionItem>>(IntegrationTestFixture.Json);
Assert.Equal("ฉบับเสนอลงนามครั้งแรก", items!.Single().Message);
}
/// <summary>400 ต้องเกิดก่อนแตะ MinIO/template — ไม่ทิ้ง orphan object ใน bucket</summary>
[Fact]
public async Task Generate_OversizeMessage_Returns400()
{
using var client = fixture.CreateClient();
var (templateId, _) = await TestFlow.CreateConfiguredTemplateAsync(client, "msg-gen-oversize");
using var response = await client.PostAsJsonAsync(
"api/documents/generate",
new { templateId, values = TestFlow.DefaultValues, message = new string('ก', 2049) },
IntegrationTestFixture.Json);
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
}
}

View file

@ -34,6 +34,7 @@ public class DocumentsController(
private const long MaxUploadBytes = 100L * 1024 * 1024; // 100MB ตาม spec
private const int MaxVersionInsertRetries = 5;
private const int MaxVersionMessageLength = 2048; // FR-13 — ตรงกับ HasMaxLength ใน AppDbContext
/// <summary>FR-5 — อัปโหลด version ใหม่ (auto-create Document ถ้ายังไม่มี)
/// + FR-11: แนบ `fields` (map tag→text) → sync latest values + snapshot ต่อ version</summary>
@ -59,6 +60,11 @@ public class DocumentsController(
if (!FieldMapJson.TryParse(request.Fields, out var fieldMap, out var fieldsError))
return BadRequest(fieldsError);
// FR-13 — commit message ทางเลือก (เช็คก่อนแตะ DB/storage กัน 500 จากข้อจำกัดความยาว)
var message = NormalizeMessage(request.Message);
if (message is { Length: > MaxVersionMessageLength })
return BadRequest($"`message` ยาวเกิน {MaxVersionMessageLength} อักขระ");
var now = DateTimeOffset.UtcNow;
var fileName = request.File.FileName;
@ -131,6 +137,7 @@ public class DocumentsController(
CreatedByUserId = currentUser.UserId, // จาก claim `sub` เท่านั้น
CreatedAt = now,
FieldsSnapshotJson = fieldsSnapshotJson,
Message = message, // FR-13
};
db.DocumentVersions.Add(version);
@ -212,6 +219,11 @@ public class DocumentsController(
if (!FieldMapJson.TryNormalize(request.Values, out var values, out var valuesError))
return BadRequest($"`values` ผิด format: {valuesError}");
// FR-13 — เช็คก่อนทำ MinIO/template IO ใดๆ (กัน 500 + orphan object ใน bucket เมื่อ DB reject ทีหลัง)
var message = NormalizeMessage(request.Message);
if (message is { Length: > MaxVersionMessageLength })
return BadRequest($"`message` ยาวเกิน {MaxVersionMessageLength} อักขระ");
// validate required + type (FR-10) — field ที่ส่งเกินนิยาม ignore ตาม policy เดียวกับ FR-11
var missingRequired = fieldDefs
.Where(f => f.IsRequired && (!values.TryGetValue(f.Key, out var v) || string.IsNullOrWhiteSpace(v ?? string.Empty)))
@ -297,6 +309,7 @@ public class DocumentsController(
ContentHash = contentHash,
CreatedByUserId = currentUser.UserId,
CreatedAt = now,
Message = message, // FR-13
};
db.DocumentVersions.Add(version);
@ -420,12 +433,13 @@ public class DocumentsController(
v.CreatedByUserId,
v.ContentHash,
v.FieldsSnapshotJson,
v.Message,
})
.ToListAsync(ct);
return Ok(rows.Select(r => new VersionListItem(
r.Id, r.VersionNumber, r.CreatedAt, r.CreatedByUserId, r.ContentHash,
ParseSnapshot(r.FieldsSnapshotJson))).ToList());
ParseSnapshot(r.FieldsSnapshotJson), r.Message)).ToList());
}
/// <summary>FR-7 — ดาวน์โหลด version ที่ระบุ (proxy stream จาก MinIO — ไม่ expose MinIO ตรงๆ)</summary>
@ -535,4 +549,9 @@ public class DocumentsController(
private static bool IsUniqueViolation(DbUpdateException ex) =>
ex.InnerException is PostgresException { SqlState: PostgresErrorCodes.UniqueViolation };
/// <summary>FR-13 — normalize commit message: ว่าง/whitespace ล้วน → null, ไม่เช่นนั้น trim
/// (นโยบายเดียวกับ Template.Description ใน TemplatesController)</summary>
private static string? NormalizeMessage(string? message) =>
string.IsNullOrWhiteSpace(message) ? null : message.Trim();
}

View file

@ -40,6 +40,7 @@ public class AppDbContext(DbContextOptions<AppDbContext> options) : DbContext(op
entity.Property(x => x.ObjectKey).HasMaxLength(1024);
entity.Property(x => x.ContentHash).HasMaxLength(64);
entity.Property(x => x.Message).HasMaxLength(2048); // FR-13 commit message — นโยบายเดียวกับ Template.Description
entity.HasOne(x => x.Document)
.WithMany(d => d.Versions)

View file

@ -0,0 +1,256 @@
// <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 WordVersioning.Api.Data;
#nullable disable
namespace WordVersioning.Api.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20260820144855_AddVersionMessage")]
partial class AddVersionMessage
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("WordVersioning.Api.Models.Document", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("AddInSignature")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property<DateTimeOffset>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("FileName")
.IsRequired()
.HasMaxLength(512)
.HasColumnType("character varying(512)");
b.Property<Guid?>("TemplateId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("TemplateId");
b.ToTable("Documents");
});
modelBuilder.Entity("WordVersioning.Api.Models.DocumentFieldValue", b =>
{
b.Property<Guid>("DocumentId")
.HasColumnType("uuid");
b.Property<string>("FieldKey")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<Guid>("SourceVersionId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("UpdatedByUserId")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Value")
.IsRequired()
.HasColumnType("text");
b.HasKey("DocumentId", "FieldKey");
b.ToTable("DocumentFieldValues");
});
modelBuilder.Entity("WordVersioning.Api.Models.DocumentVersion", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("ContentHash")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property<DateTimeOffset>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("CreatedByUserId")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("DocumentId")
.HasColumnType("uuid");
b.Property<string>("FieldsSnapshotJson")
.HasColumnType("text");
b.Property<string>("Message")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)");
b.Property<string>("ObjectKey")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("character varying(1024)");
b.Property<int>("VersionNumber")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("DocumentId", "VersionNumber")
.IsUnique();
b.ToTable("DocumentVersions");
});
modelBuilder.Entity("WordVersioning.Api.Models.Template", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)");
b.Property<bool>("IsActive")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("ObjectKey")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("character varying(1024)");
b.Property<DateTimeOffset>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.ToTable("Templates");
});
modelBuilder.Entity("WordVersioning.Api.Models.TemplateField", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<bool>("IsRequired")
.HasColumnType("boolean");
b.Property<string>("Key")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("Label")
.IsRequired()
.HasMaxLength(512)
.HasColumnType("character varying(512)");
b.Property<int>("SortOrder")
.HasColumnType("integer");
b.Property<Guid>("TemplateId")
.HasColumnType("uuid");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(16)
.HasColumnType("character varying(16)");
b.HasKey("Id");
b.HasIndex("TemplateId", "Key")
.IsUnique();
b.ToTable("TemplateFields");
});
modelBuilder.Entity("WordVersioning.Api.Models.Document", b =>
{
b.HasOne("WordVersioning.Api.Models.Template", "Template")
.WithMany("Documents")
.HasForeignKey("TemplateId")
.OnDelete(DeleteBehavior.Restrict);
b.Navigation("Template");
});
modelBuilder.Entity("WordVersioning.Api.Models.DocumentFieldValue", b =>
{
b.HasOne("WordVersioning.Api.Models.Document", null)
.WithMany()
.HasForeignKey("DocumentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("WordVersioning.Api.Models.DocumentVersion", b =>
{
b.HasOne("WordVersioning.Api.Models.Document", "Document")
.WithMany("Versions")
.HasForeignKey("DocumentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Document");
});
modelBuilder.Entity("WordVersioning.Api.Models.TemplateField", b =>
{
b.HasOne("WordVersioning.Api.Models.Template", "Template")
.WithMany("Fields")
.HasForeignKey("TemplateId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Template");
});
modelBuilder.Entity("WordVersioning.Api.Models.Document", b =>
{
b.Navigation("Versions");
});
modelBuilder.Entity("WordVersioning.Api.Models.Template", b =>
{
b.Navigation("Documents");
b.Navigation("Fields");
});
#pragma warning restore 612, 618
}
}
}

View file

@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace WordVersioning.Api.Migrations
{
/// <inheritdoc />
public partial class AddVersionMessage : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Message",
table: "DocumentVersions",
type: "character varying(2048)",
maxLength: 2048,
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Message",
table: "DocumentVersions");
}
}
}

View file

@ -103,6 +103,10 @@ namespace WordVersioning.Api.Migrations
b.Property<string>("FieldsSnapshotJson")
.HasColumnType("text");
b.Property<string>("Message")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)");
b.Property<string>("ObjectKey")
.IsRequired()
.HasMaxLength(1024)

View file

@ -25,4 +25,7 @@ public class DocumentVersion
/// <summary>Snapshot ค่า fields ของ version นี้ (FR-11) — map tag→text แบบ JSON</summary>
public string? FieldsSnapshotJson { get; set; }
/// <summary>คำอธิบาย version จากผู้ใช้ แบบ git commit message (FR-13) — optional ยาวสูงสุด 2048</summary>
public string? Message { get; set; }
}

View file

@ -15,6 +15,9 @@ public class UploadVersionRequest
/// <summary>JSON object map tag→text จาก content controls (FR-11)</summary>
public string? Fields { get; set; }
/// <summary>คำอธิบาย version แบบ commit message (FR-13) — optional</summary>
public string? Message { get; set; }
}
public record UploadVersionResponse(Guid VersionId, int VersionNumber);
@ -27,18 +30,22 @@ public class GenerateDocumentRequest
/// <summary>map fieldKey → value (ค่า scalar ทั้งหมด)</summary>
public JsonElement Values { get; set; }
/// <summary>คำอธิบาย version แบบ commit message (FR-13) — optional</summary>
public string? Message { get; set; }
}
public record GenerateDocumentResponse(Guid DocumentId, Guid VersionId, int VersionNumber, string DownloadUrl);
/// <summary>item ของ version history — fields คือ snapshot ที่ parse แล้ว (ถ้ามี)</summary>
/// <summary>item ของ version history — fields คือ snapshot ที่ parse แล้ว (ถ้ามี), message คือคำอธิบายของผู้ใช้ (FR-13)</summary>
public record VersionListItem(
Guid VersionId,
int VersionNumber,
DateTimeOffset CreatedAt,
string CreatedByUserId,
string ContentHash,
object? Fields);
object? Fields,
string? Message);
/// <summary>response ของ GET .../download-link — presigned URL อายุสั้นให้เปิดในเบราว์เซอร์ของผู้ใช้</summary>
public record VersionDownloadLinkResponse(string Url, DateTimeOffset ExpiresAt);