feat(MED-50): use account_params in dashboard

This commit is contained in:
2025-07-24 08:38:12 +03:00
parent 66760adc06
commit 349e3e3143
5 changed files with 57 additions and 18 deletions

View File

@@ -4,6 +4,10 @@ import { Database } from '@kit/supabase/database';
import { UserAnalysis } from '../types/accounts';
export type AccountWithParams = Database['medreport']['Tables']['accounts']['Row'] & {
account_params: Pick<Database['medreport']['Tables']['account_params']['Row'], 'weight' | 'height'> | null;
};
/**
* Class representing an API for interacting with user accounts.
* @constructor
@@ -17,11 +21,11 @@ class AccountsApi {
* @description Get the account data for the given ID.
* @param id
*/
async getAccount(id: string) {
async getAccount(id: string): Promise<AccountWithParams> {
const { data, error } = await this.client
.schema('medreport')
.from('accounts')
.select('*')
.select('*, account_params: account_params (weight, height)')
.eq('id', id)
.single();