fix: use two-step query to fix scoped package 404s on tool detail page
The relation filter `package: { npmPackageName }` was not working correctly.
Now first find the package, then find the tool by packageId.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
5f7a9881ea
commit
2fb63ad506
1 changed files with 11 additions and 1 deletions
|
|
@ -33,9 +33,19 @@ async function getTool(slug: string[]): Promise<Tool | null> {
|
|||
return null;
|
||||
}
|
||||
|
||||
// First find the package by npm name
|
||||
const pkg = await prisma.package.findUnique({
|
||||
where: { npmPackageName: packageName },
|
||||
});
|
||||
|
||||
if (!pkg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Then find the tool using packageId
|
||||
const tool = await prisma.tool.findFirst({
|
||||
where: {
|
||||
package: { npmPackageName: packageName },
|
||||
packageId: pkg.id,
|
||||
...(exportName && { name: exportName }),
|
||||
},
|
||||
include: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue