Exemplo n.º 1
0
        public List <Board> GetBoardsThatUserIsPartOf(JunaUser user)
        {
            var selectedBoardsList = new List <Board>();

            if (user != null)
            {
                var createdBoards = _boardRepository.GetBoardsCreatedByUser(user);
                selectedBoardsList.AddRange(createdBoards);
                //boards that user is following
                var boards = _boardRepository.GetAllBoards();
                foreach (var board in boards)
                {
                    var followActivity = _activityRepository.GetByActorVerbAndObject($"JunaUser:{user.ObjectId}", BoardInteractionMetadata.INTERACTION_FOLLOW, $"Board-{board.Id}");
                    if (followActivity != null)
                    {
                        var selectedBoard = _boardRepository.GetById(Guid.Parse(followActivity.Object.Split(new char[] { '-' }, 2)[1]));
                        selectedBoardsList.Add(selectedBoard);
                    }
                }
            }
            return(selectedBoardsList);
        }