@hy-capital/api-habit-tracker-types 1.0.12 → 1.0.13
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/constant.d.ts +3 -0
- package/dist/constant.js +262 -0
- package/dist/habit.d.ts +22 -0
- package/dist/habit.js +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/user-stat.d.ts +5 -9
- package/package.json +1 -1
- package/src/constant.ts +262 -0
- package/src/habit.ts +31 -0
- package/src/index.ts +3 -1
- package/src/user-stat.ts +7 -10
package/dist/constant.js
ADDED
@@ -0,0 +1,262 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.habitTypesByStatType = void 0;
|
4
|
+
exports.habitTypesByStatType = {
|
5
|
+
'Calmness': [
|
6
|
+
{
|
7
|
+
name: 'Daily meditation',
|
8
|
+
description: 'Practice mindfulness meditation for 10-15 minutes daily',
|
9
|
+
difficulty: 2,
|
10
|
+
statType: 'Calmness',
|
11
|
+
habitTime: 'Morning'
|
12
|
+
},
|
13
|
+
{
|
14
|
+
name: 'Deep breathing exercises',
|
15
|
+
description: 'Engage in deep breathing exercises to reduce stress and promote relaxation',
|
16
|
+
difficulty: 1,
|
17
|
+
statType: 'Calmness',
|
18
|
+
habitTime: 'Anytime'
|
19
|
+
},
|
20
|
+
{
|
21
|
+
name: 'Digital detox',
|
22
|
+
description: 'Take a break from digital devices for 1 hour daily',
|
23
|
+
difficulty: 2,
|
24
|
+
statType: 'Calmness',
|
25
|
+
habitTime: 'Evening'
|
26
|
+
},
|
27
|
+
{
|
28
|
+
name: 'Journaling',
|
29
|
+
description: 'Write down thoughts and feelings to gain clarity and reduce anxiety',
|
30
|
+
difficulty: 1,
|
31
|
+
statType: 'Calmness',
|
32
|
+
habitTime: 'Evening'
|
33
|
+
}
|
34
|
+
],
|
35
|
+
'Diet': [
|
36
|
+
{
|
37
|
+
name: 'Eat a healthy breakfast',
|
38
|
+
description: 'Include fruits, whole grains, and protein in your morning meal',
|
39
|
+
difficulty: 1,
|
40
|
+
statType: 'Diet',
|
41
|
+
habitTime: 'Morning'
|
42
|
+
},
|
43
|
+
{
|
44
|
+
name: 'Meal prep',
|
45
|
+
description: 'Plan and prepare meals for the week to ensure balanced nutrition',
|
46
|
+
difficulty: 2,
|
47
|
+
statType: 'Diet',
|
48
|
+
habitTime: 'Anytime'
|
49
|
+
},
|
50
|
+
{
|
51
|
+
name: 'Hydration habit',
|
52
|
+
description: 'Drink a glass of water first thing in the morning',
|
53
|
+
difficulty: 1,
|
54
|
+
statType: 'Diet',
|
55
|
+
habitTime: 'Morning'
|
56
|
+
},
|
57
|
+
{
|
58
|
+
name: 'Reduce sugar intake',
|
59
|
+
description: 'Limit sugary snacks and beverages',
|
60
|
+
difficulty: 2,
|
61
|
+
statType: 'Diet',
|
62
|
+
habitTime: 'Anytime'
|
63
|
+
}
|
64
|
+
],
|
65
|
+
'Exercise': [
|
66
|
+
{
|
67
|
+
name: 'Daily walk',
|
68
|
+
description: 'Go for a 30-minute brisk walk every day',
|
69
|
+
difficulty: 2,
|
70
|
+
statType: 'Exercise',
|
71
|
+
habitTime: 'Morning'
|
72
|
+
},
|
73
|
+
{
|
74
|
+
name: 'Stretching routine',
|
75
|
+
description: 'Perform a 10-minute stretching routine to improve flexibility',
|
76
|
+
difficulty: 1,
|
77
|
+
statType: 'Exercise',
|
78
|
+
habitTime: 'Evening'
|
79
|
+
},
|
80
|
+
{
|
81
|
+
name: 'Strength training',
|
82
|
+
description: 'Do strength training exercises 2-3 times per week',
|
83
|
+
difficulty: 3,
|
84
|
+
statType: 'Exercise',
|
85
|
+
habitTime: 'Morning'
|
86
|
+
},
|
87
|
+
{
|
88
|
+
name: 'Active breaks',
|
89
|
+
description: 'Take 5-minute active breaks every hour during work',
|
90
|
+
difficulty: 1,
|
91
|
+
statType: 'Exercise',
|
92
|
+
habitTime: 'Anytime'
|
93
|
+
}
|
94
|
+
],
|
95
|
+
'Productivity': [
|
96
|
+
{
|
97
|
+
name: 'Prioritize tasks',
|
98
|
+
description: 'Write a to-do list and rank tasks by priority',
|
99
|
+
difficulty: 1,
|
100
|
+
statType: 'Productivity',
|
101
|
+
habitTime: 'Morning'
|
102
|
+
},
|
103
|
+
{
|
104
|
+
name: 'Pomodoro technique',
|
105
|
+
description: 'Work in focused 25-minute intervals followed by short breaks',
|
106
|
+
difficulty: 2,
|
107
|
+
statType: 'Productivity',
|
108
|
+
habitTime: 'Anytime'
|
109
|
+
},
|
110
|
+
{
|
111
|
+
name: 'Declutter workspace',
|
112
|
+
description: 'Spend 5 minutes tidying up your workspace daily',
|
113
|
+
difficulty: 1,
|
114
|
+
statType: 'Productivity',
|
115
|
+
habitTime: 'Evening'
|
116
|
+
},
|
117
|
+
{
|
118
|
+
name: 'Limit multitasking',
|
119
|
+
description: 'Focus on one task at a time for better efficiency',
|
120
|
+
difficulty: 2,
|
121
|
+
statType: 'Productivity',
|
122
|
+
habitTime: 'Anytime'
|
123
|
+
}
|
124
|
+
],
|
125
|
+
'Public speaking': [
|
126
|
+
{
|
127
|
+
name: 'Practice speeches',
|
128
|
+
description: 'Spend 10 minutes daily practicing a prepared speech',
|
129
|
+
difficulty: 2,
|
130
|
+
statType: 'Public speaking',
|
131
|
+
habitTime: 'Morning'
|
132
|
+
},
|
133
|
+
{
|
134
|
+
name: 'Mirror practice',
|
135
|
+
description: 'Practice speaking in front of a mirror to improve confidence',
|
136
|
+
difficulty: 1,
|
137
|
+
statType: 'Public speaking',
|
138
|
+
habitTime: 'Evening'
|
139
|
+
},
|
140
|
+
{
|
141
|
+
name: 'Record and review',
|
142
|
+
description: 'Record yourself speaking and review for areas of improvement',
|
143
|
+
difficulty: 2,
|
144
|
+
statType: 'Public speaking',
|
145
|
+
habitTime: 'Anytime'
|
146
|
+
},
|
147
|
+
{
|
148
|
+
name: 'Learn storytelling',
|
149
|
+
description: 'Read about storytelling techniques to make presentations engaging',
|
150
|
+
difficulty: 1,
|
151
|
+
statType: 'Public speaking',
|
152
|
+
habitTime: 'Anytime'
|
153
|
+
}
|
154
|
+
],
|
155
|
+
'Sleep': [
|
156
|
+
{
|
157
|
+
name: 'No screens before bed',
|
158
|
+
description: 'Avoid phones, tablets, and computers 1-2 hours before bedtime to reduce blue light exposure',
|
159
|
+
difficulty: 3,
|
160
|
+
statType: 'Sleep',
|
161
|
+
habitTime: 'Evening'
|
162
|
+
},
|
163
|
+
{
|
164
|
+
name: 'Consistent sleep schedule',
|
165
|
+
description: 'Go to bed and wake up at the same time every day, even on weekends',
|
166
|
+
difficulty: 2,
|
167
|
+
statType: 'Sleep',
|
168
|
+
habitTime: 'Evening'
|
169
|
+
},
|
170
|
+
{
|
171
|
+
name: 'Dark bedroom environment',
|
172
|
+
description: 'Use blackout curtains or an eye mask to create complete darkness',
|
173
|
+
difficulty: 1,
|
174
|
+
statType: 'Sleep',
|
175
|
+
habitTime: 'Evening'
|
176
|
+
},
|
177
|
+
{
|
178
|
+
name: 'Cool room temperature',
|
179
|
+
description: 'Maintain bedroom temperature between 60-67°F (15-19°C)',
|
180
|
+
difficulty: 1,
|
181
|
+
statType: 'Sleep',
|
182
|
+
habitTime: 'Evening'
|
183
|
+
},
|
184
|
+
{
|
185
|
+
name: 'No caffeine after 2pm',
|
186
|
+
description: 'Avoid coffee, tea, and other caffeinated beverages in the afternoon',
|
187
|
+
difficulty: 2,
|
188
|
+
statType: 'Sleep',
|
189
|
+
habitTime: 'Evening'
|
190
|
+
},
|
191
|
+
{
|
192
|
+
name: 'No large meals before bed',
|
193
|
+
description: 'Avoid heavy meals within 3 hours of bedtime',
|
194
|
+
difficulty: 2,
|
195
|
+
statType: 'Sleep',
|
196
|
+
habitTime: 'Evening'
|
197
|
+
},
|
198
|
+
{
|
199
|
+
name: 'Regular exercise',
|
200
|
+
description: 'Exercise regularly but not within 2 hours of bedtime',
|
201
|
+
difficulty: 2,
|
202
|
+
statType: 'Sleep',
|
203
|
+
habitTime: 'Evening'
|
204
|
+
},
|
205
|
+
{
|
206
|
+
name: 'Relaxation routine',
|
207
|
+
description: 'Practice relaxation techniques like deep breathing, meditation, or gentle stretching',
|
208
|
+
difficulty: 1,
|
209
|
+
statType: 'Sleep',
|
210
|
+
habitTime: 'Evening'
|
211
|
+
},
|
212
|
+
{
|
213
|
+
name: 'Comfortable bedding',
|
214
|
+
description: 'Use comfortable, breathable bedding and a supportive mattress/pillow',
|
215
|
+
difficulty: 1,
|
216
|
+
statType: 'Sleep',
|
217
|
+
habitTime: 'Evening'
|
218
|
+
},
|
219
|
+
{
|
220
|
+
name: 'White noise',
|
221
|
+
description: 'Use a white noise machine or fan to mask disruptive sounds',
|
222
|
+
difficulty: 1,
|
223
|
+
statType: 'Sleep',
|
224
|
+
habitTime: 'Evening'
|
225
|
+
},
|
226
|
+
{
|
227
|
+
name: 'No alcohol before bed',
|
228
|
+
description: 'Avoid alcohol within 4 hours of bedtime',
|
229
|
+
difficulty: 2,
|
230
|
+
statType: 'Sleep',
|
231
|
+
habitTime: 'Evening'
|
232
|
+
},
|
233
|
+
{
|
234
|
+
name: 'Sunlight exposure',
|
235
|
+
description: 'Get natural sunlight during the day to regulate circadian rhythm',
|
236
|
+
difficulty: 1,
|
237
|
+
statType: 'Sleep',
|
238
|
+
habitTime: 'Evening'
|
239
|
+
},
|
240
|
+
{
|
241
|
+
name: 'Bedroom for sleep only',
|
242
|
+
description: 'Use bedroom only for sleep and intimacy, not for work or entertainment',
|
243
|
+
difficulty: 2,
|
244
|
+
statType: 'Sleep',
|
245
|
+
habitTime: 'Evening'
|
246
|
+
},
|
247
|
+
{
|
248
|
+
name: 'No clock watching',
|
249
|
+
description: 'Turn clock face away and avoid checking time during the night',
|
250
|
+
difficulty: 2,
|
251
|
+
statType: 'Sleep',
|
252
|
+
habitTime: 'Evening'
|
253
|
+
},
|
254
|
+
{
|
255
|
+
name: 'Relaxing bedtime reading',
|
256
|
+
description: 'Read a physical book (not e-reader) with calm content before bed',
|
257
|
+
difficulty: 1,
|
258
|
+
statType: 'Sleep',
|
259
|
+
habitTime: 'Evening'
|
260
|
+
}
|
261
|
+
]
|
262
|
+
};
|
package/dist/habit.d.ts
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
import { StatType } from './user-stat';
|
2
|
+
export type HabitTime = 'Morning' | 'Afternoon' | 'Evening' | 'Anytime';
|
3
|
+
export type HabitDifficulty = 1 | 2 | 3;
|
4
|
+
export interface HabitType {
|
5
|
+
name: string;
|
6
|
+
habitTime: HabitTime;
|
7
|
+
statType: StatType;
|
8
|
+
difficulty: HabitDifficulty;
|
9
|
+
description: string;
|
10
|
+
}
|
11
|
+
export interface BaseHabit {
|
12
|
+
user_id: number;
|
13
|
+
name: string;
|
14
|
+
stat_type: StatType;
|
15
|
+
done_days: string[];
|
16
|
+
start_time: string;
|
17
|
+
}
|
18
|
+
export interface DbHabit extends BaseHabit {
|
19
|
+
id: number;
|
20
|
+
created_at: string;
|
21
|
+
updated_at: string;
|
22
|
+
}
|
package/dist/habit.js
ADDED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
@@ -17,3 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./user"), exports);
|
18
18
|
__exportStar(require("./user-stat"), exports);
|
19
19
|
__exportStar(require("./frontend-user"), exports);
|
20
|
+
__exportStar(require("./constant"), exports);
|
21
|
+
__exportStar(require("./habit"), exports);
|
package/dist/user-stat.d.ts
CHANGED
@@ -1,17 +1,13 @@
|
|
1
|
-
export type StatType = '
|
2
|
-
export interface
|
1
|
+
export type StatType = 'Calmness' | 'Diet' | 'Exercise' | 'Productivity' | 'Public speaking' | 'Sleep';
|
2
|
+
export interface BaseUserStat {
|
3
3
|
user_id: number;
|
4
4
|
type: StatType;
|
5
5
|
initial_score: number;
|
6
6
|
current_score: number;
|
7
7
|
potential_score: number;
|
8
|
+
}
|
9
|
+
export interface DbUserStat extends BaseUserStat {
|
10
|
+
id: number;
|
8
11
|
created_at: string;
|
9
12
|
updated_at: string;
|
10
13
|
}
|
11
|
-
export interface UpsertUserStatRequest {
|
12
|
-
user_id: number;
|
13
|
-
type: StatType;
|
14
|
-
initial_score: number;
|
15
|
-
current_score: number;
|
16
|
-
potential_score: number;
|
17
|
-
}
|
package/package.json
CHANGED
package/src/constant.ts
ADDED
@@ -0,0 +1,262 @@
|
|
1
|
+
import {StatType} from './user-stat';
|
2
|
+
import {HabitType} from './habit';
|
3
|
+
|
4
|
+
export const habitTypesByStatType: Record<StatType, HabitType[]> = {
|
5
|
+
'Calmness': [
|
6
|
+
{
|
7
|
+
name: 'Daily meditation',
|
8
|
+
description: 'Practice mindfulness meditation for 10-15 minutes daily',
|
9
|
+
difficulty: 2,
|
10
|
+
statType: 'Calmness',
|
11
|
+
habitTime: 'Morning'
|
12
|
+
},
|
13
|
+
{
|
14
|
+
name: 'Deep breathing exercises',
|
15
|
+
description: 'Engage in deep breathing exercises to reduce stress and promote relaxation',
|
16
|
+
difficulty: 1,
|
17
|
+
statType: 'Calmness',
|
18
|
+
habitTime: 'Anytime'
|
19
|
+
},
|
20
|
+
{
|
21
|
+
name: 'Digital detox',
|
22
|
+
description: 'Take a break from digital devices for 1 hour daily',
|
23
|
+
difficulty: 2,
|
24
|
+
statType: 'Calmness',
|
25
|
+
habitTime: 'Evening'
|
26
|
+
},
|
27
|
+
{
|
28
|
+
name: 'Journaling',
|
29
|
+
description: 'Write down thoughts and feelings to gain clarity and reduce anxiety',
|
30
|
+
difficulty: 1,
|
31
|
+
statType: 'Calmness',
|
32
|
+
habitTime: 'Evening'
|
33
|
+
}
|
34
|
+
],
|
35
|
+
'Diet': [
|
36
|
+
{
|
37
|
+
name: 'Eat a healthy breakfast',
|
38
|
+
description: 'Include fruits, whole grains, and protein in your morning meal',
|
39
|
+
difficulty: 1,
|
40
|
+
statType: 'Diet',
|
41
|
+
habitTime: 'Morning'
|
42
|
+
},
|
43
|
+
{
|
44
|
+
name: 'Meal prep',
|
45
|
+
description: 'Plan and prepare meals for the week to ensure balanced nutrition',
|
46
|
+
difficulty: 2,
|
47
|
+
statType: 'Diet',
|
48
|
+
habitTime: 'Anytime'
|
49
|
+
},
|
50
|
+
{
|
51
|
+
name: 'Hydration habit',
|
52
|
+
description: 'Drink a glass of water first thing in the morning',
|
53
|
+
difficulty: 1,
|
54
|
+
statType: 'Diet',
|
55
|
+
habitTime: 'Morning'
|
56
|
+
},
|
57
|
+
{
|
58
|
+
name: 'Reduce sugar intake',
|
59
|
+
description: 'Limit sugary snacks and beverages',
|
60
|
+
difficulty: 2,
|
61
|
+
statType: 'Diet',
|
62
|
+
habitTime: 'Anytime'
|
63
|
+
}
|
64
|
+
],
|
65
|
+
'Exercise': [
|
66
|
+
{
|
67
|
+
name: 'Daily walk',
|
68
|
+
description: 'Go for a 30-minute brisk walk every day',
|
69
|
+
difficulty: 2,
|
70
|
+
statType: 'Exercise',
|
71
|
+
habitTime: 'Morning'
|
72
|
+
},
|
73
|
+
{
|
74
|
+
name: 'Stretching routine',
|
75
|
+
description: 'Perform a 10-minute stretching routine to improve flexibility',
|
76
|
+
difficulty: 1,
|
77
|
+
statType: 'Exercise',
|
78
|
+
habitTime: 'Evening'
|
79
|
+
},
|
80
|
+
{
|
81
|
+
name: 'Strength training',
|
82
|
+
description: 'Do strength training exercises 2-3 times per week',
|
83
|
+
difficulty: 3,
|
84
|
+
statType: 'Exercise',
|
85
|
+
habitTime: 'Morning'
|
86
|
+
},
|
87
|
+
{
|
88
|
+
name: 'Active breaks',
|
89
|
+
description: 'Take 5-minute active breaks every hour during work',
|
90
|
+
difficulty: 1,
|
91
|
+
statType: 'Exercise',
|
92
|
+
habitTime: 'Anytime'
|
93
|
+
}
|
94
|
+
],
|
95
|
+
'Productivity': [
|
96
|
+
{
|
97
|
+
name: 'Prioritize tasks',
|
98
|
+
description: 'Write a to-do list and rank tasks by priority',
|
99
|
+
difficulty: 1,
|
100
|
+
statType: 'Productivity',
|
101
|
+
habitTime: 'Morning'
|
102
|
+
},
|
103
|
+
{
|
104
|
+
name: 'Pomodoro technique',
|
105
|
+
description: 'Work in focused 25-minute intervals followed by short breaks',
|
106
|
+
difficulty: 2,
|
107
|
+
statType: 'Productivity',
|
108
|
+
habitTime: 'Anytime'
|
109
|
+
},
|
110
|
+
{
|
111
|
+
name: 'Declutter workspace',
|
112
|
+
description: 'Spend 5 minutes tidying up your workspace daily',
|
113
|
+
difficulty: 1,
|
114
|
+
statType: 'Productivity',
|
115
|
+
habitTime: 'Evening'
|
116
|
+
},
|
117
|
+
{
|
118
|
+
name: 'Limit multitasking',
|
119
|
+
description: 'Focus on one task at a time for better efficiency',
|
120
|
+
difficulty: 2,
|
121
|
+
statType: 'Productivity',
|
122
|
+
habitTime: 'Anytime'
|
123
|
+
}
|
124
|
+
],
|
125
|
+
'Public speaking': [
|
126
|
+
{
|
127
|
+
name: 'Practice speeches',
|
128
|
+
description: 'Spend 10 minutes daily practicing a prepared speech',
|
129
|
+
difficulty: 2,
|
130
|
+
statType: 'Public speaking',
|
131
|
+
habitTime: 'Morning'
|
132
|
+
},
|
133
|
+
{
|
134
|
+
name: 'Mirror practice',
|
135
|
+
description: 'Practice speaking in front of a mirror to improve confidence',
|
136
|
+
difficulty: 1,
|
137
|
+
statType: 'Public speaking',
|
138
|
+
habitTime: 'Evening'
|
139
|
+
},
|
140
|
+
{
|
141
|
+
name: 'Record and review',
|
142
|
+
description: 'Record yourself speaking and review for areas of improvement',
|
143
|
+
difficulty: 2,
|
144
|
+
statType: 'Public speaking',
|
145
|
+
habitTime: 'Anytime'
|
146
|
+
},
|
147
|
+
{
|
148
|
+
name: 'Learn storytelling',
|
149
|
+
description: 'Read about storytelling techniques to make presentations engaging',
|
150
|
+
difficulty: 1,
|
151
|
+
statType: 'Public speaking',
|
152
|
+
habitTime: 'Anytime'
|
153
|
+
}
|
154
|
+
],
|
155
|
+
'Sleep': [
|
156
|
+
{
|
157
|
+
name: 'No screens before bed',
|
158
|
+
description: 'Avoid phones, tablets, and computers 1-2 hours before bedtime to reduce blue light exposure',
|
159
|
+
difficulty: 3,
|
160
|
+
statType: 'Sleep',
|
161
|
+
habitTime: 'Evening'
|
162
|
+
},
|
163
|
+
{
|
164
|
+
name: 'Consistent sleep schedule',
|
165
|
+
description: 'Go to bed and wake up at the same time every day, even on weekends',
|
166
|
+
difficulty: 2,
|
167
|
+
statType: 'Sleep',
|
168
|
+
habitTime: 'Evening'
|
169
|
+
},
|
170
|
+
{
|
171
|
+
name: 'Dark bedroom environment',
|
172
|
+
description: 'Use blackout curtains or an eye mask to create complete darkness',
|
173
|
+
difficulty: 1,
|
174
|
+
statType: 'Sleep',
|
175
|
+
habitTime: 'Evening'
|
176
|
+
},
|
177
|
+
{
|
178
|
+
name: 'Cool room temperature',
|
179
|
+
description: 'Maintain bedroom temperature between 60-67°F (15-19°C)',
|
180
|
+
difficulty: 1,
|
181
|
+
statType: 'Sleep',
|
182
|
+
habitTime: 'Evening'
|
183
|
+
},
|
184
|
+
{
|
185
|
+
name: 'No caffeine after 2pm',
|
186
|
+
description: 'Avoid coffee, tea, and other caffeinated beverages in the afternoon',
|
187
|
+
difficulty: 2,
|
188
|
+
statType: 'Sleep',
|
189
|
+
habitTime: 'Evening'
|
190
|
+
},
|
191
|
+
{
|
192
|
+
name: 'No large meals before bed',
|
193
|
+
description: 'Avoid heavy meals within 3 hours of bedtime',
|
194
|
+
difficulty: 2,
|
195
|
+
statType: 'Sleep',
|
196
|
+
habitTime: 'Evening'
|
197
|
+
},
|
198
|
+
{
|
199
|
+
name: 'Regular exercise',
|
200
|
+
description: 'Exercise regularly but not within 2 hours of bedtime',
|
201
|
+
difficulty: 2,
|
202
|
+
statType: 'Sleep',
|
203
|
+
habitTime: 'Evening'
|
204
|
+
},
|
205
|
+
{
|
206
|
+
name: 'Relaxation routine',
|
207
|
+
description: 'Practice relaxation techniques like deep breathing, meditation, or gentle stretching',
|
208
|
+
difficulty: 1,
|
209
|
+
statType: 'Sleep',
|
210
|
+
habitTime: 'Evening'
|
211
|
+
},
|
212
|
+
{
|
213
|
+
name: 'Comfortable bedding',
|
214
|
+
description: 'Use comfortable, breathable bedding and a supportive mattress/pillow',
|
215
|
+
difficulty: 1,
|
216
|
+
statType: 'Sleep',
|
217
|
+
habitTime: 'Evening'
|
218
|
+
},
|
219
|
+
{
|
220
|
+
name: 'White noise',
|
221
|
+
description: 'Use a white noise machine or fan to mask disruptive sounds',
|
222
|
+
difficulty: 1,
|
223
|
+
statType: 'Sleep',
|
224
|
+
habitTime: 'Evening'
|
225
|
+
},
|
226
|
+
{
|
227
|
+
name: 'No alcohol before bed',
|
228
|
+
description: 'Avoid alcohol within 4 hours of bedtime',
|
229
|
+
difficulty: 2,
|
230
|
+
statType: 'Sleep',
|
231
|
+
habitTime: 'Evening'
|
232
|
+
},
|
233
|
+
{
|
234
|
+
name: 'Sunlight exposure',
|
235
|
+
description: 'Get natural sunlight during the day to regulate circadian rhythm',
|
236
|
+
difficulty: 1,
|
237
|
+
statType: 'Sleep',
|
238
|
+
habitTime: 'Evening'
|
239
|
+
},
|
240
|
+
{
|
241
|
+
name: 'Bedroom for sleep only',
|
242
|
+
description: 'Use bedroom only for sleep and intimacy, not for work or entertainment',
|
243
|
+
difficulty: 2,
|
244
|
+
statType: 'Sleep',
|
245
|
+
habitTime: 'Evening'
|
246
|
+
},
|
247
|
+
{
|
248
|
+
name: 'No clock watching',
|
249
|
+
description: 'Turn clock face away and avoid checking time during the night',
|
250
|
+
difficulty: 2,
|
251
|
+
statType: 'Sleep',
|
252
|
+
habitTime: 'Evening'
|
253
|
+
},
|
254
|
+
{
|
255
|
+
name: 'Relaxing bedtime reading',
|
256
|
+
description: 'Read a physical book (not e-reader) with calm content before bed',
|
257
|
+
difficulty: 1,
|
258
|
+
statType: 'Sleep',
|
259
|
+
habitTime: 'Evening'
|
260
|
+
}
|
261
|
+
]
|
262
|
+
};
|
package/src/habit.ts
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
import {StatType} from './user-stat';
|
2
|
+
|
3
|
+
export type HabitTime = 'Morning' | 'Afternoon' | 'Evening' | 'Anytime';
|
4
|
+
export type HabitDifficulty = 1 | 2 | 3;
|
5
|
+
|
6
|
+
export interface HabitType {
|
7
|
+
name: string;
|
8
|
+
habitTime: HabitTime;
|
9
|
+
statType: StatType;
|
10
|
+
difficulty: HabitDifficulty;
|
11
|
+
description: string;
|
12
|
+
}
|
13
|
+
|
14
|
+
export interface BaseHabit {
|
15
|
+
user_id: number;
|
16
|
+
name: string;
|
17
|
+
stat_type: StatType;
|
18
|
+
done_days: string[];
|
19
|
+
start_time: string
|
20
|
+
// inspo:
|
21
|
+
// after_i_do_something
|
22
|
+
// remind_me_at_time
|
23
|
+
// remind_me_at_location
|
24
|
+
// missed_days (not needed, you can derive it based on done days)
|
25
|
+
}
|
26
|
+
|
27
|
+
export interface DbHabit extends BaseHabit {
|
28
|
+
id: number;
|
29
|
+
created_at: string
|
30
|
+
updated_at: string
|
31
|
+
}
|
package/src/index.ts
CHANGED
package/src/user-stat.ts
CHANGED
@@ -1,19 +1,16 @@
|
|
1
|
-
export type StatType =
|
1
|
+
export type StatType =
|
2
|
+
'Calmness' | 'Diet' | 'Exercise' | 'Productivity' | 'Public speaking' | 'Sleep';
|
2
3
|
|
3
|
-
export interface
|
4
|
+
export interface BaseUserStat {
|
4
5
|
user_id: number;
|
5
6
|
type: StatType;
|
6
7
|
initial_score: number;
|
7
8
|
current_score: number;
|
8
9
|
potential_score: number;
|
9
|
-
created_at: string;
|
10
|
-
updated_at: string;
|
11
10
|
}
|
12
11
|
|
13
|
-
export interface
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
current_score: number;
|
18
|
-
potential_score: number;
|
12
|
+
export interface DbUserStat extends BaseUserStat {
|
13
|
+
id: number;
|
14
|
+
created_at: string;
|
15
|
+
updated_at: string;
|
19
16
|
}
|