feat(favorites): add dashboard favorites - #214
Conversation
Introduces UserConfig and favorite relationships for Companies and Boundaries. Adds APIs to manage favorites, dashboard favorites display, favorite indicators and toggles on Company/Boundary pages, and navigation to favorited items. Includes migrations and seed updates to initialize user configuration for existing and new users. Signed-off-by: Kevin Jablonski <kevjablonski@gmail.com>
Extracts shared favorite management into a reusable utility to reduce duplicate API code.
Removes the UserConfig dependency and associates favorites directly with Users. Updates migrations, models, APIs, and frontend to simplify favorite management while preserving existing functionality. Signed-off-by: Kevin Jablonski <kevjablonski@gmail.com>
|
| })), | ||
| ]; | ||
| } else if (error.value) { | ||
| console.error("Failed to load user config:", error.value); |
| const aliasStore = useAliasStore(); | ||
| const { data: config, error } = await useFetch("/api/favorites/list"); | ||
| const boundaryTerm = aliasStore.BoundaryAlias; | ||
| const companyTerm = aliasStore.CompanyAlias; |
There was a problem hiding this comment.
Getting lint errors that this isn't used.
| import { useAliasStore } from "~/stores/AliasStorage"; | ||
| const aliasStore = useAliasStore(); | ||
| const { data: config, error } = await useFetch("/api/favorites/list"); | ||
| const boundaryTerm = aliasStore.BoundaryAlias; |
There was a problem hiding this comment.
Getting lint errors that this isn't used.
There was a problem hiding this comment.
Multiword error flagging. FavoriteTable, FavoritesView maybe?
| await navigateTo({ | ||
| path: "/company-boundary/" + favorite.id, | ||
| }); | ||
| } catch (error) { |
There was a problem hiding this comment.
Errors not showing in UI
| const user = await User.findByPk(body.id, { attributes: { exclude: ["password", "salt"] } }); | ||
|
|
||
| if (!user) { | ||
| if (!user ) { |
There was a problem hiding this comment.
remove added space from diff
|
|
||
| if (body.ThemeId && user.ThemeId !== body.ThemeId) { | ||
| user.ThemeId = body.ThemeId; | ||
| if (body.ThemeId && user.ThemeId !== body.ThemeId) { |
There was a problem hiding this comment.
remove added space from diff
| if (body.ThemeId && user.ThemeId !== body.ThemeId) { | ||
| user.ThemeId = body.ThemeId; | ||
| if (body.ThemeId && user.ThemeId !== body.ThemeId) { | ||
| user.ThemeId = body.ThemeId; |
There was a problem hiding this comment.
remove added space from diff
| @@ -1,4 +1,4 @@ | |||
| import { UserRole } from "../../../db/models"; | |||
| import { UserRole} from "../../../db/models"; | |||
There was a problem hiding this comment.
Replace the missing space to clean up diff
There was a problem hiding this comment.
There is no check to see if the user is a member and allowed to favorite. You can add a favorite to a boundary you don't belong to and then get the header information from a list.



Summary
Introduces support for user favorites by adding favorite relationships for Companies and Boundaries directly to Users. Adds APIs to manage favorites, displays favorites on the dashboard for quick access, and allows users to favorite and unfavorite items throughout the application.
Changes
Added
Changed
Testing
Related
Closes #213