Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Rename add<type> to add<type>s #44

Open
benwoodward opened this issue Apr 19, 2022 · 0 comments
Open

Rename add<type> to add<type>s #44

benwoodward opened this issue Apr 19, 2022 · 0 comments

Comments

@benwoodward
Copy link

benwoodward commented Apr 19, 2022

The addType function, e.g. addThing, addProduct receives an array of items to add. Always throws me that it's named addType (singular) but takes an array as input. I think it'd make sense to rename it to addTypes, e.g. addProducts, addThings, addUsers

As it is currently:

type Author {
	id: ID!
	name: String! @search(by: [hash])
	dob: DateTime
	posts: [Post]
}

type Post {
	postID: ID!
	title: String! @search(by: [term, fulltext])
	text: String @search(by: [fulltext, term])
	datePublished: DateTime
}
addPost(input: [AddPostInput!]!): AddPostPayload

input AddPostInput {
	title: String!
	text: String
	datePublished: DateTime
}

type AddPostPayload {
	post(filter: PostFilter, order: PostOrder, first: Int, offset: Int): [Post]
	numUids: Int
}
mutation {
  addAuthor(input: [{ name: "A.N. Author", posts: []}]) {
    author {
      id
      name
    }
  }
}

Proposed change:

type Author {
	id: ID!
	name: String! @search(by: [hash])
	dob: DateTime
	posts: [Post]
}

type Post {
	postID: ID!
	title: String! @search(by: [term, fulltext])
	text: String @search(by: [fulltext, term])
	datePublished: DateTime
}
addPosts(input: [AddPostsInput!]!): AddPostsPayload

input AddPostsInput {
	title: String!
	text: String
	datePublished: DateTime
}

type AddPostsPayload {
	post(filter: PostFilter, order: PostOrder, first: Int, offset: Int): [Post]
	numUids: Int
}
mutation {
  addAuthors(input: [{ name: "A.N. Author", posts: []}]) {
    author {
      id
      name
    }
  }
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant