-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
fix: group by #4768
fix: group by #4768
Conversation
...packages/client/src/__tests__/integration/happy/exhaustive-schema/__snapshots__/test.ts.snap
Show resolved
Hide resolved
body: (ctx) => `Group by ${ctx.singular}. | ||
@param {${getGroupByArgsName(ctx.model.name)}} args - Group by arguments. | ||
@example | ||
// Group by city, order by createdAt, get count | ||
const result = await prisma.user.groupBy({ | ||
by: ['city', 'createdAt'], | ||
orderBy: { | ||
createdAt: true | ||
}, | ||
count: { | ||
_all: true | ||
}, | ||
}) | ||
`, |
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.
This looks hardcoded @timsuchanek should be dynamic no?
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 intentionally did a hardcoded example here, as it's otherwise quite hard to auto generate the jsdocs (we need to find the right fields, check if they're even there etc).
So I chose an example that always makes sense.
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.
Ok!
Add type constraints for the following cases:
take
orskip
is provided,orderBy
is requiredorderBy
needs to be inby
Introduces
tsd
to write type error tests.