Last active
February 1, 2019 13:47
-
-
Save tgriesser/9e66593e980ee17ad8f4d304d9cfe792 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function commonPostFields(t) { | |
t.string('title') | |
t.string('body') | |
t.list.field('tags', { type: TagEnum }) | |
t.field('meta', { type: "PostMetadata" }) | |
} | |
export const Post = objectType({ | |
name: "Post", | |
definition(t) { | |
t.implements('Node') | |
commonPostFields(t) | |
} | |
}) | |
export const CreatePostInput = inputObjectType({ | |
name: "CreatePostInput", | |
definition(t) { | |
commonPostFields(t) | |
} | |
}) | |
export const UpdatePostInput = inputObjectType({ | |
name: "UpdatePostInput", | |
definition(t) { | |
t.id('id', { required: true }) | |
commonPostFields(t) | |
} | |
}) | |
export const PostTagEnum = enumType({ | |
name: "PostTags", | |
members: ["DRAFT", "PUBLISHED"] | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment