-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtypes.ts
More file actions
76 lines (68 loc) · 1.6 KB
/
types.ts
File metadata and controls
76 lines (68 loc) · 1.6 KB
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
import db from "./db";
/** APICase is the case structure from the API. */
export type APICase = {
/** Extra properties from custom cases */
extra?: {
// Case gold chance (0-1)
gold_chance?: number;
// Whether or not the case should not give StatTraks
disable_stattraks?: boolean;
};
id: string;
type: string | null;
first_sale_date: string | null;
name: string;
description: string | null;
image: string;
contains: APIItem[];
contains_rare: APIItem[];
loot_list: {
name: string;
footer: string;
image: string;
} | null;
};
/** ItemType is the item structure from the API. */
export type APIItem = {
id: string;
name: string;
rarity: {
id: string;
name: string;
color: string;
};
phase?: string | null;
image: string;
};
/** IndexedDBItem is the item structure saved to IndexedDB. */
export type IndexedDBItem = {
id: string;
name: string;
rarity: string;
phase: string | null;
};
/** GradeType is the possible item rarities. */
export type ItemGrade =
| "Consumer Grade"
| "Industrial Grade"
| "Mil-Spec Grade"
| "Restricted"
| "Classified"
| "Covert"
| "Rare Special Item";
/** CasePickerCase is the APICase data being passed to the case picker */
export type CasePickerCase = Pick<
APICase,
"id" | "name" | "description" | "image" | "first_sale_date"
>;
// DB types
const query = db.query.unboxes.findMany({
with: {
item: true,
case: true,
},
});
/** UnboxWithAllRelations is the unbox item with all relations loaded. */
export type UnboxWithAllRelations = Awaited<
ReturnType<(typeof query)["execute"]>
>[number];