1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Chore: TypeScript tweaks

This commit is contained in:
Laurent Cozic 2024-01-06 16:37:15 +00:00
parent 91b51adc48
commit 68e04f944f
2 changed files with 19 additions and 3 deletions

View File

@ -20,6 +20,22 @@ const { isImageMimeType } = require('../resourceUtils');
const { MarkupToHtml } = require('@joplin/renderer');
const { ALL_NOTES_FILTER_ID } = require('../reserved-ids');
interface PreviewsOptions {
order?: {
by: string;
dir: string;
}[];
conditions?: string[];
conditionsParams?: any[];
fields?: string[] | string;
uncompletedTodosOnTop?: boolean;
showCompletedTodos?: boolean;
anywherePattern?: string;
itemTypes?: string[];
limit?: number;
includeDeleted?: boolean;
}
export default class Note extends BaseItem {
public static updateGeolocationEnabled_ = true;
@ -332,7 +348,7 @@ export default class Note extends BaseItem {
public static async loadFolderNoteByField(folderId: string, field: string, value: any) {
if (!folderId) throw new Error('folderId is undefined');
const options = {
const options: PreviewsOptions = {
conditions: [`\`${field}\` = ?`],
conditionsParams: [value],
fields: '*',

View File

@ -1,4 +1,4 @@
import { TagEntity } from '../services/database/types';
import { TagEntity, TagsWithNoteCountEntity } from '../services/database/types';
import BaseModel from '../BaseModel';
import BaseItem from './BaseItem';
@ -109,7 +109,7 @@ export default class Tag extends BaseItem {
return !!r;
}
public static async allWithNotes() {
public static async allWithNotes(): Promise<TagsWithNoteCountEntity[]> {
return await Tag.modelSelectAll('SELECT * FROM tags_with_note_count');
}