core/schemas/core.graphql
Untone a63cf24812
Some checks failed
deploy / deploy (push) Failing after 1m58s
0.2.15
2023-11-24 02:00:28 +03:00

340 lines
5.6 KiB
GraphQL

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
}
# Типы
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: 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
# ratings
stat: AuthorStat # synthetic
}
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
created_at: Int!
topics: [Topic]
authors: [Author]
communities: [Community]
# mainTopic: String
title: String
subtitle: String
lang: String
community: String
cover: String
layout: String
version_of: String
visibility: ShoutVisibility
updated_at: Int
updated_by: Author
deleted_at: Int
deleted_by: Author
published_at: Int
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!
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!
}
type Topic {
id: Int!
slug: String!
title: String
body: String
pic: String
stat: TopicStat
oid: String
}
# Входные типы
input ShoutInput {
slug: String
title: String
body: String
lead: String
description: String
layout: String
media: String
authors: [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 {
kind: ReactionKind!
shout: Int!
range: String
body: String
reply_to: Int
}
input AuthorsBy {
last_seen: Int
created_at: Int
slug: String
name: String
topic: String
order: String
time_ago: Int
stat: String
}
input ShoutsFilterBy {
slug: String
title: String
body: String
topic: String
topics: [String]
author: String
authors: [String]
layouts: [String]
visibility: String
time_ago: Int
stat: String
}
input LoadShoutsFilters {
title: String
body: String
topic: String
author: String
layouts: [String]
visibility: String
time_ago: 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
created_by: Int
time_ago: Int
sort: String
}
# output type
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 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]
authorsAll: [Author]
authorFollowers(slug: String!): [Author]
authorFollowedAuthors(slug: String!): [Author]
authorFollowedTopics(slug: String!): [Topic]
loadAuthorsBy(by: AuthorsBy, limit: Int, offset: Int): [Author]
getAuthor(slug: String!): Author
topicsAll: [Topic]
getTopic(slug: String!): Topic
topicsRandom(amount: Int): [Topic]
topicsByCommunity(community: String!): [Topic]
topicsByAuthor(author_id: Int!): [Topic]
communitiesAll: [Community]
getCommunity: Community
search(text: String!, limit: Int, offset: Int): [Shout]
}