Skip to content

Build your personal knowledge base with Trilium Notes

server-ts: Port bblob

Elian Doraneef8297ce181
diff --git a/src/becca/entities/bblob.js b/src/becca/entities/bblob.ts
similarity index 75%
rename from src/becca/entities/bblob.js
rename to src/becca/entities/bblob.ts
index def5888eee..2ea67f0448 100644
--- a/src/becca/entities/bblob.js
+++ b/src/becca/entities/bblob.ts
@@ -1,18 +1,21 @@
+import { BlobRow } from "./rows";
+
class BBlob {
static get entityName() { return "blobs"; }
static get primaryKeyName() { return "blobId"; }
static get hashedProperties() { return ["blobId", "content"]; }
- constructor(row) {
- /** @type {string} */
+ blobId: string;
+ content: string | Buffer;
+ contentLength: number;
+ dateModified: string;
+ utcDateModified: string;
+
+ constructor(row: BlobRow) {
this.blobId = row.blobId;
- /** @type {string|Buffer} */
this.content = row.content;
- /** @type {int} */
this.contentLength = row.contentLength;
- /** @type {string} */
this.dateModified = row.dateModified;
- /** @type {string} */
this.utcDateModified = row.utcDateModified;
}
@@ -27,4 +30,4 @@ class BBlob {
}
}
-module.exports = BBlob;
+export = BBlob;
diff --git a/src/becca/entities/rows.ts b/src/becca/entities/rows.ts
index e2f0a240c4..54c0e8b04c 100644
--- a/src/becca/entities/rows.ts
+++ b/src/becca/entities/rows.ts
@@ -51,4 +51,12 @@ export interface EtapiTokenRow {
utcDateCreated?: string;
utcDateModified?: string;
isDeleted: boolean;
+}
+
+export interface BlobRow {
+ blobId: string;
+ content: string | Buffer;
+ contentLength: number;
+ dateModified: string;
+ utcDateModified: string;
}
\ No newline at end of file