-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Flexible-schema] Add findOne and fix findMany pagination + soft-delete for graphql-query-runner #6978
[Flexible-schema] Add findOne and fix findMany pagination + soft-delete for graphql-query-runner #6978
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,15 +26,19 @@ export class GraphqlQueryFilterConditionParser { | |
} | ||
|
||
const result: FindOptionsWhere<ObjectLiteral> = {}; | ||
let orCondition: FindOptionsWhere<ObjectLiteral>[] | null = null; | ||
Comment on lines
28
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: Consider initializing orCondition as an empty array instead of null for consistency. |
||
|
||
for (const [key, value] of Object.entries(conditions)) { | ||
switch (key) { | ||
case 'and': | ||
return this.parseAndCondition(value, isNegated); | ||
Object.assign(result, this.parseAndCondition(value, isNegated)); | ||
break; | ||
case 'or': | ||
return this.parseOrCondition(value, isNegated); | ||
orCondition = this.parseOrCondition(value, isNegated); | ||
break; | ||
case 'not': | ||
return this.parse(value, !isNegated); | ||
Object.assign(result, this.parse(value, !isNegated)); | ||
break; | ||
default: | ||
Object.assign( | ||
result, | ||
|
@@ -43,6 +47,10 @@ export class GraphqlQueryFilterConditionParser { | |
} | ||
} | ||
|
||
if (orCondition) { | ||
return orCondition.map((condition) => ({ ...result, ...condition })); | ||
} | ||
Comment on lines
+50
to
+52
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. logic: This logic might not correctly handle negated 'or' conditions. Consider how negation should be applied when combining with other conditions. |
||
|
||
return result; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
INVALID_INPUT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
INVALID_FIRST / INVALID_LAST