Skip to content

Nested Search support added - #4

Open
sourodeep23 wants to merge 1 commit into
mainfrom
pr-nested-search
Open

Nested Search support added#4
sourodeep23 wants to merge 1 commit into
mainfrom
pr-nested-search

Conversation

@sourodeep23

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread src/baseService.ts
}
if (fieldInfo.type === 'String') {
_.set(prismaFilters, `${propertyName}.contains`, value);
if (fieldInfo?.type === 'String' || nestedFieldPath) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can move it to it's independent if block

Comment thread src/baseService.ts
if (fieldInfo.type === 'String') {
_.set(prismaFilters, `${propertyName}.contains`, value);
if (fieldInfo?.type === 'String' || nestedFieldPath) {
_.set(prismaFilters, `${nestedFieldPath?nestedFieldPath:propertyName}.contains`, value);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same in independent if block

Comment thread src/baseService.ts
@@ -147,15 +143,15 @@ export class BaseService<T> implements OnInit, IBaseService {
_.set(prismaFilters, `${propertyName}.in`, value);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have a support for array value, keep in mind we don't have fieldInfo however we can know type of value and based on that we can manage prismafilters

Comment thread src/baseService.ts
@@ -165,52 +161,43 @@ export class BaseService<T> implements OnInit, IBaseService {
_.set(prismaFilters, `${propertyName}.not.in`, value);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Comment thread src/baseService.ts
if (_.isString(value)) {
_.set(prismaFilters, `${propertyName}.not.contains`, value);
if (_.isString(value) || nestedFieldPath) {
_.set(prismaFilters, `${nestedFieldPath?nestedFieldPath:propertyName}.not.contains`, value);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seperate block

Comment thread src/baseService.ts
}
if (fieldInfo.type === 'DateTime') {
GT: ({ prismaFilters, value, propertyName, fieldInfo, isRelation, nestedFieldPath }) => {
if (_.isNumber(value) || fieldInfo?.type === 'DateTime' || nestedFieldPath) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants