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.ts45
1 files changed, 39 insertions, 6 deletions
diff --git a/fe/src/types.ts b/fe/src/types.ts
index 526e7eb..c8f2f00 100644
--- a/fe/src/types.ts
+++ b/fe/src/types.ts
@@ -1,14 +1,19 @@
1export interface Size { 1import type { Invalidator, Subscriber, Unsubscriber, Updater } from "svelte/store";
2 size: number;
3 unit: string;
4}
5 2
6export interface Preference { 3export interface Preference {
4 id: number;
7 color: string; 5 color: string;
8 size: Size; 6 size_id: number;
7 user_id: number;
8}
9
10export interface Size {
11 size: number;
12 unit: string;
9} 13}
10 14
11export interface User { 15export interface User {
16 id: number;
12 name: string; 17 name: string;
13 uuid: string; 18 uuid: string;
14} 19}
@@ -17,4 +22,32 @@ export interface Statistic {
17 user_id: string; 22 user_id: string;
18 date: string; 23 date: string;
19 quantity: number; 24 quantity: number;
20} \ No newline at end of file 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}