Add Revit return workbook export
This commit is contained in:
parent
77d775fde1
commit
1a4c8cad8c
17 changed files with 3783 additions and 6 deletions
40
tests/external-export-batch.repository.test.ts
Normal file
40
tests/external-export-batch.repository.test.ts
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import path from "node:path";
|
||||
import assert from "node:assert/strict";
|
||||
import { describe, it } from "node:test";
|
||||
import { migrate } from "drizzle-orm/better-sqlite3/migrator";
|
||||
import { createDatabaseContext } from "../src/db/database-context.js";
|
||||
import { ExternalExportBatchRepository } from "../src/db/repositories/external-export-batch.repository.js";
|
||||
import { projects } from "../src/db/schema/projects.js";
|
||||
import { createDefaultExternalModelConfiguration } from "../src/external-model/configuration/external-model-configuration.js";
|
||||
|
||||
describe("external export batch repository", () => {
|
||||
it("appends immutable audit metadata without changing the project revision", () => {
|
||||
const context = createDatabaseContext(":memory:");
|
||||
try {
|
||||
migrate(context.db, { migrationsFolder: path.resolve("src", "db", "migrations") });
|
||||
context.db.insert(projects).values({ id: "project-1", name: "Projekt", currentRevision: 7 }).run();
|
||||
const repository = new ExternalExportBatchRepository(context.db);
|
||||
const configuration = createDefaultExternalModelConfiguration();
|
||||
repository.append({
|
||||
id: "export-1", projectId: "project-1", projectRevision: 7,
|
||||
importBatchId: "historical-import-without-foreign-key", exportedAtIso: "2026-09-30T10:00:00.000Z",
|
||||
fileName: "Projekt_Revit-Rueckgabe_2026-09-30.xlsx", sha256: "a".repeat(64),
|
||||
configurationSnapshot: configuration, configurationSha256: "b".repeat(64), scope: "all", objectCount: 4,
|
||||
});
|
||||
configuration.columns.designation = "Nachträglich geändert";
|
||||
repository.append({
|
||||
id: "export-2", projectId: "project-1", projectRevision: 7,
|
||||
importBatchId: "historical-import-without-foreign-key", exportedAtIso: "2026-09-30T11:00:00.000Z",
|
||||
fileName: "Projekt_Revit-Rueckgabe_2026-09-30.xlsx", sha256: "c".repeat(64),
|
||||
configurationSnapshot: configuration, configurationSha256: "d".repeat(64), scope: "selected", objectCount: 1,
|
||||
});
|
||||
|
||||
const batches = repository.listByProject("project-1");
|
||||
assert.deepEqual(batches.map((batch) => batch.id), ["export-2", "export-1"]);
|
||||
assert.notEqual(batches[0]!.configurationSnapshot.columns.designation, batches[1]!.configurationSnapshot.columns.designation);
|
||||
assert.equal(context.db.select({ revision: projects.currentRevision }).from(projects).get()!.revision, 7);
|
||||
} finally {
|
||||
context.close();
|
||||
}
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue