-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Build arg setter for position #4396
Conversation
import { FieldMetadataType } from 'src/metadata/field-metadata/field-metadata.entity'; | ||
|
||
@Injectable() | ||
export class ArgsSettersFactory { |
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.
Not a big fan of the name since it does not "set" existing args but rather build new ones. But I don't know how I should call it.
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.
I agree, maybe we can just call it ArgFactory
for now ?
cc @charlesBochet
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.
renamed QueryRunnerArgFactory so we avoid mistakes between existing arg factories in the builder
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.
Small comments :)
import { FieldMetadataType } from 'src/metadata/field-metadata/field-metadata.entity'; | ||
|
||
@Injectable() | ||
export class ArgsSettersFactory { |
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.
I agree, maybe we can just call it ArgFactory
for now ?
cc @charlesBochet
packages/twenty-server/src/workspace/workspace-query-runner/factories/arg-setters.factory.ts
Outdated
Show resolved
Hide resolved
packages/twenty-server/src/workspace/workspace-query-runner/factories/arg-setters.factory.ts
Outdated
Show resolved
Hide resolved
return this.applySettersToArgsRecursive(args, options, fieldMetadataMap); | ||
} | ||
|
||
private async applySettersToArgsRecursive( |
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.
Not sure of the naming too, maybe computeArgs
?
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.
renamed createArgsRecursive
edf2f36
to
983c72c
Compare
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.
LGTM !
Position input needs to be of type :
number | first | last
:number
, returns valuefirst
, fetch first element ascending and setposition / 2
last
, fetch first element descending and setposition + 1
This logic is integrated into a new factory call arg-setters. It iterates recursively on all arguments and override existing ones using setter function.