scalar DateTime ################################### Payload interface ErrorInterface { message: String! } type ApiError implements ErrorInterface { message: String! } type SignInOk { token: String! user: User! } union SignInResult = ApiError | SignInOk type RegisterUserOk { token: String user: User! } union RegisterUserResult = ApiError | RegisterUserOk type ResultPayload { status: Boolean! error: String token: String user: User message: Message shout: Shout } ################################### Mutation type Mutation { # message createMessage(body: String!, replyTo: Int): ResultPayload! updateMessage(id: Int!, body: String!): ResultPayload! deleteMessage(messageId: Int!): ResultPayload! # auth # resetPassword(password: String!, token: String!): Token! confirmEmail(token: String!): ResultPayload! # invalidateAllTokens: Boolean! # invalidateTokenById(id: Int!): Boolean! # requestEmailConfirmation: User! # requestPasswordReset(email: String!): Boolean! registerUser(email: String!, password: String!): RegisterUserResult! # shout createShout: ResultPayload! deleteShout(shoutId: Int!): ResultPayload! rateShout(value: Int!): ResultPayload! # profile # rateUser(value: Int!): ResultPayload! # updateOnlineStatus: ResultPayload! # updateUsername(username: String!): ResultPayload! } ################################### Query type Query { # auth / user isEmailFree(email: String!): ResultPayload! signIn(email: String!, password: String!): SignInResult! signOut: ResultPayload! getCurrentUser: ResultPayload! # getUserById(id: Int!): ResultPayload! # getUserRating(shout: Int): Int! # messages getMessages(count: Int = 100, page: Int = 1): [Message!]! # shouts # getShoutRating(shout: Int): Int! # shoutsByAuthor(author: Int): [Shout]! # shoutsByReplyTo(shout: Int): [Shout]! # shoutsByTags(tags: [String]): [Shout]! # shoutsByTime(time: DateTime): [Shout]! # getOnlineUsers: [User!]! # topAuthors: [User]! # topShouts: [Shout]! } ############################################ Subscription type Subscription { messageCreated: Message! messageUpdated: Message! messageDeleted: Message! onlineUpdated: [User!]! shoutUpdated: Shout! userUpdated: User! } ############################################ Entities type Role { id: Int! name: String! org: String! level: Int! # 1-8 desc: String } type User { createdAt: DateTime! email: String emailConfirmed: Boolean id: Int! muted: Boolean rating: Int roles: [Role!]! updatedAt: DateTime! username: String userpic: String wasOnlineAt: DateTime } type Message { author: Int! body: String! createdAt: DateTime! id: Int! replyTo: Int updatedAt: DateTime! visibleForUsers: [Int]! } # is publication type Shout { id: Int! org: String! slug: String! author: Int! body: String! createdAt: DateTime! updatedAt: DateTime! deletedAt: DateTime deletedBy: Int rating: Int published: DateTime # if there is no published field - it is not published replyTo: Int # another shout tags: [String] # actual values topics: [String] # topic-slugs title: String versionOf: Int visibleForRoles: [String] # role ids are strings visibleForUsers: [Int] } type Topic { slug: String! # ID createdBy: Int! # User createdAt: DateTime! value: String parents: [String] # NOTE: topic can have parent topics children: [String] # and children } # TODO: resolvers to add/remove topics from publication type Proposal { body: String! shout: Int! range: String # full / 0:2340 author: Int! createdAt: DateTime! } type Token { createdAt: DateTime! expiresAt: DateTime id: Int! ownerId: Int! usedAt: DateTime value: String! } type Like { author: Int! id: Int! value: Int! shout: Int user: Int }