• Create topic handler

    Parameters

    • chatService: ChatDataService

      injected service use to handle the chat related operations

      • createTopic
      • createSubscription
    • authSecrets: AuthSecrets

      injected auth secrets used to handle the authentication

    • authenticate: AuthenticationFunction

      injected function used to handle the authentication

    • logger: Logger

      injected logger used to handle the logging

    • context: AdapterHandlerContext

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

      • body.typeId is required
      • body.ownerIds is required

    Returns Promise<adapter.AdapterHandlerResponse>

    201 Status Created

    • data: created topic

    Description

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

    1. Authenticate the request (authenticate)

    2. Create topic (chatService.createTopic)

    3. Create subscription for each owner (chatService.createSubscription)

    4. Get topic by id and normalize (chatService.getOneTopicAndNormalize)

    5. Return the created topic

    Throws

    400 NBError Bad Request

    • invalid typeId

    Throws

    500 NBError Internal Server Error

    • create topic failed

Generated using TypeDoc