]> git.r.bdr.sh - rbdr/forum/blob - src/lib/data/queries.ts
4def052b71dabb20710483becb76d2b430a7a76a
[rbdr/forum] / src / lib / data / queries.ts
1 import { gql } from '@apollo/client/core';
2
3 export const GET_FORUMS = gql`
4 query GetForums {
5 forumsCollection {
6 edges {
7 node {
8 id
9 glyph
10 label
11 position
12 }
13 }
14 }
15 }
16 `;
17
18 export const GET_FORUM = gql`
19 query GetForum($id: ID!) {
20 forum(id: $id) {
21 id
22 glyph
23 label
24 position
25 topics {
26 id
27 title
28 updated_at
29 ttl
30 }
31 }
32 }
33 `;
34
35 export const GET_TAG = gql`
36 query GetTag($id: ID!) {
37 tag(id: $id) {
38 id
39 topics {
40 id
41 title
42 updated_at
43 ttl
44 }
45 }
46 }
47 `;
48
49 export const GET_TOPIC = gql`
50 query GetTopic($id: ID!) {
51 topic(id: $id) {
52 id
53 title
54 updated_at
55 ttl
56 forum {
57 id
58 glyph
59 label
60 }
61 tags {
62 id
63 weight
64 }
65 posts {
66 id
67 text
68 created_at
69 author {
70 id
71 handle
72 }
73 }
74 }
75 }
76 `;
77
78 export const GET_POST = gql`
79 query GetPost($id: ID!) {
80 post(id: $id) {
81 id
82 text
83 created_at
84 author {
85 id
86 handle
87 }
88 topic {
89 id
90 title
91 }
92 }
93 }
94 `;