File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed
Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -72,13 +72,24 @@ export const workBookSchema = z.object({
7272 workBookType : z . nativeEnum ( WorkBookType ) ,
7373 urlSlug : z
7474 . string ( )
75- . min ( 0 , { message : '' } )
76- . max ( 30 , { message : '30文字になるまで削除してください' } ) // 問題集(カリキュラムと解法別)をURLで識別するためのオプション。a-z、0-9、(-)ハイフンのみ使用可能。例: bfs、dfs、dp、union-find、2-sat。
77- . transform ( ( value ) => ( value === '' ? undefined : value . toLowerCase ( ) ) )
75+ . nullable ( )
76+ . optional ( )
77+ . refine (
78+ ( value ) => {
79+ // Allow empty string, null, or undefined
80+ if ( value === '' || value === null || value === undefined ) {
81+ return true ;
82+ }
83+ return value . length <= 30 ;
84+ } ,
85+ { message : '30文字以下になるまで削除してください' } ,
86+ )
87+ . transform ( ( value ) =>
88+ value === '' || value === null || value === undefined ? undefined : value . toLowerCase ( ) ,
89+ )
7890 . refine ( ( value ) => value === undefined || isValidUrlSlug ( value ) , {
7991 message : '半角英小文字、数字、ハイフンのみ使用可能です' ,
80- } )
81- . optional ( ) ,
92+ } ) ,
8293 workBookTasks : z
8394 . array ( workBookTaskSchema )
8495 . min ( 1 , { message : '1問以上登録してください' } )
You can’t perform that action at this time.
0 commit comments