Skip to content
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

Expose CRUD through API #12

Open
oliverzheng opened this issue May 31, 2018 · 5 comments
Open

Expose CRUD through API #12

oliverzheng opened this issue May 31, 2018 · 5 comments
Assignees

Comments

@oliverzheng
Copy link
Owner

No description provided.

@oliverzheng
Copy link
Owner Author

@joshjcarrier I'm thinking the graphql model can be like

- Meme

- root
  - bucket/org/repo - something that denotes a set of memes that a set of people share
    - memes
      - macro (string)
      - image
        - url (string)
        - width, height (integer)
- bucket(bucketID)
  - same as above

Need a much better name than bucket. Repo implies only 1 github repo but an org might share the same memes. Org implies it won't work for single repos.

The reason I'd want to put url/width/height into an image object instead of directly on the meme, is so we might have multiple images per meme in the future, for things like thumbnails.

@joshjcarrier
Copy link
Collaborator

joshjcarrier commented Jun 2, 2018

# Relay-compliant global identification.
interface Node {
  id: ID!
}

type Meme {
  # The text that this meme replaces.
  macro: String!

  # The meme's insertable image.
  image: Image!
}

# An  image.
type Image {
  # The recommended height for the image.
  height: Int!

  # An embeddable link to image content.
  url: URI!

  # The recommended width for the image.
  width: Int!
}

# A grouping of memes that are used together.
type Collection implements Node {
  # A globally unique ID for the collection.
  id: ID!

  # All memes that belong to this collection.
  memes(
    # The number of memes to return.
    first: Int, 

    # An optional offset by cursor.
    after: String): MemeConnection!
}

# A paginated set of memes.
type MemeConnection {
  # Memes in the paginated set.
  nodes: [Meme]!

  # Pagination metadata.
  pageInfo: PageInfo!
}

# A meme in a connection.
type MemeEdge {
  node: Meme!

  cursor: String!
}

# Relay-compliant pagination metadata.
type PageInfo {
  hasNextPage: Boolean!

  hasPreviousPage: Boolean!
}

# The query root for LGTMeme.
type Query {
  # Find a collection by its URL segment.
  collection(slug: String): Collection

  node(id: ID!): Node
}

# An ISO-8601-compliant string for URLs.
scalar URI

@oliverzheng
Copy link
Owner Author

demandingsmoothdromaeosaur-size_restricted

@oliverzheng
Copy link
Owner Author

Nailed it. This looks pretty darn perfect.

dhmeazk

@oliverzheng oliverzheng self-assigned this Jun 8, 2018
@oliverzheng
Copy link
Owner Author

File upload blocked by netlify/netlify-lambda#42. :|

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants