Files
ncd-fe/packages/pl-fe/src/normalizers/notification.ts
nicole mikołajczyk 9f98b5b07d nicolium: oxlint and oxfmt migration, remove eslint
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
2026-02-15 13:30:55 +01:00

21 lines
683 B
TypeScript

import omit from 'lodash/omit';
import type { Notification as BaseNotification, NotificationGroup } from 'pl-api';
const normalizeNotification = (notification: BaseNotification): NotificationGroup => ({
...omit(notification, ['account', 'status', 'target']),
group_key: notification.id,
notifications_count: 1,
most_recent_notification_id: notification.id,
page_min_id: notification.id,
page_max_id: notification.id,
latest_page_notification_at: notification.created_at,
sample_account_ids: [notification.account.id],
// @ts-ignore
status_id: notification.status?.id,
// @ts-ignore
target_id: notification.target?.id,
});
export { normalizeNotification };