core/schema.graphql

403 lines
7.9 KiB
GraphQL
Raw Normal View History

2021-08-20 23:17:15 +00:00
scalar DateTime
################################### Payload
type Result {
2022-02-03 09:13:53 +00:00
error: String
2021-08-20 23:17:15 +00:00
}
2022-05-03 12:55:29 +00:00
type CurrentUserInfo {
2022-06-17 13:11:18 +00:00
totalUnreadMessages: Int
userSubscribedTopics: [String]!
userSubscribedAuthors: [String]!
userSubscribedCommunities: [String]!
2022-05-03 12:55:29 +00:00
}
2021-08-20 23:17:15 +00:00
type AuthResult {
2022-02-03 09:13:53 +00:00
error: String
token: String
user: User
2022-05-03 12:55:29 +00:00
info: CurrentUserInfo
2021-08-20 23:17:15 +00:00
}
type UserResult {
2022-02-03 09:13:53 +00:00
error: String
user: User
2022-05-03 12:55:29 +00:00
info: CurrentUserInfo
2021-08-20 23:17:15 +00:00
}
input ShoutInput {
2022-02-03 09:13:53 +00:00
slug: String!
body: String!
community: Int!
mainTopic: String
topic_slugs: [String]
title: String
subtitle: String
versionOf: String
visibleForRoles: [String] # role ids are strings
visibleForUsers: [Int]
2021-08-21 00:40:41 +00:00
}
input ProfileInput {
2022-02-03 09:13:53 +00:00
name: String
userpic: String
links: [String]
bio: String
2021-08-20 23:17:15 +00:00
}
2021-11-26 00:41:20 +00:00
input CommunityInput {
2022-02-03 09:13:53 +00:00
title: String!
desc: String
pic: String
2021-11-26 00:41:20 +00:00
}
2021-08-20 23:17:15 +00:00
type ShoutResult {
2022-02-03 09:13:53 +00:00
error: String
shout: Shout
2021-08-20 23:17:15 +00:00
}
2022-04-29 08:01:04 +00:00
type ShoutsResult {
error: String
shouts: [Shout]
}
2021-11-21 11:04:38 +00:00
type CommentResult {
2022-02-03 09:13:53 +00:00
error: String
comment: Comment
2021-11-21 11:04:38 +00:00
}
input TopicInput {
2022-02-03 09:13:53 +00:00
slug: String!
title: String
body: String
pic: String
children: [String]
community: String!
}
type TopicResult {
2022-02-03 09:13:53 +00:00
error: String
topic: Topic
}
2022-01-28 09:49:46 +00:00
enum CommentStatus {
2022-02-03 09:13:53 +00:00
NEW
UPDATED
UPDATED_RATING
DELETED
2022-01-28 09:49:46 +00:00
}
type CommentUpdatedResult {
2022-02-03 09:13:53 +00:00
error: String
status: CommentStatus
comment: Comment
2022-01-28 09:49:46 +00:00
}
enum SubscriptionType {
TOPIC
AUTHOR
COMMUNITY
}
2021-08-20 23:17:15 +00:00
################################### Mutation
type Mutation {
2022-02-03 09:13:53 +00:00
# auth
confirmEmail(token: String!): AuthResult!
registerUser(email: String!, password: String): AuthResult!
requestPasswordUpdate(email: String!): Result!
updatePassword(password: String!, token: String!): Result!
# requestEmailConfirmation: User!
# shout
createShout(input: ShoutInput!): ShoutResult!
updateShout(input: ShoutInput!): ShoutResult!
deleteShout(slug: String!): Result!
rateShout(slug: String!, value: Int!): Result!
viewShout(slug: String!): Result!
# user profile
2022-02-16 12:38:05 +00:00
rateUser(slug: String!, value: Int!): Result!
2022-02-03 09:13:53 +00:00
# updateOnlineStatus: Result!
updateProfile(profile: ProfileInput!): Result!
# topics
createTopic(input: TopicInput!): TopicResult!
updateTopic(input: TopicInput!): TopicResult!
2022-06-19 17:54:39 +00:00
# comments
2022-02-03 09:13:53 +00:00
createComment(body: String!, shout: String!, replyTo: Int): CommentResult!
updateComment(id: Int!, body: String!): CommentResult!
deleteComment(id: Int!): Result!
rateComment(id: Int!, value: Int!): Result!
2022-06-19 17:54:39 +00:00
# community
2022-02-03 09:13:53 +00:00
createCommunity(title: String!, desc: String!): Community!
updateCommunity(community: CommunityInput!): Community!
deleteCommunity(id: Int!): Result!
2022-06-19 17:54:39 +00:00
# proposal
createProposal(body: String!, range: String): Proposal!
updateProposal(body: String!, range: String): Proposal!
acceptProposal(id: Int!): Result!
declineProposal(id: Int!): Result!
disableProposal(id: Int!): Result!
deleteProposal(id: Int!): Result!
rateProposal(id: Int!): Result!
2022-06-17 13:11:18 +00:00
subscribe(what: SubscriptionType!, slug: String!): Result!
unsubscribe(what: SubscriptionType!, slug: String!): Result!
2021-08-20 23:17:15 +00:00
}
################################### Query
type Query {
2022-02-03 09:13:53 +00:00
# auth
2022-06-15 12:41:28 +00:00
isEmailUsed(email: String!): Boolean!
2022-02-03 09:13:53 +00:00
signIn(email: String!, password: String): AuthResult!
signOut: Result!
# profile
getCurrentUser: UserResult!
getUsersBySlugs(slugs: [String]!): [User]!
getUserRoles(slug: String!): [Role]!
2022-02-16 10:44:26 +00:00
userComments(slug: String!, page: Int!, size: Int!): [Comment]!
userSubscriptions(slug: String!): [User]!
userSubscribers(slug: String!): [User]!
2022-04-29 07:51:51 +00:00
userSubscribedTopics(slug: String!): [String]!
2022-02-03 09:13:53 +00:00
2022-04-29 08:01:04 +00:00
shoutsRatedByUser(page: Int!, size: Int!): ShoutsResult!
2022-04-28 09:04:14 +00:00
shoutsCommentedByUser(slug: String!, page: Int!, size: Int!): [Shout]!
2022-04-29 08:27:34 +00:00
userUnpublishedShouts(page: Int!, size: Int!): ShoutsResult!
2022-04-28 09:04:14 +00:00
2022-02-03 09:13:53 +00:00
# shouts
getShoutBySlug(slug: String!): Shout!
2022-05-31 07:03:50 +00:00
shoutsByTopics(slugs: [String]!, page: Int!, size: Int!): [Shout]!
shoutsByAuthors(slugs: [String]!, page: Int!, size: Int!): [Shout]!
shoutsByCommunities(slugs: [String]!, page: Int!, size: Int!): [Shout]!
2022-02-03 09:13:53 +00:00
getShoutComments(slug: String!): [Comment]!
2022-06-19 17:54:39 +00:00
# collab
getShoutProposals(slug: String!): [Proposal]!
2022-02-03 09:13:53 +00:00
# mainpage
topViewed(page: Int!, size: Int!): [Shout]!
topMonth(page: Int!, size: Int!): [Shout]!
topOverall(page: Int!, size: Int!): [Shout]!
2022-06-11 22:05:20 +00:00
recentPublished(page: Int!, size: Int!): [Shout]!
# feed
recentAll(page: Int!, size: Int!): [Shout]!
2022-02-03 09:13:53 +00:00
# topics
topicsBySlugs(slugs: [String]): [Topic]!
topicsByCommunity(community: String!): [Topic]!
topicsByAuthor(author: String!): [Topic]!
# getOnlineUsers: [User!]!
# communities
getCommunity(slug: String): Community!
getCommunities: [Community]!
2022-06-21 12:21:02 +00:00
shoutCommentsSubscribed(slug: String!, page: Int!, size: Int!): [Shout]!
2022-02-03 09:13:53 +00:00
shoutsReviewed(page: Int!, size: Int!): [Shout]!
2022-02-03 09:29:16 +00:00
recentCommented(page: Int!, size: Int!): [Shout]!
2021-08-20 23:17:15 +00:00
}
############################################ Subscription
type Subscription {
2022-02-03 09:13:53 +00:00
onlineUpdated: [User!]!
shoutUpdated: Shout!
userUpdated: User!
commentUpdated(shout: String!): CommentUpdatedResult!
2021-08-20 23:17:15 +00:00
}
############################################ Entities
2021-11-24 09:09:47 +00:00
type Resource {
2022-02-03 09:13:53 +00:00
id: Int!
name: String!
2021-11-24 09:09:47 +00:00
}
type Operation {
2022-02-03 09:13:53 +00:00
id: Int!
name: String!
2021-11-24 09:09:47 +00:00
}
type Permission {
2022-02-03 09:13:53 +00:00
operation_id: Int!
resource_id: Int!
2021-11-24 09:09:47 +00:00
}
2021-08-20 23:17:15 +00:00
type Role {
2022-02-03 09:13:53 +00:00
id: Int!
name: String!
community: Int!
desc: String
permissions: [Permission!]!
2021-08-20 23:17:15 +00:00
}
type Rating {
2022-02-03 09:13:53 +00:00
rater: String!
value: Int!
2022-01-11 13:33:25 +00:00
}
2021-08-20 23:17:15 +00:00
type Notification {
2022-02-03 09:13:53 +00:00
kind: String! # unique primary key
template: String!
variables: [String]
2021-08-20 23:17:15 +00:00
}
type UserNotification {
2022-02-03 09:13:53 +00:00
id: Int! # primary key
user: Int!
kind: String! # NotificationTemplate.name
values: [String]
2021-08-20 23:17:15 +00:00
}
type User {
2022-02-03 09:13:53 +00:00
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
updatedAt: DateTime
wasOnlineAt: DateTime
ratings: [Rating]
bio: String
notifications: [Int]
communities: [Int] # user participating communities
old_id: String
2021-08-20 23:17:15 +00:00
}
2021-09-03 16:01:31 +00:00
type Comment {
2022-02-03 09:13:53 +00:00
id: Int!
2022-06-14 06:13:06 +00:00
shout: Int!
2022-02-03 09:13:53 +00:00
author: User!
body: String!
replyTo: Int
createdAt: DateTime!
updatedAt: DateTime
updatedBy: Int
deletedAt: DateTime
deletedBy: Int
ratings: [CommentRating]
views: Int
old_id: String
old_thread: String
2021-10-13 17:46:30 +00:00
}
type CommentRating {
2022-02-03 09:13:53 +00:00
id: Int!
comment_id: Int!
createdBy: String!
createdAt: DateTime!
value: Int!
2021-09-03 16:01:31 +00:00
}
2021-08-20 23:17:15 +00:00
# is publication
type Shout {
2022-06-14 06:13:06 +00:00
id: Int!
2022-02-03 09:13:53 +00:00
slug: String!
body: String!
createdAt: DateTime!
authors: [User!]!
ratings: [Rating]
visibleFor: [User]
community: Int
cover: String
layout: String
# replyTo: Shout
versionOf: Shout
tags: [String] # actual values
topics: [Topic]
mainTopic: String
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
stat: ShoutStat
2021-12-17 10:22:31 +00:00
}
type ShoutStat {
2022-02-03 09:13:53 +00:00
views: Int!
comments: Int!
ratings: Int!
2021-08-20 23:17:15 +00:00
}
2021-08-26 21:14:20 +00:00
type Community {
2022-02-03 09:13:53 +00:00
slug: String!
name: String!
desc: String
pic: String!
createdAt: DateTime!
createdBy: User!
2021-08-26 21:14:20 +00:00
}
2021-12-13 16:51:01 +00:00
type TopicStat {
2022-02-03 09:13:53 +00:00
shouts: Int!
views: Int!
subscriptions: Int!
authors: Int!
2021-12-13 16:51:01 +00:00
}
2021-08-20 23:17:15 +00:00
type Topic {
2022-02-03 09:13:53 +00:00
slug: String! # ID
title: String
body: String
pic: String
parents: [String] # NOTE: topic can have parent topics
children: [String] # and children
community: String!
topicStat: TopicStat
2021-08-20 23:17:15 +00:00
}
2022-06-19 17:54:39 +00:00
enum ProposalStatus {
NEW
UPDATED
UPDATED_RATING
ACCEPTED
DECLINED
DISABLED
DELETED
}
2021-08-20 23:17:15 +00:00
type Proposal {
2022-06-19 17:54:39 +00:00
shout: String!
2022-02-03 09:13:53 +00:00
range: String # full / 0:2340
2022-06-19 11:11:14 +00:00
body: String!
2022-02-03 09:13:53 +00:00
createdAt: DateTime!
2022-06-19 17:54:39 +00:00
createdBy: String!
2022-06-19 11:11:14 +00:00
updatedAt: DateTime
acceptedAt: DateTime
2022-06-19 17:54:39 +00:00
acceptedBy: Int
2022-06-19 11:11:14 +00:00
declinedAt: DateTime
2022-06-19 17:54:39 +00:00
declinedBy: Int
disabledAt: DateTime
disabledBy: Int
2021-08-20 23:17:15 +00:00
}
type Token {
2022-02-03 09:13:53 +00:00
createdAt: DateTime!
expiresAt: DateTime
id: Int!
ownerId: Int!
usedAt: DateTime
value: String!
2021-08-28 10:13:50 +00:00
}