You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-07-16 00:14:34 +02:00
Tools: Fixed TSC compile error
This commit is contained in:
@ -26,6 +26,13 @@ export enum ModelType {
|
|||||||
Command = 16,
|
Command = 16,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface DeleteOptions {
|
||||||
|
idFieldName?: string;
|
||||||
|
trackDeleted?: boolean;
|
||||||
|
changeSource?: number;
|
||||||
|
deleteChildren?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
class BaseModel {
|
class BaseModel {
|
||||||
|
|
||||||
// TODO: This ancient part of Joplin about model types is a bit of a
|
// TODO: This ancient part of Joplin about model types is a bit of a
|
||||||
@ -632,7 +639,7 @@ class BaseModel {
|
|||||||
return this.db().exec(`DELETE FROM ${this.tableName()} WHERE id = ?`, [id]);
|
return this.db().exec(`DELETE FROM ${this.tableName()} WHERE id = ?`, [id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static async batchDelete(ids: string[], options: any = null) {
|
static async batchDelete(ids: string[], options: DeleteOptions = null) {
|
||||||
if (!ids.length) return;
|
if (!ids.length) return;
|
||||||
options = this.modOptions(options);
|
options = this.modOptions(options);
|
||||||
const idFieldName = options.idFieldName ? options.idFieldName : 'id';
|
const idFieldName = options.idFieldName ? options.idFieldName : 'id';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { ModelType } from '../BaseModel';
|
import { ModelType, DeleteOptions } from '../BaseModel';
|
||||||
import { BaseItemEntity, NoteEntity } from '../services/database/types';
|
import { BaseItemEntity, NoteEntity } from '../services/database/types';
|
||||||
import Setting from './Setting';
|
import Setting from './Setting';
|
||||||
import BaseModel from '../BaseModel';
|
import BaseModel from '../BaseModel';
|
||||||
@ -240,7 +240,7 @@ export default class BaseItem extends BaseModel {
|
|||||||
return this.batchDelete([id], options);
|
return this.batchDelete([id], options);
|
||||||
}
|
}
|
||||||
|
|
||||||
static async batchDelete(ids: string[], options: any = null) {
|
static async batchDelete(ids: string[], options: DeleteOptions = null) {
|
||||||
if (!options) options = {};
|
if (!options) options = {};
|
||||||
let trackDeleted = true;
|
let trackDeleted = true;
|
||||||
if (options && options.trackDeleted !== null && options.trackDeleted !== undefined) trackDeleted = options.trackDeleted;
|
if (options && options.trackDeleted !== null && options.trackDeleted !== undefined) trackDeleted = options.trackDeleted;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { FolderEntity } from '../services/database/types';
|
import { FolderEntity } from '../services/database/types';
|
||||||
import BaseModel from '../BaseModel';
|
import BaseModel, { DeleteOptions } from '../BaseModel';
|
||||||
import time from '../time';
|
import time from '../time';
|
||||||
import { _ } from '../locale';
|
import { _ } from '../locale';
|
||||||
import Note from './Note';
|
import Note from './Note';
|
||||||
@ -16,16 +16,6 @@ interface FolderEntityWithChildren extends FolderEntity {
|
|||||||
children?: FolderEntity[];
|
children?: FolderEntity[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DeleteOptions {
|
|
||||||
deleteChildren?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
const defaultDeleteOptions = (): DeleteOptions => {
|
|
||||||
return {
|
|
||||||
deleteChildren: true,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export default class Folder extends BaseItem {
|
export default class Folder extends BaseItem {
|
||||||
static tableName() {
|
static tableName() {
|
||||||
return 'folders';
|
return 'folders';
|
||||||
@ -90,7 +80,7 @@ export default class Folder extends BaseItem {
|
|||||||
|
|
||||||
public static async delete(folderId: string, options: DeleteOptions = null) {
|
public static async delete(folderId: string, options: DeleteOptions = null) {
|
||||||
options = {
|
options = {
|
||||||
...defaultDeleteOptions(),
|
deleteChildren: true,
|
||||||
...options,
|
...options,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user