-
Notifications
You must be signed in to change notification settings - Fork 1
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
7 changed files
with
82 additions
and
26 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
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
14 changes: 14 additions & 0 deletions
14
src/main/kotlin/com/albatros/springsecurity/data/service/TenderApiService.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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.albatros.springsecurity.data.service | ||
|
||
import com.albatros.springsecurity.data.model.dto.TenderDto | ||
import com.albatros.springsecurity.data.model.dto.TenderInfoDto | ||
import com.albatros.springsecurity.data.model.dto.TenderProviderDto | ||
|
||
interface TenderApiService { | ||
|
||
fun getAllTenderProviders(mode: String = "eauc"): MutableList<TenderProviderDto>? | ||
|
||
fun getTendersByProviders(providerId: Int): List<TenderDto>? | ||
|
||
fun getTenderInfoById(tenderId: Int): MutableList<TenderInfoDto>? | ||
} |
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
34 changes: 27 additions & 7 deletions
34
src/main/kotlin/com/albatros/springsecurity/presentation/controller/TenderController.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,23 +1,43 @@ | ||
package com.albatros.springsecurity.presentation.controller | ||
|
||
import com.albatros.springsecurity.data.model.database.Tender | ||
import com.albatros.springsecurity.data.repository.TenderRepository | ||
import com.albatros.springsecurity.data.service.TenderApiService | ||
import org.springframework.web.bind.annotation.GetMapping | ||
import org.springframework.web.bind.annotation.PathVariable | ||
import org.springframework.web.bind.annotation.RequestMapping | ||
import org.springframework.web.bind.annotation.RequestParam | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
@RestController | ||
@RequestMapping("/api") | ||
class TenderController( | ||
private val tenderService: TenderApiService | ||
private val apiService: TenderApiService, | ||
private val tenderRepository: TenderRepository | ||
) { | ||
|
||
@GetMapping("providers/") | ||
fun getAll() = tenderService.getAllTenderProviders() | ||
@GetMapping("/provider/") | ||
fun getAll() = apiService.getAllTenderProviders() | ||
|
||
@GetMapping("tenders/{id}") | ||
fun getTendersByProviderId(@PathVariable id: Int) = tenderService.getTendersByProviders(id) | ||
@GetMapping("/provider/{id}/tender") | ||
fun getTendersByProviderId(@PathVariable id: Int) = apiService.getTendersByProviders(id) | ||
|
||
@GetMapping("tenders/{id}/info") | ||
fun getTenderInfoById(@PathVariable id: Int) = tenderService.getTenderInfoById(id) | ||
@GetMapping("/tender/customer") | ||
fun findAllByCustomerContainsIgnoreCase(@RequestParam customer: String): List<Tender> = | ||
tenderRepository.findAllByCustomerContainsIgnoreCase(customer) | ||
|
||
@GetMapping("/tender/region") | ||
fun findAllByRegionContainsIgnoreCase(@RequestParam region: String): List<Tender> = | ||
tenderRepository.findAllByRegionContainsIgnoreCase(region) | ||
|
||
@GetMapping("/tender/category") | ||
fun findAllByCategory(@RequestParam category: String): List<Tender> = tenderRepository.findAllByCategory(category) | ||
|
||
@GetMapping("/tender/etp") | ||
fun findAllByEtpEqualsIgnoreCase(@RequestParam etp: String): List<Tender> = | ||
tenderRepository.findAllByEtpEqualsIgnoreCase(etp) | ||
|
||
@GetMapping("/tender/name") | ||
fun findAllByTenderNameContainingIgnoreCase(@RequestParam(value = "query") query: String): List<Tender> = | ||
tenderRepository.findAllByTenderNameContainingIgnoreCase(query) | ||
} |
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