aboutsummaryrefslogtreecommitdiff
path: root/src/lib/data
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/data')
-rw-r--r--src/lib/data/queries.ts94
-rw-r--r--src/lib/data/types.d.ts20
2 files changed, 11 insertions, 103 deletions
diff --git a/src/lib/data/queries.ts b/src/lib/data/queries.ts
deleted file mode 100644
index 4def052..0000000
--- a/src/lib/data/queries.ts
+++ /dev/null
@@ -1,94 +0,0 @@
-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
- }
- }
- }
-`;
diff --git a/src/lib/data/types.d.ts b/src/lib/data/types.d.ts
index 2498bf7..aae2f80 100644
--- a/src/lib/data/types.d.ts
+++ b/src/lib/data/types.d.ts
@@ -8,9 +8,10 @@ export type Topic = {
title: string;
ttl: number;
updated_at: number;
- tags: Tag[];
- posts: Post[];
- forum: Forum;
+ forum_id: string;
+ forum?: Forum;
+ posts?: Post[];
+ tags?: Tag[];
};
export type Post = {
@@ -18,14 +19,15 @@ export type Post = {
created_at: number;
title: string;
text: string;
- topic: Topic;
- author: Author;
+ topic_id: string;
+ topic?: Topic;
+ author_id: string;
+ author?: User;
};
export type Tag = {
- id: string;
- weight: number;
- topics: Topic[];
+ tag: string;
+ count: number;
};
export type Forum = {
@@ -36,7 +38,7 @@ export type Forum = {
topics: Topic[];
};
-export type Author = {
+export type User = {
id: string;
handle: string;
};