feat(api): show only published version on changelog public route
This commit is contained in:
parent
514a2d2003
commit
3449b5c2ac
@ -1,4 +1,4 @@
|
|||||||
import { changelog, db } from '@boring.tools/database'
|
import { changelog, changelog_version, db } from '@boring.tools/database'
|
||||||
import { ChangelogByIdParams, ChangelogOutput } from '@boring.tools/schema'
|
import { ChangelogByIdParams, ChangelogOutput } from '@boring.tools/schema'
|
||||||
import { createRoute } from '@hono/zod-openapi'
|
import { createRoute } from '@hono/zod-openapi'
|
||||||
import { and, eq } from 'drizzle-orm'
|
import { and, eq } from 'drizzle-orm'
|
||||||
@ -33,6 +33,7 @@ export const func = async ({ id }: { id: string }) => {
|
|||||||
where: and(eq(changelog.id, id)),
|
where: and(eq(changelog.id, id)),
|
||||||
with: {
|
with: {
|
||||||
versions: {
|
versions: {
|
||||||
|
where: eq(changelog_version.status, 'published'),
|
||||||
orderBy: (changelog_version, { desc }) => [
|
orderBy: (changelog_version, { desc }) => [
|
||||||
desc(changelog_version.createdAt),
|
desc(changelog_version.createdAt),
|
||||||
],
|
],
|
||||||
|
Loading…
Reference in New Issue
Block a user