diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..61ba0b13 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +indent_style = tabs +indent_size = 1 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace=true +insert_final_newline = true diff --git a/schema.graphql b/schema.graphql index 58f1c2d5..f2fb5070 100644 --- a/schema.graphql +++ b/schema.graphql @@ -3,286 +3,286 @@ scalar DateTime ################################### Payload type Result { - error: String + error: String } type AuthResult { - error: String - token: String - user: User + error: String + token: String + user: User } type UserResult { - error: String - user: User + error: String + user: User } type MessageResult { - error: String - message: Message + error: String + message: Message } input ShoutInput { - slug: String! - body: String! - replyTo: String # another shout - tags: [String] # actual values - topics: [Int] - title: String - subtitle: String - versionOf: String - visibleForRoles: [String] # role ids are strings - visibleForUsers: [Int] + slug: String! + body: String! + replyTo: String # another shout + tags: [String] # actual values + topics: [Int] + title: String + subtitle: String + versionOf: String + visibleForRoles: [String] # role ids are strings + visibleForUsers: [Int] } input ProfileInput { - email: String - username: String - userpic: String + email: String + username: String + userpic: String } type ShoutResult { - error: String - shout: Shout + error: String + shout: Shout } ################################### Mutation type Mutation { - # message - createMessage(body: String!, replyTo: Int): MessageResult! - updateMessage(id: Int!, body: String!): MessageResult! - deleteMessage(messageId: Int!): Result! + # message + createMessage(body: String!, replyTo: Int): MessageResult! + updateMessage(id: Int!, body: String!): MessageResult! + deleteMessage(messageId: Int!): Result! - # auth - confirmEmail(token: String!): AuthResult! - requestPasswordReset(email: String!): Boolean! - confirmPasswordReset(token: String!): Boolean! - registerUser(email: String!, password: String): AuthResult! - # updatePassword(password: String!, token: String!): Token! - # invalidateAllTokens: Boolean! - # invalidateTokenById(id: Int!): Boolean! - # requestEmailConfirmation: User! + # auth + confirmEmail(token: String!): AuthResult! + requestPasswordReset(email: String!): Boolean! + confirmPasswordReset(token: String!): Boolean! + registerUser(email: String!, password: String): AuthResult! + # updatePassword(password: String!, token: String!): Token! + # invalidateAllTokens: Boolean! + # invalidateTokenById(id: Int!): Boolean! + # requestEmailConfirmation: User! - # shout - createShout(input: ShoutInput!): ShoutResult! - updateShout(id: Int!, input: ShoutInput!): ShoutResult! - deleteShout(id: Int!): Result! - rateShout(shout_id: Int!, value: Int!): Result! - viewShout(shout_id: Int!): Result! + # shout + createShout(input: ShoutInput!): ShoutResult! + updateShout(id: Int!, input: ShoutInput!): ShoutResult! + deleteShout(id: Int!): Result! + rateShout(shout_id: Int!, value: Int!): Result! + viewShout(shout_id: Int!): Result! - # user profile - # rateUser(value: Int!): Result! - # updateOnlineStatus: Result! - updateProfile(profile: ProfileInput!): Result! + # user profile + # rateUser(value: Int!): Result! + # updateOnlineStatus: Result! + updateProfile(profile: ProfileInput!): Result! - # topics - topicSubscribe(slug: String!): Result! - topicUnsubscribe(slug: String!): Result! + # topics + topicSubscribe(slug: String!): Result! + topicUnsubscribe(slug: String!): Result! } ################################### Query type Query { - # auth - isEmailFree(email: String!): Result! - signIn(email: String!, password: String): AuthResult! - signOut: Result! + # auth + isEmailFree(email: String!): Result! + signIn(email: String!, password: String): AuthResult! + signOut: Result! - # profile - getCurrentUser: UserResult! - getUserBySlug(slug: String!): UserResult! - # rateUser(shout: Int): Int! + # profile + getCurrentUser: UserResult! + getUserBySlug(slug: String!): UserResult! + # rateUser(shout: Int): Int! - # messages - getMessages(count: Int = 100, page: Int = 1): [Message!]! + # messages + getMessages(count: Int = 100, page: Int = 1): [Message!]! - # shouts - getShoutBySlug(slug: String!): Shout! - # NOTE: with .comments: Comments[] - shoutsByTopic(topic: String!, limit: Int!): [Shout]! - shoutsByAuthor(author: String!, limit: Int!): [Shout]! - shoutsByCommunity(community: String!, limit: Int!): [Shout]! + # shouts + getShoutBySlug(slug: String!): Shout! + # NOTE: with .comments: Comments[] + shoutsByTopic(topic: String!, limit: Int!): [Shout]! + shoutsByAuthor(author: String!, limit: Int!): [Shout]! + shoutsByCommunity(community: String!, limit: Int!): [Shout]! - # mainpage - topShoutsByView(limit: Int): [Shout]! - topShoutsByRating(limit: Int): [Shout]! - favoriteShouts(limit: Int): [Shout]! - recentShouts(limit: Int): [Shout]! - topAuthors(limit: Int): [User]! + # mainpage + topShoutsByView(limit: Int): [Shout]! + topShoutsByRating(limit: Int): [Shout]! + favoriteShouts(limit: Int): [Shout]! + recentShouts(limit: Int): [Shout]! + topAuthors(limit: Int): [User]! - # topics - topicsBySlugs(slugs: [String]!): [Topic]! - topicsByCommunity(community: String!): [Topic]! - topicsByAuthor(author: String!): [Topic]! + # topics + topicsBySlugs(slugs: [String]!): [Topic]! + topicsByCommunity(community: String!): [Topic]! + topicsByAuthor(author: String!): [Topic]! - # getOnlineUsers: [User!]! + # getOnlineUsers: [User!]! } ############################################ Subscription type Subscription { - messageCreated: Message! - messageUpdated: Message! - messageDeleted: Message! + messageCreated: Message! + messageUpdated: Message! + messageDeleted: Message! - onlineUpdated: [User!]! - shoutUpdated: Shout! - userUpdated: User! - topicUpdated: Shout! + onlineUpdated: [User!]! + shoutUpdated: Shout! + userUpdated: User! + topicUpdated: Shout! } ############################################ Entities type Role { - id: Int! - name: String! - community: Int! - desc: String - permissions: [Int!]! + id: Int! + name: String! + community: Int! + desc: String + permissions: [Int!]! } type Rating { - createdBy: Int! - value: Int! + createdBy: Int! + value: Int! } type Notification { - kind: String! # unique primary key - template: String! - variables: [String] + kind: String! # unique primary key + template: String! + variables: [String] } type UserNotification { - id: Int! # primary key - user: Int! - kind: String! # NotificationTemplate.name - values: [String] + id: Int! # primary key + user: Int! + kind: String! # NotificationTemplate.name + values: [String] } type User { - id: Int! - username: String! # to login, ex. email - createdAt: 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 - roles: [Role] - updatedAt: DateTime - wasOnlineAt: DateTime - rating: Int - ratings: [Rating] - bio: String - notifications: [Int] - topics: [String] # user subscribed topics - communities: [Int] # user participating communities - old_id: String + id: Int! + username: String! # to login, ex. email + createdAt: 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 + roles: [Role] + updatedAt: DateTime + wasOnlineAt: DateTime + rating: Int + ratings: [Rating] + bio: String + notifications: [Int] + topics: [String] # user subscribed topics + communities: [Int] # user participating communities + old_id: String } type Message { - author: Int! - body: String! - createdAt: DateTime! - id: Int! - replyTo: Int - updatedAt: DateTime! - visibleForUsers: [Int]! + author: Int! + body: String! + createdAt: DateTime! + id: Int! + replyTo: Int + updatedAt: DateTime! + visibleForUsers: [Int]! } type Comment { - id: Int! - author: Int! - body: String! - replyTo: Int! - createdAt: DateTime! - updatedAt: DateTime - updatedBy: Int - shout: Int! - deletedAt: DateTime - deletedBy: Int - rating: Int - ratigns: [CommentRating] - views: Int - old_id: String - old_thread: String + id: Int! + author: Int! + body: String! + replyTo: Int! + createdAt: DateTime! + updatedAt: DateTime + updatedBy: Int + shout: Int! + deletedAt: DateTime + deletedBy: Int + rating: Int + ratigns: [CommentRating] + views: Int + old_id: String + old_thread: String } type CommentRating { - id: Int! - comment_id: Int! - createdBy: Int! - createdAt: DateTime! - value: Int! + id: Int! + comment_id: Int! + createdBy: Int! + createdAt: DateTime! + value: Int! } # is publication type Shout { - id: Int! - slug: String! - body: String! - createdAt: DateTime! - authors: [User!]! - comments: [Comment] - ratigns: [Rating] - visibleFor: [User] - community: Int - cover: String - layout: String - rating: Int - views: Int - replyTo: Shout - versionOf: Shout - tags: [String] # actual values - topics: [String] # topic-slugs, order has matter - title: String - subtitle: String - updatedAt: DateTime - updatedBy: Int # can be user id? - deletedAt: DateTime - deletedBy: Int - publishedBy: Int # if there is no published field - it is not published - publishedAt: DateTime - old_id: String + id: Int! + slug: String! + body: String! + createdAt: DateTime! + authors: [User!]! + comments: [Comment] + ratigns: [Rating] + visibleFor: [User] + community: Int + cover: String + layout: String + rating: Int + views: Int + replyTo: Shout + versionOf: Shout + tags: [String] # actual values + topics: [String] # topic-slugs, order has matter + title: String + subtitle: String + updatedAt: DateTime + updatedBy: Int # can be user id? + deletedAt: DateTime + deletedBy: Int + publishedBy: Int # if there is no published field - it is not published + publishedAt: DateTime + old_id: String } type Community { - slug: String! - name: String! - desc: String - pic: String! + slug: String! + name: String! + desc: String + pic: String! } type Topic { - slug: String! # ID - title: String - body: String - pic: String - parents: [String] # NOTE: topic can have parent topics - children: [String] # and children - cat_id: String + slug: String! # ID + title: String + body: String + pic: String + parents: [String] # NOTE: topic can have parent topics + children: [String] # and children + cat_id: String } # TODO: resolvers to add/remove topics from publication type Proposal { - body: String! - shout: Int! - range: String # full / 0:2340 - author: Int! - createdAt: DateTime! + 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! + createdAt: DateTime! + expiresAt: DateTime + id: Int! + ownerId: Int! + usedAt: DateTime + value: String! }