package myProject.servlets.friends;

import myProject.repository.FriendsRepository;
import myProject.util.RequestResponseHelper;
import myProject.util.ResponseUtil;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class FriendRemoveServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //RegId, RegId
        RequestResponseHelper.Pair pair = RequestResponseHelper.getPairFromRequest(req);
        boolean isSuccess = FriendsRepository.removeFriend(pair.getFirst(), pair.getSecond());

        ResponseUtil.sendResponse(isSuccess, resp);
    }
}
