@@ -20,8 +20,7 @@ const content = z
2020 message : "Must be at least 10 characters long"
2121 } )
2222 . refine ( ( str ) => str === null || str === "" || str . includes ( " " ) , {
23- message :
24- "You have no spaces, this is supposed to be at least a couple of words, ideally a few sentences."
23+ message : "You have no spaces, this is supposed to be at least a couple of words, ideally a few sentences."
2524 } )
2625
2726const categoryKeys = Object . keys ( scriptCategories ) as TScriptCategories
@@ -41,18 +40,12 @@ export const baseScriptSchema = z.object({
4140 . regex ( / ^ [ a - f A - F 0 - 9 ] + $ / , "Must be a valid hexadecimal string" ) ,
4241 wasplib : z
4342 . string ( )
44- . regex (
45- / ^ \d { 4 } \. \d { 2 } \. \d { 2 } - [ a - f A - F 0 - 9 ] { 7 } $ / ,
46- "Must match format YYYY.MM.DD-HEX with valid hex"
47- ) ,
43+ . regex ( / ^ \d { 4 } \. \d { 2 } \. \d { 2 } - [ a - f A - F 0 - 9 ] { 7 } $ / , "Must match format YYYY.MM.DD-HEX with valid hex" ) ,
4844 xp_min : z
4945 . number ( )
5046 . int ( "Only whole numbers are allowed." )
5147 . gte ( 0 , "There's no way to lose experience in OSRS." ) ,
52- xp_max : z
53- . number ( )
54- . int ( "Only whole numbers are allowed." )
55- . max ( 60000 , "That exceeds the reasonable limit." ) ,
48+ xp_max : z . number ( ) . int ( "Only whole numbers are allowed." ) . max ( 60000 , "That exceeds the reasonable limit." ) ,
5649 gp_min : z
5750 . number ( )
5851 . int ( "Only whole numbers are allowed." )
@@ -97,10 +90,7 @@ export const addScriptClientSchema = baseScriptSchema
9790 ( schema ) => schema . xp_min <= schema . xp_max ,
9891 "Minimum experience cannot exceed the maximum experience."
9992 )
100- . refine (
101- ( schema ) => schema . gp_min <= schema . gp_max ,
102- "Minimum gold cannot exceed the maximum gold."
103- )
93+ . refine ( ( schema ) => schema . gp_min <= schema . gp_max , "Minimum gold cannot exceed the maximum gold." )
10494
10595export type AddScriptSchema = z . infer < typeof addScriptClientSchema >
10696
@@ -124,10 +114,7 @@ export const updateScriptClientSchema = baseScriptSchema
124114 ( schema ) => schema . xp_min <= schema . xp_max ,
125115 "Minimum experience cannot exceed the maximum experience."
126116 )
127- . refine (
128- ( schema ) => schema . gp_min <= schema . gp_max ,
129- "Minimum gold cannot exceed the maximum gold."
130- )
117+ . refine ( ( schema ) => schema . gp_min <= schema . gp_max , "Minimum gold cannot exceed the maximum gold." )
131118
132119export type UpdateScriptSchema = z . infer < typeof updateScriptClientSchema >
133120
@@ -163,20 +150,14 @@ export const profileSchema = z.object({
163150
164151export const scripterSchema = z . object ( {
165152 id : z . string ( ) . uuid ( "ID must be a valid UUIDv4." ) ,
166- realname : z
167- . string ( )
168- . min ( 2 , "If your name really has less than 2 characters contact Torwent." )
169- . nullable ( ) ,
153+ realname : z . string ( ) . min ( 2 , "If your name really has less than 2 characters contact Torwent." ) . nullable ( ) ,
170154 description : z
171155 . string ( )
172156 . min ( 6 , "Must be more than 6 characters long." )
173157 . max ( 32 , "Must be less than 32 characters long." )
174158 . includes ( " " , { message : "This should be a sentence or at least a couple of words." } )
175159 . nullable ( ) ,
176- github : z
177- . string ( )
178- . startsWith ( "https://github.com/" , "This should be a github user profile." )
179- . nullable ( ) ,
160+ github : z . string ( ) . startsWith ( "https://github.com/" , "This should be a github user profile." ) . nullable ( ) ,
180161 paypal : z
181162 . string ( )
182163 . length (
@@ -236,10 +217,7 @@ export const checkoutSchema = z.object({
236217} )
237218
238219const newPriceSchema = z . object ( {
239- amount : z
240- . number ( )
241- . gte ( 0 , "Amount has to be a positive value." )
242- . lte ( 200 , "Amount can't be more than 200€." ) ,
220+ amount : z . number ( ) . gte ( 0 , "Amount has to be a positive value." ) . lte ( 200 , "Amount can't be more than 200€." ) ,
243221 interval : z . string ( ) . min ( 4 ) . max ( 5 ) . regex ( new RegExp ( "week|month|year" ) ) ,
244222 currency : z . string ( ) . length ( 3 ) . regex ( new RegExp ( "eur" ) )
245223} )
0 commit comments