basic entity support with lazy loaded relations

This commit is contained in:
azivner
2018-01-29 18:34:59 -05:00
parent b44412bc32
commit 587f3d833e
6 changed files with 95 additions and 13 deletions

15
src/entities/note_tree.js Normal file
View File

@@ -0,0 +1,15 @@
"use strict";
const Entity = require('./entity');
class NoteTree extends Entity {
async getNote() {
return this.sql.getEntity("SELECT * FROM note_tree WHERE isDeleted = 0 AND noteId = ?", [this.noteId]);
}
async getParentNote() {
return this.sql.getEntity("SELECT * FROM note_tree WHERE isDeleted = 0 AND parentNoteId = ?", [this.parentNoteId]);
}
}
module.exports = NoteTree;