-
Notifications
You must be signed in to change notification settings - Fork 546
/
Copy pathProjectModel.ts
42 lines (40 loc) · 1020 Bytes
/
ProjectModel.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
42
import { Repository } from '../services/github';
import UserModel from './UserModel';
export default class ProjectModel {
private constructor(
public id: number,
public owner: UserModel,
public fullName: string,
public name: string,
public htmlUrl: string,
public description: string,
public language: string,
public forksCount: number,
public stargazersCount: number,
public openIssuesCount: number,
public archived: boolean,
public disabled: boolean,
public pushedAt: string,
public createdAt: string,
public updatedAt: string
) {}
static from(raw: Repository): ProjectModel {
return new ProjectModel(
raw.id,
UserModel.from(raw.owner),
raw.full_name,
raw.name,
raw.html_url,
raw.description,
raw.language,
raw.forks_count,
raw.stargazers_count,
raw.open_issues_count,
raw.archived,
raw.disabled,
raw.pushed_at,
raw.created_at,
raw.updated_at
);
}
}