-
Notifications
You must be signed in to change notification settings - Fork 1
/
types.ts
55 lines (47 loc) · 1.31 KB
/
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Note: Most interfaces below are prefixed with a "G" to distinguish them from
// the types representing the server data.
//
// The letter "G" has been chosen because the store represents a graph.
import {
RespondentDemographic,
Question,
Answer,
Filter,
Option,
} from "@/types";
export interface GOption extends Option {
id: string;
isActive: boolean;
edgesRespondent: Set<string>;
filterId: string;
}
export interface GRespondentDemographic extends RespondentDemographic {
id: string;
edgesAnswer: Set<string>;
[k: string]: string | Set<string>;
}
export interface GQuestion extends Pick<Question, "title" | "question_type"> {
id: string;
edgesAnswer: Set<string>;
edgesRespondent: Set<string>;
}
export interface GAnswer extends Pick<Answer, "text"> {
id: string;
edgesRespondent: Set<string>;
}
export interface GFilter extends Pick<Filter, "name" | "display"> {
id: string;
edgesOption: Set<string>;
edgesRespondent: Set<string>;
}
export type Listener = () => void;
export type Unsubscribe = () => void;
export interface GStore {
subscribe(l: Listener): Unsubscribe;
hasChanged(): void;
Options: Map<string, GOption>;
Respondents: Map<string, GRespondentDemographic>;
Questions: Map<string, GQuestion>;
Answers: Map<string, GAnswer>;
Filters: Map<string, GFilter>;
}