mirror of
https://github.com/outline/outline.git
synced 2026-11-25 23:24:06 +03:00
feat: notifications.list
This commit is contained in:
1 parent
fb8d8f8159
commit
007cbeaab6
5 files changed
+246
-19
No files matched your search
@@ -6,6 +6,7 @@ import {
|
||||
FileOperationType,
|
||||
IntegrationService,
|
||||
IntegrationType,
|
||||
NotificationEventType,
|
||||
} from "@shared/types";
|
||||
import {
|
||||
Share,
|
||||
@@ -26,6 +27,7 @@ import {
|
||||
WebhookDelivery,
|
||||
ApiKey,
|
||||
Subscription,
|
||||
Notification,
|
||||
} from "@server/models";
|
||||
|
||||
let count = 1;
|
||||
@@ -493,3 +495,25 @@ export async function buildWebhookDelivery(
|
||||
|
||||
return WebhookDelivery.create(overrides);
|
||||
}
|
||||
|
||||
export async function buildNotification(
|
||||
overrides: Partial<Notification> = {}
|
||||
): Promise<Notification> {
|
||||
if (!overrides.event) {
|
||||
overrides.event = NotificationEventType.UpdateDocument;
|
||||
}
|
||||
|
||||
if (!overrides.teamId) {
|
||||
const team = await buildTeam();
|
||||
overrides.teamId = team.id;
|
||||
}
|
||||
|
||||
if (!overrides.userId) {
|
||||
const user = await buildUser({
|
||||
teamId: overrides.teamId,
|
||||
});
|
||||
overrides.userId = user.id;
|
||||
}
|
||||
|
||||
return Notification.create(overrides);
|
||||
}
|
||||
Reference in new issue
Block a user