feat(dashboard, api): integrate BMI thresholds and enhance dashboard with health metrics
This commit is contained in:
@@ -242,6 +242,23 @@ class AccountsApi {
|
||||
|
||||
return (count ?? 0) > 0;
|
||||
}
|
||||
|
||||
async fetchBmiThresholds() {
|
||||
// Fetch BMI
|
||||
const { data, error } = await this.client
|
||||
.schema('medreport')
|
||||
.from('bmi_thresholds')
|
||||
.select(
|
||||
'age_min,age_max,underweight_max,normal_min,normal_max,overweight_min,strong_min,obesity_min',
|
||||
)
|
||||
.order('age_min', { ascending: true });
|
||||
|
||||
if (error) {
|
||||
console.error('Error fetching BMI thresholds:', error);
|
||||
throw error;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
export function createAccountsApi(client: SupabaseClient<Database>) {
|
||||
|
||||
@@ -14,4 +14,4 @@ export enum ApplicationRoleEnum {
|
||||
User = 'user',
|
||||
Doctor = 'doctor',
|
||||
SuperAdmin = 'super_admin',
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user