aboutsummaryrefslogtreecommitdiffstats
path: root/src/types/graphql/mutations.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/types/graphql/mutations.ts')
-rw-r--r--src/types/graphql/mutations.ts61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/types/graphql/mutations.ts b/src/types/graphql/mutations.ts
new file mode 100644
index 0000000..581a46e
--- /dev/null
+++ b/src/types/graphql/mutations.ts
@@ -0,0 +1,61 @@
+import { sendCommentMutation } from '../../services/graphql/comments.mutation';
+import { sendMailMutation } from '../../services/graphql/contact.mutation';
+
+//===========================================================================
+// Existing mutations list
+//===========================================================================
+
+export type Mutations = typeof sendMailMutation | typeof sendCommentMutation;
+
+//===========================================================================
+// Mutations response types
+//===========================================================================
+
+export type SendCommentResponse<T> = {
+ createComment: T;
+};
+
+export type SendMailResponse<T> = {
+ sendEmail: T;
+};
+
+export type MutationsResponseMap<T> = {
+ [sendCommentMutation]: SendCommentResponse<T>;
+ [sendMailMutation]: SendMailResponse<T>;
+};
+
+export type Approved = {
+ approved: boolean;
+};
+
+export type SentComment = {
+ clientMutationId: string;
+ success: boolean;
+ comment: Approved | null;
+};
+
+//===========================================================================
+// Mutations input types
+//===========================================================================
+
+export type SendCommentInput = {
+ author: string;
+ authorEmail: string;
+ authorUrl: string;
+ clientMutationId: string;
+ commentOn: number;
+ content: string;
+ parent?: number;
+};
+
+export type SendMailInput = {
+ body: string;
+ clientMutationId: string;
+ replyTo: string;
+ subject: string;
+};
+
+export type MutationsInputMap = {
+ [sendCommentMutation]: SendCommentInput;
+ [sendMailMutation]: SendMailInput;
+};