mirror of
https://gitea.gofwd.group/Forward_Group/ballistic-builder-spring.git
synced 2025-12-05 18:46:44 -05:00
lots of changes
This commit is contained in:
180
pom.xml
180
pom.xml
@@ -1,79 +1,113 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>3.4.3</version>
|
<version>3.4.3</version>
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>group.goforward</groupId>
|
<groupId>group.goforward</groupId>
|
||||||
<artifactId>ballistic</artifactId>
|
<artifactId>ballistic</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
<name>ballistic</name>
|
<name>ballistic</name>
|
||||||
<description>Ballistic Builder</description>
|
<description>Ballistic Builder API</description>
|
||||||
<url/>
|
<url/>
|
||||||
<licenses>
|
<licenses>
|
||||||
<license/>
|
<license/>
|
||||||
</licenses>
|
</licenses>
|
||||||
<developers>
|
<developers>
|
||||||
<developer/>
|
<developer>
|
||||||
</developers>
|
<name>Don Strawsburg</name>
|
||||||
<scm>
|
<email>don@goforward.group</email>
|
||||||
<connection/>
|
<organization>Forward Group, LLC</organization>
|
||||||
<developerConnection/>
|
</developer>
|
||||||
<tag/>
|
<developer>
|
||||||
<url/>
|
<name>Sean Strawsburg</name>
|
||||||
</scm>
|
<email>don@goforward.group</email>
|
||||||
<properties>
|
<organization>Forward Group, LLC</organization>
|
||||||
<java.version>17</java.version>
|
</developer>
|
||||||
</properties>
|
</developers>
|
||||||
<dependencies>
|
<scm>
|
||||||
<dependency>
|
<connection/>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<developerConnection/>
|
||||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
<tag/>
|
||||||
</dependency>
|
<url/>
|
||||||
<dependency>
|
</scm>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<properties>
|
||||||
<artifactId>spring-boot-starter-data-rest</artifactId>
|
<java.version>17</java.version>
|
||||||
</dependency>
|
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||||
<dependency>
|
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||||
<groupId>org.springframework.boot</groupId>
|
</properties>
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<dependencies>
|
||||||
</dependency>
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-rest</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-devtools</artifactId>
|
<artifactId>spring-boot-devtools</artifactId>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springdoc</groupId>
|
||||||
<artifactId>spring-boot-docker-compose</artifactId>
|
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||||
<scope>runtime</scope>
|
<version>2.8.5</version>
|
||||||
<optional>true</optional>
|
</dependency>
|
||||||
</dependency>-->
|
<!--<dependency>
|
||||||
<dependency>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<groupId>org.postgresql</groupId>
|
<artifactId>spring-boot-docker-compose</artifactId>
|
||||||
<artifactId>postgresql</artifactId>
|
<scope>runtime</scope>
|
||||||
<scope>runtime</scope>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>-->
|
||||||
<dependency>
|
<!-- Jakarta / validation API is pulled by starters; explicit jakarta persistence if needed -->
|
||||||
<groupId>org.springframework.boot</groupId>
|
<dependency>
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<groupId>jakarta.persistence</groupId>
|
||||||
<scope>test</scope>
|
<artifactId>jakarta.persistence-api</artifactId>
|
||||||
</dependency>
|
<version>3.1.0</version>
|
||||||
</dependencies>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.postgresql</groupId>
|
||||||
|
<artifactId>postgresql</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
</plugin>
|
<version>3.11.0</version>
|
||||||
</plugins>
|
<configuration>
|
||||||
</build>
|
<source>${maven.compiler.source}</source>
|
||||||
|
<target>${maven.compiler.target}</target>
|
||||||
|
<compilerArgs>
|
||||||
|
<arg>--enable-preview</arg>
|
||||||
|
</compilerArgs>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
70
src/main/java/group/goforward/ballistic/ApiResponse.java
Normal file
70
src/main/java/group/goforward/ballistic/ApiResponse.java
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
package group.goforward.ballistic;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
public class ApiResponse<T> {
|
||||||
|
|
||||||
|
private static final String API_SUCCESS = "success";
|
||||||
|
private static final String API_FAILURE = "failure";
|
||||||
|
private static final String API_ERROR = "error";
|
||||||
|
private String[] messages;
|
||||||
|
private T data;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private String status;
|
||||||
|
private LocalDateTime timestamp;
|
||||||
|
private ApiResponse(String status, String[] message, T data) {
|
||||||
|
this.status = status;
|
||||||
|
this.messages = message;
|
||||||
|
this.data = data;
|
||||||
|
this.timestamp = LocalDateTime.now();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> ApiResponse<T> success(T data, String message) {
|
||||||
|
String[] msg = {message};
|
||||||
|
return new ApiResponse<>(API_SUCCESS, msg, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> ApiResponse<T> success(T data) {
|
||||||
|
String[] msg = {};
|
||||||
|
return new ApiResponse<>(API_SUCCESS, msg, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> ApiResponse<T> error(String[] messages) {
|
||||||
|
return new ApiResponse<>(API_ERROR, messages, null);
|
||||||
|
}
|
||||||
|
public static <T> ApiResponse<T> error(String message) {
|
||||||
|
String[] msg = {};
|
||||||
|
return new ApiResponse<>(API_ERROR, msg, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getMessages() {
|
||||||
|
return messages;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessages(String[] messages) {
|
||||||
|
this.messages = messages;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T getData() {return data;}
|
||||||
|
public void setData(T data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(String status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDateTime getTimestamp() {
|
||||||
|
return timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTimestamp(LocalDateTime timestamp) {
|
||||||
|
this.timestamp = timestamp;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,15 @@ package group.goforward.ballistic;
|
|||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.domain.EntityScan;
|
||||||
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@EntityScan("group.goforward.ballistic.model")
|
||||||
|
@ComponentScan("group.goforward.ballistic.configuration")
|
||||||
|
@ComponentScan("group.goforward.ballistic.controllers")
|
||||||
|
@ComponentScan("group.goforward.ballistic.service")
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class BallisticApplication {
|
public class BallisticApplication {
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,84 @@
|
|||||||
|
// src/main/java/com/example/config/CorsConfig.java
|
||||||
|
package group.goforward.ballistic.configuration;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.cors.CorsConfiguration;
|
||||||
|
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||||
|
import org.springframework.web.filter.CorsFilter;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class CorsConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public CorsFilter corsFilter() {
|
||||||
|
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||||
|
CorsConfiguration config = new CorsConfiguration();
|
||||||
|
|
||||||
|
// Allow credentials
|
||||||
|
config.setAllowCredentials(true);
|
||||||
|
|
||||||
|
// Allow Angular development server
|
||||||
|
config.setAllowedOrigins(Arrays.asList(
|
||||||
|
"http://localhost:4200",
|
||||||
|
"http://localhost:4201",
|
||||||
|
"http://localhost:8070",
|
||||||
|
"https://localhost:8070",
|
||||||
|
"http://192.168.11.210:8070",
|
||||||
|
"https://192.168.11.210:8070",
|
||||||
|
"http://localhost:4200",
|
||||||
|
"http://citysites.gofwd.group",
|
||||||
|
"https://citysites.gofwd.group",
|
||||||
|
"http://citysites.gofwd.group:8070",
|
||||||
|
"https://citysites.gofwd.group:8070"
|
||||||
|
|
||||||
|
));
|
||||||
|
|
||||||
|
// Allow all headers
|
||||||
|
config.addAllowedHeader("*");
|
||||||
|
|
||||||
|
// Allow all HTTP methods
|
||||||
|
config.setAllowedMethods(Arrays.asList(
|
||||||
|
"GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"
|
||||||
|
));
|
||||||
|
|
||||||
|
// Expose headers
|
||||||
|
config.setExposedHeaders(Arrays.asList(
|
||||||
|
"Authorization",
|
||||||
|
"Content-Type",
|
||||||
|
"X-Total-Count"
|
||||||
|
));
|
||||||
|
|
||||||
|
// Max age for preflight cache (1 hour)
|
||||||
|
config.setMaxAge(3600L);
|
||||||
|
|
||||||
|
source.registerCorsConfiguration("/**", config);
|
||||||
|
return new CorsFilter(source);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Alternative using WebMvcConfigurer:
|
||||||
|
/*
|
||||||
|
package group.goforward.citysites.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class WebConfig implements WebMvcConfigurer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addCorsMappings(CorsRegistry registry) {
|
||||||
|
registry.addMapping("/api/**")
|
||||||
|
.allowedOrigins("http://localhost:4200")
|
||||||
|
.allowedMethods("GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS")
|
||||||
|
.allowedHeaders("*")
|
||||||
|
.allowCredentials(true)
|
||||||
|
.maxAge(3600);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package group.goforward.ballistic.configuration;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
//import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
|
||||||
|
public class JpaConfig {
|
||||||
|
// Enables @CreatedDate / @LastModifiedDate processing
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
package group.goforward.ballistic.configuration;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package group.goforward.ballistic.controllers;
|
package group.goforward.ballistic.controllers;
|
||||||
|
|
||||||
import group.goforward.ballistic.jpa.Psa;
|
import group.goforward.ballistic.model.Psa;
|
||||||
import group.goforward.ballistic.service.PsaService;
|
import group.goforward.ballistic.service.PsaService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
@@ -11,7 +11,7 @@ import java.util.Optional;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/psa")
|
@RequestMapping("/api/psa")
|
||||||
public class PsaController {
|
public class PsaController {
|
||||||
|
|
||||||
private final PsaService psaService;
|
private final PsaService psaService;
|
||||||
@@ -21,12 +21,12 @@ public class PsaController {
|
|||||||
this.psaService = psaService;
|
this.psaService = psaService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/api/getAllPsa")
|
||||||
public List<Psa> getAllPsa() {
|
public List<Psa> getAllPsa() {
|
||||||
return psaService.findAll();
|
return psaService.findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/api/getPSAById/{id}")
|
||||||
public ResponseEntity<Psa> getPsaById(@PathVariable UUID id) {
|
public ResponseEntity<Psa> getPsaById(@PathVariable UUID id) {
|
||||||
Optional<Psa> psa = psaService.findById(id);
|
Optional<Psa> psa = psaService.findById(id);
|
||||||
return psa.map(ResponseEntity::ok).orElseGet(() -> ResponseEntity.notFound().build());
|
return psa.map(ResponseEntity::ok).orElseGet(() -> ResponseEntity.notFound().build());
|
||||||
@@ -37,7 +37,7 @@ public class PsaController {
|
|||||||
return psaService.save(psa);
|
return psaService.save(psa);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/{id}")
|
@PutMapping("/api/updatePsa/{id}")
|
||||||
public ResponseEntity<Psa> updatePsa(@PathVariable UUID id, @RequestBody Psa psaDetails) {
|
public ResponseEntity<Psa> updatePsa(@PathVariable UUID id, @RequestBody Psa psaDetails) {
|
||||||
Optional<Psa> psa = psaService.findById(id);
|
Optional<Psa> psa = psaService.findById(id);
|
||||||
if (psa.isPresent()) {
|
if (psa.isPresent()) {
|
||||||
@@ -49,7 +49,7 @@ public class PsaController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/{id}")
|
@DeleteMapping("/api/deletePsa/{id}")
|
||||||
public ResponseEntity<Void> deletePsa(@PathVariable UUID id) {
|
public ResponseEntity<Void> deletePsa(@PathVariable UUID id) {
|
||||||
psaService.deleteById(id);
|
psaService.deleteById(id);
|
||||||
return ResponseEntity.noContent().build();
|
return ResponseEntity.noContent().build();
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package group.goforward.ballistic.controllers;
|
||||||
|
|
||||||
|
import group.goforward.ballistic.ApiResponse;
|
||||||
|
import group.goforward.ballistic.model.State;
|
||||||
|
import group.goforward.ballistic.repos.StateRepository;
|
||||||
|
import group.goforward.ballistic.service.StatesService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping()
|
||||||
|
public class StateController {
|
||||||
|
@Autowired
|
||||||
|
private StateRepository repo;
|
||||||
|
@Autowired
|
||||||
|
private StatesService statesService;
|
||||||
|
|
||||||
|
@GetMapping("/api/getAllStates")
|
||||||
|
public ResponseEntity<List<State>> getAllStates() {
|
||||||
|
List<State> state = repo.findAll();
|
||||||
|
return ResponseEntity.ok(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/api/getAllStatesTest")
|
||||||
|
public ApiResponse<List<State>> getAllStatesTest() {
|
||||||
|
List<State> state = repo.findAll();
|
||||||
|
return ApiResponse.success(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/api/getAllStatesById/{id}")
|
||||||
|
public ResponseEntity<State> getAllStatesById(@PathVariable Integer id) {
|
||||||
|
return repo.findById(id)
|
||||||
|
.map(ResponseEntity::ok)
|
||||||
|
.orElse(ResponseEntity.notFound().build());
|
||||||
|
}
|
||||||
|
@GetMapping("/api/getAllStatesByAbbreviation/{abbreviation}")
|
||||||
|
public ResponseEntity<State> getAllStatesByAbbreviation(@PathVariable String abbreviation) {
|
||||||
|
return repo.findByAbbreviation(abbreviation)
|
||||||
|
.map(ResponseEntity::ok)
|
||||||
|
.orElse(ResponseEntity.notFound().build());
|
||||||
|
}
|
||||||
|
@PostMapping("/api/addState")
|
||||||
|
public ResponseEntity<State> createState(@RequestBody State item) {
|
||||||
|
State created = statesService.save(item);
|
||||||
|
return ResponseEntity.status(HttpStatus.CREATED).body(created);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/api/deleteState/{id}")
|
||||||
|
public ResponseEntity<Void> deleteItem(@PathVariable Integer id) {
|
||||||
|
return statesService.findById(id)
|
||||||
|
.map(item -> {
|
||||||
|
statesService.deleteById(id);
|
||||||
|
return ResponseEntity.noContent().<Void>build();
|
||||||
|
})
|
||||||
|
.orElse(ResponseEntity.notFound().build());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package group.goforward.ballistic.jpa;
|
package group.goforward.ballistic.model;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package group.goforward.ballistic.jpa;
|
package group.goforward.ballistic.model;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package group.goforward.ballistic.jpa;
|
package group.goforward.ballistic.model;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package group.goforward.ballistic.jpa;
|
package group.goforward.ballistic.model;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.EmbeddedId;
|
import jakarta.persistence.EmbeddedId;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package group.goforward.ballistic.jpa;
|
package group.goforward.ballistic.model;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Embeddable;
|
import jakarta.persistence.Embeddable;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package group.goforward.ballistic.jpa;
|
package group.goforward.ballistic.model;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package group.goforward.ballistic.jpa;
|
package group.goforward.ballistic.model;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package group.goforward.ballistic.jpa;
|
package group.goforward.ballistic.model;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package group.goforward.ballistic.jpa;
|
package group.goforward.ballistic.model;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package group.goforward.ballistic.jpa;
|
package group.goforward.ballistic.model;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package group.goforward.ballistic.jpa;
|
package group.goforward.ballistic.model;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package group.goforward.ballistic.jpa;
|
package group.goforward.ballistic.model;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package group.goforward.ballistic.jpa;
|
package group.goforward.ballistic.model;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package group.goforward.ballistic.jpa;
|
package group.goforward.ballistic.model;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package group.goforward.ballistic.jpa;
|
package group.goforward.ballistic.model;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package group.goforward.ballistic.jpa;
|
package group.goforward.ballistic.model;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package group.goforward.ballistic.jpa;
|
package group.goforward.ballistic.model;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package group.goforward.ballistic.jpa;
|
package group.goforward.ballistic.model;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package group.goforward.ballistic.jpa;
|
package group.goforward.ballistic.model;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package group.goforward.ballistic.jpa;
|
package group.goforward.ballistic.model;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package group.goforward.ballistic.jpa;
|
package group.goforward.ballistic.model;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
@@ -6,8 +6,6 @@ import jakarta.persistence.Id;
|
|||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
import org.hibernate.annotations.ColumnDefault;
|
import org.hibernate.annotations.ColumnDefault;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "psa")
|
@Table(name = "psa")
|
||||||
public class Psa {
|
public class Psa {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package group.goforward.ballistic.jpa;
|
package group.goforward.ballistic.model;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package group.goforward.ballistic.jpa;
|
package group.goforward.ballistic.model;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package group.goforward.ballistic.jpa;
|
package group.goforward.ballistic.model;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package group.goforward.ballistic.jpa;
|
package group.goforward.ballistic.model;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package group.goforward.ballistic.jpa;
|
package group.goforward.ballistic.model;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package group.goforward.ballistic.jpa;
|
package group.goforward.ballistic.model;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
package group.goforward.ballistic.repos;
|
package group.goforward.ballistic.repos;
|
||||||
import group.goforward.ballistic.jpa.Psa;
|
import group.goforward.ballistic.model.Psa;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package group.goforward.ballistic.repos;
|
||||||
|
|
||||||
|
import group.goforward.ballistic.model.State;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public interface StateRepository extends JpaRepository<State, Integer> {
|
||||||
|
Optional<State> findByAbbreviation(String abbreviation);
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
package group.goforward.ballistic.service;
|
package group.goforward.ballistic.service;
|
||||||
import group.goforward.ballistic.jpa.Psa;
|
import group.goforward.ballistic.model.Psa;
|
||||||
import group.goforward.ballistic.repos.PsaRepository;
|
import group.goforward.ballistic.repos.PsaRepository;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package group.goforward.ballistic.service;
|
||||||
|
|
||||||
|
import group.goforward.ballistic.model.State;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public interface StatesService {
|
||||||
|
|
||||||
|
List<State> findAll();
|
||||||
|
|
||||||
|
Optional<State> findById(Integer id);
|
||||||
|
|
||||||
|
State save(State item);
|
||||||
|
void deleteById(Integer id);
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package group.goforward.ballistic.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import group.goforward.ballistic.model.State;
|
||||||
|
import group.goforward.ballistic.repos.StateRepository;
|
||||||
|
import group.goforward.ballistic.service.StatesService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class StatesServiceImpl implements StatesService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StateRepository repo;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<State> findAll() {
|
||||||
|
return repo.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<State> findById(Integer id) {
|
||||||
|
return repo.findById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public State save(State item) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteById(Integer id) {
|
||||||
|
deleteById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user