tasks: list by prefix
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user