• Create message handler

    Parameters

    • notificationService: NotificationDataService

      injected service use to handle the notification related operations

      • createMessage
      • getOneMessage
      • normalizeOneMessage
      • isPublicMessage
      • createTransmissionsForMessage
    • mailConfig: {
          mailService?: MailService;
          sender?: string;
      }

      injected mail config

      • mailService
      • sender
      • Optional mailService?: MailService
      • Optional sender?: string
    • expandUserAPI: Pick<UserDefaultAdapterAPI, "getUserById">

      injected user api

      • getUserById
    • socketAPI: undefined | SocketAPI<defaultNotification.Message & {
          isPublicMessage: boolean;
      }, Transmission>
    • logger: Logger

      injected logger used to handle the logging

    • context: AdapterHandlerContext

      request context [headers, body, params, query].

    Returns Promise<adapter.AdapterHandlerResponse>

    201 Status Created

    • data: message

    Description

    This handler will create message by applying the following steps in sequence:

    1. Create message (notificationService.createMessage)

    2. Get message by id and normalize (notificationService.getOneMessage)

    3. Check if message is public (notificationService.isPublicMessage)

    4. If message is public, emit message to public channel

    5. If message is not public, create transmission for message (notificationService.createTransmissionsForMessage)

    6. If message should send mail, send mail to receivers (mailService.sendMail)

    7. Return the message

    Throws

    500 NBError Internal Server Error

    • create message failed
    • send mail failed

Generated using TypeDoc