Files
speckle-server/packages/server/modules/comments/graph/schemas/comments.gql
T
Dimitrie Stefanescu e916ced857 feat(comms): wip
2022-03-16 16:55:51 +00:00

121 lines
2.9 KiB
GraphQL

extend type Query {
comment(id: String!, streamId: String!): Comment
comments(streamId: String!, resources: [ResourceIdentifierInput]!, limit: Int = 25, cursor: String, archived: Boolean! = false): CommentCollection
}
type Comment {
id: String!
authorId: String!
archived: Boolean!
screenshot: String
text: String!
data: JSONObject
resources: [ResourceIdentifier]!
createdAt: DateTime
updatedAt: DateTime
viewedAt: DateTime # relevant only if a top level commit.
replies(limit: Int = 25, cursor: String): CommentCollection
reactions: [String]
}
type CommentCollection {
totalCount: Int!
cursor: DateTime
items: [Comment]!
}
type ResourceIdentifier {
resourceId: String!
resourceType: ResourceType!
}
input ResourceIdentifierInput {
resourceId: String!
resourceType: ResourceType!
}
enum ResourceType {
comment
object
commit
stream
}
input CommentCreateInput {
streamId: String!
resources: [ResourceIdentifierInput]!
text: String!
data: JSONObject!
screenshot: String
}
input ReplyCreateInput {
streamId: String!
parentComment: String!
text: String!
data: JSONObject
}
input CommentEditInput {
streamId: String!
id: String!
text: String!
data: JSONObject!
}
input ReplyEditInput {
id: String!
text: String!
archived: Boolean
}
extend type Mutation {
# Used for broadcasting real time chat head bubbles and status.
userViewerActivityBroadcast(
streamId: String!
resourceId: String!
data: JSONObject
): Boolean! @hasRole(role: "server:user") @hasScope(scope: "streams:read")
commentCreate(input: CommentCreateInput! ): String!
@hasRole(role: "server:user")
@hasScope(scope: "streams:read")
# Mark a given comment as viewed
commentView(streamId: String!, commentId: String!): Boolean!
@hasRole(role: "server:user")
@hasScope(scope: "streams:read")
commentArchive( streamId: String!, commentId: String!, archived: Boolean! = true ): Boolean!
@hasRole(role: "server:user")
@hasScope(scope: "streams:read")
commentEdit(streamId: String!, comment: JSONObject!): Boolean!
@hasRole(role: "server:user")
@hasScope(scope: "streams:read")
commentReply( input: ReplyCreateInput! ): String!
@hasRole(role: "server:user")
@hasScope(scope: "streams:read")
commentReactionToggle(streamId: String!, commentId: String!, reaction: String!): Boolean!
@hasRole(role: "server:user")
@hasScope(scope: "streams:read")
}
extend type Subscription {
userViewerActivity(streamId: String!, resourceId: String!): JSONObject
@hasRole(role: "server:user")
@hasScope(scope: "streams:read")
commentActivity(streamId: String!, resourceId: [String!]): JSONObject
@hasRole(role: "server:user")
@hasScope(scope: "streams:read")
commentThreadActivity(streamId: String!, commentId: String!): JSONObject
@hasRole(role: "server:user")
@hasScope(scope: "streams:read")
}