• Validate follower

    Parameters

    Returns Promise<number>

    200 Status OK

    Description

    This function is used to check if followerId is not equal to followId by applying the following steps in sequence:

    1. Get followId and followerId from request context

    2. If followId is not equal to followerId return 200

    3. If followId is equal to followerId return 403

    Throws

    403 NBError Forbidden

    • user cannot follow themself

    Example: example usage

    const targetField = {
    followId: {
    type: 'params',
    name: 'userId',
    },
    followerId: {
    type: 'body',
    name: 'followerId',
    },
    };
    const logger = new Logger();
    const context = {
    params: {
    userId: '1',
    },
    body: {
    followerId: '2',
    },
    };
    const result = await validateFollower(targetField, logger, context); // Return 200

Generated using TypeDoc