-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: hook up to katharostech directus.
- Loading branch information
Showing
12 changed files
with
5,429 additions
and
227 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"imports": { | ||
"crypto": "node:crypto" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import { createDirectus, graphql } from '@directus/sdk'; | ||
|
||
type Author = { | ||
directus_users_id: { | ||
display_name: string; | ||
slug: string; | ||
}; | ||
}; | ||
|
||
type ArticleTranslation = { | ||
title: string; | ||
body: string; | ||
feature_image: { | ||
id: string; | ||
}; | ||
languages_id: { | ||
code: string, | ||
} | ||
}; | ||
|
||
type Tag = { | ||
id: string; | ||
tags_id: { | ||
slug: string; | ||
translations: { | ||
title: string; | ||
languages_code: { | ||
code: string; | ||
}; | ||
}[]; | ||
}; | ||
}; | ||
|
||
type Article = { | ||
id: string; | ||
slug: string; | ||
published_date: string; | ||
authors: Author[]; | ||
tags: Tag[]; | ||
translations: ArticleTranslation[]; | ||
}; | ||
|
||
type Schema = { | ||
articles: Article[]; | ||
}; | ||
|
||
const directus = createDirectus<Schema>('https://directus.katharostech.com').with(graphql()); | ||
|
||
export default directus; | ||
|
||
export async function getArticles() { | ||
return await directus.query<{ articles: Article[] }>(` | ||
query { | ||
articles { | ||
id | ||
slug | ||
published_date | ||
authors { | ||
directus_users_id { | ||
display_name | ||
slug | ||
} | ||
} | ||
tags { | ||
id | ||
tags_id { | ||
slug | ||
translations { | ||
title | ||
languages_code { | ||
code | ||
} | ||
} | ||
} | ||
} | ||
translations { | ||
title | ||
body | ||
feature_image { | ||
id | ||
} | ||
languages_id { | ||
code | ||
} | ||
} | ||
} | ||
} | ||
`); | ||
} |
Oops, something went wrong.