index wvotes for search

This commit is contained in:
keyan 2022-10-28 10:58:31 -05:00
parent 760b6b6e10
commit cb7f68e0e5
3 changed files with 5 additions and 1 deletions

View File

@ -321,7 +321,6 @@ export default {
const items = await models.$queryRaw(` const items = await models.$queryRaw(`
${SELECT} ${SELECT}
FROM "Item" FROM "Item"
${await filterClause(me, models)}
ORDER BY created_at DESC ORDER BY created_at DESC
OFFSET $1 OFFSET $1
LIMIT ${LIMIT}`, decodedCursor.offset) LIMIT ${LIMIT}`, decodedCursor.offset)
@ -800,6 +799,9 @@ export default {
return sats || 0 return sats || 0
}, },
wvotes: async (item) => {
return item.weightedVotes - item.weightedDownVotes
},
meSats: async (item, args, { me, models }) => { meSats: async (item, args, { me, models }) => {
if (!me) return 0 if (!me) return 0

View File

@ -84,6 +84,7 @@ export default gql`
commentSats: Int! commentSats: Int!
lastCommentAt: String lastCommentAt: String
upvotes: Int! upvotes: Int!
wvotes: Float!
meSats: Int! meSats: Int!
meDontLike: Boolean! meDontLike: Boolean!
outlawed: Boolean! outlawed: Boolean!

View File

@ -23,6 +23,7 @@ const ITEM_SEARCH_FIELDS = gql`
location location
remote remote
upvotes upvotes
wvotes
sats sats
boost boost
lastCommentAt lastCommentAt