add medreport schema

This commit is contained in:
Danel Kungla
2025-07-09 13:31:37 +03:00
parent 9371ff7710
commit d9198a8a12
73 changed files with 420 additions and 270 deletions

View File

@@ -14,7 +14,7 @@ import { cn } from '@kit/ui/utils';
import { useDismissNotification, useFetchNotifications } from '../hooks';
type Notification = Database['public']['Tables']['notifications']['Row'];
type Notification = Database['medreport']['Tables']['notifications']['Row'];
type PartialNotification = Pick<
Notification,
@@ -121,7 +121,10 @@ export function NotificationsPopover(params: {
return (
<Popover modal open={open} onOpenChange={setOpen}>
<PopoverTrigger asChild>
<Button className={'relative px-4 py-2 h-10 border-1 mr-0'} variant="ghost">
<Button
className={'relative mr-0 h-10 border-1 px-4 py-2'}
variant="ghost"
>
<Bell className={'size-4'} />
<span

View File

@@ -8,6 +8,7 @@ export function useDismissNotification() {
return useCallback(
async (notification: number) => {
const { error } = await client
.schema('medreport')
.from('notifications')
.update({ dismissed: true })
.eq('id', notification);

View File

@@ -49,6 +49,7 @@ function useFetchInitialNotifications(props: { accountIds: string[] }) {
queryKey: ['notifications', ...props.accountIds],
queryFn: async () => {
const { data } = await client
.schema('medreport')
.from('notifications')
.select(
`id,

View File

@@ -22,7 +22,7 @@ import { Database } from '@kit/supabase/database';
import { createNotificationsService } from './notifications.service';
type Notification = Database['public']['Tables']['notifications'];
type Notification = Database['medreport']['Tables']['notifications'];
/**
* @name createNotificationsApi

View File

@@ -4,7 +4,7 @@ import { SupabaseClient } from '@supabase/supabase-js';
import { Database } from '@kit/supabase/database';
type Notification = Database['public']['Tables']['notifications'];
type Notification = Database['medreport']['Tables']['notifications'];
export function createNotificationsService(client: SupabaseClient<Database>) {
return new NotificationsService(client);
@@ -14,7 +14,10 @@ class NotificationsService {
constructor(private readonly client: SupabaseClient<Database>) {}
async createNotification(params: Notification['Insert']) {
const { error } = await this.client.from('notifications').insert(params);
const { error } = await this.client
.schema('medreport')
.from('notifications')
.insert(params);
if (error) {
throw error;