package com.royalrangers.controller;

import com.royalrangers.dto.ResponseResult;
import com.royalrangers.dto.user.EmailDto;
import com.royalrangers.service.SubscribeService;
import com.royalrangers.utils.ResponseBuilder;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/subscribe")
public class SubscribeController {
    @Autowired
    private SubscribeService subscribeService;

    @PostMapping
    @ApiOperation(value = "Create subscriber")
    public ResponseResult subscribe(@RequestBody EmailDto param) {

        String email = param.getEmail();
        log.info("Add subscriber: " + email);
        try {
            subscribeService.add(email);
            return ResponseBuilder.success(String.format("Email %s added to subscribers list", email));
        } catch (Exception e) {
            return ResponseBuilder.fail(e.getMessage());
        }
    }

    @DeleteMapping
    @ApiOperation(value = "Delete subscriber")
    public ResponseResult unsubscribe(@RequestBody EmailDto param) {

        String email = param.getEmail();
        log.info("Remove subscriber: " + email);
        try {
            subscribeService.remove(email);
            return ResponseBuilder.success(String.format("Email %s removed from subscribers list", email));
        } catch (Exception e) {
            return ResponseBuilder.fail(e.getMessage());
        }
    }
}

@@ -79,51 +79,8 @@
 lt;%0A
-import com.royalrangers.dto.user.EmailDto;%0A
 impo
@@ -632,67 +632,24 @@
 ody 
-EmailDto param) %7B%0A%0A        String email = param.getEmail();
+String email) %7B%0A
 %0A   
@@ -1077,67 +1077,24 @@
 ody 
-EmailDto param) %7B%0A%0A        String email = param.getEmail();
+String email) %7B%0A
 %0A   

Change request from object to string.