Skip to content

Commit

Permalink
update path db queries
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeKarow committed Jun 20, 2023
1 parent 920d255 commit d969531
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/pages/category/[tag]/[[...storyId]].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export const getStaticPaths: GetStaticPaths<{ tag: string; storyId?: string[] }>
locales = ['en', 'es'],
}) => {
const categories = await prisma.storyCategory.findMany({
select: { tag: true, stories: { select: { storyId: true } } },
select: { tag: true, stories: { select: { storyId: true }, where: { story: { published: true } } } },
})

const paths = categories.flatMap(({ tag, stories }) => [
Expand Down
2 changes: 1 addition & 1 deletion src/pages/story/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const getStaticProps: GetStaticProps<Record<string, unknown>, RoutedQuery
}
}
export const getStaticPaths: GetStaticPaths = async ({ locales = ['en', 'es'] }) => {
const stories = await prisma.story.findMany({ select: { id: true } })
const stories = await prisma.story.findMany({ select: { id: true }, where: { published: true } })

return {
paths: stories.flatMap(({ id }) => locales.map((locale) => ({ params: { id }, locale }))),
Expand Down

0 comments on commit d969531

Please sign in to comment.