This repository has been archived by the owner on Nov 8, 2022. It is now read-only.
/
Repo.js
70 lines (55 loc) · 1.92 KB
/
Repo.js
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 { types as t } from 'mobx-state-tree'
// eslint-disable-next-line import/named
import { PAGE_SIZE } from '@config'
import { User, PagedUsers } from './User'
import { Community } from './Community'
import { Tag } from './Tag'
const Contributor = t.model('Contributor', {
avatar: t.string,
nickname: t.string,
htmlUrl: t.string,
})
const Language = t.model('Language', {
name: t.string,
color: t.string,
})
export const Repo = t.model('Reop', {
id: t.maybeNull(t.string),
title: t.optional(t.string, ''),
ownerName: t.maybeNull(t.string),
ownerUrl: t.maybeNull(t.string),
repoUrl: t.maybeNull(t.string),
desc: t.maybeNull(t.string),
homepageUrl: t.maybeNull(t.string),
readme: t.maybeNull(t.string),
issuesCount: t.optional(t.number, 0),
prsCount: t.optional(t.number, 0),
starCount: t.optional(t.number, 0),
forkCount: t.optional(t.number, 0),
watchCount: t.optional(t.number, 0),
primaryLanguage: t.optional(Language, { name: '', color: 'grey' }),
license: t.maybeNull(t.string),
releaseTag: t.maybeNull(t.string),
contributors: t.array(Contributor),
author: t.maybeNull(User),
views: t.optional(t.number, 0),
pin: t.maybeNull(t.boolean),
favoritedCount: t.optional(t.number, 0),
viewerHasFavorited: t.optional(t.boolean, false),
favoritedCategoryId: t.maybeNull(t.string),
communities: t.optional(t.array(Community), []),
origialCommunity: t.optional(Community, {}),
tags: t.optional(t.array(Tag), []),
lastSync: t.maybeNull(t.string),
pagedCommentsParticipators: t.optional(PagedUsers, {}),
viewerHasViewed: t.optional(t.boolean, false),
insertedAt: t.optional(t.string, ''),
updatedAt: t.optional(t.string, ''),
})
export const PagedRepos = t.model('PagedRepos', {
entries: t.optional(t.array(Repo), []),
pageNumber: t.optional(t.number, 1),
pageSize: t.optional(t.number, PAGE_SIZE.D),
totalCount: t.optional(t.number, 0),
totalPages: t.optional(t.number, 0),
})