schema-main
This commit is contained in:
40
schema/enum.graphql
Normal file
40
schema/enum.graphql
Normal file
@@ -0,0 +1,40 @@
|
||||
enum ReactionStatus {
|
||||
NEW
|
||||
UPDATED
|
||||
CHANGED
|
||||
EXPLAINED
|
||||
DELETED
|
||||
}
|
||||
|
||||
enum ReactionKind {
|
||||
|
||||
# collabs
|
||||
AGREE
|
||||
DISAGREE
|
||||
ASK
|
||||
PROPOSE
|
||||
PROOF
|
||||
DISPROOF
|
||||
ACCEPT
|
||||
REJECT
|
||||
|
||||
# public feed
|
||||
QUOTE
|
||||
COMMENT
|
||||
LIKE
|
||||
DISLIKE
|
||||
|
||||
}
|
||||
|
||||
enum FollowingEntity {
|
||||
TOPIC
|
||||
AUTHOR
|
||||
COMMUNITY
|
||||
REACTIONS
|
||||
}
|
||||
|
||||
enum InviteStatus {
|
||||
PENDING
|
||||
ACCEPTED
|
||||
REJECTED
|
||||
}
|
81
schema/input.graphql
Normal file
81
schema/input.graphql
Normal file
@@ -0,0 +1,81 @@
|
||||
input ShoutInput {
|
||||
slug: String
|
||||
title: String
|
||||
body: String
|
||||
lead: String
|
||||
description: String
|
||||
layout: String
|
||||
media: String
|
||||
topics: [TopicInput]
|
||||
community: Int
|
||||
subtitle: String
|
||||
cover: String
|
||||
}
|
||||
|
||||
input ProfileInput {
|
||||
slug: String
|
||||
name: String
|
||||
pic: String
|
||||
links: [String]
|
||||
bio: String
|
||||
about: String
|
||||
}
|
||||
|
||||
input TopicInput {
|
||||
id: Int
|
||||
slug: String!
|
||||
title: String
|
||||
body: String
|
||||
pic: String
|
||||
}
|
||||
|
||||
input ReactionInput {
|
||||
id: Int
|
||||
kind: ReactionKind!
|
||||
shout: Int!
|
||||
quote: String
|
||||
body: String
|
||||
reply_to: Int
|
||||
}
|
||||
|
||||
input AuthorsBy {
|
||||
last_seen: Int
|
||||
created_at: Int
|
||||
slug: String
|
||||
name: String
|
||||
topic: String
|
||||
order: String
|
||||
after: Int
|
||||
stat: String
|
||||
}
|
||||
|
||||
input LoadShoutsFilters {
|
||||
topic: String
|
||||
author: String
|
||||
layouts: [String]
|
||||
featured: Boolean
|
||||
reacted: Boolean
|
||||
after: Int
|
||||
}
|
||||
|
||||
input LoadShoutsOptions {
|
||||
filters: LoadShoutsFilters
|
||||
with_author_captions: Boolean
|
||||
limit: Int!
|
||||
random_limit: Int
|
||||
offset: Int
|
||||
order_by: String
|
||||
order_by_desc: Boolean
|
||||
}
|
||||
|
||||
input ReactionBy {
|
||||
shout: String
|
||||
shouts: [String]
|
||||
search: String
|
||||
comment: Boolean
|
||||
rating: Boolean
|
||||
topic: String
|
||||
created_by: Int
|
||||
after: Int
|
||||
sort: String
|
||||
}
|
31
schema/mutation.graphql
Normal file
31
schema/mutation.graphql
Normal file
@@ -0,0 +1,31 @@
|
||||
type Mutation {
|
||||
# author
|
||||
rate_author(rated_slug: String!, value: Int!): CommonResult!
|
||||
update_author(profile: ProfileInput!): CommonResult!
|
||||
|
||||
# editor
|
||||
create_shout(inp: ShoutInput!): CommonResult!
|
||||
update_shout(shout_id: Int!, shout_input: ShoutInput, publish: Boolean): CommonResult!
|
||||
delete_shout(shout_id: Int!): CommonResult!
|
||||
|
||||
# follower
|
||||
follow(what: FollowingEntity!, slug: String!): CommonResult!
|
||||
unfollow(what: FollowingEntity!, slug: String!): CommonResult!
|
||||
|
||||
# topic
|
||||
create_topic(input: TopicInput!): CommonResult!
|
||||
update_topic(input: TopicInput!): CommonResult!
|
||||
delete_topic(slug: String!): CommonResult!
|
||||
|
||||
# reaction
|
||||
create_reaction(reaction: ReactionInput!): CommonResult!
|
||||
update_reaction(reaction: ReactionInput!): CommonResult!
|
||||
delete_reaction(reaction_id: Int!): CommonResult!
|
||||
|
||||
# collab
|
||||
create_invite(slug: String, author_id: Int): CommonResult!
|
||||
remove_author(slug: String, author_id: Int): CommonResult!
|
||||
remove_invite(invite_id: Int!): CommonResult!
|
||||
accept_invite(invite_id: Int!): CommonResult!
|
||||
reject_invite(invite_id: Int!): CommonResult!
|
||||
}
|
41
schema/query.graphql
Normal file
41
schema/query.graphql
Normal file
@@ -0,0 +1,41 @@
|
||||
type Query {
|
||||
# author
|
||||
get_author(slug: String, author_id: Int): Author
|
||||
get_author_id(user: String!): Author
|
||||
get_authors_all: [Author]
|
||||
get_author_followers(slug: String, user: String, author_id: Int): [Author]
|
||||
get_author_followed(slug: String, user: String, author_id: Int): [Author]
|
||||
load_authors_by(by: AuthorsBy!, limit: Int, offset: Int): [Author]
|
||||
|
||||
# community
|
||||
get_community: Community
|
||||
get_communities_all: [Community]
|
||||
|
||||
# editor
|
||||
get_shouts_drafts: [Shout]
|
||||
|
||||
# follower
|
||||
get_my_followed: CommonResult! # { authors topics communities }
|
||||
get_shout_followers(slug: String, shout_id: Int): [Author]
|
||||
|
||||
# reaction
|
||||
load_reactions_by(by: ReactionBy!, limit: Int, offset: Int): [Reaction]
|
||||
|
||||
# reader
|
||||
get_shout(slug: String, shout_id: Int): Shout
|
||||
load_shouts_followed(follower_id: Int!, limit: Int, offset: Int): [Shout] # userReactedShouts
|
||||
load_shouts_by(options: LoadShoutsOptions): [Shout]
|
||||
load_shouts_search(text: String!, limit: Int, offset: Int): [SearchResult]
|
||||
load_shouts_feed(options: LoadShoutsOptions): [Shout]
|
||||
load_shouts_unrated(limit: Int, offset: Int): [Shout]
|
||||
load_shouts_random_top(options: LoadShoutsOptions): [Shout]
|
||||
load_shouts_random_topic(limit: Int!): CommonResult! # { topic shouts }
|
||||
load_shouts_drafts: [Shout]
|
||||
|
||||
# topic
|
||||
get_topic(slug: String!): Topic
|
||||
get_topics_all: [Topic]
|
||||
get_topics_random(amount: Int): [Topic]
|
||||
get_topics_by_author(slug: String, user: String, author_id: Int): [Topic]
|
||||
get_topics_by_community(slug: String, community_id: Int): [Topic]
|
||||
}
|
181
schema/type.graphql
Normal file
181
schema/type.graphql
Normal file
@@ -0,0 +1,181 @@
|
||||
type AuthorFollowings {
|
||||
unread: Int
|
||||
topics: [String]
|
||||
authors: [String]
|
||||
reactions: [Int]
|
||||
communities: [String]
|
||||
}
|
||||
|
||||
type AuthorStat {
|
||||
shouts: Int
|
||||
followings: Int
|
||||
followers: Int
|
||||
rating: Int
|
||||
rating_shouts: Int
|
||||
rating_comments: Int
|
||||
commented: Int
|
||||
viewed: Int
|
||||
}
|
||||
|
||||
type Author {
|
||||
id: Int!
|
||||
user: String! # user.id
|
||||
slug: String! # user.nickname
|
||||
name: String # user.preferred_username
|
||||
pic: String
|
||||
bio: String
|
||||
about: String
|
||||
links: [String]
|
||||
created_at: Int
|
||||
last_seen: Int
|
||||
updated_at: Int
|
||||
deleted_at: Int
|
||||
seo: String
|
||||
# synthetic
|
||||
stat: AuthorStat # ratings inside
|
||||
communities: [Community]
|
||||
}
|
||||
|
||||
type ReactionUpdating {
|
||||
error: String
|
||||
status: ReactionStatus
|
||||
reaction: Reaction
|
||||
}
|
||||
|
||||
type Rating {
|
||||
rater: String!
|
||||
value: Int!
|
||||
}
|
||||
|
||||
type Reaction {
|
||||
id: Int!
|
||||
shout: Shout!
|
||||
created_at: Int!
|
||||
created_by: Author!
|
||||
updated_at: Int
|
||||
deleted_at: Int
|
||||
deleted_by: Author
|
||||
range: String
|
||||
kind: ReactionKind!
|
||||
body: String
|
||||
reply_to: Int
|
||||
stat: Stat
|
||||
oid: String
|
||||
# old_thread: String
|
||||
}
|
||||
|
||||
type Shout {
|
||||
id: Int!
|
||||
slug: String!
|
||||
body: String!
|
||||
lead: String
|
||||
description: String
|
||||
main_topic: String
|
||||
topics: [Topic]
|
||||
created_by: Author!
|
||||
updated_by: Author
|
||||
deleted_by: Author
|
||||
authors: [Author]
|
||||
communities: [Community]
|
||||
title: String!
|
||||
subtitle: String
|
||||
lang: String
|
||||
community: String
|
||||
cover: String
|
||||
cover_caption: String
|
||||
layout: String!
|
||||
|
||||
created_at: Int!
|
||||
updated_at: Int
|
||||
published_at: Int
|
||||
featured_at: Int
|
||||
deleted_at: Int
|
||||
|
||||
version_of: Shout # TODO: use version_of somewhere
|
||||
|
||||
media: String
|
||||
stat: Stat
|
||||
score: Float
|
||||
}
|
||||
|
||||
type Stat {
|
||||
viewed: Int
|
||||
reacted: Int
|
||||
rating: Int
|
||||
commented: Int
|
||||
ranking: Int
|
||||
}
|
||||
|
||||
type Community {
|
||||
id: Int!
|
||||
slug: String!
|
||||
name: String!
|
||||
desc: String
|
||||
pic: String!
|
||||
created_at: Int!
|
||||
created_by: Author!
|
||||
}
|
||||
|
||||
type Collection {
|
||||
id: Int!
|
||||
slug: String!
|
||||
title: String!
|
||||
desc: String
|
||||
amount: Int
|
||||
published_at: Int
|
||||
created_at: Int!
|
||||
created_by: Author!
|
||||
}
|
||||
|
||||
type TopicStat {
|
||||
shouts: Int!
|
||||
followers: Int!
|
||||
authors: Int!
|
||||
viewed: Int
|
||||
}
|
||||
|
||||
type Topic {
|
||||
id: Int!
|
||||
slug: String!
|
||||
title: String
|
||||
body: String
|
||||
pic: String
|
||||
stat: TopicStat
|
||||
oid: String
|
||||
}
|
||||
|
||||
# output type
|
||||
|
||||
type CommonResult {
|
||||
error: String
|
||||
slugs: [String]
|
||||
shout: Shout
|
||||
shouts: [Shout]
|
||||
author: Author
|
||||
authors: [Author]
|
||||
reaction: Reaction
|
||||
reactions: [Reaction]
|
||||
topic: Topic
|
||||
topics: [Topic]
|
||||
community: Community
|
||||
communities: [Community]
|
||||
}
|
||||
|
||||
type SearchResult {
|
||||
slug: String!
|
||||
title: String!
|
||||
cover: String
|
||||
main_topic: String
|
||||
created_at: Int
|
||||
authors: [Author]
|
||||
topics: [Topic]
|
||||
score: Float!
|
||||
}
|
||||
|
||||
type Invite {
|
||||
id: Int!
|
||||
inviter_id: Int!
|
||||
author_id: Int!
|
||||
shout_id: Int!
|
||||
status: InviteStatus
|
||||
}
|
Reference in New Issue
Block a user