Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Commit bb19cc2

Browse files
committed
server: Fix shadowed fields in becca entities
1 parent 709101c commit bb19cc2

File tree

8 files changed

+6
-15
lines changed

8 files changed

+6
-15
lines changed

src/becca/becca-interface.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import BAttribute from "./entities/battribute.js";
88
import BBranch from "./entities/bbranch.js";
99
import BRevision from "./entities/brevision.js";
1010
import BAttachment from "./entities/battachment.js";
11-
import { AttachmentRow, RevisionRow } from './entities/rows.js';
11+
import { AttachmentRow, BlobRow, RevisionRow } from './entities/rows.js';
1212
import BBlob from "./entities/bblob.js";
1313
import BRecentNote from "./entities/brecent_note.js";
1414
import AbstractBeccaEntity from "./entities/abstract_becca_entity.js";
@@ -199,7 +199,7 @@ export default class Becca {
199199
return null;
200200
}
201201

202-
const row = sql.getRow<BBlob | null>("SELECT *, LENGTH(content) AS contentLength FROM blobs WHERE blobId = ?", [entity.blobId]);
202+
const row = sql.getRow<BlobRow | null>("SELECT *, LENGTH(content) AS contentLength FROM blobs WHERE blobId = ?", [entity.blobId]);
203203
return row ? new BBlob(row) : null;
204204
}
205205

src/becca/entities/battachment.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ class BAttachment extends AbstractBeccaEntity<BAttachment> {
4444
title!: string;
4545
type?: keyof typeof attachmentRoleToNoteTypeMapping;
4646
position?: number;
47-
blobId?: string;
48-
isProtected?: boolean;
49-
dateModified?: string;
5047
utcDateScheduledForErasureSince?: string | null;
5148
/** optionally added to the entity */
5249
contentLength?: number;

src/becca/entities/bblob.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,8 @@ class BBlob extends AbstractBeccaEntity<BBlob> {
77
static get primaryKeyName() { return "blobId"; }
88
static get hashedProperties() { return ["blobId", "content"]; }
99

10-
blobId!: string;
1110
content!: string | Buffer;
1211
contentLength!: number;
13-
dateModified!: string;
14-
utcDateModified!: string;
1512

1613
constructor(row: BlobRow) {
1714
super();

src/becca/entities/bbranch.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ class BBranch extends AbstractBeccaEntity<BBranch> {
2929
prefix!: string | null;
3030
notePosition!: number;
3131
isExpanded!: boolean;
32-
utcDateModified?: string;
3332

3433
constructor(row?: BranchRow) {
3534
super();

src/becca/entities/boption.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ class BOption extends AbstractBeccaEntity<BOption> {
1414

1515
name!: string;
1616
value!: string;
17-
isSynced!: boolean;
1817

1918
constructor(row?: OptionRow) {
2019
super();

src/becca/entities/brecent_note.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ class BRecentNote extends AbstractBeccaEntity<BRecentNote> {
1515

1616
noteId!: string;
1717
notePath!: string;
18-
utcDateCreated!: string;
1918

2019
constructor(row: RecentNoteRow) {
2120
super();

src/becca/entities/brevision.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,9 @@ class BRevision extends AbstractBeccaEntity<BRevision> {
3333
noteId!: string;
3434
type!: string;
3535
mime!: string;
36-
isProtected!: boolean;
3736
title!: string;
38-
blobId?: string;
3937
dateLastEdited?: string;
40-
dateCreated!: string;
4138
utcDateLastEdited?: string;
42-
utcDateCreated!: string;
4339
contentLength?: number;
4440
content?: string | Buffer;
4541

src/routes/api/revisions.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ function getRevision(req: Request) {
6464
function getRevisionFilename(revision: BRevision) {
6565
let filename = utils.formatDownloadTitle(revision.title, revision.type, revision.mime);
6666

67+
if (!revision.dateCreated) {
68+
throw new Error("Missing creation date for revision.");
69+
}
70+
6771
const extension = path.extname(filename);
6872
const date = revision.dateCreated
6973
.substr(0, 19)

0 commit comments

Comments
 (0)