Add print view, board info card and document logo upload
- Seitenansicht (/projects/:projectId/print): tabular cover page, board overview with supply structure and power sums, one plan per board with a repeating title block; PDF via the browser print dialog with named @page rules (A4 portrait cover, A4/A3 landscape plans, page x of y). - Distribution-board info card (board number, location, fed-from, remark) in the board edit dialog, persisted through the additively extended distribution-board.update command (migration 0008, snapshot schema 6, legacy subtree commands normalized). - Global document logo upload (PNG/JPEG/SVG, max 2 MB) outside project revisions and snapshots. - fed-from stays free text; the overview hierarchy and cumulated sums are preliminary until the feed link is modeled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
2e3e85a8e5
commit
4779e4a1a7
40 changed files with 5297 additions and 33 deletions
|
|
@ -192,6 +192,67 @@ describe("distribution-board subtree project command", () => {
|
|||
}
|
||||
});
|
||||
|
||||
it("copies board info values and accepts snapshots stored before they existed", () => {
|
||||
const context = createTestDatabase();
|
||||
try {
|
||||
const board = createPopulatedBoard(context);
|
||||
context.db
|
||||
.update(distributionBoards)
|
||||
.set({ boardNumber: "UV 1.1", location: "Technik" })
|
||||
.where(eq(distributionBoards.id, board.id))
|
||||
.run();
|
||||
const repository =
|
||||
new DistributionBoardSubtreeProjectCommandRepository(context.db);
|
||||
const withInfo = repository.capture("project-1", board.id);
|
||||
const clone = cloneDistributionBoardSubtree(withInfo, "UV 1 Kopie");
|
||||
assert.equal(clone.distributionBoard.boardNumber, "UV 1.1");
|
||||
assert.equal(clone.distributionBoard.location, "Technik");
|
||||
|
||||
context.db
|
||||
.update(distributionBoards)
|
||||
.set({ boardNumber: null, location: null })
|
||||
.where(eq(distributionBoards.id, board.id))
|
||||
.run();
|
||||
const legacySnapshot = structuredClone(
|
||||
repository.capture("project-1", board.id)
|
||||
);
|
||||
const legacyBoard = legacySnapshot.distributionBoard as Record<
|
||||
string,
|
||||
unknown
|
||||
>;
|
||||
delete legacyBoard.boardNumber;
|
||||
delete legacyBoard.location;
|
||||
delete legacyBoard.fedFrom;
|
||||
delete legacyBoard.remark;
|
||||
|
||||
const deleted = repository.execute({
|
||||
projectId: "project-1",
|
||||
expectedRevision: 0,
|
||||
source: "user",
|
||||
description: "Verteilung löschen",
|
||||
command: createDistributionBoardDeleteSubtreeProjectCommand(
|
||||
legacySnapshot
|
||||
),
|
||||
});
|
||||
assert.throws(
|
||||
() => repository.capture("project-1", board.id),
|
||||
/not found/
|
||||
);
|
||||
repository.execute({
|
||||
projectId: "project-1",
|
||||
expectedRevision: 1,
|
||||
source: "user",
|
||||
command: deleted.inverse,
|
||||
});
|
||||
assert.equal(
|
||||
repository.capture("project-1", board.id).distributionBoard.fedFrom,
|
||||
null
|
||||
);
|
||||
} finally {
|
||||
context.close();
|
||||
}
|
||||
});
|
||||
|
||||
it("rejects changed deletion snapshots without partial writes", () => {
|
||||
const context = createTestDatabase();
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue