comment.graphql 2.17 KB
Newer Older
NGPixel's avatar
NGPixel committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
# ===============================================
# COMMENT
# ===============================================

extend type Query {
  comments: CommentQuery
}

extend type Mutation {
  comments: CommentMutation
}

# -----------------------------------------------
# QUERIES
# -----------------------------------------------

type CommentQuery {
  providers: [CommentProvider] @auth(requires: ["manage:system"])
19 20

  list(
21 22
    locale: String!
    path: String!
23 24 25 26 27
  ): [CommentPost]! @auth(requires: ["read:comments", "manage:system"])

  single(
    id: Int!
  ): CommentPost @auth(requires: ["read:comments", "manage:system"])
NGPixel's avatar
NGPixel committed
28 29 30 31 32 33 34 35 36 37 38
}

# -----------------------------------------------
# MUTATIONS
# -----------------------------------------------

type CommentMutation {
  updateProviders(
    providers: [CommentProviderInput]
  ): DefaultResponse @auth(requires: ["manage:system"])

39 40 41 42
  create(
    pageId: Int!
    replyTo: Int
    content: String!
43 44
    guestName: String
    guestEmail: String
45
  ): CommentCreateResponse @auth(requires: ["write:comments", "manage:system"]) @rateLimit(limit: 1, duration: 15)
46 47 48 49

  update(
    id: Int!
    content: String!
NGPixel's avatar
NGPixel committed
50
  ): CommentUpdateResponse @auth(requires: ["write:comments", "manage:comments", "manage:system"])
51 52 53 54

  delete(
    id: Int!
  ): DefaultResponse @auth(requires: ["manage:comments", "manage:system"])
NGPixel's avatar
NGPixel committed
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
}

# -----------------------------------------------
# TYPES
# -----------------------------------------------

type CommentProvider {
  isEnabled: Boolean!
  key: String!
  title: String!
  description: String
  logo: String
  website: String
  isAvailable: Boolean
  config: [KeyValuePair]
}

input CommentProviderInput {
  isEnabled: Boolean!
  key: String!
  config: [KeyValuePairInput]
}
77 78 79

type CommentPost {
  id: Int!
NGPixel's avatar
NGPixel committed
80
  content: String! @auth(requires: ["write:comments", "manage:comments", "manage:system"])
81 82 83 84 85 86 87 88
  render: String!
  authorId: Int!
  authorName: String!
  authorEmail: String! @auth(requires: ["manage:system"])
  authorIP: String! @auth(requires: ["manage:system"])
  createdAt: Date!
  updatedAt: Date!
}
89 90 91 92 93

type CommentCreateResponse {
  responseResult: ResponseStatus
  id: Int
}
NGPixel's avatar
NGPixel committed
94 95 96 97 98

type CommentUpdateResponse {
  responseResult: ResponseStatus
  render: String
}