-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #94 from emil-webkom/admin-event
Admin event
- Loading branch information
Showing
13 changed files
with
1,240 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { getUserById } from "@/data/user"; | ||
import { db } from "@/lib/db"; | ||
import { NextRequest, NextResponse } from "next/server"; | ||
|
||
export async function GET( | ||
req: NextRequest, | ||
{ params }: { params: { id: string } }, | ||
) { | ||
try { | ||
const paameldinger = await db.arrangementPaamelding.findMany({ | ||
where: { | ||
arrangementID: params.id, | ||
}, | ||
}); | ||
|
||
if (!paameldinger || paameldinger.length === 0) { | ||
return NextResponse.json( | ||
{ error: "Ingen paameldinger funnet" }, | ||
{ status: 404 }, | ||
); | ||
} | ||
const userPromises = paameldinger.map((p) => getUserById(p.userID)); | ||
const users = await Promise.all(userPromises); | ||
|
||
return NextResponse.json(users); | ||
} catch (error) { | ||
return NextResponse.json( | ||
{ error: "En feil oppstod ved henting av brukere" }, | ||
{ status: 500 }, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.