예제 #1
0
 @DELETE
 @Path("{userId}/friend/{friendUserId}")
 public Response unFriend(
     @PathParam("userId") final String userId,
     @PathParam("friendUserId") final String friendUserId) {
   userDao.deleteFriendRequest(userId, friendUserId, Constants.FRIEND_UNFRIEND_DELETE);
   return Response.ok().build();
 }
예제 #2
0
  @PUT
  @Path("{userId}/friend/{friendUserId}")
  public Response confirmFriend(
      @PathParam("userId") final String userId,
      @PathParam("friendUserId") final String friendUserId,
      @QueryParam(STATUS_QPARAM) final String status) {
    if (status.toLowerCase().equals("agreed")) {
      userDao.confirmFriendRelation(userDao.getUser(userId), userDao.getUser(friendUserId));
      // TODO:notification to user about acceptance

    } else if (status.toLowerCase().equals("cancel")) {
      userDao.deleteFriendRequest(userId, friendUserId, Constants.FRIEND_REQUEST_CANCEL_DELETE);
    }
    return Response.ok().build();
  }