Files
speckle-server/packages/server/modules/comments/graph/schemas/comments.gql
T
Gergő Jedlicska 67cb97a262 gergo/testCommentsGQL (#775)
* yarn first go

* fix frontend build cache loader

* yarn workspaces built server Docker

* build(yarn): add workspaces plugin config

* chore(package defs): clean package*.json -s

* chore(gitignore): ignore yarn error log

* build(yarn): update yarn lock

* build(preview-service webpack): add extra resolved path to preview service webpack config

because of yarn package hoisting, there are no package level node_modules folder anymore.

* build(docker): update dockerignore with yarn specific configs

* build(docker): update Dockerfiles for yarn workspaces utilization

* ci(circleci): update server test job to yarn

* ci(circle): disable cache restore

* ci(circleci): trying the node orb yarn-run

* ci(circleci): yarn-run again

* ci(circleci): disable node orb

* ci(circleci): change base node image for tests

* ci(circleci): add yarn cache

* ci(circleci): remove node install step

* ci(circleci): add server specific cache archives

* ci(circleci): test build and publish

* ci(circleci): change npm auth method to suit yarn

* ci(circleci): trying new builder image

* ci(circleci): another base image, maybe this works

* ci(circleci): force a specific docker engine version

* ci(circleci): add yarn version plugin and its changes

* ci(circleci): cleanup and remove temp branch config

* chore(package defs): moving from npm run to yarn

* explicitly specifying webpack4 as a frontend dep

* chore(package defs): replace npm with yarn everywhere

* docs(root readme): update with some yarn specific docs

* test(server comments gql): add wip server comments gql tests

* test(server comments graphql): add missing test operations and generate a bunch of testcases

* test(server comments graphql api): fix all authz test cases for comments

* test(server comments service): fix comments service failing test

* fix(tests): do not look inside

Co-authored-by: Fabians <fabis94@live.com>
Co-authored-by: Dimitrie Stefanescu <didimitrie@gmail.com>
2022-06-02 11:15:27 +02:00

231 lines
5.8 KiB
GraphQL

extend type Query {
comment(id: String!, streamId: String!): Comment
"""
This query can be used in the following ways:
- get all the comments for a stream: **do not pass in any resource identifiers**.
- get the comments targeting any of a set of provided resources (comments/objects): **pass in an array of resources.**
"""
comments(
streamId: String!
resources: [ResourceIdentifierInput]
limit: Int = 25
cursor: String
archived: Boolean! = false
): CommentCollection
}
extend type Stream {
"""
The total number of comments for this stream. To actually get the comments, use the comments query without passing in a resource array. E.g.:
```
query{
comments(streamId:"streamId"){
...
}
```
"""
commentCount: Int!
}
extend type Commit {
"""
The total number of comments for this commit. To actually get the comments, use the comments query and pass in a resource array consisting of of this commit's id.
E.g.,
```
query{
comments(streamId:"streamId" resources:[{resourceType: commit, resourceId:"commitId"}] ){
...
}
```
"""
commentCount: Int!
}
extend type CommitCollectionUserNode {
"""
The total number of comments for this commit. To actually get the comments, use the comments query and pass in a resource array consisting of of this commit's id.
E.g.,
```
query{
comments(streamId:"streamId" resources:[{resourceType: commit, resourceId:"commitId"}] ){
...
}
```
"""
commentCount: Int!
}
extend type Object {
"""
The total number of comments for this commit. To actually get the comments, use the comments query and pass in a resource array consisting of of this object's id.
E.g.,
```
query{
comments(streamId:"streamId" resources:[{resourceType: object, resourceId:"objectId"}] ){
...
}
```
"""
commentCount: Int!
}
type Comment {
id: String!
authorId: String!
archived: Boolean!
screenshot: String
text: String!
data: JSONObject
"""
Resources that this comment targets. Can be a mixture of either one stream, or multiple commits and objects.
"""
resources: [ResourceIdentifier]!
createdAt: DateTime
"""
The time this comment was last updated. Corresponds also to the latest reply to this comment, if any.
"""
updatedAt: DateTime
"""
The last time you viewed this comment. Present only if an auth'ed request. Relevant only if a top level commit.
"""
viewedAt: DateTime
"""
Gets the replies to this comment.
"""
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!
"""
Specifies the resources this comment is linked to. There are several use cases:
- a comment targets only one resource (commit or object)
- a comment targets one or more resources (commits or objects)
- a comment targets only a stream
"""
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!
}
extend type Mutation {
"""
Used for broadcasting real time chat head bubbles and status. Does not persist any info.
"""
userViewerActivityBroadcast(
streamId: String!
resourceId: String!
data: JSONObject
): Boolean! @hasRole(role: "server:user")
"""
Used for broadcasting real time typing status in comment threads. Does not persist any info.
"""
userCommentThreadActivityBroadcast(
streamId: String!
commentId: String!
data: JSONObject
): Boolean! @hasRole(role: "server:user")
"""
Creates a comment
"""
commentCreate(input: CommentCreateInput!): String!
@hasRole(role: "server:user")
@hasScope(scope: "streams:read")
"""
Flags a comment as viewed by you (the logged in user).
"""
commentView(streamId: String!, commentId: String!): Boolean!
@hasRole(role: "server:user")
@hasScope(scope: "streams:read")
"""
Archives a comment.
"""
commentArchive(
streamId: String!
commentId: String!
archived: Boolean! = true
): Boolean! @hasRole(role: "server:user") @hasScope(scope: "streams:read")
"""
Edits a comment.
"""
commentEdit(input: CommentEditInput!): Boolean!
@hasRole(role: "server:user")
@hasScope(scope: "streams:read")
"""
Adds a reply to a comment.
"""
commentReply(input: ReplyCreateInput!): String!
@hasRole(role: "server:user")
@hasScope(scope: "streams:read")
}
extend type Subscription {
"""
Broadcasts "real-time" location data for viewer users.
"""
userViewerActivity(streamId: String!, resourceId: String!): JSONObject
"""
Subscribe to comment events. There's two ways to use this subscription:
- for a whole stream: do not pass in any resourceIds; this sub will get called whenever a comment (not reply) is added to any of the stream's resources.
- for a specific resource/set of resources: pass in a list of resourceIds (commit or object ids); this sub will get called when *any* of the resources provided get a comment.
"""
commentActivity(streamId: String!, resourceIds: [String]): JSONObject
@hasRole(role: "server:user")
@hasScope(scope: "streams:read")
"""
Subscribes to events on a specific comment. Use to find out when:
- a top level comment is deleted (trigger a deletion event outside)
- a top level comment receives a reply.
"""
commentThreadActivity(streamId: String!, commentId: String!): JSONObject
@hasRole(role: "server:user")
@hasScope(scope: "streams:read")
}