mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
server-ts: Refactor out abstract init in entities
This commit is contained in:
parent
a354b54a08
commit
f857b8a9bb
@ -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;
|
||||
|
||||
|
@ -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,
|
||||
|
@ -26,10 +26,6 @@ class BBlob extends AbstractBeccaEntity<BBlob> {
|
||||
this.utcDateModified = row.utcDateModified;
|
||||
}
|
||||
|
||||
init() {
|
||||
// Nothing to do.
|
||||
}
|
||||
|
||||
getPojo() {
|
||||
return {
|
||||
blobId: this.blobId,
|
||||
|
@ -32,10 +32,6 @@ class BOption extends AbstractBeccaEntity<BOption> {
|
||||
this.utcDateModified = row.utcDateModified;
|
||||
}
|
||||
|
||||
init(): void {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
beforeSaving() {
|
||||
super.beforeSaving();
|
||||
|
||||
|
@ -29,10 +29,6 @@ class BRecentNote extends AbstractBeccaEntity<BRecentNote> {
|
||||
this.utcDateCreated = row.utcDateCreated || dateUtils.utcNowDateTime();
|
||||
}
|
||||
|
||||
init(): void {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
getPojo() {
|
||||
return {
|
||||
noteId: this.noteId,
|
||||
|
@ -68,10 +68,6 @@ class BRevision extends AbstractBeccaEntity<BRevision> {
|
||||
this.contentLength = row.contentLength;
|
||||
}
|
||||
|
||||
init() {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
getNote() {
|
||||
return becca.notes[this.noteId];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user