This repository has been archived by the owner on Oct 18, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: badge click to latest report (#226)
* feat: badge click to latest report * fix: refactor badge form code * fix: change from img to image component
- Loading branch information
1 parent
49c0f39
commit b19b02e
Showing
4 changed files
with
86 additions
and
47 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,28 @@ | ||
import { redirect } from "next/navigation"; | ||
|
||
import prisma from "@/models/db"; | ||
|
||
export const dynamic = "force-dynamic"; | ||
|
||
export async function GET(request, { params }) { | ||
const { id } = params; | ||
|
||
const repository = await prisma.repository.findUnique({ | ||
where: { id }, | ||
include: { | ||
checks: { | ||
orderBy: { | ||
createdAt: "desc", | ||
}, | ||
take: 1, | ||
}, | ||
}, | ||
}); | ||
|
||
if (repository?.checks[0]) { | ||
const check = repository.checks[0]; | ||
redirect(`/repo/report/${check.id}`); | ||
} else { | ||
redirect("/repo/list"); | ||
} | ||
} |