Overview
Chronos Calendar provides dedicated endpoints for reordering both todo items and categories. This enables efficient bulk reordering operations, typically triggered by drag-and-drop interactions in the UI. Authentication: All endpoints require authentication via Bearer token.Reorder Todo Items
POST /todos/reorder
Reorder all todo items in a single operation
Request Body
Array of todo item UUIDs in the desired display order
Response
Confirmation message: “Reordered”
Example Request
Example Response
Behavior
Order Assignment: Todos are assigned sequential order values starting from 0.
- First UUID in array →
order: 0 - Second UUID in array →
order: 1 - Third UUID in array →
order: 2 - And so on…
Use Cases
Drag-and-Drop Reordering
Drag-and-Drop Reordering
When a user drags a todo item to a new position, send all visible todo IDs in the new order.
Sorting Todos
Sorting Todos
When applying a sort (e.g., by scheduled date or alphabetically), send the sorted IDs to persist the new order.
Moving Completed Items to Bottom
Moving Completed Items to Bottom
Automatically reorder to place completed items at the bottom of the list.
Reorder Categories
POST /todos/todo-lists/reorder
Reorder all todo list categories in a single operation
Request Body
Array of category (todo list) UUIDs in the desired display order
Response
Confirmation message: “Reordered”
Example Request
Example Response
Behavior
Categories are assigned sequential order values starting from 0, identical to todo item reordering.Implementation Details
Database Updates
Both reorder endpoints use the same underlying mechanism:- Accept an array of UUIDs in the desired order
- Iterate through the array with index enumeration
- Update each item’s
orderfield to match its array index - Verify user ownership before updating (security check)
/home/daytona/workspace/source/backend/app/routers/todos.py:64
Security
Performance Considerations
Batch Operations: Currently, each item is updated individually in a loop. For large lists (100+ items), this may result in slower response times. Consider limiting the number of items reordered in a single operation.
Error Responses
Validation Errors
Best Practices
Send Complete List
Always send the complete list of item IDs that should be reordered. Partial lists will only update the included items, potentially creating gaps in the order sequence.
Filter by User Context
Only include items owned by the authenticated user. The API will ignore items from other users, but sending them wastes bandwidth.
Optimistic UI Updates
Update the UI immediately (optimistically) before the API call completes. Revert on error.
Related Endpoints
Todo Items
Full CRUD operations for todo items
Todo Lists
Manage categories and lists
Update Todo
Update individual todo order
Update List
Update individual category order
Rate Limiting
All reorder endpoints are subject to the API rate limit configured in application settings. Exceeding the rate limit will return a429 Too Many Requests response.