scalar DateTime ################################### Payload ################################### enum MessageStatus { NEW UPDATED DELETED } type UserFollowings { unread: Int topics: [String] authors: [String] reactions: [Int] communities: [String] } type AuthResult { error: String token: String user: User news: UserFollowings } type ChatMember { slug: String! name: String! userpic: String invitedAt: DateTime invitedBy: String # user slug # TODO: add more } type AuthorStat { followings: Int followers: Int rating: Int commented: Int } type Author { id: Int! slug: String! name: String! userpic: String caption: String # only for full shout bio: String links: [String] stat: AuthorStat roles: [Role] # in different communities lastSeen: DateTime } type Result { error: String uids: [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 } ################################### Inputs ################################### input ShoutInput { slug: String! body: String! community: String! mainTopic: String topic_slugs: [String] title: String subtitle: String versionOf: String visibleForRoles: [String] # role ids are strings visibleForUsers: [String] } input ProfileInput { name: String userpic: String links: [String] bio: String } input TopicInput { slug: String! community: String! title: String body: String pic: String children: [String] parents: [String] } input ReactionInput { kind: Int! shout: String! range: String body: String replyTo: Int } input ChatInput { id: String! title: String description: String } enum FollowingEntity { TOPIC AUTHOR COMMUNITY REACTIONS } ################################### Mutation type Mutation { # inbox createChat(title: String, members: [String]!): Result! updateChat(chat: ChatInput!): Result! deleteChat(chatId: String!): Result! inviteChat(chatId: String!, userslug: String!): Result! createMessage(chatId: String!, body: String!, replyTo: String): Result! updateMessage(chatId: String!, id: Int!, body: String!): Result! deleteMessage(chatId: String!, id: Int!): Result! markAsRead(chatId: String!, ids: [Int]!): Result! # auth refreshSession: AuthResult! registerUser(email: String!, password: String, name: String): AuthResult! sendLink(email: String!, lang: String): Result! confirmEmail(token: String!): AuthResult! # shout createShout(input: ShoutInput!): Result! updateShout(input: ShoutInput!): Result! deleteShout(slug: String!): 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(reaction: ReactionInput!): Result! deleteReaction(id: Int!): Result! # collab inviteAuthor(author: String!, shout: String!): Result! removeAuthor(author: String!, shout: String!): Result! # following follow(what: FollowingEntity!, slug: String!): Result! unfollow(what: FollowingEntity!, slug: String!): Result! } input MessagesBy { author: String body: String chat: String order: String days: Int stat: String } input AuthorsBy { lastSeen: DateTime createdAt: DateTime slug: String name: String topic: String order: String days: Int stat: String } input ShoutsBy { slug: String title: String body: String topic: String topics: [String] author: String layout: String visibility: String order: String days: Int stat: String } input ReactionBy { shout: String shouts: [String] body: String topic: String author: String order: String days: Int stat: String } ################################### Query type Query { # inbox loadChats(offset: Int, amount: Int): Result! # your chats loadMessagesBy(by: MessagesBy!, amount: Int, offset: Int): Result! searchUsers(query: String!, amount: Int, offset: Int): Result! # auth isEmailUsed(email: String!): Boolean! signIn(email: String!, password: String, lang: String): AuthResult! signOut: AuthResult! # zine loadAuthorsBy(by: AuthorsBy, amount: Int, offset: Int): [Author]! loadShoutsBy(by: ShoutsBy, amount: Int, offset: Int): [Shout]! loadReactionsBy(by: ReactionBy!, amount: Int, limit: Int): [Reaction]! userFollowers(slug: String!): [Author]! userFollowedAuthors(slug: String!): [Author]! userFollowedTopics(slug: String!): [Topic]! authorsAll: [Author]! getAuthor(slug: String!): User! # collab getCollabs: [Collab]! # migrate markdownBody(body: String!): String! # topics getTopic(slug: String!): Topic! topicsAll: [Topic]! topicsRandom(amount: Int): [Topic]! topicsByCommunity(community: String!): [Topic]! topicsByAuthor(author: String!): [Topic]! } ############################################ Subscription type Subscription { newMessage(chats: [Int!]): Message! onlineUpdated: [User!]! shoutUpdated: Shout! userUpdated: User! reactionUpdated(shout: String!): ReactionUpdating! } ############################################ Entities type Resource { id: Int! name: String! } type Operation { id: Int! name: String! } type Permission { operation_id: Int! resource_id: Int! } type Role { id: Int! name: String! community: String! desc: String permissions: [Permission!]! } type Rating { rater: String! value: Int! } type Notification { kind: String! # unique primary key template: String! variables: [String] } type UserNotification { id: Int! # primary key user: Int! kind: String! # NotificationTemplate.name values: [String] } 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 notifications: [Int] communities: [Int] # user participating communities oid: String } type Collab { authors: [String]! invites: [String] createdAt: DateTime! title: String body: String } enum ReactionKind { LIKE DISLIKE AGREE DISAGREE PROOF DISPROOF COMMENT QUOTE PROPOSE ASK 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: Reaction stat: Stat old_id: String old_thread: String } # is publication type Shout { id: Int! slug: String! body: 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 publishedBy: User publishedAt: DateTime 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! createdAt: DateTime! createdBy: User! } type Collection { id: Int! slug: String! title: String! desc: String amount: Int publishedAt: DateTime createdAt: DateTime! createdBy: User! } type TopicStat { shouts: Int! followers: Int! authors: Int! viewed: Int! reacted: Int! commented: Int rating: Int } type Topic { slug: String! # ID title: String body: String pic: String parents: [String] # NOTE: topic can have parent topics children: [String] # and children community: Community! stat: TopicStat oid: String } type Token { createdAt: DateTime! expiresAt: DateTime id: Int! ownerId: Int! usedAt: DateTime value: String! } type Message { author: String! chatId: String! body: String! createdAt: Int! id: Int! replyTo: String updatedAt: Int } type Chat { id: String! createdAt: Int! createdBy: User! updatedAt: Int! title: String description: String users: [User]! admins: [User] messages: [Message]! unread: Int private: Boolean }