-
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
6 changed files
with
26 additions
and
4 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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# Parking Service | ||
|
||
Backend for Poga Parking Service | ||
|
||
SwaggerUI - http://localhost:8080/swagger-ui.html |
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
4 changes: 3 additions & 1 deletion
4
src/main/kotlin/poga/parking/parkingservice/ParkingServiceApplication.kt
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 |
---|---|---|
@@ -1,11 +1,13 @@ | ||
package poga.parking.parkingservice | ||
|
||
import io.swagger.v3.oas.annotations.OpenAPIDefinition | ||
import org.springframework.boot.autoconfigure.SpringBootApplication | ||
import org.springframework.boot.runApplication | ||
|
||
@SpringBootApplication | ||
@OpenAPIDefinition | ||
class ParkingServiceApplication | ||
|
||
fun main(args: Array<String>) { | ||
runApplication<ParkingServiceApplication>(*args) | ||
runApplication<ParkingServiceApplication>(*args) | ||
} |
11 changes: 10 additions & 1 deletion
11
src/main/kotlin/poga/parking/parkingservice/controller/PlaceController.kt
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 |
---|---|---|
@@ -1,39 +1,48 @@ | ||
package poga.parking.parkingservice.controller | ||
|
||
import io.swagger.v3.oas.annotations.Operation | ||
import io.swagger.v3.oas.annotations.tags.Tag | ||
import org.springframework.beans.factory.annotation.Autowired | ||
import org.springframework.http.HttpStatus | ||
import org.springframework.http.ResponseEntity | ||
import org.springframework.web.bind.annotation.GetMapping | ||
import org.springframework.web.bind.annotation.PathVariable | ||
import org.springframework.web.bind.annotation.PostMapping | ||
import org.springframework.web.bind.annotation.RequestMapping | ||
import org.springframework.web.bind.annotation.RestController | ||
import poga.parking.parkingservice.controller.model.input.BookPlaceRequest | ||
import poga.parking.parkingservice.controller.model.ouput.FreePlacesResponse | ||
import poga.parking.parkingservice.controller.model.ouput.StatisticsResponse | ||
import poga.parking.parkingservice.service.PlaceService | ||
import poga.parking.parkingservice.support.toHttpStatusCode | ||
|
||
@RestController("/place") | ||
@RestController | ||
@RequestMapping("/place") | ||
@Tag(name = "API for parking places") | ||
class PlaceController( | ||
@Autowired private val placeService: PlaceService | ||
) { | ||
|
||
@GetMapping("/free") | ||
@Operation(summary = "Get all free places") | ||
fun gerFreePlaces(): ResponseEntity<FreePlacesResponse> = | ||
ResponseEntity( | ||
placeService.getFreePlaces(), | ||
HttpStatus.OK.toHttpStatusCode() | ||
) | ||
|
||
@PostMapping("/book") | ||
@Operation(summary = "Book a parking place by user") | ||
fun bookPlace(request: BookPlaceRequest): ResponseEntity<Long> = | ||
TODO("$request") | ||
|
||
@PostMapping("/free/{id}") | ||
@Operation(summary = "Free up a parking place by user") | ||
fun freeUpPlace(@PathVariable id: Long): ResponseEntity<Boolean> = | ||
TODO("$id") | ||
|
||
@GetMapping("/free/{id}") | ||
@Operation(summary = "Get statistics of a free parking place by id") | ||
fun getStatisticsAfterFreeUp(@PathVariable id: Long): ResponseEntity<StatisticsResponse> = | ||
TODO("$id") | ||
} |
8 changes: 7 additions & 1 deletion
8
src/main/kotlin/poga/parking/parkingservice/controller/StatisticsController.kt
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