core/schemas/core.graphql

377 lines
6.6 KiB
GraphQL
Raw Normal View History

2023-10-23 14:47:11 +00:00
enum ShoutVisibility {
AUTHORS
COMMUNITY
PUBLIC
2022-08-12 12:50:59 +00:00
}
2023-10-23 14:47:11 +00:00
enum ReactionStatus {
NEW
UPDATED
CHANGED
EXPLAINED
DELETED
2021-08-20 23:17:15 +00:00
}
2023-10-23 14:47:11 +00:00
enum ReactionKind {
2023-12-17 05:08:35 +00:00
# collabs
2023-10-23 14:47:11 +00:00
AGREE
DISAGREE
2023-12-09 22:47:22 +00:00
ASK
PROPOSE
2023-10-23 14:47:11 +00:00
PROOF
DISPROOF
ACCEPT
REJECT
2023-12-09 22:47:22 +00:00
# public feed
QUOTE
COMMENT
LIKE
DISLIKE
2022-11-13 04:21:09 +00:00
}
2023-10-23 14:47:11 +00:00
enum FollowingEntity {
TOPIC
AUTHOR
COMMUNITY
REACTIONS
2022-11-12 18:13:23 +00:00
}
2023-11-28 10:55:05 +00:00
enum InviteStatus {
PENDING
ACCEPTED
REJECTED
}
2023-10-23 14:47:11 +00:00
# Типы
2022-10-05 09:32:48 +00:00
2023-10-23 14:47:11 +00:00
type AuthorFollowings {
unread: Int
topics: [String]
authors: [String]
reactions: [Int]
communities: [String]
2021-08-20 23:17:15 +00:00
}
2023-10-23 14:47:11 +00:00
type AuthorStat {
followings: Int
followers: Int
rating: Int
commented: Int
shouts: Int
2021-11-24 09:09:47 +00:00
}
2023-10-23 14:47:11 +00:00
type Author {
id: Int!
2023-11-03 10:10:22 +00:00
user: String! # user.id
slug: String! # user.nickname
name: String # user.preferred_username
2023-10-25 16:55:30 +00:00
pic: String
2023-10-23 14:47:11 +00:00
bio: String
about: String
links: [String]
2023-11-03 10:10:22 +00:00
created_at: Int
last_seen: Int
updated_at: Int
deleted_at: Int
2023-12-17 05:08:35 +00:00
seo: String
2023-12-16 17:03:00 +00:00
# synthetic
stat: AuthorStat # ratings inside
communities: [Community]
2021-11-24 09:09:47 +00:00
}
2023-10-23 14:47:11 +00:00
type ReactionUpdating {
error: String
status: ReactionStatus
reaction: Reaction
2021-08-20 23:17:15 +00:00
}
type Rating {
2023-10-23 14:47:11 +00:00
rater: String!
value: Int!
}
type Reaction {
2023-10-23 14:47:11 +00:00
id: Int!
shout: Shout!
2023-11-03 10:10:22 +00:00
created_at: Int!
created_by: Author!
updated_at: Int
deleted_at: Int
deleted_by: Author
2023-10-23 14:47:11 +00:00
range: String
kind: ReactionKind!
body: String
2023-11-03 10:10:22 +00:00
reply_to: Int
2023-10-23 14:47:11 +00:00
stat: Stat
2023-11-22 16:38:39 +00:00
oid: String
# old_thread: String
2021-10-13 17:46:30 +00:00
}
2021-09-03 16:01:31 +00:00
2021-08-20 23:17:15 +00:00
type Shout {
2023-10-23 14:47:11 +00:00
id: Int!
slug: String!
body: String!
lead: String
description: String
2023-11-03 10:10:22 +00:00
created_at: Int!
2023-12-09 16:22:47 +00:00
main_topic: String
2023-10-23 14:47:11 +00:00
topics: [Topic]
2023-11-30 08:04:03 +00:00
created_by: Author!
updated_by: Author
deleted_by: Author
2023-10-23 14:47:11 +00:00
authors: [Author]
communities: [Community]
2023-12-23 19:00:22 +00:00
title: String!
2023-10-23 14:47:11 +00:00
subtitle: String
lang: String
community: String
cover: String
2023-12-07 18:29:25 +00:00
cover_caption: String
2023-12-23 19:00:22 +00:00
layout: String!
2023-11-03 10:10:22 +00:00
version_of: String
2023-10-23 14:47:11 +00:00
visibility: ShoutVisibility
2023-11-03 10:10:22 +00:00
updated_at: Int
deleted_at: Int
published_at: Int
2023-10-23 14:47:11 +00:00
media: String
stat: Stat
2021-12-17 10:22:31 +00:00
}
type Stat {
2023-10-23 14:47:11 +00:00
viewed: Int
reacted: Int
rating: Int
commented: Int
ranking: Int
2021-08-20 23:17:15 +00:00
}
2021-08-26 21:14:20 +00:00
type Community {
2023-10-23 14:47:11 +00:00
id: Int!
slug: String!
name: String!
desc: String
pic: String!
2023-11-03 10:10:22 +00:00
created_at: Int!
created_by: Author!
2021-08-26 21:14:20 +00:00
}
2022-08-11 09:09:57 +00:00
type Collection {
2023-10-23 14:47:11 +00:00
id: Int!
slug: String!
title: String!
desc: String
amount: Int
2023-11-03 10:10:22 +00:00
published_at: Int
created_at: Int!
created_by: Author!
2022-08-11 09:09:57 +00:00
}
2021-12-13 16:51:01 +00:00
type TopicStat {
2023-10-23 14:47:11 +00:00
shouts: Int!
followers: Int!
authors: Int!
2021-12-13 16:51:01 +00:00
}
2021-08-20 23:17:15 +00:00
type Topic {
2023-10-23 14:47:11 +00:00
id: Int!
slug: String!
title: String
body: String
pic: String
stat: TopicStat
oid: String
2021-08-20 23:17:15 +00:00
}
2023-11-28 10:55:05 +00:00
type Invite {
id: Int!
inviter_id: Int!
author_id: Int!
shout_id: Int!
status: InviteStatus
}
2023-11-03 10:10:22 +00:00
# Входные типы
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!
2023-11-27 16:03:47 +00:00
quote: String
2023-11-03 10:10:22 +00:00
body: String
2023-11-23 20:30:00 +00:00
reply_to: Int
2023-11-03 10:10:22 +00:00
}
input AuthorsBy {
last_seen: Int
created_at: Int
slug: String
name: String
topic: String
order: String
2023-11-29 07:23:41 +00:00
after: Int
2023-11-03 10:10:22 +00:00
stat: String
}
input LoadShoutsFilters {
topic: String
author: String
2023-11-23 20:30:00 +00:00
layouts: [String]
2023-11-29 12:11:05 +00:00
published: Boolean
2023-11-29 07:23:41 +00:00
after: Int
2023-11-29 09:29:09 +00:00
reacted: Boolean
2023-11-03 10:10:22 +00:00
}
input LoadShoutsOptions {
filters: LoadShoutsFilters
with_author_captions: Boolean
limit: Int!
2023-12-18 00:55:12 +00:00
random_limit: Int
2023-11-03 10:10:22 +00:00
offset: Int
order_by: String
order_by_desc: Boolean
}
input ReactionBy {
shout: String
shouts: [String]
search: String
comment: Boolean
topic: String
2023-11-22 16:38:39 +00:00
created_by: Int
2023-11-29 07:23:41 +00:00
after: Int
2023-11-03 10:10:22 +00:00
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]
}
2023-10-23 14:47:11 +00:00
2023-12-19 12:18:58 +00:00
type SearchResult {
slug: String!
title: String!
score: Float!
}
2023-10-23 14:47:11 +00:00
# Мутации
type Mutation {
2023-12-17 05:08:35 +00:00
# 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!
# collab
create_invite(slug: String, author_id: Int): Result!
remove_author(slug: String, author_id: Int): Result!
remove_invite(invite_id: Int!): Result!
accept_invite(invite_id: Int!): Result!
reject_invite(invite_id: Int!): Result!
2021-08-28 10:13:50 +00:00
}
2023-10-23 14:47:11 +00:00
# Запросы
type Query {
2023-12-17 05:08:35 +00:00
# author
get_author(slug: String, author_id: Int): Author
get_author_id(user: String!): Author
2023-12-19 08:09:50 +00:00
get_authors_all: [Author]
2023-12-17 05:08:35 +00:00
load_authors_all(limit: Int, offset: Int): [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] # userReactedShouts
load_shouts_by(options: LoadShoutsOptions): [Shout]
2023-12-19 12:18:58 +00:00
load_shouts_search(text: String!, limit: Int, offset: Int): [SearchResult]
2023-12-17 05:08:35 +00:00
load_shouts_feed(options: LoadShoutsOptions): [Shout]
load_shouts_unrated(limit: Int, offset: Int): [Shout]
load_shouts_random_top(options: LoadShoutsOptions): [Shout]
2023-12-22 18:08:37 +00:00
load_shouts_random_topic(limit: Int!): Result! # { topic shouts }
2023-12-17 05:08:35 +00:00
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]
2023-11-22 21:05:04 +00:00
}