Started Swagger Documentation
This commit is contained in:
parent
22e94a8c1a
commit
5c5adebbc4
@ -8,6 +8,7 @@ import hhn.labsw.bugageocaching.repositories.*;
|
||||
import hhn.labsw.bugageocaching.util.FinderUtil;
|
||||
import hhn.labsw.bugageocaching.util.VerificationUtil;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -56,16 +57,18 @@ public class Controller {
|
||||
fetchPublicKey();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "Retrieves all Caches, including their Stations, from the Database")
|
||||
@CrossOrigin(origins = "*", allowedHeaders = "*") // only for dev purpose
|
||||
@RequestMapping(value = "/api/allCaches", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/api/allCaches", method = RequestMethod.GET, produces = "application/json")
|
||||
@ResponseBody
|
||||
public ResponseEntity getAllCaches() {
|
||||
return ResponseEntity.status(200).body(new Gson().toJson(cacheRepository.findAll()));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "Starts the given Cache for the given User")
|
||||
@CrossOrigin(origins = "*", allowedHeaders = "*") // only for dev purpose
|
||||
@RequestMapping("/api/startCache")
|
||||
@RequestMapping(value = "/api/startCache", method = RequestMethod.POST, produces = "application/json")
|
||||
@ResponseBody
|
||||
public ResponseEntity startCache(@RequestParam(value = "token", defaultValue = "-1") String token,
|
||||
@RequestParam String cacheID) {
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
package hhn.labsw.bugageocaching.entities;
|
||||
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -11,15 +14,23 @@ public class Cache {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@ApiModelProperty(notes = "The autogenerated CacheID (Primary Key)")
|
||||
private int id;
|
||||
|
||||
@ApiModelProperty(notes = "The name of the Cache")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(notes = "The Description of the Cache")
|
||||
private String description;
|
||||
|
||||
@ApiModelProperty(notes = "The number of ranking points the user gets fro completing the cache")
|
||||
private int rankingPoints;
|
||||
|
||||
@OneToMany
|
||||
@ApiModelProperty(notes = "All stations included in the Cache")
|
||||
private List<Station> stationen = new ArrayList<>();
|
||||
|
||||
@ApiModelProperty(notes = "The Reward for the Cache")
|
||||
@ManyToOne (cascade = {CascadeType.ALL})
|
||||
private Reward reward;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user