• Does owner attachment exist validator

    Parameters

    • attachmentService: AttachmentService

      injected service use to handle the attachment related operations

      • getOneAttachment
    • logger: Logger

      injected logger used to handle the logging

    • context: AdapterHandlerContext

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

      • params.userId is required
      • params.attachmentId is required

    Returns Promise<number>

    200 Status OK

    Description

    This validator will check if attachment exist for user by applying the following steps in sequence:

    1. Get userId and attachmentId from context

    2. Check if userId or attachmentId not exist in context

    3. Get attachment by userId and attachmentId with ownerType user (attachmentService.getOneAttachment)

    4. Check if attachment not found

    Throws

    400 NBError Bad Request

    • userId or attachmentId not exist in request params

    Throws

    404 NBError Not Found

    • attachment not found for user

Generated using TypeDoc