Skip to content
This repository was archived by the owner on Mar 1, 2026. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions packages/runtime/src/client/crud/operations/find.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,19 @@ export class FindOperationHandler<Schema extends SchemaDef> extends BaseOperatio
const normalizedArgs = this.normalizeArgs(args);

// parse args
const parsedArgs = validateArgs
const parsedArgs = (validateArgs
? this.inputValidator.validateFindArgs(this.model, operation === 'findUnique', normalizedArgs)
: normalizedArgs;
: normalizedArgs) as FindArgs<Schema, GetModels<Schema>, true>;

if (operation === 'findFirst') {
Comment thread
ymc9 marked this conversation as resolved.
parsedArgs.take = 1;
}

// run query
const result = await this.read(
this.client.$qb,
this.model,
parsedArgs as FindArgs<Schema, GetModels<Schema>, true>,
parsedArgs,
);

const finalResult = operation === 'findMany' ? result : (result[0] ?? null);
Expand Down