aboutsummaryrefslogtreecommitdiff
path: root/fe/src/types.ts
diff options
context:
space:
mode:
Diffstat (limited to 'fe/src/types.ts')
-rw-r--r--fe/src/types.ts53
1 files changed, 53 insertions, 0 deletions
diff --git a/fe/src/types.ts b/fe/src/types.ts
new file mode 100644
index 0000000..c8f2f00
--- /dev/null
+++ b/fe/src/types.ts
@@ -0,0 +1,53 @@
1import type { Invalidator, Subscriber, Unsubscriber, Updater } from "svelte/store";
2
3export interface Preference {
4 id: number;
5 color: string;
6 size_id: number;
7 user_id: number;
8}
9
10export interface Size {
11 size: number;
12 unit: string;
13}
14
15export interface User {
16 id: number;
17 name: string;
18 uuid: string;
19}
20
21export interface Statistic {
22 user_id: string;
23 date: string;
24 quantity: number;
25}
26
27export type Nullable<T> = T | null;
28
29export interface User {
30 uuid: string;
31 username: string;
32}
33
34export interface TokenStore {
35 subscribe: (run: Subscriber<Nullable<string>>, invalidate?: Invalidator<Nullable<string>>) => Unsubscriber,
36 authenticate: (newToken: string) => void,
37 unauthenticate: () => void
38}
39
40
41export interface UserStore {
42 subscribe: (run: Subscriber<Nullable<User>>, invalidate?: Invalidator<Nullable<User>>) => Unsubscriber,
43 setUser: (user: User) => void,
44 reset: () => void
45}
46
47export interface PreferenceStore {
48 set: (this: void, value: Preference) => void;
49 subscribe: (this: void, run: Subscriber<Nullable<Preference>>, invalidate?: Invalidator<Nullable<Preference>>) => Unsubscriber;
50 reset: () => void;
51 update: (this: void, updater: Updater<Nullable<Preference>>) => void;
52 setPreference: (user: Preference) => void;
53}