diff --git a/src/main/java/org/hbp/mip/controllers/AppsApi.java b/src/main/java/org/hbp/mip/controllers/AppsApi.java new file mode 100644 index 0000000000000000000000000000000000000000..3e634bed527a61e78d5fec10e28475aaa0fa2c87 --- /dev/null +++ b/src/main/java/org/hbp/mip/controllers/AppsApi.java @@ -0,0 +1,37 @@ +/** + * Created by mirco on 20.05.16. + */ + +package org.hbp.mip.controllers; + +import io.swagger.annotations.*; +import org.hbp.mip.model.App; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.LinkedList; +import java.util.List; + +import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; + +@RestController +@RequestMapping(value = "/apps", produces = {APPLICATION_JSON_VALUE}) +@Api(value = "/apps", description = "the apps API") +public class AppsApi { + + @ApiOperation(value = "Get apps", response = App.class, responseContainer = "List") + @ApiResponses(value = { @ApiResponse(code = 200, message = "Success") }) + @RequestMapping(method = RequestMethod.GET) + public ResponseEntity<List> getApps( + @ApiParam(value = "Only ask own articles") @RequestParam(value = "own", required = false) Boolean own, + @ApiParam(value = "Only ask results matching status", allowableValues = "{values=[draft, published, closed]}") @RequestParam(value = "status", required = false) String status, + @ApiParam(value = "Only ask articles from own team") @RequestParam(value = "team", required = false) Boolean team + ) { + List<App> apps = new LinkedList<>(); + + return ResponseEntity.ok(apps); + } +} diff --git a/src/main/java/org/hbp/mip/model/App.java b/src/main/java/org/hbp/mip/model/App.java new file mode 100644 index 0000000000000000000000000000000000000000..b51cd69da6ac4cec0720862ac6c1e4d070369a50 --- /dev/null +++ b/src/main/java/org/hbp/mip/model/App.java @@ -0,0 +1,113 @@ +/** + * Created by mirco on 20.05.16. + */ + +package org.hbp.mip.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.annotations.ApiModel; + +import javax.persistence.*; + +@Entity +@Table(name = "`app`") +@ApiModel +@JsonInclude(JsonInclude.Include.NON_NULL) +public class App { + + @Id + @GeneratedValue + private Integer id; + private String name; + private String description; + private String author; + private String email; + private String category; + private String link; + private String image; + private Integer ratings; + private Integer ratings_count; + + public App() { + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getAuthor() { + return author; + } + + public void setAuthor(String author) { + this.author = author; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public String getLink() { + return link; + } + + public void setLink(String link) { + this.link = link; + } + + public String getImage() { + return image; + } + + public void setImage(String image) { + this.image = image; + } + + public Integer getRatings() { + return ratings; + } + + public void setRatings(Integer ratings) { + this.ratings = ratings; + } + + public Integer getRatings_count() { + return ratings_count; + } + + public void setRatings_count(Integer ratings_count) { + this.ratings_count = ratings_count; + } +} diff --git a/src/main/java/org/hbp/mip/model/Config.java b/src/main/java/org/hbp/mip/model/Config.java index e9572c666769287f1d42d853097f99a25fbc5da3..8dd7d80c2a36e2266960c3ed30db0a2d9cd68abb 100644 --- a/src/main/java/org/hbp/mip/model/Config.java +++ b/src/main/java/org/hbp/mip/model/Config.java @@ -20,7 +20,7 @@ import java.util.Map; public class Config { @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) + @GeneratedValue private Long id = null; private String type = null; diff --git a/src/main/java/org/hbp/mip/model/Filter.java b/src/main/java/org/hbp/mip/model/Filter.java index bf0c29b1e03dc4c5fceb14699f8ca091fa94488b..4dc26eeb604edd9ad5602267209e25507657c641 100644 --- a/src/main/java/org/hbp/mip/model/Filter.java +++ b/src/main/java/org/hbp/mip/model/Filter.java @@ -20,7 +20,7 @@ import java.util.List; public class Filter { @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) + @GeneratedValue private Long id = null; @ManyToOne diff --git a/src/main/java/org/hbp/mip/model/Query.java b/src/main/java/org/hbp/mip/model/Query.java index 1f57e36168071c0960edb7c1a52567aa628097aa..c92885964478076445ea26991e490ea8243d7954 100644 --- a/src/main/java/org/hbp/mip/model/Query.java +++ b/src/main/java/org/hbp/mip/model/Query.java @@ -21,7 +21,7 @@ import java.util.List; public class Query { @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) + @GeneratedValue private Long id = null; private String request = null; diff --git a/src/main/resources/hibernate.cfg.xml b/src/main/resources/hibernate.cfg.xml index b37c0788b0da91cd7ae7da601f120b529549441b..f6bf967ac5c5a89ffb4c3e6d089c15c29c82f96d 100644 --- a/src/main/resources/hibernate.cfg.xml +++ b/src/main/resources/hibernate.cfg.xml @@ -29,6 +29,7 @@ <mapping class="org.hbp.mip.model.Filter"/> <mapping class="org.hbp.mip.model.Group"/> <mapping class="org.hbp.mip.model.Config"/> + <mapping class="org.hbp.mip.model.App"/> </session-factory> </hibernate-configuration> diff --git a/src/test/db b/src/test/db index c356487b96c0e7ab555130688c84b647e294c63a..924d54ccf64c0282aea7ab13ea8c774b020092e3 160000 --- a/src/test/db +++ b/src/test/db @@ -1 +1 @@ -Subproject commit c356487b96c0e7ab555130688c84b647e294c63a +Subproject commit 924d54ccf64c0282aea7ab13ea8c774b020092e3