core/schemas/core.graphql

340 lines
5.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 {
LIKE
DISLIKE
AGREE
DISAGREE
PROOF
DISPROOF
COMMENT
QUOTE
PROPOSE
ASK
REMARK
FOOTNOTE
ACCEPT
REJECT
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-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
# ratings
stat: AuthorStat # synthetic
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-10-23 14:47:11 +00:00
topics: [Topic]
authors: [Author]
communities: [Community]
2023-11-03 10:10:22 +00:00
# mainTopic: String
2023-10-23 14:47:11 +00:00
title: String
subtitle: String
lang: String
community: String
cover: String
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
updated_by: Author
deleted_at: Int
deleted_by: Author
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-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!
range: String
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-23 20:30:00 +00:00
time_ago: Int
2023-11-03 10:10:22 +00:00
stat: String
}
input ShoutsFilterBy {
slug: String
title: String
body: String
topic: String
topics: [String]
author: String
authors: [String]
2023-11-23 20:30:00 +00:00
layouts: [String]
2023-11-03 10:10:22 +00:00
visibility: String
2023-11-23 20:30:00 +00:00
time_ago: Int
2023-11-03 10:10:22 +00:00
stat: String
}
input LoadShoutsFilters {
title: String
body: String
topic: String
author: String
2023-11-23 20:30:00 +00:00
layouts: [String]
2023-11-03 10:10:22 +00:00
visibility: String
2023-11-23 20:30:00 +00:00
time_ago: Int
2023-11-03 10:10:22 +00:00
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
2023-11-22 16:38:39 +00:00
created_by: Int
2023-11-23 20:30:00 +00:00
time_ago: 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
# Мутации
type Mutation {
2023-11-22 21:05:04 +00:00
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!
2021-08-28 10:13:50 +00:00
}
2023-10-23 14:47:11 +00:00
# Запросы
type Query {
2023-11-22 21:05:04 +00:00
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
2023-11-23 23:00:28 +00:00
search(text: String!, limit: Int, offset: Int): [Shout]
2023-11-22 21:05:04 +00:00
}