aboutsummaryrefslogtreecommitdiffstats
path: root/src/ts/types/articles.ts
blob: 91703a27fc0b624f5b7ce7e4d297fbca66bb8fcb (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
import { Comment, CommentsResponse } from './comments';
import { Cover, CoverResponse } from './cover';
import { SEO } from './seo';
import { SubjectPreview, ThematicPreview } from './taxonomies';

export type ArticleDates = {
  publication: string;
  update: string;
};

export type ArticlePreviewResponse = {
  acfPosts: {
    postsInSubject: SubjectPreview[] | null;
    postsInThematic: ThematicPreview[] | null;
  };
  commentCount: number | null;
  contentParts: {
    beforeMore: string;
  };
  databaseId: number;
  date: string;
  featuredImage: CoverResponse | null;
  id: string;
  modified: string;
  slug: string;
  title: string;
};

export type ArticlePreview = {
  commentCount: number | null;
  content: string;
  databaseId: number;
  date: ArticleDates;
  featuredImage?: Cover | object;
  id: string;
  slug: string;
  subjects: SubjectPreview[] | [];
  thematics: ThematicPreview[] | [];
  title: string;
};

export type ArticleResponse = ArticlePreviewResponse & {
  comments: CommentsResponse;
  contentParts: {
    afterMore: string;
  };
  seo: SEO;
};

export type Article = ArticlePreview & {
  comments: Comment[];
  intro: string;
  seo: SEO;
};

export type PostByResponse = {
  postBy: ArticleResponse;
};

export type FetchPostByReturn = (slug: string) => Promise<PostByResponse>;

export type GetPostByReturn = (slug: string) => Promise<Article>;

export type ArticleProps = {
  post: Article;
};

export type ArticleSlug = {
  slug: string;
};