server-ts: Refactor out abstract init in entities

This commit is contained in:
Elian Doran 2024-04-03 19:05:10 +03:00
parent a354b54a08
commit f857b8a9bb
No known key found for this signature in database
6 changed files with 3 additions and 21 deletions

View File

@ -92,7 +92,9 @@ abstract class AbstractBeccaEntity<T extends AbstractBeccaEntity<T>> {
abstract getPojo(): {};
abstract init(): void;
init() {
// Do nothing by default, can be overriden in derived classes.
}
abstract updateFromRow(row: unknown): void;

View File

@ -83,10 +83,6 @@ class BAttachment extends AbstractBeccaEntity<BAttachment> {
this.contentLength = row.contentLength;
}
init(): void {
// Do nothing.
}
copy(): BAttachment {
return new BAttachment({
ownerId: this.ownerId,

View File

@ -26,10 +26,6 @@ class BBlob extends AbstractBeccaEntity<BBlob> {
this.utcDateModified = row.utcDateModified;
}
init() {
// Nothing to do.
}
getPojo() {
return {
blobId: this.blobId,

View File

@ -32,10 +32,6 @@ class BOption extends AbstractBeccaEntity<BOption> {
this.utcDateModified = row.utcDateModified;
}
init(): void {
// Do nothing.
}
beforeSaving() {
super.beforeSaving();

View File

@ -29,10 +29,6 @@ class BRecentNote extends AbstractBeccaEntity<BRecentNote> {
this.utcDateCreated = row.utcDateCreated || dateUtils.utcNowDateTime();
}
init(): void {
// Do nothing.
}
getPojo() {
return {
noteId: this.noteId,

View File

@ -68,10 +68,6 @@ class BRevision extends AbstractBeccaEntity<BRevision> {
this.contentLength = row.contentLength;
}
init() {
// Do nothing.
}
getNote() {
return becca.notes[this.noteId];
}