@rimori/client 2.5.56-next.0 → 2.5.57-next.0
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.
|
@@ -59,7 +59,7 @@ type Result<T> = {
|
|
|
59
59
|
error: Error;
|
|
60
60
|
};
|
|
61
61
|
/**
|
|
62
|
-
* Controller for exercise-related operations: reading the
|
|
62
|
+
* Controller for exercise-related operations: reading the user's open exercises,
|
|
63
63
|
* creating them, and marking them complete.
|
|
64
64
|
*/
|
|
65
65
|
export declare class ExerciseModule {
|
|
@@ -86,8 +86,11 @@ export declare class ExerciseModule {
|
|
|
86
86
|
*/
|
|
87
87
|
whenIdle(): Promise<void>;
|
|
88
88
|
/**
|
|
89
|
-
* Reads the current user's open exercises from
|
|
90
|
-
* (`status = 'pending'`,
|
|
89
|
+
* Reads the current user's open exercises directly from `public.exercises`
|
|
90
|
+
* (`status = 'pending'`, `end_date` still in the future). Queries the table itself rather than
|
|
91
|
+
* the `weekly_exercises` view so callers see every open exercise, not just ones inside the
|
|
92
|
+
* current calendar week — a month-long exercise created last week would otherwise be invisible
|
|
93
|
+
* to a dedup check run today.
|
|
91
94
|
*/
|
|
92
95
|
view(): Promise<Result<ExerciseRow[]>>;
|
|
93
96
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Controller for exercise-related operations: reading the
|
|
2
|
+
* Controller for exercise-related operations: reading the user's open exercises,
|
|
3
3
|
* creating them, and marking them complete.
|
|
4
4
|
*/
|
|
5
5
|
export class ExerciseModule {
|
|
@@ -40,13 +40,21 @@ export class ExerciseModule {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
|
-
* Reads the current user's open exercises from
|
|
44
|
-
* (`status = 'pending'`,
|
|
43
|
+
* Reads the current user's open exercises directly from `public.exercises`
|
|
44
|
+
* (`status = 'pending'`, `end_date` still in the future). Queries the table itself rather than
|
|
45
|
+
* the `weekly_exercises` view so callers see every open exercise, not just ones inside the
|
|
46
|
+
* current calendar week — a month-long exercise created last week would otherwise be invisible
|
|
47
|
+
* to a dedup check run today.
|
|
45
48
|
*/
|
|
46
49
|
async view() {
|
|
47
|
-
const { data, error } = await this.supabase
|
|
50
|
+
const { data, error } = await this.supabase
|
|
51
|
+
.schema('public')
|
|
52
|
+
.from('exercises')
|
|
53
|
+
.select('*')
|
|
54
|
+
.eq('status', 'pending')
|
|
55
|
+
.gt('end_date', new Date().toISOString());
|
|
48
56
|
if (error) {
|
|
49
|
-
return { error: new Error(`Failed to fetch
|
|
57
|
+
return { error: new Error(`Failed to fetch open exercises: ${error.message}`) };
|
|
50
58
|
}
|
|
51
59
|
return { data: (data ?? []) };
|
|
52
60
|
}
|