general category trip

This commit is contained in:
2026-05-07 18:47:45 +07:00
parent 12f13f2049
commit 49aa64c522
25 changed files with 904 additions and 386 deletions
+9 -3
View File
@@ -1,5 +1,7 @@
import { z } from "zod/v4";
import { LIMITS } from "@/lib/limits";
import { ACTIVITY_CATEGORIES } from "@/lib/activity-category";
import type { ActivityCategory } from "@/app/generated/prisma/enums";
import {
isTripDepartureDayPast,
tripStoredInstantFromYmd,
@@ -17,6 +19,10 @@ export const tripImageUrlsSchema = z
export const createTripSchema = z
.object({
category: z.enum(
ACTIVITY_CATEGORIES as [ActivityCategory, ...ActivityCategory[]],
{ message: "Kategori aktivitas tidak valid" }
),
title: z
.string()
.trim()
@@ -39,13 +45,13 @@ export const createTripSchema = z
)
.optional()
),
mountain: z
destination: z
.string()
.trim()
.min(2, "Destinasi harus diisi")
.max(
LIMITS.MAX_MOUNTAIN_LENGTH,
`Destinasi maksimal ${LIMITS.MAX_MOUNTAIN_LENGTH} karakter`
LIMITS.MAX_DESTINATION_LENGTH,
`Destinasi maksimal ${LIMITS.MAX_DESTINATION_LENGTH} karakter`
),
location: z
.string()