loopbackio / loopbackio/loopback4-example-shopping
Email validation for createAll method
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 365
- Forks
- 195
- PR merge metrics
- No merged PRs in 30d
Description
Hi All,
the documentation of loopback 4 does not contain validations for createAll method at interceptors. Can anyone guide me on how do we validate for createAll method?
const validateOrder: Interceptor = async (invocationCtx, next) => {
console.log('log: before-', invocationCtx.methodName);
const order: Order = new Order();
if (invocationCtx.methodName == 'create')
Object.assign(order, invocationCtx.args[0]);
else if (invocationCtx.methodName == 'updateById')
Object.assign(order, invocationCtx.args[1]);
if (order.orderNum.length !== 6) {
throw new HttpErrors.InternalServerError('Invalid order number');
}
const result = await next();
return result;
};
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the interceptor example in the issue and the LoopBack 4 documentation for create, updateById, and createAll. Determine how createAll arguments are exposed to an interceptor and document the validation approach and expected behavior. Done means the documentation clearly explains how to validate email values for createAll.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend, documentation
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100