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

Update tickets without losing newer edits

Authorize changes and reject stale versions.

UNDERSTAND

Bring these concepts with you

BUILD

Your implementation

  1. Implement updateTicket. Owners can edit title/body; only staff can change status. Enforce organization scope on the read and write.
  2. Require the version the browser loaded. Use a conditional UPDATE WHERE version = ? and increment the version atomically.
  3. Return 409 if another edit won first. The UI should reload and let the learner compare changes rather than silently retry a stale overwrite.
function updateTicket(actor, id, input) { /* conditional UPDATE + version */ }
Need a hint?
  • A separate read followed by an unconditional write can lose an edit. The version predicate belongs in the UPDATE.
  • Keep status and immutable identity separate from editable text. Use one conditional statement for this single-row change.

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 4

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

Two browser tabs save version 1. How do you avoid silently losing one user’s edit?

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