Skip to content

Commit

Permalink
ffdd
Browse files Browse the repository at this point in the history
  • Loading branch information
pratyush3124 committed Mar 14, 2024
1 parent 0c6b026 commit 5b9a095
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/api/event1/getTeamViaToken/route.js
Original file line number Diff line number Diff line change
@@ -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";

Expand All @@ -9,14 +10,16 @@ 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" });
}

return NextResponse.json({
message: "Team Details sent. ",
status: 200,
teamDetails: team,
teamDetails: teamDetails,
});
} catch (error) {
console.error("An error occurred:", error);
Expand Down

0 comments on commit 5b9a095

Please sign in to comment.