-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.d.ts
107 lines (94 loc) · 2.13 KB
/
types.d.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
export interface FeathersRecord {
id: number;
createdAt: string;
updatedAt: string;
}
export interface FeathersQueryParams<ServiceType> {
$limit?: number;
$skip?: number;
$sort?: {
[key in keyof Partial<ServiceType>]: 1 | -1;
};
}
export type FeathersFieldParam =
| number
| string
| boolean
| { $in: number[] }
| { $nin: number[] }
| { $lt: number | string }
| { $lte: number | string }
| { $gt: number | string }
| { $gte: number | string }
| { $ne: number | string }
| { $or: any[] };
export type FeathersFieldParams<ServiceType> = Partial<
Record<keyof ServiceType, FeathersFieldParam>
>;
/** Defines how we can query a record with Feathers, via:
* Overall query params like $sort
* Individual field params like $in
* */
export type QueryParams<ServiceType> = FeathersQueryParam<ServiceType> &
FeathersFieldParam<ServiceType>;
export interface FindResult<ServiceType> {
limit: number;
skip: number;
total: number;
items: ServiceType[];
}
export interface InfiniteQueryResult<ServiceType> {
pages: FindResult<ServiceType>[];
pageParams: number[];
}
export interface User {
id: number;
email: string;
password?: string;
googleId?: string;
profilePicture?: string;
facebookId?: string;
discogsId?: number;
}
export interface VinylRecord extends FeathersRecord {
artist: string;
name: string;
year: number | string;
smallImageUrl: string;
largeImageUrl: string;
discogsMasterId?: number;
genres: string[];
tracks?: Track[];
}
export interface UserRecord extends FeathersRecord {
recordId: number;
userId: number;
action: string;
mediaCondition: string;
// optional properties
source?: string;
notes?: string;
color?: string;
price?: number;
record?: Record;
user?: User;
bins?: Bin[];
}
export interface Bin extends FeathersRecord {
name: string;
order: number;
featuredRecordId?: number;
featuredRecord?: Record;
userId: number;
recentlyAddedRecords?: Record[];
numRecords: number;
}
interface SvgProps {
color?: string;
}
interface Track extends FeathersRecord {
name: string;
recordId: number;
duration: string;
position: string;
}