@hy-capital/api-habit-tracker-types 1.0.39 → 1.0.40

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,13 +1,6 @@
1
1
  import { DbUser } from './user';
2
- import { DbHabit } from './habit';
3
2
  import { DbUserRating } from './user-rating';
4
3
  export interface FrontendUser {
5
4
  user: DbUser;
6
5
  user_rating: DbUserRating | null;
7
6
  }
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,7 @@ 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 habitDateFormat = "DD-MM-YYYY";
7
8
  export declare const habitDayToNumberMappings: Record<HabitDay, number>;
8
9
  export declare const numberToHabitDayMappings: Record<number, HabitDay>;
9
10
  export interface HabitType {
@@ -57,3 +58,18 @@ export interface DbHabit extends BaseHabit {
57
58
  created_at: string;
58
59
  updated_at: string;
59
60
  }
61
+ export interface HabitStats {
62
+ mostMasteredHabit: {
63
+ habit: DbHabit | null;
64
+ count: number;
65
+ };
66
+ longestStreak: {
67
+ habit: DbHabit | null;
68
+ streak: number;
69
+ };
70
+ totalHabitsCompleted: number;
71
+ }
72
+ export interface HabitsResponse {
73
+ habits: DbHabit[];
74
+ stats: HabitStats;
75
+ }
package/dist/habit.js CHANGED
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.numberToHabitDayMappings = exports.habitDayToNumberMappings = exports.allHabitDays = void 0;
3
+ exports.numberToHabitDayMappings = exports.habitDayToNumberMappings = exports.habitDateFormat = exports.allHabitDays = void 0;
4
4
  exports.allHabitDays = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
5
+ exports.habitDateFormat = 'DD-MM-YYYY';
5
6
  exports.habitDayToNumberMappings = {
6
7
  'Monday': 1,
7
8
  'Tuesday': 2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hy-capital/api-habit-tracker-types",
3
- "version": "1.0.39",
3
+ "version": "1.0.40",
4
4
  "main": "dist/index.js",
5
5
  "license": "MIT",
6
6
  "types": "dist/index.d.ts",
@@ -1,16 +1,7 @@
1
1
  import {DbUser} from './user';
2
- import {DbHabit} from './habit';
3
2
  import {DbUserRating} from './user-rating';
4
3
 
5
4
  export interface FrontendUser {
6
5
  user: DbUser;
7
6
  user_rating: DbUserRating | null;
8
- // user_stats: UserStats;
9
7
  }
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,9 @@ 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
+
9
+ export const habitDateFormat = 'DD-MM-YYYY';
10
+
8
11
  export const habitDayToNumberMappings: Record<HabitDay, number> = {
9
12
  'Monday': 1,
10
13
  'Tuesday': 2,
@@ -81,4 +84,21 @@ export interface DbHabit extends BaseHabit {
81
84
  id: number;
82
85
  created_at: string
83
86
  updated_at: string
87
+ }
88
+
89
+ export interface HabitStats {
90
+ mostMasteredHabit: {
91
+ habit: DbHabit | null,
92
+ count: number
93
+ };
94
+ longestStreak: {
95
+ habit: DbHabit | null,
96
+ streak: number
97
+ };
98
+ totalHabitsCompleted: number;
99
+ }
100
+
101
+ export interface HabitsResponse {
102
+ habits: DbHabit[];
103
+ stats: HabitStats;
84
104
  }