// // RULES: // api method for get notifications by user id import { COL_NOTIFICATIONS } from '@/constants'; import { pb } from '@/lib/pb'; import type { Notification } from './type.d'; export async function getNotificationsByUserId(userId: string): Promise { const records = await pb.collection(COL_NOTIFICATIONS).getFullList({ expand: 'author, to_user_id', filter: `to_user_id.id = "${userId}"`, sort: '-created', }); return records as unknown as Notification[]; }