forked from paularmstrong/normalizr
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.js
More file actions
33 lines (27 loc) · 670 Bytes
/
schema.js
File metadata and controls
33 lines (27 loc) · 670 Bytes
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
import { schema } from '../../src';
export const user = new schema.Entity('users');
export const label = new schema.Entity('labels');
export const milestone = new schema.Entity('milestones', {
creator: user
});
export const issue = new schema.Entity('issues', {
assignee: user,
assignees: [user],
labels: label,
milestone,
user
});
export const pullRequest = new schema.Entity('pullRequests', {
assignee: user,
assignees: [user],
labels: label,
milestone,
user
});
export const issueOrPullRequest = new schema.Array(
{
issues: issue,
pullRequests: pullRequest
},
(entity) => (entity.pull_request ? 'pullRequests' : 'issues')
);