• Is my message validator

    Parameters

    • chatService: ChatDataService

      injected service use to handle the chat related operations

      • getOneMessage
    • options: {
          authSecrets: AuthSecrets;
          authenticate: AuthenticationFunction;
          messageIdField: TargetField;
      }

      Options

      • authSecrets authenticate secret
      • authenticate injected authenticate function
      • messageIdField which field to get the message id from
      • authSecrets: AuthSecrets
      • authenticate: AuthenticationFunction
      • messageIdField: TargetField
    • logger: Logger

      injected logger used to handle the logging

    • context: AdapterHandlerContext

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

    Returns Promise<number>

    200 Status OK

    Description

    This validator checks if the message belongs to the login user by applying the following steps in sequence:

    1. Authenticate the user (authenticate)

    2. Get message by id (chatService.getOneMessage)

    3. Return 200 if the message belongs to the login user

    Throws

    403 NBError Forbidden

    • check user subscription validator need token type to be user token
    • message: ${messageId} does not belongs login user

    Throws

    404 NBError Not Found

    • message: ${messageId} not found.

Generated using TypeDoc