core/schema.graphql

519 lines
9.9 KiB
GraphQL
Raw Normal View History

2021-08-20 23:17:15 +00:00
scalar DateTime
################################### Payload ###################################
2021-08-20 23:17:15 +00:00
2022-08-11 05:53:14 +00:00
enum MessageStatus {
NEW
UPDATED
DELETED
2022-08-11 05:53:14 +00:00
}
2022-10-04 12:07:41 +00:00
type UserFollowings {
unread: Int
topics: [String]
authors: [String]
reactions: [Int]
communities: [String]
2022-08-12 12:50:59 +00:00
}
2021-08-20 23:17:15 +00:00
type AuthResult {
error: String
token: String
user: User
news: UserFollowings
2021-08-20 23:17:15 +00:00
}
2022-11-02 10:00:04 +00:00
type ChatMember {
2022-11-21 08:13:57 +00:00
id: Int!
2022-11-02 10:00:04 +00:00
slug: String!
name: String!
2022-11-12 18:13:23 +00:00
userpic: String
2022-11-21 08:13:57 +00:00
lastSeen: DateTime
2022-12-04 14:03:55 +00:00
online: Boolean
2022-11-27 12:12:08 +00:00
# invitedAt: DateTime
# invitedBy: String # user slug
# TODO: keep invite databit
2022-11-02 10:00:04 +00:00
}
2022-11-13 04:21:09 +00:00
type AuthorStat {
followings: Int
followers: Int
rating: Int
2022-11-13 15:24:29 +00:00
commented: Int
2022-11-19 11:35:34 +00:00
shouts: Int
2022-11-13 04:21:09 +00:00
}
2022-11-12 18:13:23 +00:00
type Author {
2022-11-13 04:21:09 +00:00
id: Int!
2022-11-12 18:13:23 +00:00
slug: String!
2022-11-13 04:21:09 +00:00
name: String!
2022-11-12 18:13:23 +00:00
userpic: String
2022-11-13 04:21:09 +00:00
caption: String # only for full shout
bio: String
2022-12-09 05:54:26 +00:00
about: String
2022-11-13 04:21:09 +00:00
links: [String]
2022-11-12 18:13:23 +00:00
stat: AuthorStat
roles: [Role] # in different communities
lastSeen: DateTime
createdAt: DateTime
2022-11-12 18:13:23 +00:00
}
type Result {
error: String
slugs: [String]
chat: Chat
chats: [Chat]
message: Message
messages: [Message]
members: [ChatMember]
shout: Shout
shouts: [Shout]
author: Author
authors: [Author]
reaction: Reaction
reactions: [Reaction]
topic: Topic
topics: [Topic]
community: Community
communities: [Community]
}
enum ReactionStatus {
NEW
UPDATED
CHANGED
EXPLAINED
DELETED
}
type ReactionUpdating {
error: String
status: ReactionStatus
reaction: Reaction
2021-08-20 23:17:15 +00:00
}
################################### Inputs ###################################
2021-08-20 23:17:15 +00:00
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
2021-08-21 00:40:41 +00:00
}
input ProfileInput {
slug: String
name: String
userpic: String
links: [String]
bio: String
about: String
2021-08-20 23:17:15 +00:00
}
input TopicInput {
id: Int,
slug: String!
# community: String!
title: String
body: String
pic: String
# children: [String]
# parents: [String]
2022-01-28 09:49:46 +00:00
}
2023-01-13 11:04:45 +00:00
input ReactionInput {
kind: ReactionKind!
shout: Int!
range: String
body: String
replyTo: Int
2022-01-28 09:49:46 +00:00
}
2022-11-02 13:36:10 +00:00
input ChatInput {
id: String!
title: String
description: String
}
enum FollowingEntity {
TOPIC
AUTHOR
COMMUNITY
REACTIONS
}
2021-08-20 23:17:15 +00:00
################################### Mutation
type Mutation {
# inbox
createChat(title: String, members: [Int]!): Result!
updateChat(chat: ChatInput!): Result!
deleteChat(chatId: String!): Result!
createMessage(chat: String!, body: String!, replyTo: Int): Result!
updateMessage(chatId: String!, id: Int!, body: String!): Result!
deleteMessage(chatId: String!, id: Int!): Result!
markAsRead(chatId: String!, ids: [Int]!): Result!
# auth
getSession: AuthResult!
registerUser(email: String!, password: String, name: String): AuthResult!
sendLink(email: String!, lang: String, template: String): Result!
confirmEmail(token: String!): AuthResult!
# shout
createShout(inp: ShoutInput!): Result!
updateShout(shout_id: Int!, shout_input: ShoutInput, publish: Boolean): Result!
deleteShout(shout_id: Int!): Result!
# user profile
rateUser(slug: String!, value: Int!): Result!
updateOnlineStatus: Result!
updateProfile(profile: ProfileInput!): Result!
# topics
createTopic(input: TopicInput!): Result!
# TODO: mergeTopics(t1: String!, t2: String!): Result!
updateTopic(input: TopicInput!): Result!
destroyTopic(slug: String!): Result!
# reactions
createReaction(reaction: ReactionInput!): Result!
updateReaction(id: Int!, reaction: ReactionInput!): Result!
deleteReaction(id: Int!): Result!
# following
follow(what: FollowingEntity!, slug: String!): Result!
unfollow(what: FollowingEntity!, slug: String!): Result!
2022-11-15 02:36:30 +00:00
}
2022-11-15 09:34:12 +00:00
input MessagesBy {
2022-11-15 02:36:30 +00:00
author: String
body: String
chat: String
2022-11-15 09:34:12 +00:00
order: String
days: Int
stat: String
2021-08-20 23:17:15 +00:00
}
2022-11-15 09:34:12 +00:00
input AuthorsBy {
2022-11-15 02:36:30 +00:00
lastSeen: DateTime
createdAt: DateTime
slug: String
name: String
topic: String
2022-11-15 09:34:12 +00:00
order: String
days: Int
stat: String
2022-11-15 02:36:30 +00:00
}
input LoadShoutsFilters {
title: String
body: String
topic: String
author: String
layout: String
excludeLayout: 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
2022-11-15 02:36:30 +00:00
}
2022-11-15 09:34:12 +00:00
input ReactionBy {
2022-11-22 18:48:28 +00:00
shout: String # slug
2022-11-15 15:20:44 +00:00
shouts: [String]
2022-11-22 18:48:28 +00:00
search: String # fts on body
comment: Boolean
topic: String # topic.slug
createdBy: String # user.slug
days: Int # before
sort: String # how to sort, default createdAt
2022-11-15 02:36:30 +00:00
}
2021-08-20 23:17:15 +00:00
################################### Query
type Query {
# inbox
loadChats( limit: Int, offset: Int): Result! # your chats
loadMessagesBy(by: MessagesBy!, limit: Int, offset: Int): Result!
loadRecipients(limit: Int, offset: Int): Result!
searchRecipients(query: String!, limit: Int, offset: Int): Result!
searchMessages(by: MessagesBy!, limit: Int, offset: Int): Result!
# auth
isEmailUsed(email: String!): Boolean!
signIn(email: String!, password: String, lang: String): AuthResult!
signOut: AuthResult!
# zine
loadAuthorsBy(by: AuthorsBy, limit: Int, offset: Int): [Author]!
loadShout(slug: String, shout_id: Int): Shout
loadShouts(options: LoadShoutsOptions): [Shout]!
loadDrafts: [Shout]!
loadReactionsBy(by: ReactionBy!, limit: Int, offset: Int): [Reaction]!
userFollowers(slug: String!): [Author]!
userFollowedAuthors(slug: String!): [Author]!
userFollowedTopics(slug: String!): [Topic]!
authorsAll: [Author]!
getAuthor(slug: String!): Author
myFeed(options: LoadShoutsOptions): [Shout]
# migrate
markdownBody(body: String!): String!
# topics
getTopic(slug: String!): Topic
topicsAll: [Topic]!
topicsRandom(amount: Int): [Topic]!
topicsByCommunity(community: String!): [Topic]!
topicsByAuthor(author: String!): [Topic]!
2021-08-20 23:17:15 +00:00
}
############################################ Subscription
type Subscription {
newMessage: Message # new messages in inbox
newShout: Shout # personal feed new shout
newReaction: Reaction # new reactions to notify
2021-08-20 23:17:15 +00:00
}
############################################ Entities
2021-11-24 09:09:47 +00:00
type Resource {
id: Int!
name: String!
2021-11-24 09:09:47 +00:00
}
type Operation {
id: Int!
name: String!
2021-11-24 09:09:47 +00:00
}
type Permission {
operation: Int!
resource: Int!
2021-11-24 09:09:47 +00:00
}
2021-08-20 23:17:15 +00:00
type Role {
id: Int!
name: String!
community: String!
desc: String
permissions: [Permission!]!
2021-08-20 23:17:15 +00:00
}
type Rating {
rater: String!
value: Int!
2022-01-11 13:33:25 +00:00
}
2021-08-20 23:17:15 +00:00
type User {
id: Int!
username: String! # to login, ex. email, phone
createdAt: DateTime!
lastSeen: DateTime
slug: String!
name: String # to display
email: String
password: String
oauth: String # provider:token
userpic: String
links: [String]
emailConfirmed: Boolean # should contain all emails too
muted: Boolean
updatedAt: DateTime
ratings: [Rating]
bio: String
about: String
communities: [Int] # user participating communities
oid: String
2021-08-20 23:17:15 +00:00
}
enum ReactionKind {
LIKE
DISLIKE
AGREE
DISAGREE
PROOF
DISPROOF
2022-09-01 10:16:22 +00:00
COMMENT
QUOTE
2022-09-01 10:16:22 +00:00
PROPOSE
ASK
2022-09-01 10:16:22 +00:00
REMARK
FOOTNOTE
2023-01-17 19:56:48 +00:00
ACCEPT
REJECT
}
type Reaction {
id: Int!
shout: Shout!
createdAt: DateTime!
createdBy: User!
updatedAt: DateTime
deletedAt: DateTime
deletedBy: User
range: String # full / 0:2340
kind: ReactionKind!
body: String
replyTo: Int
stat: Stat
old_id: 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
# is publication
type Shout {
id: Int!
slug: String!
body: String!
lead: String
description: String
createdAt: DateTime!
topics: [Topic]
mainTopic: String
title: String
subtitle: String
authors: [Author]
lang: String
community: String
cover: String
layout: String # audio video literature image
versionOf: String # for translations and re-telling the same story
visibility: String # owner authors community public
updatedAt: DateTime
updatedBy: User
deletedAt: DateTime
deletedBy: User
publishedAt: DateTime
media: String # json [ { title pic url body }, .. ]
stat: Stat
2021-12-17 10:22:31 +00:00
}
type Stat {
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 {
id: Int!
slug: String!
name: String!
desc: String
pic: String!
createdAt: DateTime!
createdBy: User!
2021-08-26 21:14:20 +00:00
}
2022-08-11 09:09:57 +00:00
type Collection {
id: Int!
slug: String!
title: String!
desc: String
amount: Int
publishedAt: DateTime
createdAt: DateTime!
createdBy: User!
2022-08-11 09:09:57 +00:00
}
2021-12-13 16:51:01 +00:00
type TopicStat {
shouts: Int!
followers: Int!
authors: Int!
# viewed: Int
# reacted: Int!
# commented: Int
# rating: Int
2021-12-13 16:51:01 +00:00
}
2021-08-20 23:17:15 +00:00
type Topic {
id: Int!
slug: String!
title: String
body: String
pic: String
# community: Community!
stat: TopicStat
oid: String
2021-08-20 23:17:15 +00:00
}
type Token {
createdAt: DateTime!
expiresAt: DateTime
id: Int!
ownerId: Int!
usedAt: DateTime
value: String!
2021-08-28 10:13:50 +00:00
}
2022-08-11 05:53:14 +00:00
type Message {
author: Int!
chatId: String!
body: String!
createdAt: Int!
id: Int!
replyTo: Int
updatedAt: Int
seen: Boolean
2022-08-11 05:53:14 +00:00
}
type Chat {
id: String!
createdAt: Int!
createdBy: Int!
updatedAt: Int!
title: String
description: String
users: [Int]
members: [ChatMember]
admins: [Int]
messages: [Message]
unread: Int
private: Boolean
}
enum NotificationType {
NEW_COMMENT,
NEW_REPLY
}
type Notification {
id: Int!
shout: Int
reaction: Int
type: NotificationType
createdAt: DateTime!
seen: Boolean!
data: String # JSON
occurrences: Int!
2022-08-11 05:53:14 +00:00
}