Notes/src/becca/entities/bblob.ts

35 lines
949 B
TypeScript
Raw Normal View History

2024-02-17 01:06:07 +02:00
import { BlobRow } from "./rows";
// FIXME: Why this does not extend the abstract becca?
2023-05-05 16:37:39 +02:00
class BBlob {
2023-06-28 21:05:31 +02:00
static get entityName() { return "blobs"; }
static get primaryKeyName() { return "blobId"; }
static get hashedProperties() { return ["blobId", "content"]; }
2024-02-17 01:06:07 +02:00
blobId: string;
content: string | Buffer;
contentLength: number;
dateModified: string;
utcDateModified: string;
constructor(row: BlobRow) {
2023-05-05 16:37:39 +02:00
this.blobId = row.blobId;
this.content = row.content;
this.contentLength = row.contentLength;
this.dateModified = row.dateModified;
this.utcDateModified = row.utcDateModified;
}
getPojo() {
return {
blobId: this.blobId,
content: this.content || null,
2023-05-05 16:37:39 +02:00
contentLength: this.contentLength,
dateModified: this.dateModified,
utcDateModified: this.utcDateModified
};
}
}
2024-02-17 01:06:07 +02:00
export = BBlob;