diff --git a/metadata-webimpl/pom.xml b/metadata-webimpl/pom.xml
index f0816c7..bc6e8dd 100644
--- a/metadata-webimpl/pom.xml
+++ b/metadata-webimpl/pom.xml
@@ -12,6 +12,7 @@
bibonne.exp.oas-cache
metadata-webimpl
0.0.1-SNAPSHOT
+ jar
21
@@ -54,6 +55,7 @@
+ metadata
org.apache.maven.plugins
@@ -61,6 +63,9 @@
true
true
+
+ 21
+ --enable-preview
diff --git a/metadata-webimpl/src/main/java/bibonne/exp/oascache/metadata/endpoints/CommuneEndpoint.java b/metadata-webimpl/src/main/java/bibonne/exp/oascache/metadata/endpoints/CommuneEndpoint.java
index 64a4eeb..d0ada0c 100644
--- a/metadata-webimpl/src/main/java/bibonne/exp/oascache/metadata/endpoints/CommuneEndpoint.java
+++ b/metadata-webimpl/src/main/java/bibonne/exp/oascache/metadata/endpoints/CommuneEndpoint.java
@@ -5,12 +5,14 @@
import bibonne.exp.oascache.metadata.internal.WebResponseBuilder;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Controller;
import java.time.LocalDate;
import java.util.List;
import java.util.Optional;
@RequiredArgsConstructor
+@Controller
public class CommuneEndpoint implements GeoCommuneApi {
private final WebResponseBuilder webResponseBuilder;
diff --git a/metadata-webimpl/src/main/java/bibonne/exp/oascache/metadata/endpoints/DepartementEndpoint.java b/metadata-webimpl/src/main/java/bibonne/exp/oascache/metadata/endpoints/DepartementEndpoint.java
new file mode 100644
index 0000000..c505894
--- /dev/null
+++ b/metadata-webimpl/src/main/java/bibonne/exp/oascache/metadata/endpoints/DepartementEndpoint.java
@@ -0,0 +1,31 @@
+package bibonne.exp.oascache.metadata.endpoints;
+
+import bibonne.exp.oascache.metadata.api.GeoDepartementApi;
+import bibonne.exp.oascache.metadata.api.model.Commune;
+import bibonne.exp.oascache.metadata.api.model.Departement;
+import bibonne.exp.oascache.metadata.api.model.TerritoireRef;
+import bibonne.exp.oascache.metadata.api.model.TypeEnum;
+import bibonne.exp.oascache.metadata.internal.WebResponseBuilder;
+import lombok.RequiredArgsConstructor;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Controller;
+
+import java.time.LocalDate;
+import java.util.List;
+import java.util.Optional;
+
+@RequiredArgsConstructor
+@Controller
+public class DepartementEndpoint implements GeoDepartementApi {
+ private final WebResponseBuilder webResponseBuilder;
+
+ @Override
+ public ResponseEntity getcogdep(String code, Optional date) throws Exception {
+ return this.webResponseBuilder.forFindByCodeQuery(Departement.class, code, date).asOneObjet();
+ }
+
+ @Override
+ public ResponseEntity> getcogdepdesc(String code, Optional date, Optional filtreNom, Optional type) throws Exception {
+ return this.webResponseBuilder.forFindDescQuery(Departement.class, code, date, TerritoireRef.class).asList();
+ }
+}
diff --git a/metadata-webimpl/src/main/java/bibonne/exp/oascache/metadata/internal/WebResponseBuilder.java b/metadata-webimpl/src/main/java/bibonne/exp/oascache/metadata/internal/WebResponseBuilder.java
index 71e4a24..d310ea4 100644
--- a/metadata-webimpl/src/main/java/bibonne/exp/oascache/metadata/internal/WebResponseBuilder.java
+++ b/metadata-webimpl/src/main/java/bibonne/exp/oascache/metadata/internal/WebResponseBuilder.java
@@ -1,7 +1,9 @@
package bibonne.exp.oascache.metadata.internal;
+import bibonne.exp.oascache.metadata.api.model.Departement;
import bibonne.exp.oascache.metadata.internal.queries.FindAllQuery;
import bibonne.exp.oascache.metadata.internal.queries.FindByCodeQuery;
+import bibonne.exp.oascache.metadata.internal.queries.FindDescQuery;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
@@ -19,6 +21,10 @@ public WebResponse forFindAllQuery(Class targetClass, Optional(this.queryExecutor.execute(FindAllQuery.INSTANCE.interpolate(targetClass.getSimpleName(), date)), targetClass, unmarshaller);
}
+ public WebResponse forFindDescQuery(Class sourceTerritory, String code, Optional date, Class targetClass) {
+ return new WebResponse<>(this.queryExecutor.execute(new FindDescQuery(sourceTerritory.getSimpleName()).interpolate(code, date)), targetClass, unmarshaller);
+ }
+
public record WebResponse(String queryResult, Class targetClass, Unmarshaller unmarshaller) {
public ResponseEntity asOneObjet() {
var entityToReturn=unmarshaller.unmarshal(queryResult, targetClass);