feat: Initial clean release of CHM
一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
这个提交包含在:
@@ -0,0 +1,59 @@
|
||||
import JoplinDatabase from '../../JoplinDatabase';
|
||||
import paginationToSql from './paginationToSql';
|
||||
import { Pagination, PaginationOrder } from './types';
|
||||
|
||||
export interface ModelFeedPage {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Heterogeneous: callers receive entity types (Note/Folder/Resource) which lack index signatures
|
||||
items: any[];
|
||||
has_more: boolean;
|
||||
total?: number;
|
||||
}
|
||||
|
||||
export interface WhereQuery {
|
||||
sql: string;
|
||||
params?: (string | number | boolean)[];
|
||||
}
|
||||
|
||||
// Note: this method might return more fields than was requested as it will
|
||||
// also return fields that are necessary for pagination.
|
||||
export default async function(db: JoplinDatabase, tableName: string, pagination: Pagination, whereQuery: WhereQuery = null, fields: string[] = null): Promise<ModelFeedPage> {
|
||||
fields = fields ? fields.slice() : ['id'];
|
||||
|
||||
const where = whereQuery && whereQuery.sql ? [whereQuery.sql] : [];
|
||||
const sqlParams = whereQuery && whereQuery.params ? whereQuery.params.slice() : [];
|
||||
|
||||
if (!pagination.order.length) throw new Error('Pagination order must be provided');
|
||||
if (pagination.order.length > 1) throw new Error('Only one pagination order field can be provided');
|
||||
|
||||
const paginationOrder = pagination.order[0].dir;
|
||||
|
||||
if (!pagination.order.find((o: PaginationOrder) => o.by === 'id')) {
|
||||
pagination = {
|
||||
...pagination,
|
||||
order: pagination.order.concat([{
|
||||
by: 'id',
|
||||
dir: paginationOrder,
|
||||
caseInsensitive: false,
|
||||
}]),
|
||||
};
|
||||
}
|
||||
|
||||
const orderBySql = paginationToSql(pagination);
|
||||
const fieldsSql = fields.length ? db.escapeFields(fields) : '*';
|
||||
const offset = (pagination.page - 1) * pagination.limit;
|
||||
|
||||
const sql = `
|
||||
SELECT ${fieldsSql} FROM \`${tableName}\`
|
||||
${where.length ? `WHERE ${where.join(' AND ')}` : ''}
|
||||
ORDER BY ${orderBySql}
|
||||
LIMIT ${pagination.limit}
|
||||
OFFSET ${offset}
|
||||
`;
|
||||
|
||||
const rows = await db.selectAll(sql, sqlParams);
|
||||
|
||||
return {
|
||||
items: rows,
|
||||
has_more: rows.length >= pagination.limit,
|
||||
};
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户