mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 09:58:32 +02:00
update to entity creates sync event
This commit is contained in:
parent
35c7b54176
commit
5217339209
@ -4,6 +4,7 @@ const Entity = require('./entity');
|
|||||||
|
|
||||||
class Attribute extends Entity {
|
class Attribute extends Entity {
|
||||||
static get tableName() { return "attributes"; }
|
static get tableName() { return "attributes"; }
|
||||||
|
static get primaryKeyName() { return "attributeId"; }
|
||||||
|
|
||||||
async getNote() {
|
async getNote() {
|
||||||
return this.repository.getEntity("SELECT * FROM notes WHERE noteId = ?", [this.noteId]);
|
return this.repository.getEntity("SELECT * FROM notes WHERE noteId = ?", [this.noteId]);
|
||||||
|
@ -5,6 +5,7 @@ const protected_session = require('../services/protected_session');
|
|||||||
|
|
||||||
class Note extends Entity {
|
class Note extends Entity {
|
||||||
static get tableName() { return "notes"; }
|
static get tableName() { return "notes"; }
|
||||||
|
static get primaryKeyName() { return "noteId"; }
|
||||||
|
|
||||||
constructor(repository, row) {
|
constructor(repository, row) {
|
||||||
super(repository, row);
|
super(repository, row);
|
||||||
|
@ -4,6 +4,7 @@ const Entity = require('./entity');
|
|||||||
|
|
||||||
class NoteRevision extends Entity {
|
class NoteRevision extends Entity {
|
||||||
static get tableName() { return "note_revisions"; }
|
static get tableName() { return "note_revisions"; }
|
||||||
|
static get primaryKeyName() { return "noteRevisionId"; }
|
||||||
|
|
||||||
async getNote() {
|
async getNote() {
|
||||||
return this.repository.getEntity("SELECT * FROM notes WHERE noteId = ?", [this.noteId]);
|
return this.repository.getEntity("SELECT * FROM notes WHERE noteId = ?", [this.noteId]);
|
||||||
|
@ -4,6 +4,7 @@ const Entity = require('./entity');
|
|||||||
|
|
||||||
class NoteTree extends Entity {
|
class NoteTree extends Entity {
|
||||||
static get tableName() { return "note_tree"; }
|
static get tableName() { return "note_tree"; }
|
||||||
|
static get primaryKeyName() { return "noteTreeId"; }
|
||||||
|
|
||||||
async getNote() {
|
async getNote() {
|
||||||
return this.repository.getEntity("SELECT * FROM note_tree WHERE isDeleted = 0 AND noteId = ?", [this.noteId]);
|
return this.repository.getEntity("SELECT * FROM note_tree WHERE isDeleted = 0 AND noteId = ?", [this.noteId]);
|
||||||
|
@ -4,6 +4,7 @@ const Note = require('../entities/note');
|
|||||||
const NoteRevision = require('../entities/note_revision');
|
const NoteRevision = require('../entities/note_revision');
|
||||||
const NoteTree = require('../entities/note_tree');
|
const NoteTree = require('../entities/note_tree');
|
||||||
const Attribute = require('../entities/attribute');
|
const Attribute = require('../entities/attribute');
|
||||||
|
const sync_table = require('../services/sync_table');
|
||||||
|
|
||||||
class Repository {
|
class Repository {
|
||||||
constructor(dataKey) {
|
constructor(dataKey) {
|
||||||
@ -70,6 +71,10 @@ class Repository {
|
|||||||
delete clone.repository;
|
delete clone.repository;
|
||||||
|
|
||||||
await sql.replace(entity.constructor.tableName, entity);
|
await sql.replace(entity.constructor.tableName, entity);
|
||||||
|
|
||||||
|
const primaryKey = entity[entity.constructor.primaryKeyName];
|
||||||
|
|
||||||
|
await sync_table.addEntitySync(entity.constructor.tableName, primaryKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,6 +105,7 @@ module.exports = {
|
|||||||
addImageSync,
|
addImageSync,
|
||||||
addNoteImageSync,
|
addNoteImageSync,
|
||||||
addAttributeSync,
|
addAttributeSync,
|
||||||
|
addEntitySync,
|
||||||
cleanupSyncRowsForMissingEntities,
|
cleanupSyncRowsForMissingEntities,
|
||||||
fillAllSyncRows
|
fillAllSyncRows
|
||||||
};
|
};
|
Loading…
x
Reference in New Issue
Block a user