rl-docs-hub

Home · Apps · rl-main-infra · todo_api · todo_mobile


DB Schema

MongoDB schema documentation derived from Mongoose models in todo_api/src.

Collections

  1. todolists (TodoList)
  2. todoitems (TodoItem)
  3. changelogs (ChangeLog)
  4. idempotencyrecords (IdempotencyRecord)

TodoList Schema

Field Type Required Default Notes
_id ObjectId yes auto GraphQL id mapping
ownerId string yes - Tenant/owner partition key
title string yes - Trimmed
description string no - Optional
order number no 0 UI ordering
version number no 1 Optimistic concurrency token
createdAt Date yes auto Timestamps enabled
updatedAt Date yes auto Timestamps enabled

Indexes

TodoItem Schema

Field Type Required Default Notes
_id ObjectId yes auto GraphQL id mapping
ownerId string yes - Owner partition key
listId string yes - Logical FK to TodoList._id
title string yes -  
description string no -  
completed boolean no false  
labels string[] no [] Free-form tags
dueDate Date no - Optional deadline
reminders Date[] no [] Scheduled reminders
position number no 0 In-list ordering
version number no 1 Optimistic concurrency token
createdAt Date yes auto  
updatedAt Date yes auto  

Indexes

ChangeLog Schema

Field Type Required Notes
_id ObjectId yes  
ownerId string yes Owner partition key
type string yes e.g. LIST_UPSERT, ITEM_MOVE
entityId string yes Target list/item id
payload object yes Snapshot/tombstone payload
createdAt Date yes Pull cursor base

Indexes

IdempotencyRecord Schema

Field Type Required Notes
ownerId string yes Owner partition key
key string yes Client-provided idempotency token
response object yes Cached SyncPushResult
createdAt Date yes Auto timestamp
updatedAt Date yes Auto timestamp

Indexes

Data Relationships (Mermaid ER)

erDiagram
  TODO_LIST ||--o{ TODO_ITEM : contains
  TODO_LIST {
    string id
    string ownerId
    string title
    string description
    number order
    number version
    date createdAt
    date updatedAt
  }
  TODO_ITEM {
    string id
    string ownerId
    string listId
    string title
    bool completed
    number position
    number version
    date dueDate
    date createdAt
    date updatedAt
  }
  CHANGE_LOG {
    string id
    string ownerId
    string type
    string entityId
    object payload
    date createdAt
  }
  IDEMPOTENCY_RECORD {
    string ownerId
    string key
    object response
    date createdAt
  }

Notes on Integrity