@hy-capital/api-habit-tracker-types 1.0.33 → 1.0.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,13 @@
1
1
  import { DbUser } from './user';
2
2
  import { DbUserTopic } from './user-topic';
3
+ import { DbHabit } from './habit';
3
4
  export interface FrontendUser {
4
5
  user: DbUser;
5
6
  user_topics: DbUserTopic[];
6
7
  }
8
+ export interface UserStats {
9
+ hasBeenMemberForDays: number;
10
+ favoriteHabit: DbHabit | null;
11
+ longestStreak: number;
12
+ totalHabitsCompleted: number;
13
+ }
package/dist/habit.d.ts CHANGED
@@ -4,6 +4,8 @@ export type HabitDifficulty = 1 | 2 | 3;
4
4
  export type HabitFrequency = 'Daily' | 'Monthly';
5
5
  export type HabitDay = 'Monday' | 'Tuesday' | 'Wednesday' | 'Thursday' | 'Friday' | 'Saturday' | 'Sunday';
6
6
  export declare const allHabitDays: HabitDay[];
7
+ export declare const habitDayToNumberMappings: Record<HabitDay, number>;
8
+ export declare const numberToHabitDayMappings: Record<number, HabitDay>;
7
9
  export interface HabitType {
8
10
  name: string;
9
11
  habitTime: HabitTime;
@@ -18,6 +20,7 @@ export interface BaseHabit {
18
20
  name: string;
19
21
  topic_type: TopicType;
20
22
  done_days: string[];
23
+ missed_days: string[];
21
24
  start_time: string;
22
25
  habit_time: HabitTime;
23
26
  difficulty: HabitDifficulty;
package/dist/habit.js CHANGED
@@ -1,4 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.allHabitDays = void 0;
3
+ exports.numberToHabitDayMappings = exports.habitDayToNumberMappings = exports.allHabitDays = void 0;
4
4
  exports.allHabitDays = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
5
+ exports.habitDayToNumberMappings = {
6
+ 'Monday': 1,
7
+ 'Tuesday': 2,
8
+ 'Wednesday': 3,
9
+ 'Thursday': 4,
10
+ 'Friday': 5,
11
+ 'Saturday': 6,
12
+ 'Sunday': 0
13
+ };
14
+ exports.numberToHabitDayMappings = {
15
+ 1: 'Monday',
16
+ 2: 'Tuesday',
17
+ 3: 'Wednesday',
18
+ 4: 'Thursday',
19
+ 5: 'Friday',
20
+ 6: 'Saturday',
21
+ 0: 'Sunday'
22
+ };
@@ -0,0 +1,7 @@
1
+ import { DbHabit } from './habit';
2
+ export interface UserStats {
3
+ hasBeenMemberForDays: number;
4
+ favoriteHabit: DbHabit | null;
5
+ longestStreak: number;
6
+ totalHabitsCompleted: number;
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/user.d.ts CHANGED
@@ -4,6 +4,7 @@ export interface DbUser {
4
4
  email: string;
5
5
  clerk_id: string;
6
6
  is_onboarding_done: boolean;
7
+ timezone: string;
7
8
  expo_push_token: string;
8
9
  created_at: string;
9
10
  updated_at: string;
@@ -12,13 +13,16 @@ export type InputUser = Omit<DbUser, 'id' | 'name' | 'is_onboarding_done' | 'exp
12
13
  export interface CreateUserRequest {
13
14
  email: string;
14
15
  clerk_id: string;
16
+ timezone: string;
15
17
  }
16
18
  export interface UpsertUserRequest {
17
19
  email: string;
18
20
  clerk_id: string;
21
+ timezone: string;
19
22
  }
20
23
  export interface UpdateUserRequest {
21
24
  clerk_id: string;
22
25
  name?: string;
23
26
  is_onboarding_done?: boolean;
27
+ expo_push_token?: string;
24
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hy-capital/api-habit-tracker-types",
3
- "version": "1.0.33",
3
+ "version": "1.0.37",
4
4
  "main": "dist/index.js",
5
5
  "license": "MIT",
6
6
  "types": "dist/index.d.ts",
@@ -1,7 +1,16 @@
1
1
  import {DbUser} from './user';
2
2
  import {DbUserTopic} from './user-topic';
3
+ import {DbHabit} from './habit';
3
4
 
4
5
  export interface FrontendUser {
5
6
  user: DbUser;
6
7
  user_topics: DbUserTopic[];
8
+ // user_stats: UserStats;
7
9
  }
10
+
11
+ export interface UserStats {
12
+ hasBeenMemberForDays: number;
13
+ favoriteHabit: DbHabit | null;
14
+ longestStreak: number;
15
+ totalHabitsCompleted: number;
16
+ }
package/src/habit.ts CHANGED
@@ -5,6 +5,25 @@ export type HabitDifficulty = 1 | 2 | 3;
5
5
  export type HabitFrequency = 'Daily' | 'Monthly';
6
6
  export type HabitDay = 'Monday' | 'Tuesday' | 'Wednesday' | 'Thursday' | 'Friday' | 'Saturday' | 'Sunday';
7
7
  export const allHabitDays: HabitDay[] = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
8
+ export const habitDayToNumberMappings: Record<HabitDay, number> = {
9
+ 'Monday': 1,
10
+ 'Tuesday': 2,
11
+ 'Wednesday': 3,
12
+ 'Thursday': 4,
13
+ 'Friday': 5,
14
+ 'Saturday': 6,
15
+ 'Sunday': 0
16
+ };
17
+
18
+ export const numberToHabitDayMappings: Record<number, HabitDay> = {
19
+ 1: 'Monday',
20
+ 2: 'Tuesday',
21
+ 3: 'Wednesday',
22
+ 4: 'Thursday',
23
+ 5: 'Friday',
24
+ 6: 'Saturday',
25
+ 0: 'Sunday'
26
+ };
8
27
 
9
28
  export interface HabitType {
10
29
  name: string;
@@ -21,6 +40,7 @@ export interface BaseHabit {
21
40
  name: string;
22
41
  topic_type: TopicType;
23
42
  done_days: string[];
43
+ missed_days: string[];
24
44
  start_time: string;
25
45
  habit_time: HabitTime;
26
46
  difficulty: HabitDifficulty;
@@ -0,0 +1,8 @@
1
+ import {DbHabit} from './habit';
2
+
3
+ export interface UserStats {
4
+ hasBeenMemberForDays: number;
5
+ favoriteHabit: DbHabit | null;
6
+ longestStreak: number;
7
+ totalHabitsCompleted: number;
8
+ }
package/src/user.ts CHANGED
@@ -4,6 +4,7 @@ export interface DbUser {
4
4
  email: string;
5
5
  clerk_id: string;
6
6
  is_onboarding_done: boolean;
7
+ timezone: string;
7
8
  expo_push_token: string;
8
9
  created_at: string;
9
10
  updated_at: string;
@@ -14,15 +15,18 @@ export type InputUser = Omit<DbUser, 'id' | 'name' | 'is_onboarding_done' | 'exp
14
15
  export interface CreateUserRequest {
15
16
  email: string;
16
17
  clerk_id: string;
18
+ timezone: string;
17
19
  }
18
20
 
19
21
  export interface UpsertUserRequest {
20
22
  email: string;
21
23
  clerk_id: string;
24
+ timezone: string;
22
25
  }
23
26
 
24
27
  export interface UpdateUserRequest {
25
28
  clerk_id: string;
26
29
  name?: string;
27
30
  is_onboarding_done?: boolean;
31
+ expo_push_token?: string;
28
32
  }