Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import java.time.LocalDateTime;

@RestController
@RequestMapping("/api/v1/contact")
@RequestMapping("/api/v1/contacts")
@RequiredArgsConstructor
public class ContactController {

Expand All @@ -32,4 +32,9 @@ public ResponseEntity<ApiResponse> submitContact(

return ResponseEntity.status(HttpStatus.CREATED).body(response);
}

@GetMapping
public ResponseEntity<?> getAllContacts() {
return ResponseEntity.ok(contactService.getAllContacts());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ public ResponseEntity<ApiResponse> handleValidationException(
@ExceptionHandler(Exception.class)
public ResponseEntity<ApiResponse> handleGenericException(Exception ex) {

// 🔥 CRITICAL LINE (THIS WAS MISSING)
log.error("Unhandled exception occurred", ex);
log.error("Unhandled exception occurred: {}", ex.getMessage(), ex);

ex.printStackTrace(); // 🔥 TEMPORARY DEBUG (force output)

ApiResponse response = new ApiResponse(
false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
@RequiredArgsConstructor
Expand All @@ -26,4 +27,8 @@ public void processContact(ContactRequest request) {

contactRepository.save(inquiry);
}

public List<ContactInquiry> getAllContacts() {
return contactRepository.findAll();
}
}
16 changes: 7 additions & 9 deletions src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,22 @@ spring:
main:
banner-mode: off

logging:
level:
root: INFO
com.vimaltech.contactapi: DEBUG

server:
error:
include-stacktrace: never
include-message: never
include-stacktrace: always
include-message: always

springdoc:
api-docs:
enabled: false
swagger-ui:
enabled: false

logging:
level:
root: WARN
com.vimaltech.contactapi: INFO
org.springframework: WARN
org.hibernate: WARN

management:
endpoints:
web:
Expand Down
Loading