File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { UserInputError } from 'apollo-server-express' ;
22import { ObjectId } from 'mongodb' ;
33import sendPersonalNotification from '../../utils/personalNotifications' ;
4- import type { UserDBScheme } from '@hawk.so/types' ;
54import { SenderWorkerTaskType } from '../../types/userNotifications/task-type' ;
5+ import type { EnqueueAssigneeNotificationParams } from '../../types/userNotifications/assignee' ;
66
77/**
88 * Validate and normalize bulk event ids from resolver input.
@@ -24,14 +24,6 @@ export function parseBulkEventIds(eventIds: string[]): string[] {
2424 return uniqueEventIds ;
2525}
2626
27- type AssigneeNotificationParams = {
28- assigneeData : UserDBScheme | null ;
29- assigneeId : string ;
30- projectId : string ;
31- whoAssignedId : string ;
32- eventId : string ;
33- } ;
34-
3527/**
3628 * Enqueue one assignee notification without blocking resolver response.
3729 */
@@ -41,7 +33,7 @@ export function enqueueAssigneeNotification({
4133 projectId,
4234 whoAssignedId,
4335 eventId,
44- } : AssigneeNotificationParams ) : void {
36+ } : EnqueueAssigneeNotificationParams ) : void {
4537 if ( ! assigneeData ) {
4638 return ;
4739 }
Original file line number Diff line number Diff line change 11import { SenderWorkerTaskType } from './task-type' ;
22import { SenderWorkerTask , SenderWorkerPayload } from './task' ;
3+ import type { UserDBScheme } from '@hawk.so/types' ;
34
45/**
56 * Payload of the task to notify the user about the assignment to the task
@@ -31,4 +32,17 @@ export interface AssigneeNotificationPayload extends SenderWorkerPayload {
3132 */
3233export interface AssigneeNotificationTask extends SenderWorkerTask < AssigneeNotificationPayload > {
3334 type : SenderWorkerTaskType . Assignee ;
34- }
35+ }
36+
37+ /**
38+ * Params for enqueueing assignee notification from resolvers/helpers.
39+ */
40+ export type EnqueueAssigneeNotificationParams = Pick <
41+ AssigneeNotificationPayload ,
42+ 'assigneeId' | 'projectId' | 'whoAssignedId' | 'eventId'
43+ > & {
44+ /**
45+ * Full user record of assignee.
46+ */
47+ assigneeData : UserDBScheme | null ;
48+ } ;
You can’t perform that action at this time.
0 commit comments