migration to postgresql
This commit is contained in:
@@ -107,9 +107,10 @@ export default (router, tpl) => {
|
||||
let tagid;
|
||||
const tag_exists = await sql("tags").select("id", "tag").where("tag", tag);
|
||||
if(tag_exists.length === 0) { // create new tag
|
||||
tagid = (await sql("tags").insert({
|
||||
await sql("tags").insert({
|
||||
tag: tag
|
||||
}))[0];
|
||||
});
|
||||
tagid = (await sql("tags").select("id").where("tag", tag))[0].id;
|
||||
}
|
||||
else {
|
||||
tagid = tag_exists[0].id;
|
||||
@@ -207,7 +208,11 @@ export default (router, tpl) => {
|
||||
});
|
||||
}
|
||||
|
||||
favs = await sql('favorites').select('user_id').where('item_id', itemid);
|
||||
favs = await sql('favorites')
|
||||
.select('user.user', 'user_options.avatar')
|
||||
.leftJoin('user', 'user.id', 'favorites.user_id')
|
||||
.leftJoin('user_options', 'user_options.user_id', 'favorites.user_id')
|
||||
.where('favorites.item_id', itemid);
|
||||
|
||||
res.reply({ body: JSON.stringify({
|
||||
success: true,
|
||||
|
||||
Reference in New Issue
Block a user