]> git.r.bdr.sh - rbdr/forum/blobdiff - src/data/queries.js
Add tests for actions + pacts for graphql errrors
[rbdr/forum] / src / data / queries.js
index de223cb110412e3999c18b3b3ae50d9fb6662384..7364c0f1dd7e0095d24b4f4cf47e7bb8c64e2287 100644 (file)
@@ -1,29 +1,90 @@
 import { gql } from '@apollo/client/core';
 
 export const GET_FORUMS = gql`
 import { gql } from '@apollo/client/core';
 
 export const GET_FORUMS = gql`
-  query GetForums {
-    forums {
-      id
-      glyph
-      label
-      position
-    }
-  }
+       query GetForums {
+               forums {
+                       id
+                       glyph
+                       label
+                       position
+               }
+       }
 `;
 
 export const GET_FORUM = gql`
 `;
 
 export const GET_FORUM = gql`
-  query GetForum($id: ID!) {
-    forum(id: $id) {
-      id
-      glyph
-      label
-      position
-      topics {
-        id
-        title,
-        updated_at,
-        ttl
-      }
-    }
-  }
+       query GetForum($id: ID!) {
+               forum(id: $id) {
+                       id
+                       glyph
+                       label
+                       position
+                       topics {
+                               id
+                               title
+                               updated_at
+                               ttl
+                       }
+               }
+       }
+`;
+
+export const GET_TAG = gql`
+       query GetTag($id: ID!) {
+               tag(id: $id) {
+                       id
+                       topics {
+                               id
+                               title
+                               updated_at
+                               ttl
+                       }
+               }
+       }
+`;
+
+export const GET_TOPIC = gql`
+       query GetTopic($id: ID!) {
+               topic(id: $id) {
+                       id
+                       title
+                       updated_at
+                       ttl
+                       forum {
+                               id
+                               glyph
+                               label
+                       }
+                       tags {
+                               id
+                               weight
+                       }
+                       posts {
+                               id
+                               text
+                               created_at
+                               author {
+                                       id
+                                       handle
+                               }
+                       }
+               }
+       }
+`;
+
+export const GET_POST = gql`
+       query GetPost($id: ID!) {
+               post(id: $id) {
+                       id
+                       text
+                       created_at
+                       author {
+                               id
+                               handle
+                       }
+                       topic {
+                               id
+                               title
+                       }
+               }
+       }
 `;
 `;