-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtypes.ts
41 lines (37 loc) · 900 Bytes
/
types.ts
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
export type Comment = {
id: number;
content: string;
title: string;
timeSent: string;
sentBy: string;
};
export type ArticleWithContent = {
id: number;
title: string;
markdown: string;
categories?: number[];
author: number | Author;
comments: Comment[];
timePublished: string;
imageUrl?: string;
};
export type Article = {
id: number;
title: string;
timePublished: string;
author: number | Author;
imageUrl?: string;
};
export type Author = {
id: number;
name: string;
imageUrl?: string;
};
export interface articleDao {
getAllArticles(): Promise<Article[]>;
getArticlesByCategory(categoryId: number): Promise<Article[]>;
getArticlesByAuthor(authorId: number): Promise<Article[]>;
getRecentArticles(): Promise<Article[]>;
getArticleById(id: number): Promise<ArticleWithContent>;
comment(articleId: number, comment: Comment): Promise<void>;
}