From f857b8a9bb9d86840ff4fda9afdbd9c882df3dbe Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Wed, 3 Apr 2024 19:05:10 +0300 Subject: [PATCH] server-ts: Refactor out abstract init in entities --- src/becca/entities/abstract_becca_entity.ts | 4 +++- src/becca/entities/battachment.ts | 4 ---- src/becca/entities/bblob.ts | 4 ---- src/becca/entities/boption.ts | 4 ---- src/becca/entities/brecent_note.ts | 4 ---- src/becca/entities/brevision.ts | 4 ---- 6 files changed, 3 insertions(+), 21 deletions(-) diff --git a/src/becca/entities/abstract_becca_entity.ts b/src/becca/entities/abstract_becca_entity.ts index 0edcd04ea..00bf78e80 100644 --- a/src/becca/entities/abstract_becca_entity.ts +++ b/src/becca/entities/abstract_becca_entity.ts @@ -92,7 +92,9 @@ abstract class AbstractBeccaEntity> { abstract getPojo(): {}; - abstract init(): void; + init() { + // Do nothing by default, can be overriden in derived classes. + } abstract updateFromRow(row: unknown): void; diff --git a/src/becca/entities/battachment.ts b/src/becca/entities/battachment.ts index f70cff9e2..7b203839a 100644 --- a/src/becca/entities/battachment.ts +++ b/src/becca/entities/battachment.ts @@ -83,10 +83,6 @@ class BAttachment extends AbstractBeccaEntity { this.contentLength = row.contentLength; } - init(): void { - // Do nothing. - } - copy(): BAttachment { return new BAttachment({ ownerId: this.ownerId, diff --git a/src/becca/entities/bblob.ts b/src/becca/entities/bblob.ts index cb2301a5b..40d1c5885 100644 --- a/src/becca/entities/bblob.ts +++ b/src/becca/entities/bblob.ts @@ -26,10 +26,6 @@ class BBlob extends AbstractBeccaEntity { this.utcDateModified = row.utcDateModified; } - init() { - // Nothing to do. - } - getPojo() { return { blobId: this.blobId, diff --git a/src/becca/entities/boption.ts b/src/becca/entities/boption.ts index b06a23431..48abee024 100644 --- a/src/becca/entities/boption.ts +++ b/src/becca/entities/boption.ts @@ -32,10 +32,6 @@ class BOption extends AbstractBeccaEntity { this.utcDateModified = row.utcDateModified; } - init(): void { - // Do nothing. - } - beforeSaving() { super.beforeSaving(); diff --git a/src/becca/entities/brecent_note.ts b/src/becca/entities/brecent_note.ts index da94feaa9..c19a83603 100644 --- a/src/becca/entities/brecent_note.ts +++ b/src/becca/entities/brecent_note.ts @@ -29,10 +29,6 @@ class BRecentNote extends AbstractBeccaEntity { this.utcDateCreated = row.utcDateCreated || dateUtils.utcNowDateTime(); } - init(): void { - // Do nothing. - } - getPojo() { return { noteId: this.noteId, diff --git a/src/becca/entities/brevision.ts b/src/becca/entities/brevision.ts index 48d131f0a..101506858 100644 --- a/src/becca/entities/brevision.ts +++ b/src/becca/entities/brevision.ts @@ -68,10 +68,6 @@ class BRevision extends AbstractBeccaEntity { this.contentLength = row.contentLength; } - init() { - // Do nothing. - } - getNote() { return becca.notes[this.noteId]; }