Code RoomProduct resolve accepts unbounded input
MediumPrep Room Coding #1988

Product resolve accepts unbounded input

Code reviewAlgorithms & data structuresMid–Senior~20 min

Review this TypeScript endpoint that resolves a list of product ids to full records.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix, specific and kind.

0:00 of about 20 min
Mark a line and say what kind of problem it is.0 findings
1app.post('/products/resolve', async (req, res) => {
2 const ids: string[] = req.body.ids;
3 const products = await Promise.all(
4 ids.map((id) => db.products.findById(id)),
5 );
6 res.json({ products });
7});
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.