aboutsummaryrefslogtreecommitdiff
path: root/src/lib/data/queries.ts
blob: 4def052b71dabb20710483becb76d2b430a7a76a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import { gql } from '@apollo/client/core';

export const GET_FORUMS = gql`
	query GetForums {
		forumsCollection {
      edges {
        node {
          id
          glyph
          label
          position
        }
      }
    }
	}
`;

export const GET_FORUM = gql`
	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
			}
		}
	}
`;