-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
207 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,8 @@ | |
|
||
* tidy up unfinished MapTransactions @Scheduled | ||
|
||
* normalize map entities | ||
* map name | ||
|
||
|
||
|
||
|
63 changes: 63 additions & 0 deletions
63
src/main/java/com/recom/api/map/MapTopographyController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package com.recom.api.map; | ||
|
||
import com.recom.api.commons.HttpCommons; | ||
import com.recom.dto.map.topography.MapTopographyRequestDto; | ||
import com.recom.security.account.RECOMAccount; | ||
import com.recom.security.account.RECOMAuthorities; | ||
import com.recom.service.map.MapMetaDataService; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.media.Content; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
import io.swagger.v3.oas.annotations.security.SecurityRequirement; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import lombok.NonNull; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.http.CacheControl; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.security.access.annotation.Secured; | ||
import org.springframework.security.core.annotation.AuthenticationPrincipal; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import java.util.List; | ||
|
||
@Slf4j | ||
@RestController | ||
@Tag(name = "Maps") | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/v1/map/topography") | ||
public class MapTopographyController { | ||
|
||
@NonNull | ||
private final MapMetaDataService mapMetaDataService; | ||
|
||
|
||
@Operation( | ||
summary = "Gets map topography", | ||
description = "Return a list of measured height points and some meta.", | ||
security = @SecurityRequirement(name = HttpCommons.BEARER_AUTHENTICATION_REQUIREMENT) | ||
) | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = HttpCommons.OK_CODE, description = HttpCommons.OK), | ||
@ApiResponse(responseCode = HttpCommons.UNAUTHORIZED_CODE, description = HttpCommons.UNAUTHORIZED, content = @Content()) | ||
}) | ||
@GetMapping(path = "", produces = MediaType.APPLICATION_JSON_VALUE) | ||
@Secured({RECOMAuthorities.EVERYBODY}) | ||
public ResponseEntity<List<String>> listMapNames( | ||
@AuthenticationPrincipal RECOMAccount recomAccount, | ||
@RequestBody final MapTopographyRequestDto mapTopographyRequestDto | ||
) { | ||
log.debug("Requested GET /api/v1/maps"); | ||
|
||
return ResponseEntity.status(HttpStatus.OK) | ||
.cacheControl(CacheControl.noCache()) | ||
.body(mapMetaDataService.provideAllMapNames()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/main/java/com/recom/dto/map/topography/MapTopographyDataPointDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.recom.dto.map.topography; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.constraints.NotBlank; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.io.Serializable; | ||
import java.math.BigDecimal; | ||
import java.util.List; | ||
|
||
@Data | ||
@Schema | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public class MapTopographyDataPointDto implements Serializable { | ||
|
||
@NotBlank | ||
@Schema | ||
@JsonProperty() | ||
private String mapName; | ||
|
||
@Schema | ||
@JsonProperty() | ||
private float oceanHeight; | ||
|
||
@Schema | ||
@JsonProperty() | ||
private float coordinates; | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/com/recom/dto/map/topography/MapTopographyRequestDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.recom.dto.map.topography; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.constraints.NotBlank; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.io.Serializable; | ||
|
||
@Data | ||
@Schema | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public class MapTopographyRequestDto implements Serializable { | ||
|
||
@NotBlank | ||
@Schema | ||
@JsonProperty() | ||
private String mapName; | ||
|
||
} |
37 changes: 37 additions & 0 deletions
37
src/main/java/com/recom/dto/map/topography/MapTopographyResponseDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.recom.dto.map.topography; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.constraints.NotBlank; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.io.Serializable; | ||
import java.math.BigDecimal; | ||
import java.util.List; | ||
|
||
@Data | ||
@Schema | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public class MapTopographyResponseDto implements Serializable { | ||
|
||
@NotBlank | ||
@Schema | ||
@JsonProperty() | ||
private String mapName; | ||
|
||
@Schema | ||
@JsonProperty() | ||
private Float oceanBaseHeight; | ||
|
||
@Schema | ||
@JsonProperty() | ||
private List<MapTopographyDataPointDto> coordinates; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.