testing hal+json
Signed-off-by: Peter Siegmund <developer@mars3142.org>
This commit is contained in:
@@ -28,8 +28,10 @@ public class TimezoneController {
|
|||||||
val ip = timeZoneService.getExternalIp(clientIp);
|
val ip = timeZoneService.getExternalIp(clientIp);
|
||||||
val timezoneInfo = timeZoneService.getTimeZoneInfoByIp(ip);
|
val timezoneInfo = timeZoneService.getTimeZoneInfoByIp(ip);
|
||||||
val posix = timeZoneService.getPosixTimeZone(timezoneInfo.timezone());
|
val posix = timeZoneService.getPosixTimeZone(timezoneInfo.timezone());
|
||||||
return TimezoneResponse.builder().timezone(timezoneInfo.timezone())
|
val response = new TimezoneResponse();
|
||||||
.posix_tz(posix).build();
|
response.setTimezone(timezoneInfo.timezone());
|
||||||
|
response.setPosix_tz(posix);
|
||||||
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("{area}")
|
@GetMapping("{area}")
|
||||||
@@ -44,6 +46,9 @@ public class TimezoneController {
|
|||||||
public TimezoneResponse getTimeZoneForLocation(@PathVariable String area, @PathVariable String location) {
|
public TimezoneResponse getTimeZoneForLocation(@PathVariable String area, @PathVariable String location) {
|
||||||
val timezone = area + "/" + location;
|
val timezone = area + "/" + location;
|
||||||
val posix = timeZoneService.getPosixTimeZone(timezone);
|
val posix = timeZoneService.getPosixTimeZone(timezone);
|
||||||
return TimezoneResponse.builder().timezone(timezone).posix_tz(posix).build();
|
val response = new TimezoneResponse();
|
||||||
|
response.setTimezone(timezone);
|
||||||
|
response.setPosix_tz(posix);
|
||||||
|
return response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,15 +1,15 @@
|
|||||||
package dev.mars3142.fhq.timezone_service.timezone.domain.model.response;
|
package dev.mars3142.fhq.timezone_service.timezone.domain.model.response;
|
||||||
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
import org.springframework.hateoas.RepresentationModel;
|
import org.springframework.hateoas.RepresentationModel;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Builder
|
@Setter
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class TimezoneResponse extends RepresentationModel<TimezoneResponse> {
|
public class TimezoneResponse extends RepresentationModel<TimezoneResponse> {
|
||||||
|
|
||||||
private final String timezone;
|
private String timezone;
|
||||||
private final String posix_tz;
|
private String posix_tz;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user