mirror of
https://github.com/laurent22/joplin.git
synced 2025-01-23 18:53:36 +02:00
Tools: Fixed TSC compile error
This commit is contained in:
parent
47fc51ea8a
commit
0ccd8dee41
@ -26,6 +26,13 @@ export enum ModelType {
|
||||
Command = 16,
|
||||
}
|
||||
|
||||
export interface DeleteOptions {
|
||||
idFieldName?: string;
|
||||
trackDeleted?: boolean;
|
||||
changeSource?: number;
|
||||
deleteChildren?: boolean;
|
||||
}
|
||||
|
||||
class BaseModel {
|
||||
|
||||
// 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]);
|
||||
}
|
||||
|
||||
static async batchDelete(ids: string[], options: any = null) {
|
||||
static async batchDelete(ids: string[], options: DeleteOptions = null) {
|
||||
if (!ids.length) return;
|
||||
options = this.modOptions(options);
|
||||
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 Setting from './Setting';
|
||||
import BaseModel from '../BaseModel';
|
||||
@ -240,7 +240,7 @@ export default class BaseItem extends BaseModel {
|
||||
return this.batchDelete([id], options);
|
||||
}
|
||||
|
||||
static async batchDelete(ids: string[], options: any = null) {
|
||||
static async batchDelete(ids: string[], options: DeleteOptions = null) {
|
||||
if (!options) options = {};
|
||||
let trackDeleted = true;
|
||||
if (options && options.trackDeleted !== null && options.trackDeleted !== undefined) trackDeleted = options.trackDeleted;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { FolderEntity } from '../services/database/types';
|
||||
import BaseModel from '../BaseModel';
|
||||
import BaseModel, { DeleteOptions } from '../BaseModel';
|
||||
import time from '../time';
|
||||
import { _ } from '../locale';
|
||||
import Note from './Note';
|
||||
@ -16,16 +16,6 @@ interface FolderEntityWithChildren extends FolderEntity {
|
||||
children?: FolderEntity[];
|
||||
}
|
||||
|
||||
export interface DeleteOptions {
|
||||
deleteChildren?: boolean;
|
||||
}
|
||||
|
||||
const defaultDeleteOptions = (): DeleteOptions => {
|
||||
return {
|
||||
deleteChildren: true,
|
||||
};
|
||||
};
|
||||
|
||||
export default class Folder extends BaseItem {
|
||||
static tableName() {
|
||||
return 'folders';
|
||||
@ -90,7 +80,7 @@ export default class Folder extends BaseItem {
|
||||
|
||||
public static async delete(folderId: string, options: DeleteOptions = null) {
|
||||
options = {
|
||||
...defaultDeleteOptions(),
|
||||
deleteChildren: true,
|
||||
...options,
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user