feat(MED-50): use account_params in dashboard
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user