@@ -83,46 +83,45 @@ export const opportunityCreateSchema = z.object({
8383 content : opportunityContentSchema . partial ( ) ,
8484} ) ;
8585
86- export const opportunityCreateParseSchema = opportunityCreateSchema
87- . omit ( { organizationId : true } )
88- . extend ( {
89- keywords : z . preprocess ( ( val ) => {
90- if ( Array . isArray ( val ) ) {
91- return val . map ( ( keyword ) => {
92- return {
93- keyword,
94- } ;
95- } ) ;
96- }
86+ export const opportunityCreateParseSchema = opportunityCreateSchema . extend ( {
87+ organizationId : opportunityCreateSchema . shape . organizationId . nullish ( ) ,
88+ keywords : z . preprocess ( ( val ) => {
89+ if ( Array . isArray ( val ) ) {
90+ return val . map ( ( keyword ) => {
91+ return {
92+ keyword,
93+ } ;
94+ } ) ;
95+ }
9796
98- return val ;
99- } , opportunityCreateSchema . shape . keywords ) ,
100- meta : opportunityCreateSchema . shape . meta
101- . extend ( {
102- teamSize : opportunityCreateSchema . shape . meta . shape . teamSize . optional ( ) ,
103- salary : z
104- . object ( {
105- min : z . preprocess ( ( val : bigint ) => {
106- if ( typeof val === 'undefined' ) {
107- return val ;
108- }
97+ return val ;
98+ } , opportunityCreateSchema . shape . keywords ) ,
99+ meta : opportunityCreateSchema . shape . meta
100+ . extend ( {
101+ teamSize : opportunityCreateSchema . shape . meta . shape . teamSize . optional ( ) ,
102+ salary : z
103+ . object ( {
104+ min : z . preprocess ( ( val : bigint ) => {
105+ if ( typeof val === 'undefined' ) {
106+ return val ;
107+ }
109108
110- return parseBigInt ( val ) ;
111- } , z . number ( ) . int ( ) . nonnegative ( ) . max ( 100_000_000 ) . optional ( ) ) ,
112- max : z . preprocess ( ( val : bigint ) => {
113- if ( typeof val === 'undefined' ) {
114- return val ;
115- }
109+ return parseBigInt ( val ) ;
110+ } , z . number ( ) . int ( ) . nonnegative ( ) . max ( 100_000_000 ) . optional ( ) ) ,
111+ max : z . preprocess ( ( val : bigint ) => {
112+ if ( typeof val === 'undefined' ) {
113+ return val ;
114+ }
116115
117- return parseBigInt ( val ) ;
118- } , z . number ( ) . int ( ) . nonnegative ( ) . max ( 100_000_000 ) . optional ( ) ) ,
119- period : z . number ( ) ,
120- } )
121- . partial ( )
122- . optional ( ) ,
123- } )
124- . partial ( ) ,
125- } ) ;
116+ return parseBigInt ( val ) ;
117+ } , z . number ( ) . int ( ) . nonnegative ( ) . max ( 100_000_000 ) . optional ( ) ) ,
118+ period : z . number ( ) ,
119+ } )
120+ . partial ( )
121+ . optional ( ) ,
122+ } )
123+ . partial ( ) ,
124+ } ) ;
126125
127126export const opportunityEditSchema = z
128127 . object ( {
0 commit comments