Harry de Boer 6 роки тому
коміт
df1bf55de1

+ 3 - 0
.gitignore

@@ -0,0 +1,3 @@
+.idea
+*.iml
+target

+ 47 - 0
pom.xml

@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>summercamp</groupId>
+    <artifactId>puzzeltocht</artifactId>
+    <version>1.0-SNAPSHOT</version>
+
+    <parent>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>2.0.5.RELEASE</version>
+    </parent>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.jayway.jsonpath</groupId>
+            <artifactId>json-path</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <properties>
+        <java.version>1.8</java.version>
+    </properties>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 12 - 0
src/main/java/puzzeltocht/Application.java

@@ -0,0 +1,12 @@
+package puzzeltocht;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class Application {
+
+    public static void main(String[] args) {
+        SpringApplication.run(Application.class, args);
+    }
+}

+ 37 - 0
src/main/java/puzzeltocht/controller/RouteController.java

@@ -0,0 +1,37 @@
+package puzzeltocht.controller;
+
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+import puzzeltocht.dto.Event;
+import puzzeltocht.dto.EventType;
+import puzzeltocht.dto.Location;
+
+import java.util.Collections;
+import java.util.List;
+
+@RestController
+@RequestMapping("api")
+public class RouteController {
+
+    @RequestMapping(method = RequestMethod.GET, path ="route")
+    public List<Long> routes() {
+        return Collections.singletonList(0L);
+    }
+
+    @RequestMapping(method = RequestMethod.GET, path ="route/{id}")
+    public ResponseEntity<Event> route(@PathVariable Long id) {
+        if (id != 0L) {
+            return ResponseEntity.badRequest().build();
+        }
+
+        Location loc = new Location(51.244640, 6.038359);
+        Event mockEvent = new Event(EventType.START, loc, "Welkom bij de Summercamp puzzeltocht!");
+
+        return new ResponseEntity<>(mockEvent, HttpStatus.OK);
+    }
+}
+

+ 25 - 0
src/main/java/puzzeltocht/dto/Event.java

@@ -0,0 +1,25 @@
+package puzzeltocht.dto;
+
+public class Event {
+    private EventType type;
+    private Location location;
+    private String description;
+
+    public Event(EventType type, Location location, String description) {
+        this.type = type;
+        this.location = location;
+        this.description = description;
+    }
+
+    public EventType getType() {
+        return type;
+    }
+
+    public Location getLocation() {
+        return location;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+}

+ 5 - 0
src/main/java/puzzeltocht/dto/EventType.java

@@ -0,0 +1,5 @@
+package puzzeltocht.dto;
+
+public enum EventType {
+    START
+}

+ 20 - 0
src/main/java/puzzeltocht/dto/Location.java

@@ -0,0 +1,20 @@
+package puzzeltocht.dto;
+
+public class Location {
+    private double longitude;
+    private double latitude;
+
+    public Location(double longitude, double latitude) {
+        this.longitude = longitude;
+        this.latitude = latitude;
+    }
+
+    public double getLongitude() {
+        return longitude;
+    }
+
+    public double getLatitude() {
+        return latitude;
+    }
+
+}