# Conversation Log: NearBeach Review & UI Conventions Scope: the `NearBeach/` folder in the project-5 worktree (branch `project-5`). The only files written are under `sources/`; no NearBeach code was changed. --- ## 1. Codebase review **Request:** Review `NearBeach/`, stay inside that folder, then wait. **Overview:** NearBeach is a Django and Vue 3 project-management app. - The backend is in `NearBeach/NearBeach/`: models, about 1,200 lines of URL routes, around 35 view modules, and a REST API at `/api/v0/`. - The frontend is in `src/`, built with Webpack. - Access is controlled by permission decorators in `decorators/check_user_permissions/`. **Main findings:** 1. **Wrong object in permission checks (high).** In `partials/generic_permissions.py`, `_fetch_parent_details` loads the wrong model for cards and requirement items: - for `kanban_card` it runs `KanbanBoard.objects.get(pk=card_id)` - for `requirement_item` it runs `Requirement.objects.get(...)` The tag, link and note API routes reach this code, so permission is checked against an unrelated object. If no such object exists, the request fails with a 500 error. 2. **`document_remove` deletes before checking (high).** It soft-deletes the document before confirming the document belongs to the given object. A user with edit rights on one object can delete another object's document. 3. **Response raised as an exception (low).** `raise HttpResponseBadRequest(...)` raises a response object, which isn't an exception, so Python raises a `TypeError` instead. **Smaller issues:** - **Unchecked object types:** the type name from the URL isn't validated, so a bad one causes a 500 error. - **No admin shortcut:** two API permission decorators don't let admins through automatically. - **Unhandled missing sprint:** `Sprint.objects.get` has no handling for a missing sprint. - **Users with no groups:** their permission level comes back as `None`, which crashes the comparison with a `TypeError`. - **Dev settings:** `local/settings.py` has a hardcoded `SECRET_KEY` and `DEBUG=True`. **Tests:** 114 backend tests ran and all passed. They don't cover the code paths behind the findings above, and the total seems low, so some test folders may not be discovered. ## 2. How users see data The app has these main views: - **Dashboard:** My Objects, To Do Today, RFC approvals, Kanban list, bugs, and admin widgets. - **Record pages:** an information card on top, with tabs underneath (`ParentModules.vue`): Groups & Users, Documents, Links, Customers, Sprints, Misc, Notes, and Delete for level 4. - **Kanban boards:** cards are dragged between columns and rows. - **Search and list pages.** - **Other views:** My Planner, Sprints/Gantt, scheduled objects, profile, admin pages, and public read-only share links. **Possible security issue:** `search/search.html` puts the user's search text inside a Vue expression with `v-bind:search-input="'{{search_input}}'"`. Because the app compiles its templates in the browser, this could allow cross-site scripting. Not yet tested. ## 3. Search scope - **Single-type search pages:** customers, organisations, groups, users, permission sets, notifications, sprints and tags. They match on names or text. - **"List All Objects":** covers only six types: projects, tasks, requirements, requirement items, RFCs and Kanban boards. It matches titles only (or the ID if a word is a number), and every word must match. Results are limited to the user's groups and to open records unless "include closed" is ticked. - **Not searchable anywhere:** Kanban cards and change tasks. Scheduled objects have a search function but no menu entry. ## 4. Filtering by date or user Neither is possible in any search. **Closest existing views:** - My Planner: the user's own plan, next 7 days. - Gantt: a timeline for one project's or requirement's sprints. - Dashboard "My Objects": only the current user's objects. No screen shows another user's assignments. The data needed already exists (`ObjectAssignment.assigned_user` and the start/end date fields), so the filters could be added by extending `SearchObjectsForm` and `_get_single_search_object`. ## 5. UI conventions guide **Request:** Find the right way to describe the UX so new views match the existing look and feel. **Planning:** - Two read-only explorations mapped the page shell and the Vue component conventions. - The user chose a **guide only** (no starter files and no CLAUDE.md), stored in **`sources/`**. **Output:** `sources/NearBeach-UI-conventions.md`. It covers: - **Page shell and views:** base templates, how Django data is passed into Vue, and view, decorator and URL conventions. - **Navigation:** adding links to the navbar. - **Component layout:** the card, the `col-md-4`/`col-md-8` section pattern, read-only rules and lifecycle. - **Libraries:** Naive UI for inputs only, Bootstrap for everything else, TinyMCE for rich text. - **Reusable pieces:** modals, tabs, validation, render components and composables. - **Saving and feedback:** axios with FormData, and toasts. - **Styling:** `--nb-*` theme variables. - **Setup:** component registration, the build, and tests. - **A new-view checklist** and quirks not to copy. The details were checked against the code, and the TinyMCE toolbar excerpt was corrected after checking. ## 6. Recipe for a global task list **Request:** A brief, recipe-style explanation of adding a global task list that can be grouped by user, by date or by assignment. **Answer:** a nine-step recipe: 1. Add URLs. 2. Add a `TaskListForm`. 3. Add a page view and a POST JSON data view. The data view must limit tasks to the user's groups. 4. Add the template. 5. Add `TaskList.vue`. 6. Register it in `components.js` and `app.js`. 7. Add a navbar link. 8. Add backend and frontend tests. 9. Build and check in both themes. **Follow-up:** the user said "no", then clarified "do not build it". Nothing was built. --- ## Files produced - `sources/NearBeach-UI-conventions.md` - `sources/conversation-log-261020.md` (this file)