Files
talk/graph/typeDefs.graphql
T
2017-01-27 12:05:19 -07:00

231 lines
4.2 KiB
GraphQL

# Establishes the ordering of the content by their created_at time stamp.
enum SORT_ORDER {
# newest to oldest order.
REVERSE_CHRONOLOGICAL
# oldest to newer order.
CHRONOLOGICAL
}
# Date represented as an ISO8601 string.
scalar Date
type UserSettings {
# bio of the user.
bio: String
}
input CommentsQuery {
# current status of a comment.
statuses: [COMMENT_STATUS]
# asset that a comment is on.
asset_id: ID
# the parent of the comment that we want to retrive.
parent_id: ID
# comments returned will only be ones which have at least one action of this
# type.
action_type: ACTION_TYPE
# limit the number of results to be returned.
limit: Int = 10
# skip results from the last created_at timestamp.
cursor: Date
# sort the results by created_at.
sort: SORT_ORDER = REVERSE_CHRONOLOGICAL
}
enum USER_ROLES {
# an administrator of the site
ADMIN
# a moderator of the site
MODERATOR
}
# Any person who can author comments, create actions, and view comments on a
# stream.
type User {
id: ID!
# display name of a user.
displayName: String!
# actions against a specific user.
actions: [ActionSummary]
# the current roles of the user.
roles: [USER_ROLES]
# settings for a user.
settings: UserSettings
# returns all comments based on a query.
comments(query: CommentsQuery): [Comment]
}
type Comment {
id: ID!
# the actual comment data.
body: String!
# the user who authored the comment.
user: User
# the replies that were made to the comment.
replies(sort: SORT_ORDER = CHRONOLOGICAL, limit: Int = 3): [Comment]
# the count of replies on a comment
replyCount: Int
# the actions made against a comment.
actions: [ActionSummary]
# the asset that a comment was made on.
asset: Asset
# the current status of a comment.
status: COMMENT_STATUS
# the time when the comment was created
created_at: Date!
}
enum ITEM_TYPE {
ASSETS
COMMENTS
USERS
}
enum ACTION_TYPE {
LIKE
FLAG
}
type Action {
id: ID!
action_type: ACTION_TYPE!
item_id: ID!
item_type: ITEM_TYPE!
user: User!
updated_at: Date
created_at: Date
}
type ActionSummary {
action_type: ACTION_TYPE!
item_type: ITEM_TYPE!
count: Int
current_user: Action
}
enum MODERATION_MODE {
PRE
POST
}
type Settings {
moderation: MODERATION_MODE!
infoBoxEnable: Boolean
infoBoxContent: String
closeTimeout: Int
closedMessage: String
charCountEnable: Boolean
charCount: Int
requireEmailConfirmation: Boolean
}
type Asset {
# The current ID of the asset.
id: ID!
# The scraped title of the asset.
title: String
# The URL that the asset is locaed on.
url: String
# The top level comments that are attached to the asset.
comments(sort: SORT_ORDER = REVERSE_CHRONOLOGICAL, limit: Int = 10): [Comment]
# The count of top level comments on the asset.
commentCount: Int
# The settings (rectified with the global settings) that should be applied to
# this asset.
settings: Settings!
# The date that the asset was closed at.
closedAt: Date
# The date that the asset was created.
created_at: Date
}
enum COMMENT_STATUS {
ACCEPTED
REJECTED
PREMOD
}
type RootQuery {
# retrieves site wide settings and defaults.
settings: Settings
# retrieves all assets.
assets: [Asset]
# retrieves a specific asset.
asset(id: ID, url: String): Asset
# retrieves comments based on the input query.
comments(query: CommentsQuery!): [Comment]
# retrieves the current logged in user.
me: User
}
input CreateActionInput {
# the type of action.
action_type: ACTION_TYPE!
# the type of the item.
item_type: ITEM_TYPE!
# the id of the item that is related to the action.
item_id: ID!
}
input UpdateUserSettingsInput {
# user bio
bio: String!
}
type RootMutation {
# creates a comment on the asset.
createComment(asset_id: ID!, parent_id: ID, body: String!): Comment
# creates an action based on an input.
createAction(action: CreateActionInput!): Action
# delete an action based on the action id.
deleteAction(id: ID!): Boolean
# updates a user's settings, it will return if the query was successful.
updateUserSettings(settings: UpdateUserSettingsInput!): Boolean
}
schema {
query: RootQuery
mutation: RootMutation
}