339 lines
5.4 KiB
GraphQL
339 lines
5.4 KiB
GraphQL
# Скалярные типы данных
|
|
scalar DateTime
|
|
|
|
|
|
# Перечисления
|
|
|
|
enum ShoutVisibility {
|
|
AUTHORS
|
|
COMMUNITY
|
|
PUBLIC
|
|
}
|
|
|
|
enum ReactionStatus {
|
|
NEW
|
|
UPDATED
|
|
CHANGED
|
|
EXPLAINED
|
|
DELETED
|
|
}
|
|
|
|
enum ReactionKind {
|
|
LIKE
|
|
DISLIKE
|
|
AGREE
|
|
DISAGREE
|
|
PROOF
|
|
DISPROOF
|
|
COMMENT
|
|
QUOTE
|
|
PROPOSE
|
|
ASK
|
|
REMARK
|
|
FOOTNOTE
|
|
ACCEPT
|
|
REJECT
|
|
}
|
|
|
|
enum FollowingEntity {
|
|
TOPIC
|
|
AUTHOR
|
|
COMMUNITY
|
|
REACTIONS
|
|
}
|
|
|
|
|
|
# Входные типы
|
|
|
|
|
|
input ShoutInput {
|
|
slug: String
|
|
title: String
|
|
body: String
|
|
lead: String
|
|
description: String
|
|
layout: String
|
|
media: String
|
|
authors: [String]
|
|
topics: [TopicInput]
|
|
community: Int
|
|
mainTopic: TopicInput
|
|
subtitle: String
|
|
cover: String
|
|
}
|
|
|
|
input ProfileInput {
|
|
slug: String
|
|
name: String
|
|
userpic: String
|
|
links: [String]
|
|
bio: String
|
|
about: String
|
|
}
|
|
|
|
input TopicInput {
|
|
id: Int
|
|
slug: String!
|
|
title: String
|
|
body: String
|
|
pic: String
|
|
}
|
|
|
|
input ReactionInput {
|
|
kind: ReactionKind!
|
|
shout: Int!
|
|
range: String
|
|
body: String
|
|
replyTo: Int
|
|
}
|
|
|
|
input AuthorsBy {
|
|
lastSeen: DateTime
|
|
createdAt: DateTime
|
|
slug: String
|
|
name: String
|
|
topic: String
|
|
order: String
|
|
days: Int
|
|
stat: String
|
|
}
|
|
|
|
input ShoutsFilterBy {
|
|
slug: String
|
|
title: String
|
|
body: String
|
|
topic: String
|
|
topics: [String]
|
|
author: String
|
|
authors: [String]
|
|
layout: String
|
|
visibility: String
|
|
days: Int
|
|
stat: String
|
|
}
|
|
|
|
input LoadShoutsFilters {
|
|
title: String
|
|
body: String
|
|
topic: String
|
|
author: String
|
|
layout: String
|
|
visibility: String
|
|
days: Int
|
|
reacted: Boolean
|
|
}
|
|
|
|
input LoadShoutsOptions {
|
|
filters: LoadShoutsFilters
|
|
with_author_captions: Boolean
|
|
limit: Int!
|
|
offset: Int
|
|
order_by: String
|
|
order_by_desc: Boolean
|
|
}
|
|
|
|
input ReactionBy {
|
|
shout: String
|
|
shouts: [String]
|
|
search: String
|
|
comment: Boolean
|
|
topic: String
|
|
createdBy: String
|
|
days: Int
|
|
sort: String
|
|
}
|
|
|
|
|
|
# Типы
|
|
|
|
|
|
type AuthorFollowings {
|
|
unread: Int
|
|
topics: [String]
|
|
authors: [String]
|
|
reactions: [Int]
|
|
communities: [String]
|
|
}
|
|
|
|
type AuthorStat {
|
|
followings: Int
|
|
followers: Int
|
|
rating: Int
|
|
commented: Int
|
|
shouts: Int
|
|
}
|
|
|
|
type Author {
|
|
id: Int!
|
|
user: Int!
|
|
slug: String!
|
|
name: String
|
|
pic: String
|
|
bio: String
|
|
about: String
|
|
links: [String]
|
|
stat: AuthorStat
|
|
lastSeen: DateTime
|
|
}
|
|
|
|
type Result {
|
|
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 ReactionUpdating {
|
|
error: String
|
|
status: ReactionStatus
|
|
reaction: Reaction
|
|
}
|
|
|
|
type Rating {
|
|
rater: String!
|
|
value: Int!
|
|
}
|
|
|
|
type Reaction {
|
|
id: Int!
|
|
shout: Shout!
|
|
createdAt: DateTime!
|
|
createdBy: Author!
|
|
updatedAt: DateTime
|
|
deletedAt: DateTime
|
|
deletedBy: Author
|
|
range: String
|
|
kind: ReactionKind!
|
|
body: String
|
|
replyTo: Int
|
|
stat: Stat
|
|
old_id: String
|
|
old_thread: String
|
|
}
|
|
|
|
type Shout {
|
|
id: Int!
|
|
slug: String!
|
|
body: String!
|
|
lead: String
|
|
description: String
|
|
createdAt: DateTime!
|
|
topics: [Topic]
|
|
authors: [Author]
|
|
communities: [Community]
|
|
mainTopic: String
|
|
title: String
|
|
subtitle: String
|
|
lang: String
|
|
community: String
|
|
cover: String
|
|
layout: String
|
|
versionOf: String
|
|
visibility: ShoutVisibility
|
|
updatedAt: DateTime
|
|
updatedBy: Author
|
|
deletedAt: DateTime
|
|
deletedBy: Author
|
|
publishedAt: DateTime
|
|
media: String
|
|
stat: Stat
|
|
}
|
|
|
|
type Stat {
|
|
viewed: Int
|
|
reacted: Int
|
|
rating: Int
|
|
commented: Int
|
|
ranking: Int
|
|
}
|
|
|
|
type Community {
|
|
id: Int!
|
|
slug: String!
|
|
name: String!
|
|
desc: String
|
|
pic: String!
|
|
createdAt: DateTime!
|
|
createdBy: Author!
|
|
}
|
|
|
|
type Collection {
|
|
id: Int!
|
|
slug: String!
|
|
title: String!
|
|
desc: String
|
|
amount: Int
|
|
publishedAt: DateTime
|
|
createdAt: DateTime!
|
|
createdBy: Author!
|
|
}
|
|
|
|
type TopicStat {
|
|
shouts: Int!
|
|
followers: Int!
|
|
authors: Int!
|
|
}
|
|
|
|
type Topic {
|
|
id: Int!
|
|
slug: String!
|
|
title: String
|
|
body: String
|
|
pic: String
|
|
stat: TopicStat
|
|
oid: String
|
|
}
|
|
|
|
|
|
# Мутации
|
|
|
|
type Mutation {
|
|
createShout(inp: ShoutInput!): Result!
|
|
updateShout(shout_id: Int!, shout_input: ShoutInput, publish: Boolean): Result!
|
|
deleteShout(shout_id: Int!): Result!
|
|
rateAuthor(slug: String!, value: Int!): Result!
|
|
updateOnlineStatus: Result!
|
|
updateProfile(profile: ProfileInput!): Result!
|
|
createTopic(input: TopicInput!): Result!
|
|
updateTopic(input: TopicInput!): Result!
|
|
destroyTopic(slug: String!): Result!
|
|
createReaction(reaction: ReactionInput!): Result!
|
|
updateReaction(id: Int!, reaction: ReactionInput!): Result!
|
|
deleteReaction(id: Int!): Result!
|
|
follow(what: FollowingEntity!, slug: String!): Result!
|
|
unfollow(what: FollowingEntity!, slug: String!): Result!
|
|
}
|
|
|
|
|
|
# Запросы
|
|
|
|
type Query {
|
|
loadShout(slug: String, shout_id: Int): Shout
|
|
loadShouts(options: LoadShoutsOptions): [Shout]
|
|
loadFeed(options: LoadShoutsOptions): [Shout]
|
|
loadDrafts: [Shout]
|
|
|
|
loadReactionsBy(by: ReactionBy!, limit: Int, offset: Int): [Reaction]
|
|
followedReactions(follower_id: Int!): [Shout]
|
|
|
|
authorFollowers(slug: String!): [Author]
|
|
authorFollowedAuthors(slug: String!): [Author]
|
|
authorFollowedTopics(slug: String!): [Topic]
|
|
loadAuthorsBy(by: AuthorsBy, limit: Int, offset: Int): [Author]
|
|
authorsAll: [Author]
|
|
getAuthor(slug: String!): Author
|
|
|
|
getTopic(slug: String!): Topic
|
|
topicsAll: [Topic]
|
|
topicsRandom(amount: Int): [Topic]
|
|
topicsByCommunity(community: String!): [Topic]
|
|
topicsByAuthor(author_id: Int!): [Topic]
|
|
} |