show mode in favorites
This commit is contained in:
parent
e402efd7d3
commit
1995cdaacf
@ -3,7 +3,6 @@ import lib from "../../lib.mjs";
|
||||
import cfg from "../../config.mjs";
|
||||
import fs from "fs";
|
||||
import url from "url";
|
||||
import { ifError } from "assert";
|
||||
|
||||
export default {
|
||||
getf0cks: async (o = { user, tag, mime, page, mode, fav }) => {
|
||||
@ -33,7 +32,7 @@ export default {
|
||||
sql("tags")
|
||||
.select("tags_assign.item_id", "tags.tag")
|
||||
.leftJoin("tags_assign", "tags_assign.tag_id", "tags.id")
|
||||
.where("tags.tag", "like", "%"+tag+"%")
|
||||
.where("tags.tag", "ilike", "%"+tag+"%")
|
||||
.groupBy("tags_assign.item_id", "tags.tag")
|
||||
.as("st"),
|
||||
"st.item_id", "items.id"
|
||||
@ -93,16 +92,17 @@ export default {
|
||||
}
|
||||
else {
|
||||
rows = sql("favorites")
|
||||
.select('items.id', 'items.mime')
|
||||
.select('items.id', 'items.mime', 'ta.tag_id')
|
||||
.leftJoin('user', 'user.id', 'favorites.user_id')
|
||||
.leftJoin('tags_assign', 'tags_assign.item_id', 'favorites.item_id')
|
||||
.leftJoin('tags', 'tags.id', 'tags_assign.tag_id')
|
||||
.leftJoin('items', 'items.id', 'favorites.item_id')
|
||||
.joinRaw("left join tags_assign as ta on ta.item_id = items.id and (ta.tag_id = 1 or ta.tag_id = 2)")
|
||||
.whereRaw(modequery)
|
||||
.andWhere('items.mime', 'ilike', smime)
|
||||
.andWhere('user.user', 'ilike', user)
|
||||
.orderBy('items.id', 'desc')
|
||||
.groupBy('items.id')
|
||||
.groupBy('items.id', 'ta.tag_id')
|
||||
.offset(offset)
|
||||
.limit(cfg.websrv.eps);
|
||||
}
|
||||
@ -121,7 +121,9 @@ export default {
|
||||
.groupBy('st.item_id', 'items.id', 'tags_assign.tag_id');
|
||||
}
|
||||
|
||||
|
||||
rows = await rows;
|
||||
|
||||
|
||||
|
||||
if(rows.length === 0)
|
||||
|
Loading…
Reference in New Issue
Block a user