Title
a

Andre Coetzee

03/20/2019, 8:51 AM
@Corjen canโ€™t you just sort by Id and do a reverse ?
c

Corjen

03/20/2019, 8:52 AM
No, I see that the example is not clear enough ๐Ÿ™‚
The id's can be a random order, so
["2", "4", "5", "1"]
, etc.
The use case is this:
There is a relation type with every company that has an enum
["WAITING", "LIKED", "DISLIKED"]
What i want is to get a list of companies with no relations first, then with a relation with type
WAITING
, and so one
a

Andre Coetzee

03/20/2019, 8:56 AM
I am not sure if prisma has a feature for this. But I found this on stackoverflow with normal sql: https://stackoverflow.com/questions/41712032/sql-server-select-query-with-in-and-order-by-the-same You can maybe try and recreate that
Maybe loop through that list and query each enum individually. You can then append to list if found and then return the list. Its not that sexy but it would work
c

Corjen

03/20/2019, 8:59 AM
Yeah, got that working, though pagination is a bit tricky. Was wondering if there isn't a better solution inside prisma
That would be either sorting by relation type, or being able to retreive a list in a certain id order
s

schickling

03/20/2019, 9:00 AM
This is really interesting @Corjen. Would you mind opening a GH issue for this as a feature request?
c

Corjen

03/20/2019, 9:01 AM
Sure!
@schickling https://github.com/prisma/prisma/issues/4223 There you go! Hope it makes sense! ๐Ÿ™‚
๐Ÿ™ 1