From 909853521d2f67d7cd361f913167bee6dc77b7c2 Mon Sep 17 00:00:00 2001 From: k00b Date: Mon, 2 Dec 2024 14:44:15 -0600 Subject: [PATCH] item referral threshold --- api/ssrApollo.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/api/ssrApollo.js b/api/ssrApollo.js index 7f7296db..7af73317 100644 --- a/api/ssrApollo.js +++ b/api/ssrApollo.js @@ -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)) @@ -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),