Skip to content

Commit

Permalink
fix: types use readonly
Browse files Browse the repository at this point in the history
  • Loading branch information
karrui committed Jul 19, 2024
1 parent 54b5f85 commit e57b63b
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions apps/studio/src/schemas/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import { z } from "zod"
const NEW_PAGE_LAYOUT_VALUES = [
"article",
"content",
] satisfies PrismaJson.BlobJsonContent["layout"][]
type NewPageLayoutValues = (typeof NEW_PAGE_LAYOUT_VALUES)[number]
] as const satisfies readonly PrismaJson.BlobJsonContent["layout"][]

export const MAX_TITLE_LENGTH = 150
export const MAX_PAGE_URL_LENGTH = 250
Expand Down Expand Up @@ -35,12 +34,7 @@ export const createPageSchema = z.object({
.max(MAX_PAGE_URL_LENGTH, {
message: `Page URL should be shorter than ${MAX_PAGE_URL_LENGTH} characters.`,
}),
layout: z
.enum<
string,
[NewPageLayoutValues]
>(NEW_PAGE_LAYOUT_VALUES as [NewPageLayoutValues])
.default("content"),
layout: z.enum(NEW_PAGE_LAYOUT_VALUES).default("content"),
siteId: z.number().min(1),
// NOTE: implies that top level pages are allowed
folderId: z.number().min(1).optional(),
Expand Down

0 comments on commit e57b63b

Please sign in to comment.