aboutsummaryrefslogtreecommitdiffstats
path: root/src/types/app.ts
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-11-24 20:00:08 +0100
committerArmand Philippot <git@armandphilippot.com>2023-11-27 14:47:51 +0100
commitf111685c5886f3e77edfd3621c98d8ac1b9bcce4 (patch)
tree62a541fe3afeb64bf745443706fbfb02e96c5230 /src/types/app.ts
parentbee515641cb144be9a855ff2cac258d2fedab21d (diff)
refactor(services, types): reorganize GraphQL fetchers and data types
The Typescript mapped types was useful for autocompletion in fetchers but their are harder to maintain. I think it's better to keep each query close to its fetcher to have a better understanding of the fetched data. So I: * colocate queries with their own fetcher * colocate mutations with their own mutator * remove Typescript mapped types for queries and mutations * move data convertors inside graphql services * rename most of data types and fetchers
Diffstat (limited to 'src/types/app.ts')
-rw-r--r--src/types/app.ts102
1 files changed, 0 insertions, 102 deletions
diff --git a/src/types/app.ts b/src/types/app.ts
index b613e6e..218d63b 100644
--- a/src/types/app.ts
+++ b/src/types/app.ts
@@ -28,108 +28,6 @@ export type AppPropsWithLayout = AppProps<CustomPageProps> & {
Component: NextPageWithLayout;
};
-export type ContentKind =
- | 'article'
- | 'comment'
- | 'page'
- | 'project'
- | 'thematic'
- | 'topic';
-
-export type Author<T extends ContentKind> = {
- avatar?: Image;
- description?: T extends 'comment' ? never : string;
- name: string;
- website?: string;
-};
-
-export type CommentMeta = {
- author: Author<'comment'>;
- date: string;
-};
-
-export type SingleComment = {
- approved: boolean;
- content: string;
- id: number;
- meta: CommentMeta;
- parentId?: number;
- replies: SingleComment[];
-};
-
-export type Dates = {
- publication: string;
- update?: string;
-};
-
-export type Image = {
- alt: string;
- height: number;
- src: string;
- title?: string;
- width: number;
-};
-
-export type Repos = {
- github?: string;
- gitlab?: string;
-};
-
-export type SEO = {
- description: string;
- title: string;
-};
-
-export type PageKind = Exclude<ContentKind, 'comment'>;
-
-export type Meta<T extends PageKind> = {
- articles?: T extends 'thematic' | 'topic' ? Article[] : never;
- author?: T extends 'article' | 'page' ? Author<T> : never;
- commentsCount?: T extends 'article' ? number : never;
- cover?: Image;
- dates: Dates;
- license?: T extends 'project' ? string : never;
- repos?: T extends 'project' ? Repos : never;
- seo: SEO;
- tagline?: T extends 'project' ? string : never;
- technologies?: T extends 'project' ? string[] : never;
- thematics?: T extends 'article' | 'topic' ? PageLink[] : never;
- topics?: T extends 'article' | 'thematic' ? PageLink[] : never;
- website?: T extends 'topic' ? string : never;
- wordsCount: number;
-};
-
-export type Page<T extends PageKind> = {
- content: string;
- id: number | string;
- intro: string;
- meta: Meta<T>;
- slug: string;
- title: string;
-};
-
-export type PageLink = {
- id: number;
- logo?: Image;
- name: string;
- url: string;
-};
-
-export type Article = Page<'article'>;
-export type ArticleCard = Pick<Article, 'id' | 'slug' | 'title'> &
- Pick<Meta<'article'>, 'cover' | 'dates'>;
-export type Project = Page<'project'>;
-export type ProjectPreview = Omit<Page<'project'>, 'content'>;
-export type ProjectCard = Pick<Page<'project'>, 'id' | 'slug' | 'title'> & {
- meta: Pick<Meta<'project'>, 'cover' | 'dates' | 'tagline' | 'technologies'>;
-};
-export type Thematic = Page<'thematic'>;
-export type Topic = Page<'topic'>;
-
-export type Slug = {
- slug: string;
-};
-
export type Position = 'bottom' | 'center' | 'left' | 'right' | 'top';
/** Spacing keys defined has CSS variables */