File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6666 "tw-animate-css" : " ^1.3.8" ,
6767 "typescript" : " ^5"
6868 },
69- "packageManager" : " pnpm@10.18.1 +sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34 "
69+ "packageManager" : " pnpm@10.33.0 +sha512.10568bb4a6afb58c9eb3630da90cc9516417abebd3fabbe6739f0ae795728da1491e9db5a544c76ad8eb7570f5c4bb3d6c637b2cb41bfdcdb47fa823c8649319 "
7070}
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ export const URLRecord = z.object({
44 id : z . coerce . number ( ) ,
55 is_custom : z . boolean ( ) ,
66 original_url : z . string ( ) . url ( ) ,
7- short_code : z . string ( ) . max ( 20 ) ,
7+ short_code : z . string ( ) . max ( 25 ) ,
88 created_at : z . coerce . date ( ) ,
99 updated_at : z . coerce . date ( ) ,
1010 click_count : z . number ( ) . int ( ) . nonnegative ( ) ,
Original file line number Diff line number Diff line change 11import { z } from "zod"
22
3- export const createUrlSchema = z . object ( {
3+ export const editUrlSchema = z . object ( {
44 url : z . string ( ) . url ( "Invalid URL format" ) ,
55 shortCode : z
66 . string ( )
7- . min ( 2 , "Short code must be at least 3 characters" )
8- . max ( 20 , "Short code must be at most 20 characters" )
7+ . min ( 2 , "Short code must be at least 2 characters" )
8+ . max ( 25 , "Short code must be at most 25 characters" )
99 . regex (
1010 / ^ [ a - z A - Z 0 - 9 _ - ] + $ / ,
1111 "Short code can only contain letters, numbers, hyphens and underscores"
12- )
13- . optional ( ) ,
12+ ) ,
1413} )
1514
16- export type CreateUrlInput = z . infer < typeof createUrlSchema >
17-
18- export const editUrlSchema = createUrlSchema . extend ( {
19- shortCode : z
20- . string ( )
21- . min ( 2 )
22- . max ( 20 )
23- . regex ( / ^ [ a - z A - Z 0 - 9 _ - ] + $ / ) ,
15+ export const createUrlSchema = editUrlSchema . extend ( {
16+ shortCode : editUrlSchema . shape . shortCode . optional ( ) ,
2417} )
You can’t perform that action at this time.
0 commit comments