From 5b9a095c6e6df2918e2a63dc846cb4b59f6a1aee Mon Sep 17 00:00:00 2001 From: Pratyush Date: Thu, 14 Mar 2024 23:32:15 +0530 Subject: [PATCH] ffdd --- app/api/event1/getTeamViaToken/route.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/api/event1/getTeamViaToken/route.js b/app/api/event1/getTeamViaToken/route.js index 6b05f82..bf9bbd3 100644 --- a/app/api/event1/getTeamViaToken/route.js +++ b/app/api/event1/getTeamViaToken/route.js @@ -1,4 +1,5 @@ import { connectMongoDB } from "@/lib/mongodb"; +import { Event1 } from "@/models/event1.model"; import { event1TeamToken } from "@/models/event1TeamToken"; import { NextResponse } from "next/server"; @@ -9,6 +10,8 @@ export async function POST(req) { const { code } = await req.json(); console.log(code); const team = await event1TeamToken.findOne({ teamCode: code }); + const teamDetails = await Event1.findById(team.teamId); + if (!team) { return NextResponse.json({ error: "Team not found" }); } @@ -16,7 +19,7 @@ export async function POST(req) { return NextResponse.json({ message: "Team Details sent. ", status: 200, - teamDetails: team, + teamDetails: teamDetails, }); } catch (error) { console.error("An error occurred:", error);