Giter VIP home page Giter VIP logo

Comments (7)

kikoseijo avatar kikoseijo commented on July 19, 2024

You are right @hailwood , probably your example isn't the best, because by the id you will only be able to get 1 record, right?

ill change it to email instead of id, and you will get same results, when you try to search for name like Dr% and email its null.

We probably need some filtering similar to:

$request->filled('email')

And then if its not present on request we can avoid it.

Does this sound right?

from lighthouse.

hailwood avatar hailwood commented on July 19, 2024

@kikoseijo yeah you're right, the example isn't the greatest, I just wanted to add two filters, probably could have gone with @in instead but oh well.

That idea almost sounds right, I'm just not sure how to deal with if the user actuallys wants null..
I wonder if we need to do some special processing and look for the strings IS NULL or IS NOT NULL and apply a whereNull or whereNotNull respectively?

Not sure, just tossing ideas out there.Perhaps I'm overthinking it and we don't need the user to be able to say is null/is not null...

from lighthouse.

kikoseijo avatar kikoseijo commented on July 19, 2024

Ill go for checking the existence of a field even if its empty, if it exists on query vars then process, otherwise skip-
I have done some hardcoded (string) "NULL", but, you know, this isn't Laravelish!

from lighthouse.

chrissm79 avatar chrissm79 commented on July 19, 2024

@hailwood In my mind, the way that it would work should be if the id and the name is passed in the query (or variables) then process it, whether it be null or not. If the argument is excluded then skip it. So:

{
    users(name: "Dr%") {
        id
        name
    }
}

would skip the id query, but if null where provided as a variable then it would include it in the query. Regardless, right now it is processing everything so I'll get it updated!

from lighthouse.

chrissm79 avatar chrissm79 commented on July 19, 2024

@hailwood The latest commits to master should resolve your issue. Give it a try and let me know!

https://github.com/nuwave/lighthouse/blob/master/src/Support/Database/QueryFilter.php#L64-L67

from lighthouse.

hailwood avatar hailwood commented on July 19, 2024

Thanks @chrissm79 ,

Will give this a go this evening and report back.

from lighthouse.

hailwood avatar hailwood commented on July 19, 2024

Great job @chrissm79,

Everything is working perfectly 👍

from lighthouse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.