diff --git a/src/app/functions/get-referral-stats.ts b/src/app/functions/get-referral-stats.ts index 55bf3a3..a1c9e14 100644 --- a/src/app/functions/get-referral-stats.ts +++ b/src/app/functions/get-referral-stats.ts @@ -6,7 +6,6 @@ import { ReferralNotFound } from '../errors/referral-not-found' type GetReferralInput = { token: string - eventId: string } type TotalSubscriptions = { @@ -14,17 +13,12 @@ type TotalSubscriptions = { subscription_count: string } -export async function getReferralStats({ eventId, token }: GetReferralInput) { +export async function getReferralStats({ token }: GetReferralInput) { try { const [referral] = await db .select() .from(schema.referral) - .where( - and( - eq(schema.referral.token, token), - eq(schema.referral.eventId, eventId) - ) - ) + .where(eq(schema.referral.token, token)) if (!referral) { return makeLeft(new ReferralNotFound()) diff --git a/src/http/routes/get-referral-stats.ts b/src/http/routes/get-referral-stats.ts index ed054e4..68e42cf 100644 --- a/src/http/routes/get-referral-stats.ts +++ b/src/http/routes/get-referral-stats.ts @@ -8,7 +8,6 @@ import { z } from 'zod' const querySchema = z.object({ token: z.string().min(1, 'Token is required'), - eventId: z.string().min(1, 'Event ID is required'), }) const successResponseSchema = z.object({ @@ -44,8 +43,8 @@ export async function getReferralStatsRoute(app: FastifyInstance) { response: responseSchema, }, handler: async (request, reply) => { - const { token, eventId } = querySchema.parse(request.query) - const result = await getReferralStats({ token, eventId }) + const { token } = querySchema.parse(request.query) + const result = await getReferralStats({ token }) if (isLeft(result)) { const error = result.left