core/schemas/core.graphql
Untone 13ba5ebaed
All checks were successful
deploy / deploy (push) Successful in 2m20s
shout-followers
2023-11-28 12:11:45 +03:00

357 lines
6.0 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!
quote: 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 {
# author
rate_author(rated_slug: String!, value: Int!): Result!
update_profile(profile: ProfileInput!): Result!
# editor
create_shout(inp: ShoutInput!): Result!
update_shout(shout_id: Int!, shout_input: ShoutInput, publish: Boolean): Result!
delete_shout(shout_id: Int!): Result!
# follower
follow(what: FollowingEntity!, slug: String!): Result!
unfollow(what: FollowingEntity!, slug: String!): Result!
# topic
create_topic(input: TopicInput!): Result!
update_topic(input: TopicInput!): Result!
delete_topic(slug: String!): Result!
# reaction
create_reaction(reaction: ReactionInput!): Result!
update_reaction(id: Int!, reaction: ReactionInput!): Result!
delete_reaction(id: Int!): Result!
}
# Запросы
type Query {
# author
get_author(slug: String, user: String, author_id: Int): 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: Result # { 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]
load_shouts_by(options: LoadShoutsOptions): [Shout]
load_shouts_search(text: String!, limit: Int, offset: Int): [Shout]
load_shouts_feed(options: LoadShoutsOptions): [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]
}