Class ExchangeController

java.lang.Object
com.plannaplan.controllers.TokenBasedController
com.plannaplan.controllers.ExchangeController

@RestController
@CrossOrigin
@RequestMapping("/api/v1/exchanges")
public class ExchangeController
extends TokenBasedController
Rest controller to Exchange related endpoints. More detailed api docs is available via swagger
  • Field Summary

    Fields inherited from class com.plannaplan.controllers.TokenBasedController

    userService
  • Constructor Summary

    Constructors
    Constructor Description
    ExchangeController()  
  • Method Summary

    Modifier and Type Method Description
    org.springframework.http.ResponseEntity<java.lang.String> createExchange​(java.util.Map<java.lang.String,​java.lang.Long> exchangeRequest)  
    org.springframework.http.ResponseEntity<java.lang.String> deleteExchange​(java.lang.Long offerId)  
    org.springframework.http.ResponseEntity<java.util.List<ExchangeResponse>> getExchange()  
    org.springframework.http.ResponseEntity<ExchangeResponse> getExchangeById​(java.lang.Long offerId)  

    Methods inherited from class com.plannaplan.controllers.TokenBasedController

    getCurrentUser

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ExchangeController

      public ExchangeController()
  • Method Details

    • createExchange

      @PostMapping("/exchange") public org.springframework.http.ResponseEntity<java.lang.String> createExchange​(@RequestBody java.util.Map<java.lang.String,​java.lang.Long> exchangeRequest) throws com.plannaplan.exceptions.UserNotFoundException
      Parameters:
      exchangeRequest - mapped json body with requierd paramas (groupid and assignment)
      Returns:
      was job successfull
      Throws:
      com.plannaplan.exceptions.UserNotFoundException - if user was not found
    • deleteExchange

      @DeleteMapping("/exchange/{id}") public org.springframework.http.ResponseEntity<java.lang.String> deleteExchange​(@PathVariable(name="id",required=false) java.lang.Long offerId) throws com.plannaplan.exceptions.UserNotFoundException
      Parameters:
      offerId - id to delwete from db
      Returns:
      was jub successful
      Throws:
      com.plannaplan.exceptions.UserNotFoundException - if user was not found
    • getExchange

      @GetMapping("/exchange/all") public org.springframework.http.ResponseEntity<java.util.List<ExchangeResponse>> getExchange() throws com.plannaplan.exceptions.UserNotFoundException
      Returns:
      return all user's exchange offers
      Throws:
      com.plannaplan.exceptions.UserNotFoundException - iF user was not found
    • getExchangeById

      @GetMapping("/exchange/{id}") public org.springframework.http.ResponseEntity<ExchangeResponse> getExchangeById​(@PathVariable(name="id",required=false) java.lang.Long offerId) throws com.plannaplan.exceptions.UserNotFoundException
      Parameters:
      offerId - id of exchange in db
      Returns:
      Exchage response
      Throws:
      com.plannaplan.exceptions.UserNotFoundException - if user was not found