mirror of
https://gitea.gofwd.group/Forward_Group/ballistic-builder-spring.git
synced 2026-01-20 16:51:03 -05:00
Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
29
pom.xml
29
pom.xml
@@ -38,14 +38,15 @@
|
|||||||
|
|
||||||
<scm>
|
<scm>
|
||||||
<connection></connection>
|
<connection></connection>
|
||||||
<developerConnection>scm:git:https://gitea.gofwd.group/Forward_Group/ballistic-builder-spring.git</developerConnection>
|
<developerConnection>scm:git:https://gitea.gofwd.group/Forward_Group/ballistic-builder-spring.git
|
||||||
|
</developerConnection>
|
||||||
<tag/>
|
<tag/>
|
||||||
<url>ssh://git@gitea.gofwd.group:2225/Forward_Group/ballistic-builder-spring.git</url>
|
<url>ssh://git@gitea.gofwd.group:2225/Forward_Group/ballistic-builder-spring.git</url>
|
||||||
|
|
||||||
</scm>
|
</scm>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>17</java.version>
|
<java.version>21</java.version>
|
||||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||||
</properties>
|
</properties>
|
||||||
@@ -63,6 +64,25 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
<!-- JSON Web Tokens (JJWT) -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
|
<artifactId>jjwt-api</artifactId>
|
||||||
|
<version>0.11.5</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Spring Mail -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-mail</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
|
<artifactId>jjwt-impl</artifactId>
|
||||||
|
<version>0.11.5</version>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
@@ -161,8 +181,9 @@
|
|||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.11.0</version>
|
<version>3.11.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>${maven.compiler.source}</source>
|
<source>21</source>
|
||||||
<target>${maven.compiler.target}</target>
|
<target>21</target>
|
||||||
|
<compilerArgs>--enable-preview</compilerArgs>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
|||||||
13
sql/email_requests_schema.sql
Normal file
13
sql/email_requests_schema.sql
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
CREATE TABLE email_requests (
|
||||||
|
id BIGSERIAL PRIMARY KEY,
|
||||||
|
recipient VARCHAR(255) NOT NULL,
|
||||||
|
subject VARCHAR(255) NOT NULL,
|
||||||
|
body TEXT,
|
||||||
|
sent_at TIMESTAMP,
|
||||||
|
status VARCHAR(50) NOT NULL,
|
||||||
|
error_message TEXT,
|
||||||
|
created_at TIMESTAMP NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE INDEX idx_email_requests_status ON email_requests(status);
|
||||||
|
CREATE INDEX idx_email_requests_created_at ON email_requests(created_at);
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
/**
|
||||||
|
* Catalog classification package for the BattlBuilder application.
|
||||||
|
* <p>
|
||||||
|
* This package contains classes responsible for platform resolution,
|
||||||
|
* rule compilation, and product context classification.
|
||||||
|
*
|
||||||
|
* @author Forward Group, LLC
|
||||||
|
* @version 1.0
|
||||||
|
* @since 2025-12-10
|
||||||
|
*/
|
||||||
|
package group.goforward.battlbuilder.catalog.classification;
|
||||||
@@ -1,11 +1,17 @@
|
|||||||
|
/*
|
||||||
package group.goforward.battlbuilder.configuration;
|
package group.goforward.battlbuilder.configuration;
|
||||||
|
|
||||||
// @Configuration
|
import org.springframework.context.annotation.Bean;
|
||||||
// public class PasswordConfig {
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||||
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
|
|
||||||
// @Bean
|
@Configuration
|
||||||
// public PasswordEncoder passwordEncoder() {
|
public class PasswordConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public PasswordEncoder passwordEncoder() {
|
||||||
// // BCrypt default password
|
// // BCrypt default password
|
||||||
// return new BCryptPasswordEncoder();
|
return new BCryptPasswordEncoder();
|
||||||
// }
|
}
|
||||||
// }
|
}*/
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
/**
|
/**
|
||||||
* Provides the classes necessary for the Spring Configurations for the Battl.Builder application.
|
* Configuration package for the BattlBuilder application.
|
||||||
* This package includes Configurations for Spring-Boot application
|
* <p>
|
||||||
|
* Contains Spring configuration classes for security, CORS, JPA,
|
||||||
|
* caching, and password encoding.
|
||||||
*
|
*
|
||||||
*
|
* @author Forward Group, LLC
|
||||||
* <p>The main entry point for managing the inventory is the
|
* @version 1.0
|
||||||
* {@link group.goforward.battlbuilder.BattlBuilderApplication} class.</p>
|
* @since 2025-12-10
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
* @author Don Strawsburg
|
|
||||||
* @version 1.1
|
|
||||||
*/
|
*/
|
||||||
package group.goforward.battlbuilder.configuration;
|
package group.goforward.battlbuilder.configuration;
|
||||||
@@ -9,11 +9,11 @@ import java.util.List;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/admin/part-categories")
|
@RequestMapping("/api/admin/part-categories")
|
||||||
@CrossOrigin // keep it loose for now, you can tighten origins later
|
@CrossOrigin // keep it loose for now, you can tighten origins later
|
||||||
public class PartCategoryAdminController {
|
public class AdminPartCategoryController {
|
||||||
|
|
||||||
private final PartCategoryRepository partCategories;
|
private final PartCategoryRepository partCategories;
|
||||||
|
|
||||||
public PartCategoryAdminController(PartCategoryRepository partCategories) {
|
public AdminPartCategoryController(PartCategoryRepository partCategories) {
|
||||||
this.partCategories = partCategories;
|
this.partCategories = partCategories;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -13,11 +13,11 @@ import java.util.List;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/platforms")
|
@RequestMapping("/api/platforms")
|
||||||
@CrossOrigin
|
@CrossOrigin
|
||||||
public class PlatformController {
|
public class AdminPlatformController {
|
||||||
|
|
||||||
private final PlatformRepository platformRepository;
|
private final PlatformRepository platformRepository;
|
||||||
|
|
||||||
public PlatformController(PlatformRepository platformRepository) {
|
public AdminPlatformController(PlatformRepository platformRepository) {
|
||||||
this.platformRepository = platformRepository;
|
this.platformRepository = platformRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
/**
|
||||||
|
* Admin controllers package for the BattlBuilder application.
|
||||||
|
* <p>
|
||||||
|
* Contains REST controllers for administrative operations including
|
||||||
|
* category management, platform configuration, and merchant administration.
|
||||||
|
*
|
||||||
|
* @author Forward Group, LLC
|
||||||
|
* @version 1.0
|
||||||
|
* @since 2025-12-10
|
||||||
|
*/
|
||||||
|
package group.goforward.battlbuilder.controllers.admin;
|
||||||
@@ -0,0 +1,128 @@
|
|||||||
|
package group.goforward.battlbuilder.controllers.api;
|
||||||
|
|
||||||
|
import group.goforward.battlbuilder.utils.ApiResponse;
|
||||||
|
import group.goforward.battlbuilder.dto.EmailRequestDto;
|
||||||
|
import group.goforward.battlbuilder.model.EmailRequest;
|
||||||
|
import group.goforward.battlbuilder.repos.EmailRequestRepository;
|
||||||
|
import group.goforward.battlbuilder.services.utils.EmailService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/email")
|
||||||
|
public class EmailController {
|
||||||
|
|
||||||
|
private static final String EMAIL_STATUS_SENT = "SENT";
|
||||||
|
|
||||||
|
private final EmailService emailService;
|
||||||
|
private final EmailRequestRepository emailRequestRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public EmailController(EmailService emailService, EmailRequestRepository emailRequestRepository) {
|
||||||
|
this.emailService = emailService;
|
||||||
|
this.emailRequestRepository = emailRequestRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public ResponseEntity<ApiResponse<List<EmailRequest>>> getAllEmailRequests() {
|
||||||
|
try {
|
||||||
|
List<EmailRequest> emailRequests = emailRequestRepository.findAll();
|
||||||
|
return ResponseEntity.ok(
|
||||||
|
ApiResponse.success(emailRequests, "Email requests retrieved successfully")
|
||||||
|
);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ResponseEntity.status(500).body(
|
||||||
|
ApiResponse.error("Error retrieving email requests: " + e.getMessage(), null)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/allSent")
|
||||||
|
public ResponseEntity<ApiResponse<List<EmailRequest>>> getNotSentEmailRequests() {
|
||||||
|
try {
|
||||||
|
List<EmailRequest> emailRequests = emailRequestRepository.findSent();
|
||||||
|
return ResponseEntity.ok(
|
||||||
|
ApiResponse.success(emailRequests, "Not sent email requests retrieved successfully")
|
||||||
|
);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ResponseEntity.status(500).body(
|
||||||
|
ApiResponse.error("Error retrieving not sent email requests: " + e.getMessage(), null)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/allFailed")
|
||||||
|
public ResponseEntity<ApiResponse<List<EmailRequest>>> getFailedEmailRequests() {
|
||||||
|
try {
|
||||||
|
List<EmailRequest> emailRequests = emailRequestRepository.findFailed();
|
||||||
|
return ResponseEntity.ok(
|
||||||
|
ApiResponse.success(emailRequests, "Failed email requests retrieved successfully")
|
||||||
|
);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ResponseEntity.status(500).body(
|
||||||
|
ApiResponse.error("Error retrieving failed email requests: " + e.getMessage(), null)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/allPending")
|
||||||
|
public ResponseEntity<ApiResponse<List<EmailRequest>>> getPendingEmailRequests() {
|
||||||
|
try {
|
||||||
|
List<EmailRequest> emailRequests = emailRequestRepository.findPending();
|
||||||
|
return ResponseEntity.ok(
|
||||||
|
ApiResponse.success(emailRequests, "Pending email requests retrieved successfully")
|
||||||
|
);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ResponseEntity.status(500).body(
|
||||||
|
ApiResponse.error("Error retrieving Pending email requests: " + e.getMessage(), null)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/send")
|
||||||
|
public ResponseEntity<ApiResponse<EmailRequest>> sendEmail(@RequestBody EmailRequestDto emailDto) {
|
||||||
|
try {
|
||||||
|
EmailRequest emailRequest = emailService.sendEmail(
|
||||||
|
emailDto.getRecipient(),
|
||||||
|
emailDto.getSubject(),
|
||||||
|
emailDto.getBody()
|
||||||
|
);
|
||||||
|
return buildEmailResponse(emailRequest);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return buildErrorResponse(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@DeleteMapping("/delete/{id}")
|
||||||
|
public ResponseEntity<Void> deleteItem(@PathVariable Integer id) {
|
||||||
|
return brandService.findById(id)
|
||||||
|
.map(item -> {
|
||||||
|
brandService.deleteById(id);
|
||||||
|
return ResponseEntity.noContent().<Void>build();
|
||||||
|
})
|
||||||
|
.orElse(ResponseEntity.notFound().build());
|
||||||
|
}
|
||||||
|
|
||||||
|
private ResponseEntity<ApiResponse<EmailRequest>> buildEmailResponse(EmailRequest emailRequest) {
|
||||||
|
if (EMAIL_STATUS_SENT.equals(emailRequest.getStatus())) {
|
||||||
|
return ResponseEntity.ok(
|
||||||
|
ApiResponse.success(emailRequest, "Email sent successfully")
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
String errorMessage = "Failed to send email: " + emailRequest.getErrorMessage();
|
||||||
|
return ResponseEntity.status(500).body(
|
||||||
|
ApiResponse.error(errorMessage, emailRequest)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ResponseEntity<ApiResponse<EmailRequest>> buildErrorResponse(String exceptionMessage) {
|
||||||
|
String errorMessage = "Error processing email request: " + exceptionMessage;
|
||||||
|
return ResponseEntity.status(500).body(
|
||||||
|
ApiResponse.error(errorMessage, null)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,14 +1,11 @@
|
|||||||
/**
|
/**
|
||||||
* Provides the classes necessary for the public api endpoints for the Battl.Builder
|
* API controllers package for the BattlBuilder application.
|
||||||
* application Spring Controllers.
|
* <p>
|
||||||
* This package includes Controllers for Spring-Boot application
|
* Contains REST API controllers for public-facing endpoints including
|
||||||
|
* brand management, state information, and user operations.
|
||||||
*
|
*
|
||||||
*
|
* @author Forward Group, LLC
|
||||||
* <p>The main entry point for managing the inventory is the
|
* @version 1.0
|
||||||
* {@link group.goforward.battlbuilder.BattlBuilderApplication} class.</p>
|
* @since 2025-12-10
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
* @author Don Strawsburg
|
|
||||||
* @version 1.1
|
|
||||||
*/
|
*/
|
||||||
package group.goforward.battlbuilder.controllers.api;
|
package group.goforward.battlbuilder.controllers.api;
|
||||||
@@ -1,13 +1,11 @@
|
|||||||
/**
|
/**
|
||||||
* Provides the classes necessary for the Spring Controllers for the Battl.Builder application.
|
* Utility controllers package for the BattlBuilder application.
|
||||||
* This package includes Controllers for Spring-Boot application
|
* <p>
|
||||||
|
* Contains utility REST controllers for email handling and
|
||||||
|
* health check operations.
|
||||||
*
|
*
|
||||||
*
|
* @author Forward Group, LLC
|
||||||
* <p>The main entry point for managing the inventory is the
|
* @version 1.0
|
||||||
* {@link group.goforward.battlbuilder.BattlBuilderApplication} class.</p>
|
* @since 2025-12-10
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
* @author Don Strawsburg
|
|
||||||
* @version 1.1
|
|
||||||
*/
|
*/
|
||||||
package group.goforward.battlbuilder.controllers;
|
package group.goforward.battlbuilder.controllers;
|
||||||
@@ -1,14 +1,11 @@
|
|||||||
/**
|
/**
|
||||||
* Provides the classes necessary for the utility controllers for the Battl.Builder
|
* Utility controllers package for the BattlBuilder application.
|
||||||
* application Spring Controllers.
|
* <p>
|
||||||
* This package includes Controllers for Spring-Boot application
|
* Contains utility REST controllers for email handling and
|
||||||
|
* health check operations.
|
||||||
*
|
*
|
||||||
*
|
* @author Forward Group, LLC
|
||||||
* <p>The main entry point for managing the inventory is the
|
* @version 1.0
|
||||||
* {@link group.goforward.battlbuilder.BattlBuilderApplication} class.</p>
|
* @since 2025-12-10
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
* @author Don Strawsburg
|
|
||||||
* @version 1.1
|
|
||||||
*/
|
*/
|
||||||
package group.goforward.battlbuilder.controllers.utils;
|
package group.goforward.battlbuilder.controllers.utils;
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package group.goforward.battlbuilder.dto;
|
||||||
|
|
||||||
|
// DTO for request
|
||||||
|
public class EmailRequestDto {
|
||||||
|
private String recipient;
|
||||||
|
private String subject;
|
||||||
|
private String body;
|
||||||
|
|
||||||
|
public String getRecipient() {
|
||||||
|
return recipient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRecipient(String recipient) {
|
||||||
|
this.recipient = recipient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSubject() {
|
||||||
|
return subject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSubject(String subject) {
|
||||||
|
this.subject = subject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBody() {
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBody(String body) {
|
||||||
|
this.body = body;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
/**
|
||||||
|
* Web admin DTOs package for the BattlBuilder application.
|
||||||
|
* <p>
|
||||||
|
* Contains Data Transfer Objects specific to administrative
|
||||||
|
* operations including user management, mappings, and platform configuration.
|
||||||
|
*
|
||||||
|
* @author Forward Group, LLC
|
||||||
|
* @version 1.0
|
||||||
|
* @since 2025-12-10
|
||||||
|
*/
|
||||||
|
package group.goforward.battlbuilder.dto;
|
||||||
@@ -0,0 +1,122 @@
|
|||||||
|
package group.goforward.battlbuilder.model;
|
||||||
|
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "email_requests")
|
||||||
|
@NamedQuery(
|
||||||
|
name = "EmailRequest.findSent",
|
||||||
|
query = "SELECT e FROM EmailRequest e WHERE e.status = 'SENT'"
|
||||||
|
)
|
||||||
|
|
||||||
|
@NamedQuery(
|
||||||
|
name = "EmailRequest.findFailed",
|
||||||
|
query = "SELECT e FROM EmailRequest e WHERE e.status = 'FAILED'"
|
||||||
|
)
|
||||||
|
|
||||||
|
@NamedQuery(
|
||||||
|
name = "EmailRequest.findPending",
|
||||||
|
query = "SELECT e FROM EmailRequest e WHERE e.status = 'PENDING'"
|
||||||
|
)
|
||||||
|
|
||||||
|
public class EmailRequest {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
private String recipient;
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
private String subject;
|
||||||
|
|
||||||
|
@Column(columnDefinition = "TEXT")
|
||||||
|
private String body;
|
||||||
|
|
||||||
|
@Column(name = "sent_at")
|
||||||
|
private LocalDateTime sentAt;
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
private String status; // PENDING, SENT, FAILED
|
||||||
|
|
||||||
|
@Column(name = "error_message")
|
||||||
|
private String errorMessage;
|
||||||
|
|
||||||
|
@Column(name = "created_at", nullable = false, updatable = false)
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
|
@PrePersist
|
||||||
|
protected void onCreate() {
|
||||||
|
createdAt = LocalDateTime.now();
|
||||||
|
if (status == null) {
|
||||||
|
status = "PENDING";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Getters and Setters
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRecipient() {
|
||||||
|
return recipient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRecipient(String recipient) {
|
||||||
|
this.recipient = recipient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSubject() {
|
||||||
|
return subject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSubject(String subject) {
|
||||||
|
this.subject = subject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBody() {
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBody(String body) {
|
||||||
|
this.body = body;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDateTime getSentAt() {
|
||||||
|
return sentAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSentAt(LocalDateTime sentAt) {
|
||||||
|
this.sentAt = sentAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(String status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getErrorMessage() {
|
||||||
|
return errorMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setErrorMessage(String errorMessage) {
|
||||||
|
this.errorMessage = errorMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDateTime getCreatedAt() {
|
||||||
|
return createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreatedAt(LocalDateTime createdAt) {
|
||||||
|
this.createdAt = createdAt;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1 +1,11 @@
|
|||||||
|
/**
|
||||||
|
* Model package for the BattlBuilder application.
|
||||||
|
* <p>
|
||||||
|
* Contains JPA entity classes representing the domain model including
|
||||||
|
* products, merchants, categories, platforms, and user accounts.
|
||||||
|
*
|
||||||
|
* @author Forward Group, LLC
|
||||||
|
* @version 1.0
|
||||||
|
* @since 2025-12-10
|
||||||
|
*/
|
||||||
package group.goforward.battlbuilder.model;
|
package group.goforward.battlbuilder.model;
|
||||||
11
src/main/java/group/goforward/battlbuilder/package-info.java
Normal file
11
src/main/java/group/goforward/battlbuilder/package-info.java
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
/**
|
||||||
|
* Root package for the BattlBuilder application.
|
||||||
|
* <p>
|
||||||
|
* BattlBuilder is a comprehensive platform for firearm parts catalog management,
|
||||||
|
* product classification, and merchant integration.
|
||||||
|
*
|
||||||
|
* @author Forward Group, LLC
|
||||||
|
* @version 1.0
|
||||||
|
* @since 2025-12-10
|
||||||
|
*/
|
||||||
|
package group.goforward.battlbuilder;
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package group.goforward.battlbuilder.repos;
|
||||||
|
|
||||||
|
import group.goforward.battlbuilder.model.EmailRequest;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface EmailRequestRepository extends JpaRepository<EmailRequest, Long> {
|
||||||
|
List<EmailRequest> findByStatus(String status);
|
||||||
|
|
||||||
|
List<EmailRequest> findFailed();
|
||||||
|
|
||||||
|
List<EmailRequest> findSent();
|
||||||
|
|
||||||
|
List<EmailRequest> findPending();
|
||||||
|
}
|
||||||
@@ -1,13 +1,11 @@
|
|||||||
/**
|
/**
|
||||||
* Provides the classes necessary for the Spring Repository for the Battl.Builder application.
|
* Repositories package for the BattlBuilder application.
|
||||||
* This package includes Repository for Spring-Boot application
|
* <p>
|
||||||
|
* Contains Spring Data JPA repository interfaces for database
|
||||||
|
* access and persistence operations.
|
||||||
*
|
*
|
||||||
*
|
* @author Forward Group, LLC
|
||||||
* <p>The main entry point for managing the inventory is the
|
* @version 1.0
|
||||||
* {@link group.goforward.battlbuilder.BattlBuilderApplication} class.</p>
|
* @since 2025-12-10
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
* @author Sean Strawsburg
|
|
||||||
* @version 1.1
|
|
||||||
*/
|
*/
|
||||||
package group.goforward.battlbuilder.repos;
|
package group.goforward.battlbuilder.repos;
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
/**
|
||||||
|
* Admin services package for the BattlBuilder application.
|
||||||
|
* <p>
|
||||||
|
* Contains service classes for administrative business logic
|
||||||
|
* and operations.
|
||||||
|
*
|
||||||
|
* @author Forward Group, LLC
|
||||||
|
* @version 1.0
|
||||||
|
* @since 2025-12-10
|
||||||
|
*/
|
||||||
|
package group.goforward.battlbuilder.services.admin;
|
||||||
@@ -28,7 +28,7 @@ public class BrandServiceImpl implements BrandService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Brand save(Brand item) {
|
public Brand save(Brand item) {
|
||||||
return null;
|
return repo.save(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
/**
|
/**
|
||||||
* Provides the classes necessary for the Spring Services implementations for the Battl.Builder application.
|
* Service implementations package for the BattlBuilder application.
|
||||||
* This package includes Services implementations for Spring-Boot application
|
* <p>
|
||||||
|
* Contains implementation classes for service interfaces.
|
||||||
*
|
*
|
||||||
*
|
* @author Forward Group, LLC
|
||||||
* <p>The main entry point for managing the inventory is the
|
* @version 1.0
|
||||||
* {@link group.goforward.battlbuilder.BattlBuilderApplication} class.</p>
|
* @since 2025-12-10
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
* @author Don Strawsburg
|
|
||||||
* @version 1.1
|
|
||||||
*/
|
*/
|
||||||
package group.goforward.battlbuilder.services.impl;
|
package group.goforward.battlbuilder.services.impl;
|
||||||
@@ -1 +1,12 @@
|
|||||||
|
|
||||||
|
/**
|
||||||
|
* Services package for the BattlBuilder application.
|
||||||
|
* <p>
|
||||||
|
* Contains business logic service classes for product management,
|
||||||
|
* category classification, mapping recommendations, and merchant operations.
|
||||||
|
*
|
||||||
|
* @author Forward Group, LLC
|
||||||
|
* @version 1.0
|
||||||
|
* @since 2025-12-10
|
||||||
|
*/
|
||||||
package group.goforward.battlbuilder.services;
|
package group.goforward.battlbuilder.services;
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package group.goforward.battlbuilder.services.utils;
|
||||||
|
|
||||||
|
import group.goforward.battlbuilder.model.EmailRequest;
|
||||||
|
|
||||||
|
public interface EmailService {
|
||||||
|
EmailRequest sendEmail(String recipient, String subject, String body);
|
||||||
|
void deleteById(Integer id);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
package group.goforward.battlbuilder.services.utils.impl;
|
||||||
|
|
||||||
|
import group.goforward.battlbuilder.model.EmailRequest;
|
||||||
|
import group.goforward.battlbuilder.repos.EmailRequestRepository;
|
||||||
|
import group.goforward.battlbuilder.services.utils.EmailService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.mail.SimpleMailMessage;
|
||||||
|
import org.springframework.mail.javamail.JavaMailSender;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class EmailServiceImpl implements EmailService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private JavaMailSender mailSender;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EmailRequestRepository emailRequestRepository;
|
||||||
|
|
||||||
|
@Value("${spring.mail.username}")
|
||||||
|
private String fromEmail;
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public EmailRequest sendEmail(String recipient, String subject, String body) {
|
||||||
|
// Create and save email request
|
||||||
|
EmailRequest emailRequest = new EmailRequest();
|
||||||
|
emailRequest.setRecipient(recipient);
|
||||||
|
emailRequest.setSubject(subject);
|
||||||
|
emailRequest.setBody(body);
|
||||||
|
emailRequest.setStatus("PENDING");
|
||||||
|
|
||||||
|
emailRequest = emailRequestRepository.save(emailRequest);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Send email
|
||||||
|
SimpleMailMessage message = new SimpleMailMessage();
|
||||||
|
message.setFrom(fromEmail);
|
||||||
|
message.setTo(recipient);
|
||||||
|
message.setSubject(subject);
|
||||||
|
message.setText(body);
|
||||||
|
|
||||||
|
mailSender.send(message);
|
||||||
|
|
||||||
|
// Update status
|
||||||
|
emailRequest.setStatus("SENT");
|
||||||
|
emailRequest.setSentAt(LocalDateTime.now());
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
// Update status with error
|
||||||
|
emailRequest.setStatus("FAILED");
|
||||||
|
emailRequest.setErrorMessage(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return emailRequestRepository.save(emailRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteById(Integer id) {
|
||||||
|
deleteById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
/**
|
||||||
|
* Utility service implementations package for the BattlBuilder application.
|
||||||
|
* <p>
|
||||||
|
* Contains implementation classes for utility service interfaces.
|
||||||
|
*
|
||||||
|
* @author Forward Group, LLC
|
||||||
|
* @version 1.0
|
||||||
|
* @since 2025-12-10
|
||||||
|
*/
|
||||||
|
package group.goforward.battlbuilder.services.utils.impl;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package group.goforward.battlbuilder;
|
package group.goforward.battlbuilder.utils;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@@ -24,12 +24,12 @@ public class ApiResponse<T> {
|
|||||||
this.timestamp = LocalDateTime.now();
|
this.timestamp = LocalDateTime.now();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> ApiResponse<T> success(T data, String message) {
|
public static <T> ApiResponse<T> error(String message, T data) {
|
||||||
String[] msg = {message};
|
String[] msg = {message}; // ✅ Include the message
|
||||||
return new ApiResponse<>(API_SUCCESS, msg, data);
|
return new ApiResponse<>(API_ERROR, msg, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> ApiResponse<T> success(T data) {
|
public static <T> ApiResponse<T> success(T data, String emailSentSuccessfully) {
|
||||||
String[] msg = {};
|
String[] msg = {};
|
||||||
return new ApiResponse<>(API_SUCCESS, msg, data);
|
return new ApiResponse<>(API_SUCCESS, msg, data);
|
||||||
}
|
}
|
||||||
@@ -42,6 +42,7 @@ public class ApiResponse<T> {
|
|||||||
return new ApiResponse<>(API_ERROR, msg, null);
|
return new ApiResponse<>(API_ERROR, msg, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String[] getMessages() {
|
public String[] getMessages() {
|
||||||
return messages;
|
return messages;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
/**
|
||||||
|
* Utilities package for the BattlBuilder application.
|
||||||
|
* <p>
|
||||||
|
* Contains utility classes and helper functions used throughout
|
||||||
|
* the application.
|
||||||
|
*
|
||||||
|
* @author Forward Group, LLC
|
||||||
|
* @version 1.0
|
||||||
|
* @since 2025-12-10
|
||||||
|
*/
|
||||||
|
package group.goforward.battlbuilder.utils;
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
/**
|
||||||
|
* Web admin package for the BattlBuilder application.
|
||||||
|
* <p>
|
||||||
|
* Contains web controllers for administrative interface operations
|
||||||
|
* including user management, merchant administration, and import status.
|
||||||
|
*
|
||||||
|
* @author Forward Group, LLC
|
||||||
|
* @version 1.0
|
||||||
|
* @since 2025-12-10
|
||||||
|
*/
|
||||||
|
package group.goforward.battlbuilder.web.admin;
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
/**
|
||||||
|
* Web authentication DTOs package for the BattlBuilder application.
|
||||||
|
* <p>
|
||||||
|
* Contains Data Transfer Objects for authentication operations
|
||||||
|
* including login requests, registration, and authentication responses.
|
||||||
|
*
|
||||||
|
* @author Forward Group, LLC
|
||||||
|
* @version 1.0
|
||||||
|
* @since 2025-12-10
|
||||||
|
*/
|
||||||
|
package group.goforward.battlbuilder.web.dto.auth;
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
/**
|
||||||
|
* Web package for the BattlBuilder application.
|
||||||
|
* <p>
|
||||||
|
* Contains web-related classes including controllers and DTOs
|
||||||
|
* for the web layer.
|
||||||
|
*
|
||||||
|
* @author Forward Group, LLC
|
||||||
|
* @version 1.0
|
||||||
|
* @since 2025-12-10
|
||||||
|
*/
|
||||||
|
package group.goforward.battlbuilder.web;
|
||||||
@@ -24,3 +24,11 @@ spring.mvc.view.prefix=/WEB-INF/views/
|
|||||||
spring.mvc.view.suffix=.jsp
|
spring.mvc.view.suffix=.jsp
|
||||||
|
|
||||||
|
|
||||||
|
# SMTP Configuration
|
||||||
|
spring.mail.host=mail.goforwardmail.com
|
||||||
|
spring.mail.port=587
|
||||||
|
spring.mail.username=info@battl.builders
|
||||||
|
spring.mail.password=Cul8rman2025
|
||||||
|
spring.mail.properties.mail.smtp.auth=true
|
||||||
|
spring.mail.properties.mail.smtp.starttls.enable=true
|
||||||
|
spring.mail.properties.mail.smtp.starttls.required=true
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Platform Manager</title>
|
<title>BattlBuilder Platform Manager</title>
|
||||||
<script src="https://cdn.tailwindcss.com"></script>
|
<script src="https://cdn.tailwindcss.com"></script>
|
||||||
<script>
|
<script>
|
||||||
tailwind.config = {
|
tailwind.config = {
|
||||||
|
|||||||
Reference in New Issue
Block a user