MED-109: add doctor role and basic view (#45)

* MED-109: add doctor role and basic view

* add role to accounts

* remove old super admin and doctor sql
This commit is contained in:
Helena
2025-08-13 12:28:50 +03:00
committed by GitHub
parent ce7b04fda8
commit 3c6c86c7c8
32 changed files with 562 additions and 35 deletions

View File

@@ -0,0 +1,24 @@
import { SupabaseClient } from '@supabase/supabase-js';
import { Database } from '@kit/supabase/database';
/**
* @name isDoctor
* @description Check if the current user is a doctor.
* @param client
*/
export async function isDoctor(client: SupabaseClient<Database>) {
try {
const { data, error } = await client
.schema('medreport')
.rpc('is_doctor');
if (error) {
throw error;
}
return data;
} catch {
return false;
}
}