sync fix and more logging

This commit is contained in:
azivner 2017-11-06 19:23:35 -05:00
parent 1c501beea9
commit e1251222cc
3 changed files with 10 additions and 5 deletions

5
app.js
View file

@ -1,3 +1,5 @@
const log = require('./services/log');
log.info("App starting up");
const express = require('express');
const path = require('path');
const favicon = require('serve-favicon');
@ -8,13 +10,12 @@ const session = require('express-session');
const FileStore = require('session-file-store')(session);
const os = require('os');
const options = require('./services/options');
const log = require('./services/log');
const utils = require('./services/utils');
const sql = require('./services/sql');
const dataDir = require('./services/data_dir');
const sessionSecret = require('./services/session_secret');
const db = require('sqlite');
db.open(dataDir.DOCUMENT_PATH, { Promise }).then(async () => {

View file

@ -87,8 +87,7 @@ router.put('/:noteId/expanded/:expanded', async (req, res, next) => {
const now = utils.nowTimestamp();
await sql.doInTransaction(async () => {
// we don't change date_modified so other changes are prioritized in case of conflict
await sql.execute("update notes_tree set is_expanded = ? where note_id = ?", [expanded, noteId]);
await sql.execute("update notes_tree set is_expanded = ?, date_modified = ? where note_id = ?", [expanded, now, noteId]);
await sql.addNoteTreeSync(noteId);
await sql.addAudit(audit_category.CHANGE_EXPANDED, utils.browserId(req), noteId, null, expanded);

View file

@ -1,3 +1,8 @@
const utils = require('./utils');
const log = require('./log');
module.exports = utils.randomString(16);
const sourceId = utils.randomString(16);
log.info("Using sourceId=" + sourceId);
module.exports = sourceId;