2024-04-02 23:00:04 +03:00
|
|
|
import AbstractBeccaEntity = require("./abstract_becca_entity");
|
2024-02-17 01:06:07 +02:00
|
|
|
import { BlobRow } from "./rows";
|
|
|
|
|
2024-02-18 20:29:23 +02:00
|
|
|
// TODO: Why this does not extend the abstract becca?
|
2024-04-02 23:00:04 +03:00
|
|
|
class BBlob extends AbstractBeccaEntity<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-04-02 23:00:04 +03:00
|
|
|
blobId!: string;
|
|
|
|
content!: string | Buffer;
|
|
|
|
contentLength!: number;
|
|
|
|
dateModified!: string;
|
|
|
|
utcDateModified!: string;
|
2024-02-17 01:06:07 +02:00
|
|
|
|
|
|
|
constructor(row: BlobRow) {
|
2024-04-02 23:00:04 +03:00
|
|
|
super();
|
|
|
|
this.updateFromRow(row);
|
|
|
|
}
|
|
|
|
|
|
|
|
updateFromRow(row: BlobRow): void {
|
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,
|
2024-02-17 11:54:55 +02:00
|
|
|
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;
|