mirror of
https://github.com/zadam/trilium.git
synced 2025-11-13 16:55:50 +01:00
removed legacy entities and repository
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
const sql = require('../../services/sql');
|
||||
const log = require('../../services/log');
|
||||
const attributeService = require('../../services/attributes');
|
||||
const repository = require('../../services/repository');
|
||||
const Attribute = require('../../services/becca/entities/attribute');
|
||||
const becca = require("../../services/becca/becca");
|
||||
|
||||
@@ -73,16 +72,17 @@ function setNoteAttribute(req) {
|
||||
const noteId = req.params.noteId;
|
||||
const body = req.body;
|
||||
|
||||
let attr = repository.getEntity(`SELECT * FROM attributes WHERE isDeleted = 0 AND noteId = ? AND type = ? AND name = ?`, [noteId, body.type, body.name]);
|
||||
const attributeId = sql.getValue(`SELECT attributeId FROM attributes WHERE isDeleted = 0 AND noteId = ? AND type = ? AND name = ?`, [noteId, body.type, body.name]);
|
||||
|
||||
if (attr) {
|
||||
if (attributeId) {
|
||||
const attr = becca.getAttribute(attributeId);
|
||||
attr.value = body.value;
|
||||
attr.save();
|
||||
} else {
|
||||
attr = new Attribute(body);
|
||||
const attr = new Attribute(body);
|
||||
attr.noteId = noteId;
|
||||
attr.save();
|
||||
}
|
||||
|
||||
attr.save();
|
||||
}
|
||||
|
||||
function addNoteAttribute(req) {
|
||||
@@ -195,16 +195,16 @@ function createRelation(req) {
|
||||
const targetNoteId = req.params.targetNoteId;
|
||||
const name = req.params.name;
|
||||
|
||||
let attribute = repository.getEntity(`SELECT * FROM attributes WHERE isDeleted = 0 AND noteId = ? AND type = 'relation' AND name = ? AND value = ?`, [sourceNoteId, name, targetNoteId]);
|
||||
const attributeId = sql.getValue(`SELECT attributeId FROM attributes WHERE isDeleted = 0 AND noteId = ? AND type = 'relation' AND name = ? AND value = ?`, [sourceNoteId, name, targetNoteId]);
|
||||
let attribute = becca.getAttribute(attributeId);
|
||||
|
||||
if (!attribute) {
|
||||
attribute = new Attribute();
|
||||
attribute.noteId = sourceNoteId;
|
||||
attribute.name = name;
|
||||
attribute.type = 'relation';
|
||||
attribute.value = targetNoteId;
|
||||
|
||||
attribute.save();
|
||||
attribute = new Attribute({
|
||||
noteId: sourceNoteId,
|
||||
name: name,
|
||||
type: 'relation',
|
||||
value: targetNoteId
|
||||
}).save();
|
||||
}
|
||||
|
||||
return attribute;
|
||||
@@ -215,9 +215,10 @@ function deleteRelation(req) {
|
||||
const targetNoteId = req.params.targetNoteId;
|
||||
const name = req.params.name;
|
||||
|
||||
let attribute = repository.getEntity(`SELECT * FROM attributes WHERE isDeleted = 0 AND noteId = ? AND type = 'relation' AND name = ? AND value = ?`, [sourceNoteId, name, targetNoteId]);
|
||||
const attributeId = sql.getValue(`SELECT attributeId FROM attributes WHERE isDeleted = 0 AND noteId = ? AND type = 'relation' AND name = ? AND value = ?`, [sourceNoteId, name, targetNoteId]);
|
||||
|
||||
if (attribute) {
|
||||
if (attributeId) {
|
||||
const attribute = becca.getAttribute(attributeId);
|
||||
attribute.markAsDeleted();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
const beccaService = require('../../services/becca/becca_service.js');
|
||||
const searchService = require('../../services/search/services/search.js');
|
||||
const repository = require('../../services/repository');
|
||||
const log = require('../../services/log');
|
||||
const utils = require('../../services/utils');
|
||||
const cls = require('../../services/cls');
|
||||
|
||||
@@ -6,7 +6,6 @@ const entityChangesService = require('../../services/entity_changes.js');
|
||||
const treeService = require('../../services/tree');
|
||||
const noteService = require('../../services/notes');
|
||||
const becca = require('../../services/becca/becca.js');
|
||||
const repository = require('../../services/repository');
|
||||
const TaskContext = require('../../services/task_context');
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
const zipExportService = require('../../services/export/zip');
|
||||
const singleExportService = require('../../services/export/single');
|
||||
const opmlExportService = require('../../services/export/opml');
|
||||
const repository = require("../../services/repository");
|
||||
const TaskContext = require("../../services/task_context");
|
||||
const log = require("../../services/log");
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
const repository = require('../../services/repository');
|
||||
const enexImportService = require('../../services/import/enex');
|
||||
const opmlImportService = require('../../services/import/opml');
|
||||
const zipImportService = require('../../services/import/zip');
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
const repository = require('../../services/repository');
|
||||
const beccaService = require('../../services/becca/becca_service.js');
|
||||
const protectedSessionService = require('../../services/protected_session');
|
||||
const noteRevisionService = require('../../services/note_revisions');
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
const noteService = require('../../services/notes');
|
||||
const treeService = require('../../services/tree');
|
||||
const repository = require('../../services/repository');
|
||||
const sql = require('../../services/sql');
|
||||
const utils = require('../../services/utils');
|
||||
const log = require('../../services/log');
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
const sql = require('../../services/sql');
|
||||
const repository = require('../../services/repository');
|
||||
|
||||
function getSchema() {
|
||||
const tableNames = sql.getColumn(`SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%' ORDER BY name`);
|
||||
|
||||
@@ -10,7 +10,6 @@ const contentHashService = require('../../services/content_hash');
|
||||
const log = require('../../services/log');
|
||||
const syncOptions = require('../../services/sync_options');
|
||||
const dateUtils = require('../../services/date_utils');
|
||||
const entityConstructor = require('../../entities/entity_constructor');
|
||||
const utils = require('../../services/utils');
|
||||
|
||||
async function testSync() {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
const repository = require('../services/repository');
|
||||
const log = require('../services/log');
|
||||
const fileUploadService = require('./api/files.js');
|
||||
const scriptService = require('../services/script');
|
||||
|
||||
Reference in New Issue
Block a user