diff --git a/src/main/java/com/example/wfwebapi/controller/ImageController.java b/src/main/java/com/example/wfwebapi/controller/ImageController.java index 3a83838..e694de6 100644 --- a/src/main/java/com/example/wfwebapi/controller/ImageController.java +++ b/src/main/java/com/example/wfwebapi/controller/ImageController.java @@ -6,6 +6,8 @@ import com.example.wfwebapi.repository.ImageRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import java.util.List; + @RestController @RequestMapping("/api/v1/image") public class ImageController { @@ -19,6 +21,11 @@ public class ImageController { .orElseThrow(() -> new ResourceNotFoundException("Image non trouvée : " + id)); } + @GetMapping("/all") + public List getAllImages() { + return imageRepository.findAll(); + } + @PostMapping public Image createImage(@RequestBody Image image) { return imageRepository.save(image); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index e08706e..9cf39d8 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,25 +1 @@ -# Configuration de la base de données H2 (en mémoire) -spring.datasource.url=jdbc:h2:mem:testdb -spring.datasource.driverClassName=org.h2.Driver -spring.datasource.username=sa -spring.datasource.password= - -# Initialisation de la BDD avec le script -spring.sql.init.mode=always -spring.sql.init.schema-locations=classpath:init.sql - -# Configuration de JPA/Hibernate -spring.jpa.hibernate.ddl-auto=none -spring.jpa.show-sql=true -spring.jpa.properties.hibernate.format_sql=true - -# Console H2 pour le débogage -spring.h2.console.enabled=true -spring.h2.console.path=/h2-console - -# Port du serveur (filtré via Maven) -server.port=@server.port@ - -# (Optionnel) Niveaux de log pour SQL -logging.level.org.hibernate.SQL=DEBUG -logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE +spring.application.name=WF-WEB-API \ No newline at end of file