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

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

@benwoodward

Description

@benwoodward

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
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions