1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-24 23:26:50 +02:00

Server: Add support for sharing notes via a link

This commit is contained in:
Laurent Cozic
2021-01-29 18:45:11 +00:00
parent 4a847a096b
commit ccbc329cbf
136 changed files with 4713 additions and 5561 deletions

View File

@ -1,8 +1,9 @@
import paginationToSql from './models/utils/paginationToSql';
const { Database } = require('./database.js');
import Database from './database';
import uuid from './uuid';
import time from './time';
import JoplinDatabase from './JoplinDatabase';
const Mutex = require('async-mutex').Mutex;
// New code should make use of this enum
@ -69,7 +70,7 @@ class BaseModel {
public static dispatch: Function = function() {};
private static saveMutexes_: any = {};
private static db_: any;
private static db_: JoplinDatabase;
static modelType(): ModelType {
throw new Error('Must be overriden');
@ -631,12 +632,12 @@ class BaseModel {
return this.db().exec(`DELETE FROM ${this.tableName()} WHERE id = ?`, [id]);
}
static batchDelete(ids: string[], options: any = null) {
static async batchDelete(ids: string[], options: any = null) {
if (!ids.length) return;
options = this.modOptions(options);
const idFieldName = options.idFieldName ? options.idFieldName : 'id';
const sql = `DELETE FROM ${this.tableName()} WHERE ${idFieldName} IN ("${ids.join('","')}")`;
return this.db().exec(sql);
await this.db().exec(sql);
}
static db() {