import Position from "../../models/Position";
import AppError from "../../errors/AppError";

const DeletePositionService = async (id: string): Promise<void> => {
  const position = await Position.findOne({
    where: { id }
  });

  if (!position) {
    throw new AppError("ERR_NO_POSITION_FOUND", 404);
  }

  await position.destroy();
};

export default DeletePositionService;
