Compare commits
16 Commits
feature/Pr
...
Dev
Author | SHA1 | Date |
---|---|---|
|
c133ac27e1 | 1 year ago |
![]() |
c526cfd0ac | 1 year ago |
|
f1340fe6a7 | 1 year ago |
|
9b528b8e95 | 1 year ago |
|
e2cf019437 | 1 year ago |
![]() |
630a1c0813 | 1 year ago |
![]() |
1cd2e8d714 | 1 year ago |
![]() |
fce7c6d7e9 | 1 year ago |
|
194eff0552 | 1 year ago |
|
68a9aad682 | 1 year ago |
![]() |
dbad7174ec | 1 year ago |
|
808ccbc480 | 1 year ago |
|
c4f977c45a | 1 year ago |
|
0fa91cbf59 | 1 year ago |
|
08d705ea50 | 1 year ago |
|
004e52e0f6 | 1 year ago |
@ -0,0 +1,8 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$" />
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CompilerConfiguration">
|
||||||
|
<annotationProcessing>
|
||||||
|
<profile name="Maven default annotation processors profile" enabled="true">
|
||||||
|
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||||
|
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||||
|
<outputRelativeToContentRoot value="true" />
|
||||||
|
<module name="WebService" />
|
||||||
|
</profile>
|
||||||
|
</annotationProcessing>
|
||||||
|
</component>
|
||||||
|
<component name="JavacSettings">
|
||||||
|
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
|
||||||
|
<module name="WebService" options="-parameters" />
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding">
|
||||||
|
<file url="file://$PROJECT_DIR$/WebService/src/main/java" charset="UTF-8" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="RemoteRepositoriesConfiguration">
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Central Repository" />
|
||||||
|
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Maven Central repository" />
|
||||||
|
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="jboss.community" />
|
||||||
|
<option name="name" value="JBoss Community repository" />
|
||||||
|
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||||
|
</remote-repository>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="MavenProjectsManager">
|
||||||
|
<option name="originalFiles">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/WebService/pom.xml" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="liberica-17" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/Api_Rest_VWeb.iml" filepath="$PROJECT_DIR$/.idea/Api_Rest_VWeb.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,26 @@
|
|||||||
|
package SAE.ApiREST.WebService.Wrapper;
|
||||||
|
|
||||||
|
import SAE.ApiREST.WebService.model.Article;
|
||||||
|
import SAE.ApiREST.WebService.model.Collect;
|
||||||
|
|
||||||
|
public class ArticleCollect {
|
||||||
|
private Collect collection;
|
||||||
|
private Article article;
|
||||||
|
|
||||||
|
public ArticleCollect() {}
|
||||||
|
|
||||||
|
public ArticleCollect(Collect collection, Article article) {
|
||||||
|
this.collection = collection;
|
||||||
|
this.article = article;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Collect getCollection() {
|
||||||
|
return collection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Article getNewArticle() {
|
||||||
|
return article;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setters if necessary
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package SAE.ApiREST.WebService.Wrapper;
|
||||||
|
|
||||||
|
import SAE.ApiREST.WebService.model.Collect;
|
||||||
|
|
||||||
|
public class CollectionName {
|
||||||
|
private Collect collection;
|
||||||
|
private String newName;
|
||||||
|
|
||||||
|
public CollectionName() {}
|
||||||
|
|
||||||
|
public CollectionName(Collect collection, String newName) {
|
||||||
|
this.collection = collection;
|
||||||
|
this.newName = newName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Collect getCollection() {
|
||||||
|
return collection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNewName() {
|
||||||
|
return newName;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setters if necessary
|
||||||
|
}
|
@ -1,16 +1,240 @@
|
|||||||
package SAE.ApiREST.WebService.controller;
|
package SAE.ApiREST.WebService.controller;
|
||||||
|
|
||||||
|
import SAE.ApiREST.WebService.Wrapper.ArticleCollect;
|
||||||
|
import SAE.ApiREST.WebService.Wrapper.CollectionName;
|
||||||
|
import SAE.ApiREST.WebService.exception.ArticleException;
|
||||||
|
import SAE.ApiREST.WebService.exception.CollectException;
|
||||||
|
import SAE.ApiREST.WebService.model.Article;
|
||||||
|
import SAE.ApiREST.WebService.model.Collect;
|
||||||
|
import SAE.ApiREST.WebService.service.ICollectionService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.hateoas.CollectionModel;
|
||||||
|
import org.springframework.hateoas.EntityModel;
|
||||||
|
import org.springframework.hateoas.Link;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
||||||
|
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/CollectWebService")
|
@RequestMapping("/CollectWebService")
|
||||||
public class CollectController {
|
public class CollectController {
|
||||||
|
@Autowired
|
||||||
|
ICollectionService collectionService;
|
||||||
|
|
||||||
|
public CollectController() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// region Collection
|
||||||
|
|
||||||
|
// region GET
|
||||||
|
@GetMapping(value = "/getAllCollection", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public @ResponseBody List<Collect> getAllCollection(){
|
||||||
|
List<Collect> results = collectionService.getAllCollections();
|
||||||
|
if(results.isEmpty()) {
|
||||||
|
throw new CollectException("No collections available");
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
@GetMapping(value = "/getCollectionById/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public @ResponseBody EntityModel<Collect> getCollectionById(@PathVariable(value = "id") Integer id){
|
||||||
|
Collect results = collectionService.getCollectionById(id);
|
||||||
|
if(results == null) {
|
||||||
|
throw new CollectException("No collections available");
|
||||||
|
}
|
||||||
|
return EntityModel.of(results,
|
||||||
|
linkTo(methodOn(CollectController.class).getCollectionById(id)).withSelfRel(),
|
||||||
|
linkTo(methodOn(CollectController.class).getAllArticlesById(id)
|
||||||
|
).withRel("getAllArticlesById"),
|
||||||
|
linkTo(methodOn(CollectController.class).deleteColletionById(id)
|
||||||
|
).withRel("deleteColletionById"),
|
||||||
|
linkTo(methodOn(CollectController.class).deleteAllColletionByName(results.getName())
|
||||||
|
).withRel("deleteAllColletionByName"),
|
||||||
|
linkTo(methodOn(CollectController.class).getAllCollection()
|
||||||
|
).withRel("getAllCollection"));
|
||||||
|
}
|
||||||
|
@GetMapping(value = "/getAllCollectionsByName/{name}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public @ResponseBody CollectionModel<EntityModel<Collect>> getAllCollectionsByName(@PathVariable(value = "name") String name){
|
||||||
|
List<Collect> results = collectionService.getAllCollectionsByName(name);
|
||||||
|
if(results.isEmpty()) {
|
||||||
|
throw new CollectException("No collections available");
|
||||||
|
}
|
||||||
|
List<EntityModel<Collect>> collectModels = results.stream()
|
||||||
|
.map(collect -> EntityModel.of(collect,
|
||||||
|
linkTo(methodOn(CollectController.class).getAllCollectionsByName(name)).withSelfRel(),
|
||||||
|
linkTo(methodOn(CollectController.class).getAllCollection()
|
||||||
|
).withRel("getAllCollection")))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return CollectionModel.of(collectModels);
|
||||||
|
}
|
||||||
|
// endregion
|
||||||
|
|
||||||
|
// region DELETE
|
||||||
|
@DeleteMapping(value = "/deleteColletionById/{id}")
|
||||||
|
public @ResponseBody EntityModel<Link> deleteColletionById(@PathVariable("id") Integer id){
|
||||||
|
if(!collectionService.deleteColletionById(id)) {
|
||||||
|
throw new CollectException("No collections available");
|
||||||
|
}
|
||||||
|
return EntityModel.of(linkTo(methodOn(CollectController.class).getAllCollection()
|
||||||
|
).withRel("getAllCollection"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping(value = "/deleteColletionByName/{name}")
|
||||||
|
public @ResponseBody EntityModel<Link> deleteColletionByName(@PathVariable("name") String name){
|
||||||
|
if(!collectionService.deleteColletionByName(name)) {
|
||||||
|
throw new CollectException("No collections available");
|
||||||
|
}
|
||||||
|
return EntityModel.of(linkTo(methodOn(CollectController.class).getAllCollection()
|
||||||
|
).withRel("getAllCollection"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping(value = "/deleteAllColletionByName/{name}")
|
||||||
|
public @ResponseBody EntityModel<Link> deleteAllColletionByName(@PathVariable("name") String name){
|
||||||
|
if(!collectionService.deleteAllColletionByName(name)) {
|
||||||
|
throw new CollectException("No collections available");
|
||||||
|
}
|
||||||
|
return EntityModel.of(linkTo(methodOn(CollectController.class).getAllCollection()
|
||||||
|
).withRel("getAllCollection"));
|
||||||
|
}
|
||||||
|
// endregion
|
||||||
|
|
||||||
|
// region PUT
|
||||||
|
@PutMapping(value = "/addCollection")
|
||||||
|
public @ResponseBody EntityModel<Collect> addCollection(@RequestBody Collect collection){
|
||||||
|
Collect results = collectionService.addCollection(collection);
|
||||||
|
return EntityModel.of(results,
|
||||||
|
linkTo(methodOn(CollectController.class).getCollectionById(results.getId())).withSelfRel(),
|
||||||
|
linkTo(methodOn(CollectController.class).getAllArticlesById(results.getId())
|
||||||
|
).withRel("getAllArticlesById"),
|
||||||
|
linkTo(methodOn(CollectController.class).deleteColletionById(results.getId())
|
||||||
|
).withRel("deleteColletionById"),
|
||||||
|
linkTo(methodOn(CollectController.class).deleteAllColletionByName(results.getName())
|
||||||
|
).withRel("deleteAllColletionByName"),
|
||||||
|
linkTo(methodOn(CollectController.class).getAllCollection()
|
||||||
|
).withRel("getAllCollection"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PutMapping(value = "/addCollections")
|
||||||
|
public @ResponseBody CollectionModel<EntityModel<Collect>> addCollections(@RequestBody List<Collect> collections){
|
||||||
|
List<Collect> results = collectionService.addCollections(collections);
|
||||||
|
List<EntityModel<Collect>> collectModels = results.stream()
|
||||||
|
.map(collect -> EntityModel.of(collect,
|
||||||
|
linkTo(methodOn(CollectController.class).getAllCollection()).withRel("getAllCollection")))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return CollectionModel.of(collectModels);
|
||||||
|
}
|
||||||
|
// endregion
|
||||||
|
|
||||||
|
// region POST
|
||||||
|
@PostMapping(value="/modifyCollectionName", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public @ResponseBody EntityModel<Collect> modifyCollectionName(@RequestBody CollectionName request) {
|
||||||
|
String newName = request.getNewName();
|
||||||
|
Collect collection = request.getCollection();
|
||||||
|
|
||||||
|
if(collection == null) {
|
||||||
|
throw new ArticleException("No articles available");
|
||||||
|
}
|
||||||
|
Collect results = collectionService.modifyCollectionName(collection, newName);
|
||||||
|
|
||||||
|
// Assuming your modification logic here
|
||||||
|
|
||||||
|
return EntityModel.of(results,
|
||||||
|
linkTo(methodOn(CollectController.class).getCollectionById(results.getId())).withSelfRel(),
|
||||||
|
linkTo(methodOn(CollectController.class).getAllArticlesById(results.getId())).withRel("getAllArticlesById"),
|
||||||
|
linkTo(methodOn(CollectController.class).deleteColletionById(results.getId())).withRel("deleteColletionById"),
|
||||||
|
linkTo(methodOn(CollectController.class).deleteAllColletionByName(results.getName())).withRel("deleteAllColletionByName"),
|
||||||
|
linkTo(methodOn(CollectController.class).getAllCollection()).withRel("getAllCollection"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping(value="/modifyCollectionNameById/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public @ResponseBody EntityModel<Collect> modifyCollectionNameById(@PathVariable("id") Integer id, @RequestBody String name){
|
||||||
|
Collect results = collectionService.modifyCollectionNameById(id,name);
|
||||||
|
return EntityModel.of(results,
|
||||||
|
linkTo(methodOn(CollectController.class).getCollectionById(id)).withSelfRel(),
|
||||||
|
linkTo(methodOn(CollectController.class).getAllArticlesById(id)
|
||||||
|
).withRel("getAllArticlesById"),
|
||||||
|
linkTo(methodOn(CollectController.class).deleteColletionById(id)
|
||||||
|
).withRel("deleteColletionById"),
|
||||||
|
linkTo(methodOn(CollectController.class).deleteAllColletionByName(results.getName())
|
||||||
|
).withRel("deleteAllColletionByName"),
|
||||||
|
linkTo(methodOn(CollectController.class).getAllCollection()
|
||||||
|
).withRel("getAllCollection"));
|
||||||
|
}
|
||||||
|
// endregion
|
||||||
|
// endregion
|
||||||
|
|
||||||
|
// region Article
|
||||||
|
@GetMapping(value = "/getAllArticlesById/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public @ResponseBody CollectionModel<EntityModel<Article>> getAllArticlesById(@PathVariable(value = "id") Integer id){
|
||||||
|
List<Article> results = collectionService.getAllArticlesById(id);
|
||||||
|
if(results == null) {
|
||||||
|
throw new ArticleException("No articles available");
|
||||||
|
}
|
||||||
|
List<EntityModel<Article>> collectModels = results.stream()
|
||||||
|
.map(collect -> EntityModel.of(collect,
|
||||||
|
linkTo(methodOn(CollectController.class).getCollectionById(id)).withRel("getCollection"),
|
||||||
|
linkTo(methodOn(CollectController.class).getAllCollection()).withRel("getAllCollection")))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return CollectionModel.of(collectModels);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping(value = "/addArticle", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public @ResponseBody EntityModel<Article> addArticle(@RequestBody ArticleCollect request) {
|
||||||
|
Article article = request.getNewArticle();
|
||||||
|
Collect collection = request.getCollection();
|
||||||
|
|
||||||
|
if(article == null) {
|
||||||
|
throw new ArticleException("Invalid article");
|
||||||
|
}
|
||||||
|
if(collection == null) {
|
||||||
|
throw new CollectException("No articles available");
|
||||||
|
}
|
||||||
|
Collect results = collectionService.addArticle(collection,article);
|
||||||
|
Article art = results.getAllArticles().get(results.getAllArticles().indexOf(article));
|
||||||
|
|
||||||
|
return EntityModel.of(art,
|
||||||
|
linkTo(methodOn(CollectController.class).getCollectionById(results.getId())).withSelfRel(),
|
||||||
|
linkTo(methodOn(TeacherController.class).getTeachById(results.getTeacher().getId())).withSelfRel(),
|
||||||
|
linkTo(methodOn(ArticleControler.class).getArticleById(art.getId())).withSelfRel(),
|
||||||
|
linkTo(methodOn(CollectController.class).getAllArticlesById(results.getId())
|
||||||
|
).withRel("getAllArticlesById"),
|
||||||
|
linkTo(methodOn(CollectController.class).deleteColletionById(results.getId())
|
||||||
|
).withRel("deleteColletionById"),
|
||||||
|
linkTo(methodOn(CollectController.class).deleteAllColletionByName(results.getName())
|
||||||
|
).withRel("deleteAllColletionByName"),
|
||||||
|
linkTo(methodOn(CollectController.class).getAllCollection()
|
||||||
|
).withRel("getAllCollection"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping(value = "/deleteArticle", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public @ResponseBody EntityModel<Collect> deleteArticle(@RequestBody ArticleCollect request) {
|
||||||
|
Article article = request.getNewArticle();
|
||||||
|
Collect collection = request.getCollection();
|
||||||
|
|
||||||
|
if(article == null) {
|
||||||
|
throw new ArticleException("Invalid article");
|
||||||
|
}
|
||||||
|
if(collection == null) {
|
||||||
|
throw new CollectException("No articles available");
|
||||||
|
}
|
||||||
|
Collect results = collectionService.deleteArticle(collection,article);
|
||||||
|
return EntityModel.of(results,
|
||||||
|
linkTo(methodOn(CollectController.class).getCollectionById(results.getId())).withSelfRel(),
|
||||||
|
linkTo(methodOn(CollectController.class).getAllArticlesById(results.getId())
|
||||||
|
).withRel("getAllArticlesById"),
|
||||||
|
linkTo(methodOn(CollectController.class).deleteColletionById(results.getId())
|
||||||
|
).withRel("deleteColletionById"),
|
||||||
|
linkTo(methodOn(CollectController.class).deleteAllColletionByName(results.getName())
|
||||||
|
).withRel("deleteAllColletionByName"),
|
||||||
|
linkTo(methodOn(CollectController.class).getAllCollection()
|
||||||
|
).withRel("getAllCollection"));
|
||||||
|
}
|
||||||
|
// endregion
|
||||||
|
}
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
package SAE.ApiREST.WebService.exception;
|
||||||
|
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||||
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||||
|
|
||||||
|
@ControllerAdvice
|
||||||
|
public class CollectAdvice {
|
||||||
|
@ResponseBody
|
||||||
|
@ExceptionHandler(CollectException.class)
|
||||||
|
@ResponseStatus(HttpStatus.NOT_FOUND)
|
||||||
|
String collectHandler(CollectException ex) {
|
||||||
|
return ex.getMessage();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package SAE.ApiREST.WebService.exception;
|
||||||
|
|
||||||
|
public class CollectException extends RuntimeException {
|
||||||
|
public CollectException(String exception) {
|
||||||
|
super(exception);
|
||||||
|
}
|
||||||
|
}
|
@ -1,26 +1,82 @@
|
|||||||
package SAE.ApiREST.WebService.model;
|
package SAE.ApiREST.WebService.model;
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import lombok.*;
|
|
||||||
import org.hibernate.annotations.Cascade;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@Builder
|
|
||||||
public class Collect {
|
public class Collect {
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy= GenerationType.AUTO)
|
@GeneratedValue(strategy=GenerationType.AUTO)
|
||||||
private final long isbn = 0;
|
private Integer id;
|
||||||
|
@Column(name = "articles")
|
||||||
@JoinColumn(name = "articles") @OneToMany(cascade = CascadeType.DETACH)
|
|
||||||
private ArrayList<Article> articles;
|
private ArrayList<Article> articles;
|
||||||
@Column(name = "name")
|
@Column(name = "name")
|
||||||
private String name;
|
private String name;
|
||||||
@JoinColumn(name = "teacher") @ManyToOne
|
@Column(name = "teacher")
|
||||||
private Teacher teacher;
|
private Teacher teacher;
|
||||||
|
|
||||||
|
public Collect() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Collect(String name, Teacher teacher){
|
||||||
|
this.name = name;
|
||||||
|
this.teacher = teacher;
|
||||||
|
this.articles = new ArrayList<Article>();
|
||||||
|
}
|
||||||
|
public Collect(String name, Teacher teacher, Integer id){
|
||||||
|
this.name = name;
|
||||||
|
this.teacher = teacher;
|
||||||
|
this.articles = new ArrayList<Article>();
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
// region Article
|
||||||
|
public Integer getId(){
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
// endregion
|
||||||
|
|
||||||
|
// region Article
|
||||||
|
public List<Article> getAllArticles(){
|
||||||
|
return articles;
|
||||||
|
}
|
||||||
|
|
||||||
|
// region addArticle
|
||||||
|
public void addArticle(Article article){
|
||||||
|
if(!this.articles.contains(article)){
|
||||||
|
this.articles.add(article);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void addArticles(List<Article> articles){
|
||||||
|
for(Article article : articles){
|
||||||
|
addArticle(article);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// endregion
|
||||||
|
|
||||||
|
// region removeArticle
|
||||||
|
public void removeArticle(Article article){
|
||||||
|
this.articles.remove(article);
|
||||||
|
}
|
||||||
|
public void removeArticles(List<Article> articles){
|
||||||
|
this.articles.removeAll(articles);
|
||||||
|
}
|
||||||
|
// endregion
|
||||||
|
// endregion
|
||||||
|
|
||||||
|
// region name
|
||||||
|
public String getName(){
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
public void setName(String name){
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
// endregion
|
||||||
|
|
||||||
|
// region teacher
|
||||||
|
public Teacher getTeacher(){
|
||||||
|
return teacher;
|
||||||
|
}
|
||||||
|
// endregion
|
||||||
}
|
}
|
@ -1,23 +1,59 @@
|
|||||||
package SAE.ApiREST.WebService.model;
|
package SAE.ApiREST.WebService.model;
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.Entity;
|
||||||
import lombok.*;
|
import jakarta.persistence.Id;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@Builder
|
|
||||||
|
|
||||||
public class Teacher {
|
public class Teacher {
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
|
||||||
private Integer id;
|
private Integer id;
|
||||||
private LocalDate date;
|
private LocalDate date;
|
||||||
private String mail;
|
private String mail;
|
||||||
private String username;
|
private String username;
|
||||||
|
|
||||||
|
public Teacher() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Teacher(Integer id, String date, String mail, String username) {
|
||||||
|
this.id = id;
|
||||||
|
this.date = LocalDate.parse(date, DateTimeFormatter.ofPattern("dd-MM-yyyy"));
|
||||||
|
this.mail = mail;
|
||||||
|
this.username = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDate getDate() {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDate(String date) {
|
||||||
|
this.date = LocalDate.parse(date, DateTimeFormatter.ofPattern("dd-MM-yyyy"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMail() {
|
||||||
|
return mail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMail(String mail) {
|
||||||
|
this.mail = mail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUsername() {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsername(String username) {
|
||||||
|
this.username = username;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
package SAE.ApiREST.WebService.repository;
|
|
||||||
|
|
||||||
public interface IArticleRepository {
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
package SAE.ApiREST.WebService.repository;
|
|
||||||
|
|
||||||
public interface ICollectRepository {
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
package SAE.ApiREST.WebService.repository;
|
|
||||||
|
|
||||||
import SAE.ApiREST.WebService.model.Teacher;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Repository
|
|
||||||
public interface ITeacherRepository extends JpaRepository< Teacher, Integer> {
|
|
||||||
|
|
||||||
|
|
||||||
Teacher findByusername(String username);
|
|
||||||
|
|
||||||
Teacher findBymail(String mail);
|
|
||||||
|
|
||||||
}
|
|
@ -0,0 +1,17 @@
|
|||||||
|
package SAE.ApiREST.WebService.service;
|
||||||
|
|
||||||
|
import SAE.ApiREST.WebService.Response;
|
||||||
|
import SAE.ApiREST.WebService.model.Teacher;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ITeacherService {
|
||||||
|
public List<Teacher> getAllTeacher();
|
||||||
|
public Teacher getTeacherById(Integer id);
|
||||||
|
public Teacher getTeacherByUsername(String username);
|
||||||
|
public Teacher getTeacherByMail(String mail);
|
||||||
|
public Teacher getTeacherByDate(String date);
|
||||||
|
public List<Teacher> addTeacher(Teacher t);
|
||||||
|
public List<Teacher> deleteTeacher(Integer id);
|
||||||
|
public Response modifyUsername(Teacher t, String newUsername);
|
||||||
|
}
|
@ -1,92 +1,150 @@
|
|||||||
package SAE.ApiREST.WebService.service;
|
package SAE.ApiREST.WebService.service;
|
||||||
import SAE.ApiREST.WebService.controller.ArticleControler;
|
|
||||||
import SAE.ApiREST.WebService.model.Collect;
|
import SAE.ApiREST.WebService.model.Collect;
|
||||||
|
import SAE.ApiREST.WebService.model.Teacher;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import SAE.ApiREST.WebService.model.Article;
|
import SAE.ApiREST.WebService.model.Article;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class StubCollectionService implements ICollectionService {
|
public class StubCollectionService implements ICollectionService {
|
||||||
private ArrayList<Collect> collections;
|
private List<Collect> collects = new ArrayList<>();
|
||||||
|
|
||||||
|
public StubCollectionService(){
|
||||||
|
this.collects.add(new Collect("collect1", new Teacher(1, "12-03-2023", "aline.alipres@gmail.com", "MsGarconManque"),0));
|
||||||
|
|
||||||
|
Collect collection2 = new Collect("collect2", new Teacher(1, "12-03-2023", "aline.alipres@gmail.com", "MsGarconManque"),1);
|
||||||
|
collection2.addArticle(new Article("toi","azezeaea", LocalDate.now().minusMonths(1),LocalDate.now().minusMonths(2),true,1));
|
||||||
|
this.collects.add(collection2);
|
||||||
|
|
||||||
|
Collect collection3 = new Collect("collect3", new Teacher(1, "12-03-2023", "aline.alipres@gmail.com", "MsGarconManque"),3);
|
||||||
|
collection3.addArticle(new Article("toi","azezeaea",LocalDate.now().minusMonths(1),LocalDate.now().minusMonths(2),true,1));
|
||||||
|
collection3.addArticle(new Article("toi","azezeaea",LocalDate.now().minusMonths(1),LocalDate.now().minusMonths(2),true,1));
|
||||||
|
this.collects.add(collection3);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<Collect> getAllCollections() {
|
public List<Collect> getAllCollections() {
|
||||||
return this.collections;
|
return collects;
|
||||||
}
|
}
|
||||||
|
|
||||||
// region Collection
|
// region Collection
|
||||||
|
|
||||||
// region GET
|
// region GET
|
||||||
public Collect getCollectionById(long isbn){
|
@Override
|
||||||
for(Collect collection : this.collections){
|
public Collect getCollectionById(Integer id){
|
||||||
if(collection.getIsbn() == isbn) {
|
try {
|
||||||
return collection;
|
return collects.get(id);
|
||||||
}
|
}catch (Exception e){
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<Collect> getAllCollectionsByName(String name){
|
public List<Collect> getAllCollectionsByName(String name){
|
||||||
ArrayList<Collect> repCollections = new ArrayList<Collect>();
|
ArrayList<Collect> repCollections = new ArrayList<Collect>();
|
||||||
for(Collect collection : this.collections){
|
for(Collect collection : collects){
|
||||||
if(collection.getName() == name) {
|
if(Objects.equals(collection.getName(), name)) {
|
||||||
repCollections.add(collection);
|
repCollections.add(collection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return repCollections;
|
return repCollections;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collect getCollection(Collect collect){
|
||||||
|
return getCollectionById(collect.getId());
|
||||||
|
}
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
// region DELETE
|
// region DELETE
|
||||||
public void deleteColletionById(long isbn){
|
@Override
|
||||||
Collect collection = getCollectionById(isbn);
|
public boolean deleteColletionById(Integer id){
|
||||||
this.collections.remove(collection);
|
Collect collection = getCollectionById(id);
|
||||||
|
if (collection != null) {
|
||||||
|
collects.remove(collection);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteColletionByName(String name){
|
@Override
|
||||||
|
public boolean deleteColletionByName(String name){
|
||||||
List<Collect> collectionsByName = getAllCollectionsByName(name);
|
List<Collect> collectionsByName = getAllCollectionsByName(name);
|
||||||
this.collections.remove(collectionsByName.get(0));
|
if (!collectionsByName.isEmpty()) {
|
||||||
|
collects.remove(collectionsByName.get(0));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
public void deleteAllColletionByName(String name){
|
|
||||||
|
@Override
|
||||||
|
public boolean deleteAllColletionByName(String name){
|
||||||
List<Collect> collectionsByName = getAllCollectionsByName(name);
|
List<Collect> collectionsByName = getAllCollectionsByName(name);
|
||||||
this.collections.removeAll(collectionsByName);
|
if (!collectionsByName.isEmpty()) {
|
||||||
|
collects.removeAll(collectionsByName);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCollection(Collect collection) {
|
public Collect addCollection(Collect collection) {
|
||||||
this.collections.add(collection);
|
collects.add(collection);
|
||||||
|
return collects.get(collects.lastIndexOf(collection));
|
||||||
}
|
}
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
// region PUT
|
// region PUT
|
||||||
public void addCollections(List<Collect> collections){
|
@Override
|
||||||
this.collections.addAll(collections);
|
public List<Collect> addCollections(List<Collect> collections){
|
||||||
|
collects.addAll(collections);
|
||||||
|
return collects;
|
||||||
}
|
}
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
// region POST
|
// region POST
|
||||||
public void modifyCollectionName(Collect collection, String name){
|
@Override
|
||||||
collection.setName(name);
|
public Collect modifyCollectionName(Collect collection, String name){
|
||||||
}
|
Collect collect = getCollectionById(collection.getId());
|
||||||
public void modifyCollectionNameById(long isbn, String name){
|
collect.setName(name);
|
||||||
Collect collection = getCollectionById(isbn);
|
return collect;
|
||||||
modifyCollectionName(collection,name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collect modifyCollectionNameById(Integer id, String name){
|
||||||
|
Collect collect = getCollectionById(id);
|
||||||
|
collect.setName(name);
|
||||||
|
return collect;
|
||||||
|
}
|
||||||
// endregion
|
// endregion
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
// region Article
|
// region Article
|
||||||
public List<Article> getAllArticles(Collect collect)
|
@Override
|
||||||
{
|
public List<Article> getAllArticlesById(Integer id){
|
||||||
return collect.getArticles();
|
Collect collect = getCollectionById(id);
|
||||||
|
List<Article> result = collect.getAllArticles();
|
||||||
|
if(!result.isEmpty()){
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
public void addArticle(Collect collect, Article article){
|
@Override
|
||||||
List<Article> lA = collect.getArticles();
|
public Collect addArticle(Collect collect, Article article){
|
||||||
lA.add(article);
|
Collect collection = getCollectionById(collect.getId());
|
||||||
collect.setArticles((ArrayList<Article>) lA);
|
collection.addArticle(article);
|
||||||
|
return collection;
|
||||||
}
|
}
|
||||||
public void deleteArticle(Collect collect, Article article){
|
@Override
|
||||||
collect.getArticles().remove(article);
|
public Collect deleteArticle(Collect collect, Article article){
|
||||||
|
Collect collection = getCollectionById(collect.getId());
|
||||||
|
collection.removeArticle(article);
|
||||||
|
return collection;
|
||||||
}
|
}
|
||||||
|
// endregion
|
||||||
}
|
}
|
@ -1,77 +0,0 @@
|
|||||||
package SAE.ApiREST.WebService.service;
|
|
||||||
|
|
||||||
import SAE.ApiREST.WebService.Response;
|
|
||||||
import SAE.ApiREST.WebService.model.Teacher;
|
|
||||||
import SAE.ApiREST.WebService.repository.ITeacherRepository;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class TeacherService {
|
|
||||||
|
|
||||||
|
|
||||||
private final ITeacherRepository teachRep;
|
|
||||||
|
|
||||||
|
|
||||||
public TeacherService(ITeacherRepository teachRep) {
|
|
||||||
|
|
||||||
this.teachRep = teachRep;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public List<Teacher> getAllTeacher() {
|
|
||||||
return teachRep.findAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public Teacher getTeacherById(Integer id) {
|
|
||||||
return teachRep.getReferenceById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public Teacher getTeacherByUsername(String username) {
|
|
||||||
return teachRep.findByusername(username);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public Teacher getTeacherByMail(String mail) {
|
|
||||||
return teachRep.findBymail(mail);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
public Teacher getTeacherByDate(String date) {
|
|
||||||
LocalDate d = LocalDate.parse(date, DateTimeFormatter.ofPattern("dd-MM-yyyy"));
|
|
||||||
return teachRep.findByDate(d);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
public List<Teacher> addTeacher(Teacher t) {
|
|
||||||
List<Teacher> lT = getAllTeacher();
|
|
||||||
lT.add(t);
|
|
||||||
return lT;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public List<Teacher> deleteTeacher(Integer id) {
|
|
||||||
List<Teacher> lT = getAllTeacher();
|
|
||||||
lT.remove(getTeacherById(id));
|
|
||||||
return lT;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public Response modifyUsername(Teacher t, String newUsername) {
|
|
||||||
t.setUsername(newUsername);
|
|
||||||
return new Response(t.getId(), String.format("Username changed for {id}", t.getId()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,69 @@
|
|||||||
|
package SAE.ApiREST.WebService.service;
|
||||||
|
|
||||||
|
import SAE.ApiREST.WebService.Response;
|
||||||
|
import SAE.ApiREST.WebService.exception.TeacherException;
|
||||||
|
import SAE.ApiREST.WebService.model.Teacher;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class TeacherServiceStub implements ITeacherService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Teacher> getAllTeacher() {
|
||||||
|
List<Teacher> allTeacher = new ArrayList<Teacher>();
|
||||||
|
|
||||||
|
allTeacher.add(new Teacher(1, "12-01-2023", "aline.alipres@gmail.com", "MsGarconManque"));
|
||||||
|
allTeacher.add(new Teacher(2, "20-08-2023", "Viviane.Delvecchio@gmail.com", "MmeMath"));
|
||||||
|
|
||||||
|
return allTeacher;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Teacher getTeacherById(Integer id) {
|
||||||
|
return new Teacher(id, "10-01-2021", "exemple.gmail.com", "testest");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Teacher getTeacherByUsername(String username) { return new Teacher(12, "30-08-2020", "dadadou@gmail.com", username); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Teacher getTeacherByMail(String mail) {
|
||||||
|
return new Teacher(20, "24-12-2021", mail, "tructruc");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Teacher getTeacherByDate(String date) {
|
||||||
|
return new Teacher(5, date, "doudouda@gmail.com", "username");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Teacher> addTeacher(Teacher t) {
|
||||||
|
List<Teacher> lteach = new ArrayList<Teacher>();
|
||||||
|
lteach.add(t);
|
||||||
|
return lteach;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Teacher> deleteTeacher(Integer id) {
|
||||||
|
List<Teacher> allTeacher = new ArrayList<Teacher>();
|
||||||
|
|
||||||
|
allTeacher.add(new Teacher(1,"12-01-2023", "aline.alipres@gmail.com", "MsGarconManque"));
|
||||||
|
allTeacher.add(new Teacher(2, "20-08-2023", "Viviane.Delvecchio@gmail.com", "MmeMath"));
|
||||||
|
|
||||||
|
if(allTeacher.remove(getTeacherById(id))){
|
||||||
|
return allTeacher;
|
||||||
|
} else {
|
||||||
|
throw new TeacherException(String.format("Teacher {id} isn't removed", id));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Response modifyUsername(Teacher t, String newUsername){
|
||||||
|
t.setUsername(newUsername);
|
||||||
|
return new Response(t.getId(),String.format("This user %s has changed username", t.getMail()));
|
||||||
|
}
|
||||||
|
}
|
@ -1,24 +1 @@
|
|||||||
/*
|
|
||||||
#Todo adapter a une de nos BD choisir le langage bd
|
|
||||||
spring.datasource.url=nomBD:mysql://localhost:8889/XXXXXX?createDatabaseIfNotExist=true
|
|
||||||
spring.datasource.username=test
|
|
||||||
spring.datasource.password=test
|
|
||||||
|
|
||||||
spring.jpa.open-in-view=false
|
|
||||||
|
|
||||||
|
|
||||||
# Hibernate properties
|
|
||||||
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect
|
|
||||||
spring.jpa.hibernate.ddl-auto=update
|
|
||||||
spring.jpa.generate-ddl=true
|
|
||||||
#spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
|
|
||||||
# Logging SQL statements (optional, but useful for debugging)
|
|
||||||
spring.jpa.show-sql=true
|
|
||||||
*/
|
|
||||||
|
|
||||||
spring.datasource.url=jdbc:h2:mem:testdb
|
|
||||||
spring.datasource.driverClassName=org.h2.Driver
|
|
||||||
spring.datasource.username=sa
|
|
||||||
spring.datasource.password=password
|
|
||||||
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
|
|
||||||
|
|
||||||
|
Loading…
Reference in new issue