tasks: list by prefix

This commit is contained in:
Girish Ramakrishnan
2025-10-06 19:32:06 +02:00
parent b21d29098b
commit 8718e7efd2
+3
View File
@@ -54,6 +54,7 @@ const assert = require('node:assert'),
database = require('./database.js'),
debug = require('debug')('box:tasks'),
logs = require('./logs.js'),
mysql = require('mysql2'),
path = require('node:path'),
paths = require('./paths.js'),
safe = require('safetydance'),
@@ -243,6 +244,8 @@ async function list(page, perPage, options) {
if (options.type) {
query += ' WHERE TYPE=?';
data.push(options.type);
} else if (options.prefix) {
query += ' WHERE TYPE LIKE ' + mysql.escape(options.prefix + '%');
}
query += ' ORDER BY creationTime DESC, id DESC LIMIT ?,?'; // put latest task first