• Verify subscription not exist validator

    Parameters

    • chatService: ChatDataService

      injected service use to handle the chat related operations

      • getOneTopic
      • getSubscriptions
    • options: {
          organizationIdField: TargetField;
          topicIdField: TargetField;
          userIdField: TargetField;
      }

      organizationIdField: organization id field

      • topicIdField: topic id field
      • userIdField: user id field
      • organizationIdField: TargetField
      • topicIdField: TargetField
      • userIdField: 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 given subscription does not exist by applying the following steps in sequence:

    • Get the topic by id
    • Get the matching subscriptions by organization id, topic id, and user id
    • If the subscriptions length is greater than 0, throw an error

    Throws

    403 NBError Forbidden

    • subscription already exists for topic: ${topicId}

    Throws

    404 NBError Not Found

    • topic: ${topicId} not found.

Generated using TypeDoc