2024-07-18 21:35:17 +03:00
|
|
|
import AbstractBeccaEntity from "./abstract_becca_entity.js";
|
2025-01-09 18:36:24 +02:00
|
|
|
import type { BlobRow } from "./rows.js";
|
2024-02-17 01:06:07 +02:00
|
|
|
|
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> {
|
2025-01-09 18:07:02 +02:00
|
|
|
static get entityName() {
|
|
|
|
return "blobs";
|
|
|
|
}
|
|
|
|
static get primaryKeyName() {
|
|
|
|
return "blobId";
|
|
|
|
}
|
|
|
|
static get hashedProperties() {
|
|
|
|
return ["blobId", "content"];
|
|
|
|
}
|
2023-06-28 21:05:31 +02:00
|
|
|
|
2024-04-02 23:00:04 +03:00
|
|
|
content!: string | Buffer;
|
|
|
|
contentLength!: number;
|
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-07-18 21:50:12 +03:00
|
|
|
export default BBlob;
|