mirror of
https://github.com/wassname/talk.git
synced 2026-09-11 12:51:33 +08:00
Implement post comment mutation
This commit is contained in:
@@ -1,10 +1,16 @@
|
||||
import { GQLMutationTypeResolver } from "talk-server/graph/tenant/schema/__generated__/types";
|
||||
|
||||
const Mutation: GQLMutationTypeResolver<void> = {
|
||||
createComment: async (source, { input }, ctx) => ({
|
||||
comment: await ctx.mutators.Comment.create(input),
|
||||
clientMutationId: input.clientMutationId,
|
||||
}),
|
||||
createComment: async (source, { input }, ctx) => {
|
||||
const comment = await ctx.mutators.Comment.create(input);
|
||||
return {
|
||||
commentEdge: {
|
||||
cursor: comment.created_at,
|
||||
node: comment,
|
||||
},
|
||||
clientMutationId: input.clientMutationId,
|
||||
};
|
||||
},
|
||||
updateSettings: async (source, { input }, ctx) => ({
|
||||
settings: await ctx.mutators.Settings.update(input.settings),
|
||||
clientMutationId: input.clientMutationId,
|
||||
|
||||
@@ -821,9 +821,9 @@ mutation.
|
||||
"""
|
||||
type CreateCommentPayload {
|
||||
"""
|
||||
comment is the possibly created comment.
|
||||
CommentEdge is the possibly created comment edge.
|
||||
"""
|
||||
comment: Comment
|
||||
commentEdge: CommentEdge
|
||||
|
||||
"""
|
||||
clientMutationId is required for Relay support.
|
||||
|
||||
Reference in New Issue
Block a user