package sg.ncl.service.registration.controllers;

import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import sg.ncl.service.registration.RegistrationService;
import sg.ncl.service.registration.dtos.RegistrationInfo;

import javax.inject.Inject;

/**
 * @author Te Ye & Desmond
 */
@RestController
@RequestMapping(path = "/registrations", produces = MediaType.APPLICATION_JSON_VALUE)
public class RegistrationController {

    private final RegistrationService registrationService;

    @Inject
    protected RegistrationController(final RegistrationService registrationService) {
        this.registrationService = registrationService;
    }

    @RequestMapping(method = RequestMethod.POST)
    @ResponseStatus(HttpStatus.OK)
    public void register(@RequestBody RegistrationInfo registrationInfo) {
        registrationService.register(registrationInfo.getCredentials(), registrationInfo.getUser(), registrationInfo.getTeam(), registrationInfo.getIsJoinTeam());
    }
}

package sg.ncl.service.registration.controllers;

import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import sg.ncl.service.registration.RegistrationService;
import sg.ncl.service.registration.dtos.RegistrationData;
import sg.ncl.service.registration.dtos.RegistrationInfo;

import javax.inject.Inject;

/**
 * @author Te Ye & Desmond
 */
@RestController
@RequestMapping(path = "/registrations", produces = MediaType.APPLICATION_JSON_VALUE)
public class RegistrationController {

    private final RegistrationService registrationService;

    @Inject
    protected RegistrationController(final RegistrationService registrationService) {
        this.registrationService = registrationService;
    }

    @RequestMapping(method = RequestMethod.POST)
    @ResponseStatus(HttpStatus.OK)
    public void register(@RequestBody RegistrationInfo registrationInfo) {
//        System.out.println("User: " + registrationInfo.getUser());
//        System.out.println("Team: " + registrationInfo.getTeam());
//        System.out.println("Registration: " + registrationInfo.getRegistration());
        if (registrationInfo.getIsJoinTeam())
        registrationService.register(registrationInfo.getCredentials(), registrationInfo.getUser(), registrationInfo.getTeam(), registrationInfo.getIsJoinTeam());
    }
}

Revert "remove line to apply for new team"
Revert "remove line to apply for new team"

This reverts commit e9cc064a440db8457387a8ce527453679446b327.
