summaryrefslogtreecommitdiff
path: root/lib/notice/validations.ts
blob: 146f8e09919037e26870ef0e0f07e561a7c89ed3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { z } from "zod"

// 공지사항 생성 스키마
export const createNoticeSchema = z.object({
  pagePath: z.string().min(1, "페이지 경로를 입력해주세요"),
  title: z.string().min(1, "제목을 입력해주세요"),
  content: z.string().min(1, "내용을 입력해주세요"),
  authorId: z.number().min(1, "작성자를 선택해주세요"),
  isActive: z.boolean().default(true),
})

// 공지사항 수정 스키마
export const updateNoticeSchema = z.object({
  id: z.number(),
  pagePath: z.string().min(1, "페이지 경로를 입력해주세요"),
  title: z.string().min(1, "제목을 입력해주세요"),
  content: z.string().min(1, "내용을 입력해주세요"),
  isActive: z.boolean().default(true),
})

// 페이지 경로별 공지사항 조회 스키마
export const getPageNoticeSchema = z.object({
  pagePath: z.string().min(1, "페이지 경로를 입력해주세요"),
})

// 타입 추출
export type CreateNoticeSchema = z.infer<typeof createNoticeSchema>
export type UpdateNoticeSchema = z.infer<typeof updateNoticeSchema>
export type GetPageNoticeSchema = z.infer<typeof getPageNoticeSchema>