From eef8297ce1812a2f56e68d1ee8c0d3367bfc9642 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 17 Feb 2024 01:06:07 +0200 Subject: [PATCH] server-ts: Port bblob --- src/becca/entities/{bblob.js => bblob.ts} | 17 ++++++++++------- src/becca/entities/rows.ts | 8 ++++++++ 2 files changed, 18 insertions(+), 7 deletions(-) rename src/becca/entities/{bblob.js => bblob.ts} (75%) 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 def5888ee..2ea67f044 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 e2f0a240c..54c0e8b04 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