Add frontend.

This commit is contained in:
Florian THIERRY
2021-07-31 12:26:51 +02:00
parent ef04d3dbea
commit c281df00c7
56 changed files with 32276 additions and 1 deletions

View File

@@ -0,0 +1,28 @@
package org.takiguchi.cerberus.cerberusapp.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.takiguchi.cerberus.cerberusapp.model.ReferentialDataDTO;
import org.takiguchi.cerberus.cerberusapp.model.ServiceType;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static org.takiguchi.cerberus.cerberusapp.model.ReferentialDataDTO.aReferentialData;
@RestController
@RequestMapping("/api/referentialData")
public class ReferentialDataController {
@GetMapping("/serviceTypes")
public List<ReferentialDataDTO> getServiceTypes() {
return Stream.of(ServiceType.values())
.map(type -> aReferentialData()
.withValue(type.name())
.withLabel(type.name().toLowerCase())
.build()
)
.collect(Collectors.toList());
}
}

View File

@@ -0,0 +1,45 @@
package org.takiguchi.cerberus.cerberusapp.model;
public class ReferentialDataDTO {
private final String value;
private final String label;
private ReferentialDataDTO(String value, String label) {
this.value = value;
this.label = label;
}
public static Builder aReferentialData() {
return new Builder();
}
public String getValue() {
return value;
}
public String getLabel() {
return label;
}
public static class Builder {
private String value;
private String label;
private Builder() {
}
public Builder withValue(String value) {
this.value = value;
return this;
}
public Builder withLabel(String label) {
this.label = label;
return this;
}
public ReferentialDataDTO build() {
return new ReferentialDataDTO(value, label);
}
}
}

View File

@@ -12,4 +12,10 @@ spring:
driverClassName: org.postgresql.Driver
url: jdbc:postgresql://localhost:50001/cerberus
username: h23
password: P@ssword1
password: P@ssword1
# Disable feature detection by this undocumented parameter.
# Check the org.hibernate.engine.jdbc.internal.JdbcServiceImpl.configure method for more details.
jpa:
database-platform: org.hibernate.dialect.PostgreSQLDialect
properties.hibernate.temp.use_jdbc_metadata_defaults: false
open-in-view: false