-
Notifications
You must be signed in to change notification settings - Fork 52
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
Broken link in the doc #344
Comments
Update 28.12.2024I've figured out how pagination works in
Original postBTW I am trying to figure out something else but I realized that Should not this be part of the doc? E.g. here maybe? I do not get it quite right, but it is happening between the time that client's query reaches this resolver: nestjs-query/packages/query-graphql/src/resolvers/read.resolver.ts Lines 111 to 134 in 91c8ac2
Somehow {
sorting: [
{
field: "id",
direction: "ASC",
},
],
paging: {
limit: 3,
},
relations: [
],
filter: {
},
} When my query is query {
posts(first: 3) {
id
}
} So I guess it worth noting it somewhere. |
Update 28.12.2024Here in the docs it says that the default sorting is determined by your persistence service layer: https://tripss.github.io/nestjs-query/docs/graphql/dtos#default-sort But still I was able to pin point where it is being hard coded. Not yet at least 🥲. Original CommentIf you know where it is doing the magic of adding this default sorting option please lemme know. I did not manage to find any trace of it. I tried to debug it but it was like a maze and I could not find it 😅. |
The link of the "issue" should be doug-martin/nestjs-query#954, think is became broken when I replaced all references to that repo to this one. |
Update 28.12.2024So after a closer inspection of the docs I realized that since cursor is opaque (we do not know what is inside it) the default implementation is not using "Keyset Cursors" but we can of course change it if we want to (ref). Will try to make sense of Original CommentAha, OK. I will then take care of it in another PR. BTW could please gimme some pointers about pagination in nestjs-query? it is kinda like a mystery to me since I thought that I am using cursor based pagination (meaning I was expecting more or less a query like this: SELECT
"Alert"."id" AS "Alert_id",
"Alert"."title" AS "Alert_title",
"Alert"."description" AS "Alert_description",
"Alert"."userId" AS "Alert_userId",
"Alert"."alertTypeId" AS "Alert_alertTypeId",
"Alert"."createdAt" AS "Alert_createdAt",
"Alert"."updatedAt" AS "Alert_updatedAt"
FROM "alert" "Alert"
LIMIT 7
OFFSET 6 # From where this 6 comes? I speculate that nestjs-query is either storing the keys and their offset in DB or just fetch it right when I send the query. But the problem is that I cannot see that in PostgreSQL logs. Or maybe it is part of the cursor??? When I send this query: query {
alerts(paging: {
"paging": {
"first": 6,
"after": "YXJyYXljb25uZWN0aW9uOjU="
}
}) {
edges {
cursor
node {
id
title
createdAt
}
}
pageInfo {
endCursor
hasNextPage
startCursor
hasPreviousPage
}
}
}
Also another comment, if I am understanding
|
Hmmm, it's interesting. Change log says that this is not a bug anymore: https://github.com/kasir-barati/nestjs-query/blob/master/CHANGELOG.md#bug-fixes-39 So I am gonna remove the note for it from the docs since it is not longer applicable. But please lemme know if I am getting something wrong :). |
Another place that the docs seems a bit off is when it says:
But earlier it said:
It just confused me and I tried it out in my local machine and it was returning only the first 10 records. So I suggest this wording: "By default if you do not provided an arguments it will uses the default value specified for the page size and for the sorting." |
📚 Documentation
Here: https://tripss.github.io/nestjs-query/docs/concepts/queries#paging
The link to "issue" is broken.
Dunno where should it be pointing to. Any comment?
Have you read the Contributing Guidelines on issues?
Yup.
The text was updated successfully, but these errors were encountered: