item referral threshold

This commit is contained in:
k00b 2024-12-02 14:44:15 -06:00
parent 01d5177006
commit 909853521d
1 changed files with 13 additions and 1 deletions

View File

@ -13,6 +13,8 @@ import { BLOCK_HEIGHT } from '@/fragments/blockHeight'
import { CHAIN_FEE } from '@/fragments/chainFee' import { CHAIN_FEE } from '@/fragments/chainFee'
import { getServerSession } from 'next-auth/next' import { getServerSession } from 'next-auth/next'
import { getAuthOptions } from '@/pages/api/auth/[...nextauth]' 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 }) { export default async function getSSRApolloClient ({ req, res, me = null }) {
const session = req && await getServerSession(req, res, getAuthOptions(req)) const session = req && await getServerSession(req, res, getAuthOptions(req))
@ -64,7 +66,17 @@ function oneDayReferral (request, { me }) {
let prismaPromise, getData let prismaPromise, getData
if (referrer.startsWith('item-')) { 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 => ({ getData = item => ({
referrerId: item.userId, referrerId: item.userId,
refereeId: parseInt(me.id), refereeId: parseInt(me.id),