diff --git a/src/main/java/com/example/coreTest/GeneratedCode.java b/src/main/java/com/example/coreTest/GeneratedCode.java new file mode 100644 index 0000000..7d1f570 --- /dev/null +++ b/src/main/java/com/example/coreTest/GeneratedCode.java @@ -0,0 +1,38 @@ +package com.finvant.coretest.controller; + +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.time.Instant; + +@RestController +@RequestMapping("/api/v1") +public class HealthController { + + @GetMapping("/health") + public ResponseEntity health() { + return ResponseEntity.ok( + new HealthResponse("OK", Instant.now().toEpochMilli()) + ); + } + + private static class HealthResponse { + private final String status; + private final long timestamp; + + public HealthResponse(String status, long timestamp) { + this.status = status; + this.timestamp = timestamp; + } + + public String getStatus() { + return status; + } + + public long getTimestamp() { + return timestamp; + } + } +}