mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
server: Fix shadowed fields in becca entities
This commit is contained in:
parent
709101c540
commit
bb19cc216b
@ -8,7 +8,7 @@ import BAttribute from "./entities/battribute.js";
|
|||||||
import BBranch from "./entities/bbranch.js";
|
import BBranch from "./entities/bbranch.js";
|
||||||
import BRevision from "./entities/brevision.js";
|
import BRevision from "./entities/brevision.js";
|
||||||
import BAttachment from "./entities/battachment.js";
|
import BAttachment from "./entities/battachment.js";
|
||||||
import { AttachmentRow, RevisionRow } from './entities/rows.js';
|
import { AttachmentRow, BlobRow, RevisionRow } from './entities/rows.js';
|
||||||
import BBlob from "./entities/bblob.js";
|
import BBlob from "./entities/bblob.js";
|
||||||
import BRecentNote from "./entities/brecent_note.js";
|
import BRecentNote from "./entities/brecent_note.js";
|
||||||
import AbstractBeccaEntity from "./entities/abstract_becca_entity.js";
|
import AbstractBeccaEntity from "./entities/abstract_becca_entity.js";
|
||||||
@ -199,7 +199,7 @@ export default class Becca {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const row = sql.getRow<BBlob | null>("SELECT *, LENGTH(content) AS contentLength FROM blobs WHERE blobId = ?", [entity.blobId]);
|
const row = sql.getRow<BlobRow | null>("SELECT *, LENGTH(content) AS contentLength FROM blobs WHERE blobId = ?", [entity.blobId]);
|
||||||
return row ? new BBlob(row) : null;
|
return row ? new BBlob(row) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,9 +44,6 @@ class BAttachment extends AbstractBeccaEntity<BAttachment> {
|
|||||||
title!: string;
|
title!: string;
|
||||||
type?: keyof typeof attachmentRoleToNoteTypeMapping;
|
type?: keyof typeof attachmentRoleToNoteTypeMapping;
|
||||||
position?: number;
|
position?: number;
|
||||||
blobId?: string;
|
|
||||||
isProtected?: boolean;
|
|
||||||
dateModified?: string;
|
|
||||||
utcDateScheduledForErasureSince?: string | null;
|
utcDateScheduledForErasureSince?: string | null;
|
||||||
/** optionally added to the entity */
|
/** optionally added to the entity */
|
||||||
contentLength?: number;
|
contentLength?: number;
|
||||||
|
@ -7,11 +7,8 @@ class BBlob extends AbstractBeccaEntity<BBlob> {
|
|||||||
static get primaryKeyName() { return "blobId"; }
|
static get primaryKeyName() { return "blobId"; }
|
||||||
static get hashedProperties() { return ["blobId", "content"]; }
|
static get hashedProperties() { return ["blobId", "content"]; }
|
||||||
|
|
||||||
blobId!: string;
|
|
||||||
content!: string | Buffer;
|
content!: string | Buffer;
|
||||||
contentLength!: number;
|
contentLength!: number;
|
||||||
dateModified!: string;
|
|
||||||
utcDateModified!: string;
|
|
||||||
|
|
||||||
constructor(row: BlobRow) {
|
constructor(row: BlobRow) {
|
||||||
super();
|
super();
|
||||||
|
@ -29,7 +29,6 @@ class BBranch extends AbstractBeccaEntity<BBranch> {
|
|||||||
prefix!: string | null;
|
prefix!: string | null;
|
||||||
notePosition!: number;
|
notePosition!: number;
|
||||||
isExpanded!: boolean;
|
isExpanded!: boolean;
|
||||||
utcDateModified?: string;
|
|
||||||
|
|
||||||
constructor(row?: BranchRow) {
|
constructor(row?: BranchRow) {
|
||||||
super();
|
super();
|
||||||
|
@ -14,7 +14,6 @@ class BOption extends AbstractBeccaEntity<BOption> {
|
|||||||
|
|
||||||
name!: string;
|
name!: string;
|
||||||
value!: string;
|
value!: string;
|
||||||
isSynced!: boolean;
|
|
||||||
|
|
||||||
constructor(row?: OptionRow) {
|
constructor(row?: OptionRow) {
|
||||||
super();
|
super();
|
||||||
|
@ -15,7 +15,6 @@ class BRecentNote extends AbstractBeccaEntity<BRecentNote> {
|
|||||||
|
|
||||||
noteId!: string;
|
noteId!: string;
|
||||||
notePath!: string;
|
notePath!: string;
|
||||||
utcDateCreated!: string;
|
|
||||||
|
|
||||||
constructor(row: RecentNoteRow) {
|
constructor(row: RecentNoteRow) {
|
||||||
super();
|
super();
|
||||||
|
@ -33,13 +33,9 @@ class BRevision extends AbstractBeccaEntity<BRevision> {
|
|||||||
noteId!: string;
|
noteId!: string;
|
||||||
type!: string;
|
type!: string;
|
||||||
mime!: string;
|
mime!: string;
|
||||||
isProtected!: boolean;
|
|
||||||
title!: string;
|
title!: string;
|
||||||
blobId?: string;
|
|
||||||
dateLastEdited?: string;
|
dateLastEdited?: string;
|
||||||
dateCreated!: string;
|
|
||||||
utcDateLastEdited?: string;
|
utcDateLastEdited?: string;
|
||||||
utcDateCreated!: string;
|
|
||||||
contentLength?: number;
|
contentLength?: number;
|
||||||
content?: string | Buffer;
|
content?: string | Buffer;
|
||||||
|
|
||||||
|
@ -64,6 +64,10 @@ function getRevision(req: Request) {
|
|||||||
function getRevisionFilename(revision: BRevision) {
|
function getRevisionFilename(revision: BRevision) {
|
||||||
let filename = utils.formatDownloadTitle(revision.title, revision.type, revision.mime);
|
let filename = utils.formatDownloadTitle(revision.title, revision.type, revision.mime);
|
||||||
|
|
||||||
|
if (!revision.dateCreated) {
|
||||||
|
throw new Error("Missing creation date for revision.");
|
||||||
|
}
|
||||||
|
|
||||||
const extension = path.extname(filename);
|
const extension = path.extname(filename);
|
||||||
const date = revision.dateCreated
|
const date = revision.dateCreated
|
||||||
.substr(0, 19)
|
.substr(0, 19)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user