Files
speckle-server/packages/server/modules/cli/commands/bull/test-push.ts
T
Daniel Gak Anagrov 3ca4a11ca3 feat(notifications): basic listener structure, notification record, delayed mechanism (#5432)
* feat: basic notification listener sturcuture

* feat: clean up generated gql

* chore: edited structure

* feat: added basic repo

* feat: ported comment email to job queue

* feat: ported stream access request accepted

* feat: added notification insertion

* fix: minor typings

* feat: delayed notifications

* updated types

* feat: fixed gql

* notifications are listed

* index on notifications

* feat: while loop skiping for update locked

* delayed notification for access request

* take into account user prefrences

* on comment view, notification is marked as read

* feat: added gql notifications

* feat: avoid raising errors

* fix: error added scopes

* fix: mr comments

* fix: cursor and service method

* feat: added stronger types to notifications and versioning logic

* minor: rows updated
2025-10-06 12:19:12 +01:00

42 lines
1.4 KiB
TypeScript

import { cliLogger } from '@/observability/logging'
import type { MentionedInCommentData } from '@/modules/notifications/helpers/types'
import { NotificationType } from '@speckle/shared/notifications'
import { publishNotification } from '@/modules/notifications/services/publication/publishNotification'
import { initializePublicationQueue } from '@/modules/notifications/services/publication/queue'
import type { CommandModule } from 'yargs'
const command: CommandModule = {
command: 'test-push [message] [error]',
describe: 'Push a fake notification onto the queue',
builder(yargs) {
return yargs
.positional('message', {
describe: 'Random message to push',
type: 'string',
default: 'Hello world!'
})
.positional('error', {
describe: 'Whether to throw error in handler, causing a re-queue',
type: 'boolean',
default: false
})
},
handler: async (argv) => {
await initializePublicationQueue()
// we don't want to submit a real mentions payload, this is for testing only
await publishNotification(NotificationType.MentionedInComment, {
targetUserId: '123',
data: {
text: argv.message,
timestamp: new Date().toISOString(),
error: argv.error
} as unknown as MentionedInCommentData
})
cliLogger.info('Queued a fake notification...')
}
}
export = command