Files
outline/server/presenters/notification.ts
Tom Moor bf45e97641 chore: Enforce type import consistency (#10968)
* Update types

* fix circular dep

* type imports

* lint type imports and --fix
2025-12-19 23:07:02 -05:00

32 lines
1.0 KiB
TypeScript

import type { Notification } from "@server/models";
import type { APIContext } from "@server/types";
import presentUser from "./user";
import { presentComment, presentDocument } from ".";
export default async function presentNotification(
ctx: APIContext | undefined,
notification: Notification
) {
return {
id: notification.id,
viewedAt: notification.viewedAt,
archivedAt: notification.archivedAt,
createdAt: notification.createdAt,
event: notification.event,
userId: notification.userId,
actorId: notification.actorId,
actor: notification.actor ? presentUser(notification.actor) : undefined,
commentId: notification.commentId,
comment: notification.comment
? presentComment(notification.comment)
: undefined,
documentId: notification.documentId,
document: notification.document
? await presentDocument(ctx, notification.document)
: undefined,
revisionId: notification.revisionId,
collectionId: notification.collectionId,
data: notification.data,
};
}