File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
packages/runtime/src/client/crud/operations Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -8,15 +8,19 @@ export class FindOperationHandler<Schema extends SchemaDef> extends BaseOperatio
88 const normalizedArgs = this . normalizeArgs ( args ) ;
99
1010 // parse args
11- const parsedArgs = validateArgs
11+ const parsedArgs = ( validateArgs
1212 ? this . inputValidator . validateFindArgs ( this . model , operation === 'findUnique' , normalizedArgs )
13- : normalizedArgs ;
13+ : normalizedArgs ) as FindArgs < Schema , GetModels < Schema > , true > ;
14+
15+ if ( operation === 'findFirst' ) {
16+ parsedArgs . take = 1 ;
17+ }
1418
1519 // run query
1620 const result = await this . read (
1721 this . client . $qb ,
1822 this . model ,
19- parsedArgs as FindArgs < Schema , GetModels < Schema > , true > ,
23+ parsedArgs ,
2024 ) ;
2125
2226 const finalResult = operation === 'findMany' ? result : ( result [ 0 ] ?? null ) ;
You can’t perform that action at this time.
0 commit comments