OpenBook
  • Problems
  • Tracks
  • How it works
  • Pricing
Start practicingSign In
Problems/CRUD & REST

20. Comment Threads with Moderation

Medium

Nested comment threads where authors edit within a window, deletes leave placeholders and moderators hide comments.

40 minute budget0.0% acceptancetrees · soft delete · moderation · time windows

Requirements

  1. 01Post comments on a post, optionally as a reply to another comment on the same post; GET returns the thread as a tree, oldest first.
  2. 02Only the author may edit or delete; edits are allowed only for a limited time after posting and set editedAt.
  3. 03Deleting is a soft delete that keeps the thread intact.
  4. 04Moderators (x-role: moderator) can hide any comment; readers never see a hidden comment or anything beneath it.
  5. 05Each node in the tree carries a replyCount. Time comes from the x-now header when present.

What the hidden tests check

  • Everything the interviewer tells you is checked.
  • Status codes for unknown ids, wrong authors, non-moderators and late edits are checked on every route.

4 more details are held back. In a mock interview they come out only when you ask the interviewer the right question; in practice they are listed in the workspace.

Sign in to start

Attempts, files and transcripts are saved to your account so the grader can review how you worked.

Sign inCreate an account
OpenBook

Practice for interviews where you build a feature with an AI assistant.

Early preview. Problems, grading and the interviewer are still changing.

Practice

  • Problems
  • Tracks
  • How it works
  • Pricing

Legal

  • Terms
  • Privacy
© 2026 OpenBook.