LEARN. PRACTICE. EXPLAIN.
Learning paths & interview practiceP
← Build a support-ticket app
BUILD → VERIFY → EXPLAIN · STEP 5 OF 6

Add scoped search, filtering and pagination

Keep list results authorized and bounded.

UNDERSTAND

Bring these concepts with you

BUILD

Your implementation

  1. Implement listTickets with the same role and organization scope as single-record access. Apply that scope to both the items and total count.
  2. Add literal title search and status filtering through bound parameters. Validate page and limit, cap the page size at 20, and sort deterministically by descending ID.
  3. Verify separate pages on an unchanged dataset and no cross-customer results. Discuss how inserts between requests can move offset-based pages.
function listTickets(actor, query = {}) { /* validate, scoped COUNT and SELECT */ }
Need a hint?
  • Use instr(lower(title), lower(?)) for literal search; do not concatenate search text into SQL.
  • COUNT and page SELECT must share the same filters and authorization predicate.

Saved on this device · 0 / 6000 · Do not include passwords or private data.

VERIFY

Acceptance checks

From the folder containing your downloaded files, run:

node checks.mjs ./starter.mjs 5

This runs checks up to this step. Earlier steps must work first. Mark each result only after checking your implementation; the website does not run or grade it.

Record your attempt to enable the checklist and reference comparison.

Compare with the reference

Attempt the step first, then compare decisions and behavior. There can be more than one correct implementation.

EXPLAIN

Your interviewer asks

How would you change this list API when tickets are inserted while someone is paging?

Say your answer aloud, then record the trade-offs and evidence in your notes above.

LOCAL VOICE REHEARSAL

Rehearse your step walkthrough aloud

Target pacing: 02:00 · Stays in this browser only; never uploaded.

00:00/ 02:00
AlifBay Prep