core/schema.graphql

242 lines
4.9 KiB
GraphQL
Raw Normal View History

2021-07-13 10:14:48 +00:00
scalar DateTime
2021-07-29 20:49:17 +00:00
################################### Payload
2021-07-13 10:14:48 +00:00
2021-08-04 13:38:56 +00:00
type Result {
error: String
2021-08-01 11:40:24 +00:00
}
2021-08-09 05:49:31 +00:00
type AuthResult {
2021-08-04 13:38:56 +00:00
error: String
token: String
user: User
2021-08-01 11:40:24 +00:00
}
2021-08-04 13:38:56 +00:00
type UserResult {
error: String
user: User
2021-08-01 11:40:24 +00:00
}
2021-08-04 13:38:56 +00:00
type MessageResult {
error: String
message: Message
2021-08-01 11:40:24 +00:00
}
2021-08-08 12:23:12 +00:00
input ShoutInput {
2021-08-17 09:14:26 +00:00
org_id: Int!
2021-08-08 12:23:12 +00:00
slug: String!
body: String!
replyTo: String # another shout
tags: [String] # actual values
topics: [String] # topic-slugs
title: String
versionOf: String
visibleForRoles: [String] # role ids are strings
visibleForUsers: [Int]
}
2021-08-09 05:49:31 +00:00
input ProfileInput {
email: String
username: String
userpic: String
}
2021-08-04 13:38:56 +00:00
type ShoutResult {
2021-07-13 10:14:48 +00:00
error: String
2021-07-27 04:58:06 +00:00
shout: Shout
}
2021-07-27 04:51:16 +00:00
################################### Mutation
2021-07-13 10:14:48 +00:00
type Mutation {
# message
2021-08-04 13:38:56 +00:00
createMessage(body: String!, replyTo: Int): MessageResult!
updateMessage(id: Int!, body: String!): MessageResult!
deleteMessage(messageId: Int!): Result!
2021-07-13 10:14:48 +00:00
# auth
2021-08-09 05:49:31 +00:00
confirmEmail(token: String!): AuthResult!
requestPasswordReset(email: String!): Boolean!
confirmPasswordReset(token: String!): Boolean!
registerUser(email: String!, password: String!): AuthResult!
# updatePassword(password: String!, token: String!): Token!
2021-07-30 12:53:22 +00:00
# invalidateAllTokens: Boolean!
# invalidateTokenById(id: Int!): Boolean!
# requestEmailConfirmation: User!
2021-07-13 10:14:48 +00:00
# shout
2021-08-08 12:23:12 +00:00
createShout(input: ShoutInput!): ShoutResult!
2021-08-17 09:14:26 +00:00
updateShout(input: ShoutInput!): ShoutResult!
2021-08-08 12:23:12 +00:00
deleteShout(slug: String!): Result!
rateShout(slug: String!, value: Int!): Result!
2021-07-13 10:14:48 +00:00
2021-08-09 05:49:31 +00:00
# user profile
2021-08-09 15:45:51 +00:00
# rateUser(value: Int!): Result!
# updateOnlineStatus: Result!
2021-08-09 05:54:44 +00:00
updateProfile(profile: ProfileInput!): Result!
2021-07-13 10:14:48 +00:00
}
2021-07-27 04:51:16 +00:00
################################### Query
2021-07-13 10:14:48 +00:00
type Query {
2021-08-09 05:49:31 +00:00
# auth
isEmailFree(email: String!): Result!
signIn(email: String!, password: String!): AuthResult!
2021-08-04 13:38:56 +00:00
signOut: Result!
2021-08-09 05:49:31 +00:00
# user profile
2021-08-04 13:38:56 +00:00
getCurrentUser: UserResult!
2021-08-09 05:49:31 +00:00
getUserById(id: Int!): UserResult!
2021-07-30 12:53:22 +00:00
# getUserRating(shout: Int): Int!
2021-07-13 10:14:48 +00:00
# messages
getMessages(count: Int = 100, page: Int = 1): [Message!]!
# shouts
2021-07-30 12:53:22 +00:00
# getShoutRating(shout: Int): Int!
# shoutsByAuthor(author: Int): [Shout]!
# shoutsByReplyTo(shout: Int): [Shout]!
# shoutsByTags(tags: [String]): [Shout]!
# shoutsByTime(time: DateTime): [Shout]!
# getOnlineUsers: [User!]!
2021-08-07 16:14:20 +00:00
topAuthors: [User]!
topShouts: [Shout]!
2021-07-13 10:14:48 +00:00
}
2021-07-27 04:51:16 +00:00
############################################ Subscription
type Subscription {
messageCreated: Message!
messageUpdated: Message!
messageDeleted: Message!
onlineUpdated: [User!]!
shoutUpdated: Shout!
userUpdated: User!
}
############################################ Entities
2021-07-13 10:14:48 +00:00
type Role {
2021-08-20 09:27:19 +00:00
id: Int!
2021-07-13 10:14:48 +00:00
name: String!
2021-08-20 09:27:19 +00:00
org_id: Int!
# level: Int! # 1-8
2021-07-28 17:29:51 +00:00
desc: String
2021-08-20 09:27:19 +00:00
permissions: [Int!]!
2021-07-13 10:14:48 +00:00
}
type Rating {
createdBy: 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]
}
2021-07-27 04:51:16 +00:00
type User {
username: String! # email
createdAt: DateTime!
2021-07-27 04:51:16 +00:00
email: String
password: String
oauth: String # provider:token
viewname: String # to display
userpic: String
links: [String]
emailConfirmed: Boolean # should contain all emails too # TODO: pagination here
2021-07-27 04:51:16 +00:00
id: Int!
muted: Boolean
rating: Int
roles: [Role]
updatedAt: DateTime
2021-07-27 04:51:16 +00:00
wasOnlineAt: DateTime
ratings: [Rating]
slug: String
bio: String
notifications: [Int]
2021-07-27 04:51:16 +00:00
}
type Message {
author: Int!
body: String!
createdAt: DateTime!
id: Int!
replyTo: Int
updatedAt: DateTime!
2021-07-29 17:26:15 +00:00
visibleForUsers: [Int]!
2021-07-27 04:51:16 +00:00
}
# is publication
2021-07-13 10:14:48 +00:00
type Shout {
2021-08-17 09:14:26 +00:00
org_id: Int!
2021-07-28 17:29:51 +00:00
slug: String!
2021-08-20 08:08:32 +00:00
authors: [Int!]!
cover: String
layout: String
2021-07-13 10:14:48 +00:00
body: String!
createdAt: DateTime!
2021-07-28 17:29:51 +00:00
updatedAt: DateTime!
2021-07-13 10:14:48 +00:00
deletedAt: DateTime
deletedBy: Int
rating: Int
ratigns: [Rating]
2021-08-20 08:08:32 +00:00
published: Boolean!
publishedAt: DateTime # if there is no published field - it is not published
2021-08-08 10:33:33 +00:00
replyTo: String # another shout
2021-07-27 04:51:16 +00:00
tags: [String] # actual values
topics: [String] # topic-slugs, order has matter
2021-07-13 10:14:48 +00:00
title: String
2021-08-08 10:33:33 +00:00
versionOf: String
2021-07-29 17:26:15 +00:00
visibleForRoles: [String] # role ids are strings
2021-07-13 10:14:48 +00:00
visibleForUsers: [Int]
views: Int
2021-07-13 10:14:48 +00:00
}
2021-07-27 04:51:16 +00:00
type Topic {
2021-07-27 06:50:52 +00:00
slug: String! # ID
createdBy: Int! # User
2021-07-29 17:26:15 +00:00
createdAt: DateTime!
value: String
2021-08-20 08:08:32 +00:00
desc: String
2021-07-27 04:51:16 +00:00
parents: [String] # NOTE: topic can have parent topics
children: [String] # and children
}
# TODO: resolvers to add/remove topics from publication
2021-07-13 10:14:48 +00:00
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!
}
2021-07-27 04:51:16 +00:00
type Like {
author: Int!
2021-07-13 10:14:48 +00:00
id: Int!
2021-07-29 17:26:15 +00:00
value: Int!
2021-07-27 04:51:16 +00:00
shout: Int
user: Int
2021-07-13 10:14:48 +00:00
}