# Dashy Project Refactor: Progress Report **Objective:** Transition Dashy from a browser-based SQLite (local storage) application to a Client-Server architecture using a Python FastAPI backend with a persistent database. --- ## ✅ Completed Tasks ### 1. Backend Infrastructure Setup - Created `backend/` directory structure. - Configured `requirements.txt` with essential libraries (`fastapi`, `sqlalchemy`, `pydantic`, `jose`, etc.). - **Fix:** Pinned `bcrypt==4.0.1` to resolve compatibility issues with `passlib`. ### 2. Database Modeling - **Schema Design:** Translated the original `db.js` schema into SQLAlchemy models in `models.py`. - **Relationships:** Established Many-to-Many relationships for Task Tags and One-to-Many for User Tasks and Notes. - **Audit Logging:** Implemented a robust Audit Log system to track all user actions. ### 3. API Development - **Main App (`main.py`):** Set up FastAPI with CORS middleware enabled for frontend communication. - **Authentication:** Built JWT-based login flow in `auth.py`. - **Endpoints:** Created initial endpoints for: - User retrieval - Task CRUD (Create, Read, Update) - Audit log retrieval/creation ### 4. Data Migration & Environment Handling - **Seeding:** Created `seed.py` to migrate initial prototype data into the new database. - **CIFS/NAS Fix:** - Implemented `DASHY_DB_PATH` environment variable support to allow the database file to reside on a local disk while code stays on the NAS. - Added a 30-second connection timeout to mitigate network latency. --- ## 🚧 Current Status - **Backend:** Feature-complete for the first phase. - **Database:** Schema is stabilized, seeding logic is verified, and database is active. - **Frontend:** Integrated with FastAPI backend via `api.js`. Legacy WASM SQLite files archived. --- ## ⏭️ Upcoming Steps ### Phase 2: Frontend Refactor & Workflow Polish (✅ Completed) 1. **API Integration:** Created `api.js` to handle network requests, swapped `DashyDB` for async API calls in `app.jsx`, and updated Login to use JWT tokens. 2. **Legacy Cleanup:** Archived `db.js` and `data.jsx` to `Dashy-v1/scraps/` and removed `sql.js` WASM dependency from `Dashy.html`. 3. **API Base URL Fix:** Updated `api.js` to dynamically use the browser's hostname to resolve "Connection Refused" errors. 4. **Audit Rendering Crash Fix:** Resolved the `TASK_AUDIT` ReferenceError by passing live API audit logs into the `TaskDetail` modal. 5. **UI State Refresh Fix:** Modified the `useApiData` hook to fetch subsequent updates silently without unmounting the app (fixing the drag-and-drop refresh bug). 6. **Task Completion:** Added a "Mark as completed" button, removed closed tasks from the main Overview board, and set up audit logging. 7. **User Views Update:** Updated `UserScreen` to accurately display open task counts and render a dedicated, faded "Completed" section for closed tasks. 8. **Task Reopening:** Added a "Reopen task" button to restore accidentally closed tasks back to the queue. 9. **User Management (Settings):** Built backend API endpoints (`POST`, `PATCH`, `DELETE` for `/users`) and wired up the `WorkspaceTab` allowing Admins to manage the team from the UI. 10. **Task Editing:** Implemented inline editing for task descriptions using an active text box state with "Save/Cancel" actions. 11. **UI Cleanup:** Removed hardcoded, prototype placeholder notes from the `TaskDetail` modal to prepare for future dynamic notes integration. 12. **Soft Deletion & Recovery:** Replaced hard-deletion with "Soft Deletion" by adding a `deleted_at` field to the Task model. Created a new Admin-only "Deleted" tab that allows restoring tasks from the trash via a new `/restore` endpoint. 13. **Permanent Deletion Wiring Fix:** Resolved a three-layer bug where the delete button was non-functional by adding the missing props and handlers across three files. 14. **Password Management:** Made the "Change password" flow real with backend password hashing and current-password verification. 15. **Real Login Authentication:** Fixed a security bug where the login screen accepted any password. implemented proper 401 handling. 16. **Network Hardening:** Configured the frontend to use a relative `/api` path via an Nginx SSL reverse proxy. 17. **API Authentication Enforcement:** Applied JWT Bearer token validation to all sensitive routes. 18. **Persistent Workspace Settings:** Added a `Workspace` database model to persist global dashboard settings like Name and Timezone. 19. **Dynamic UI Integration:** Completely refactored the navigation and boards to build columns and tabs dynamically from the live database user list. 20. **Functional Search:** Implemented a real-time task search feature. Clicking the search icon now reveals an inline search bar that filters tasks by title, description, or tags across all views. 21. **Advanced Audit Filtering:** Upgraded the Audit Log for Admins with a search bar and a granular event type filter. Admins can now filter the history by specific actions (e.g., "deleted tasks", "moved tasks", "user management") and search through summaries in real-time. 22. **Persistent Task Reordering:** Implemented drag-and-drop reordering within and between columns. - **Backend:** Added a `position` (Float) column to the `tasks` table and updated API endpoints to support position updates and sorted fetching. - **UI:** Enhanced the Kanban board with a "drop-between-cards" detection logic and a visual blue drop indicator. Positions are persisted to the database instantly on drop. 23. **Keyboard Shortcuts:** Added global support for keyboard navigation: - **`Escape`**: Instantly close any open modal (Task Detail, Add Task, Settings, or Audit Logs). - **`n`**: Open the "Add Task" modal from the main dashboard (disabled while typing in inputs). 24. **Drag-and-Drop Stability:** Fixed a bug where tasks would "disappear" if dropped in an invalid area. Tasks now remain visible at their original position if a drop is cancelled. ### Phase 3: Advanced Features - **Real-time Notifications:** Explore WebSockets for task assignments. - **iMessage Integration:** Develop the "Molty" bridge for phone-to-task creation. - **File Uploads:** Support for attaching photos/documents to tasks. --- **Last Updated:** Wednesday, May 13, 2026 **Status:** Phase 2 Complete / Ready for Phase 3