which request field to check
unique identifier of the entity that going to be followed
unique identifier of the entity of the follower
request context [headers, body, params, query].
200 Status OK
This function is used to check if followerId is not equal to followId by applying the following steps in sequence:
Get followId and followerId from request context
If followId is not equal to followerId return 200
If followId is equal to followerId return 403
403 NBError Forbidden
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
Validate follower