mirror of
https://github.com/lifegpc/eh-downloader.git
synced 2026-07-08 01:31:00 +08:00
add /api/file/random
This commit is contained in:
8
db.ts
8
db.ts
@@ -602,6 +602,14 @@ export class EhDb {
|
||||
);
|
||||
return s.length ? s[0] : undefined;
|
||||
}
|
||||
get_random_file() {
|
||||
const s = this.convert_file(
|
||||
this.db.queryEntries<EhFileRaw>(
|
||||
"SELECT * FROM file ORDER BY RANDOM() LIMIT 1;",
|
||||
),
|
||||
);
|
||||
return s.length ? s[0] : undefined;
|
||||
}
|
||||
get_tasks() {
|
||||
return this.transaction(() =>
|
||||
this.db.queryEntries<Task>("SELECT * FROM task;")
|
||||
|
||||
Reference in New Issue
Block a user