throw new UnsupportedOperationException("Not implemented"); //TODO build query
}
@Override
public boolean addFriend(String friendUsername, String username) {
MongoDbUser follower = (MongoDbUser) template.findOne(getUsernameQuery(username));
MongoDbUser followed = (MongoDbUser) template.findOne(getUsernameQuery(friendUsername));
MongoDbPersonAssociation outgoing = new MongoDbPersonAssociation(followed.getId(), FriendRequestStatus.SENT, MongoDbPersonAssociation.Direction.OUTGOING);
MongoDbPersonAssociation incoming = new MongoDbPersonAssociation(follower.getId(), FriendRequestStatus.RECEIVED, MongoDbPersonAssociation.Direction.INCOMING);
follower.getFriends().add(outgoing);
followed.getFriends().add(incoming);
template.save(followed);
template.save(follower);
return true;
}