Skip to content

Commit

Permalink
item referral threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
huumn authored and aegroto committed Dec 3, 2024
1 parent 999846b commit e2d5380
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion api/ssrApollo.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { BLOCK_HEIGHT } from '@/fragments/blockHeight'
import { CHAIN_FEE } from '@/fragments/chainFee'
import { getServerSession } from 'next-auth/next'
import { getAuthOptions } from '@/pages/api/auth/[...nextauth]'
import { NOFOLLOW_LIMIT } from '@/lib/constants'
import { satsToMsats } from '@/lib/format'

export default async function getSSRApolloClient ({ req, res, me = null }) {
const session = req && await getServerSession(req, res, getAuthOptions(req))
Expand Down Expand Up @@ -64,7 +66,17 @@ function oneDayReferral (request, { me }) {
let prismaPromise, getData

if (referrer.startsWith('item-')) {
prismaPromise = models.item.findUnique({ where: { id: parseInt(referrer.slice(5)) } })
prismaPromise = models.item.findUnique({
where: {
id: parseInt(referrer.slice(5)),
msats: {
gt: satsToMsats(NOFOLLOW_LIMIT)
},
weightedVotes: {
gt: 0
}
}
})
getData = item => ({
referrerId: item.userId,
refereeId: parseInt(me.id),
Expand Down

0 comments on commit e2d5380

Please sign in to comment.