45 lines
878 B
TypeScript
45 lines
878 B
TypeScript
|
import { createDirectus, rest, staticToken } from '@directus/sdk';
|
||
|
|
||
|
type Post = {
|
||
|
slug: string;
|
||
|
status: string;
|
||
|
title: string;
|
||
|
description: string;
|
||
|
tags: [];
|
||
|
cover_image: string;
|
||
|
content: string;
|
||
|
}
|
||
|
|
||
|
type Course = {
|
||
|
id: string;
|
||
|
status: string;
|
||
|
user_created: string;
|
||
|
date_created: string;
|
||
|
user_updated: string;
|
||
|
date_updated: string;
|
||
|
name: string;
|
||
|
level: string;
|
||
|
version: string;
|
||
|
type: string;
|
||
|
category: string;
|
||
|
language: string;
|
||
|
description: string;
|
||
|
image: string;
|
||
|
features: [];
|
||
|
content: string;
|
||
|
modules: [];
|
||
|
}
|
||
|
|
||
|
type Schema = {
|
||
|
codyops_posts: Post[];
|
||
|
codyops_courses: Course[];
|
||
|
codyops_campaigns: [];
|
||
|
codyops_reviews: [];
|
||
|
codyops_currencies: [];
|
||
|
}
|
||
|
|
||
|
const directus = createDirectus<Schema>(import.meta.env.ASTRO_DIRECTUS_API)
|
||
|
.with(staticToken(import.meta.env.ASTRO_DIRECTUS_TOKEN))
|
||
|
.with(rest());
|
||
|
|
||
|
export default directus;
|