Skip to content

Commit

Permalink
Rename first to take (#6266)
Browse files Browse the repository at this point in the history
  • Loading branch information
emmatown authored Aug 6, 2021
1 parent cdc25d5 commit b696a95
Show file tree
Hide file tree
Showing 42 changed files with 154 additions and 122 deletions.
32 changes: 32 additions & 0 deletions .changeset/curvy-dolphins-watch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
'@keystone-next/fields': major
'@keystone-next/keystone': major
'@keystone-next/types': major
---

Renamed `first` argument in find many queries to `take` to align with Prisma.

```graphql
type Query {
users(
where: UserWhereInput! = {}
orderBy: [UserOrderByInput!]! = []
# previously was first: Int
take: Int
skip: Int! = 0
): [User!]
# ...
}

type User {
# ...
posts(
where: PostWhereInput! = {}
orderBy: [PostOrderByInput!]! = []
# previously was first: Int
take: Int
skip: Int! = 0
): [Post!]
# ...
}
```
6 changes: 3 additions & 3 deletions examples-staging/assets-cloud/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ type Author {
posts(
where: PostWhereInput! = {}
orderBy: [PostOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [Post!]
postsCount(where: PostWhereInput! = {}): Int
Expand Down Expand Up @@ -270,15 +270,15 @@ type Query {
posts(
where: PostWhereInput! = {}
orderBy: [PostOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [Post!]
post(where: PostWhereUniqueInput!): Post
postsCount(where: PostWhereInput! = {}): Int
authors(
where: AuthorWhereInput! = {}
orderBy: [AuthorOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [Author!]
author(where: AuthorWhereUniqueInput!): Author
Expand Down
6 changes: 3 additions & 3 deletions examples-staging/assets-local/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ type Author {
posts(
where: PostWhereInput! = {}
orderBy: [PostOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [Post!]
postsCount(where: PostWhereInput! = {}): Int
Expand Down Expand Up @@ -248,15 +248,15 @@ type Query {
posts(
where: PostWhereInput! = {}
orderBy: [PostOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [Post!]
post(where: PostWhereUniqueInput!): Post
postsCount(where: PostWhereInput! = {}): Int
authors(
where: AuthorWhereInput! = {}
orderBy: [AuthorOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [Author!]
author(where: AuthorWhereUniqueInput!): Author
Expand Down
2 changes: 1 addition & 1 deletion examples-staging/auth/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ type Query {
users(
where: UserWhereInput! = {}
orderBy: [UserOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [User!]
user(where: UserWhereUniqueInput!): User
Expand Down
10 changes: 5 additions & 5 deletions examples-staging/basic/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ type User {
phoneNumbers(
where: PhoneNumberWhereInput! = {}
orderBy: [PhoneNumberOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [PhoneNumber!]
phoneNumbersCount(where: PhoneNumberWhereInput! = {}): Int
posts(
where: PostWhereInput! = {}
orderBy: [PostOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [Post!]
postsCount(where: PostWhereInput! = {}): Int
Expand Down Expand Up @@ -424,23 +424,23 @@ type Query {
users(
where: UserWhereInput! = {}
orderBy: [UserOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [User!]
user(where: UserWhereUniqueInput!): User
usersCount(where: UserWhereInput! = {}): Int
phoneNumbers(
where: PhoneNumberWhereInput! = {}
orderBy: [PhoneNumberOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [PhoneNumber!]
phoneNumber(where: PhoneNumberWhereUniqueInput!): PhoneNumber
phoneNumbersCount(where: PhoneNumberWhereInput! = {}): Int
posts(
where: PostWhereInput! = {}
orderBy: [PostOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [Post!]
post(where: PostWhereUniqueInput!): Post
Expand Down
2 changes: 1 addition & 1 deletion examples-staging/basic/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export const lists = createSchema({
kind: 'prop',
listKey: 'User',
many: true,
selection: `posts(first: 10) {
selection: `posts(take: 10) {
title
}`,
},
Expand Down
24 changes: 12 additions & 12 deletions examples-staging/ecommerce/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ type User {
cart(
where: CartItemWhereInput! = {}
orderBy: [CartItemOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [CartItem!]
cartCount(where: CartItemWhereInput! = {}): Int
orders(
where: OrderWhereInput! = {}
orderBy: [OrderOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [Order!]
ordersCount(where: OrderWhereInput! = {}): Int
role: Role
products(
where: ProductWhereInput! = {}
orderBy: [ProductOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [Product!]
productsCount(where: ProductWhereInput! = {}): Int
Expand Down Expand Up @@ -581,7 +581,7 @@ type Order {
items(
where: OrderItemWhereInput! = {}
orderBy: [OrderItemOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [OrderItem!]
itemsCount(where: OrderItemWhereInput! = {}): Int
Expand Down Expand Up @@ -674,7 +674,7 @@ type Role {
assignedTo(
where: UserWhereInput! = {}
orderBy: [UserOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [User!]
assignedToCount(where: UserWhereInput! = {}): Int
Expand Down Expand Up @@ -913,55 +913,55 @@ type Query {
users(
where: UserWhereInput! = {}
orderBy: [UserOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [User!]
user(where: UserWhereUniqueInput!): User
usersCount(where: UserWhereInput! = {}): Int
products(
where: ProductWhereInput! = {}
orderBy: [ProductOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [Product!]
product(where: ProductWhereUniqueInput!): Product
productsCount(where: ProductWhereInput! = {}): Int
productImages(
where: ProductImageWhereInput! = {}
orderBy: [ProductImageOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [ProductImage!]
productImage(where: ProductImageWhereUniqueInput!): ProductImage
productImagesCount(where: ProductImageWhereInput! = {}): Int
cartItems(
where: CartItemWhereInput! = {}
orderBy: [CartItemOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [CartItem!]
cartItem(where: CartItemWhereUniqueInput!): CartItem
cartItemsCount(where: CartItemWhereInput! = {}): Int
orderItems(
where: OrderItemWhereInput! = {}
orderBy: [OrderItemOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [OrderItem!]
orderItem(where: OrderItemWhereUniqueInput!): OrderItem
orderItemsCount(where: OrderItemWhereInput! = {}): Int
orders(
where: OrderWhereInput! = {}
orderBy: [OrderOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [Order!]
order(where: OrderWhereUniqueInput!): Order
ordersCount(where: OrderWhereInput! = {}): Int
roles(
where: RoleWhereInput! = {}
orderBy: [RoleOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [Role!]
role(where: RoleWhereUniqueInput!): Role
Expand Down
2 changes: 1 addition & 1 deletion examples-staging/embedded-nextjs/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ type Query {
posts(
where: PostWhereInput! = {}
orderBy: [PostOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [Post!]
post(where: PostWhereUniqueInput!): Post
Expand Down
12 changes: 6 additions & 6 deletions examples-staging/graphql-api-endpoint/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type User {
posts(
where: PostWhereInput! = {}
orderBy: [PostOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [Post!]
postsCount(where: PostWhereInput! = {}): Int
Expand Down Expand Up @@ -126,7 +126,7 @@ type Post {
tags(
where: TagWhereInput! = {}
orderBy: [TagOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [Tag!]
tagsCount(where: TagWhereInput! = {}): Int
Expand Down Expand Up @@ -247,7 +247,7 @@ type Tag {
posts(
where: PostWhereInput! = {}
orderBy: [PostOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [Post!]
postsCount(where: PostWhereInput! = {}): Int
Expand Down Expand Up @@ -382,23 +382,23 @@ type Query {
users(
where: UserWhereInput! = {}
orderBy: [UserOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [User!]
user(where: UserWhereUniqueInput!): User
usersCount(where: UserWhereInput! = {}): Int
posts(
where: PostWhereInput! = {}
orderBy: [PostOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [Post!]
post(where: PostWhereUniqueInput!): Post
postsCount(where: PostWhereInput! = {}): Int
tags(
where: TagWhereInput! = {}
orderBy: [TagOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [Tag!]
tag(where: TagWhereUniqueInput!): Tag
Expand Down
2 changes: 1 addition & 1 deletion examples-staging/playground/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ type Query {
notes(
where: NoteWhereInput! = {}
orderBy: [NoteOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [Note!]
note(where: NoteWhereUniqueInput!): Note
Expand Down
10 changes: 5 additions & 5 deletions examples-staging/roles/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ type Person {
tasks(
where: TodoWhereInput! = {}
orderBy: [TodoOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [Todo!]
tasksCount(where: TodoWhereInput! = {}): Int
Expand Down Expand Up @@ -194,7 +194,7 @@ type Role {
assignedTo(
where: PersonWhereInput! = {}
orderBy: [PersonOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [Person!]
assignedToCount(where: PersonWhereInput! = {}): Int
Expand Down Expand Up @@ -359,23 +359,23 @@ type Query {
todos(
where: TodoWhereInput! = {}
orderBy: [TodoOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [Todo!]
todo(where: TodoWhereUniqueInput!): Todo
todosCount(where: TodoWhereInput! = {}): Int
people(
where: PersonWhereInput! = {}
orderBy: [PersonOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [Person!]
person(where: PersonWhereUniqueInput!): Person
peopleCount(where: PersonWhereInput! = {}): Int
roles(
where: RoleWhereInput! = {}
orderBy: [RoleOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [Role!]
role(where: RoleWhereUniqueInput!): Role
Expand Down
6 changes: 3 additions & 3 deletions examples-staging/sandbox/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ type User {
tasks(
where: TodoWhereInput! = {}
orderBy: [TodoOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [Todo!]
tasksCount(where: TodoWhereInput! = {}): Int
Expand Down Expand Up @@ -238,15 +238,15 @@ type Query {
todos(
where: TodoWhereInput! = {}
orderBy: [TodoOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [Todo!]
todo(where: TodoWhereUniqueInput!): Todo
todosCount(where: TodoWhereInput! = {}): Int
users(
where: UserWhereInput! = {}
orderBy: [UserOrderByInput!]! = []
first: Int
take: Int
skip: Int! = 0
): [User!]
user(where: UserWhereUniqueInput!): User
Expand Down
Loading

1 comment on commit b696a95

@vercel
Copy link

@vercel vercel bot commented on b696a95 Aug 6, 2021

Choose a reason for hiding this comment

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

Please sign in to comment.