You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, BoardRecord has a property favorite labeings whether a board is favorited by a user, but this it not robust when we need to support multiple users later (a board is favorited by multiple users). We'd better use a new collection board_favorites to store such relationships.
Actions
remove favorite key from BoardRecord, and all related stuff;
add a new collection board_favorites, add a new file BoardFavoritesCollection in the models folder
define inteface BoardFavoriteRecord
interface{
userId: string
boardId: string}
when user starred a board, we add a new record to { userId, boardId } to board_favorites collection
when user unstarred a board, we remove this record
getFavoriteBoardsByUserId, is query { userId }
Services & Subscriptions
4.1. add following public methods for clients to call
publicstarBoard(boardId: string): Promise<void>// we get userId with Meteor.userId() on serverpubliccancelStarBoard(boardId: string): Promise<void>publicgetMineFavoriteBoards(): Promise<IBoard[]>// get favorite board ids in `board_favorites` and query boards in `boards`
4.2 add BoardFavoritesSubscriber to subscribe changes to board_favorites
4.3 add global atom states to update state in favorites sidebar and top right bar
Background
Currently,
BoardRecord
has a propertyfavorite
labeings whether a board is favorited by a user, but this it not robust when we need to support multiple users later (a board is favorited by multiple users). We'd better use a new collectionboard_favorites
to store such relationships.Actions
favorite
key fromBoardRecord
, and all related stuff;board_favorites
, add a new fileBoardFavoritesCollection
in themodels
folderBoardFavoriteRecord
starred
a board, we add a new record to{ userId, boardId }
toboard_favorites
collectionunstarred
a board, we remove this record4.1. add following public methods for clients to call
4.2 add
BoardFavoritesSubscriber
to subscribe changes toboard_favorites
4.3 add global atom states to update state in
favorites
sidebar and top right barsources
filled star icon color:
#f0c000
(yellow)preview
The text was updated successfully, but these errors were encountered: