generated from stscoundrel/kotlin-template
-
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
1 parent
170cc1b
commit 56f08d9
Showing
4 changed files
with
70 additions
and
3 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
src/main/kotlin/io/github/stscoundrel/revalidator/controller/LogController.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,41 @@ | ||
package io.github.stscoundrel.revalidator.controller | ||
|
||
import io.github.stscoundrel.revalidator.entities.Log | ||
import io.github.stscoundrel.revalidator.service.LogService | ||
import org.springframework.web.bind.annotation.GetMapping | ||
import org.springframework.web.bind.annotation.RequestMapping | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
@RestController | ||
@RequestMapping("/api/logs") | ||
class LogController(private val logService: LogService) { | ||
@GetMapping | ||
fun getAllLogs(): List<Log> { | ||
return logService.getAll() | ||
} | ||
|
||
@GetMapping("/old-norse") | ||
fun getOldNorseLogs(): List<Log> { | ||
return logService.getOldNorse() | ||
} | ||
|
||
@GetMapping("/old-icelandic") | ||
fun getOldIcelandicLogs(): List<Log> { | ||
return logService.getOldIcelandic() | ||
} | ||
|
||
@GetMapping("/old-swedish") | ||
fun getOldSwedishLogs(): List<Log> { | ||
return logService.getOldSwedish() | ||
} | ||
|
||
@GetMapping("/old-norwegian") | ||
fun getOldNorwegianLogs(): List<Log> { | ||
return logService.getOldNorwegian() | ||
} | ||
|
||
@GetMapping("/old-danish") | ||
fun getOldDanishLogs(): List<Log> { | ||
return logService.getOldDanish() | ||
} | ||
} |
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
5 changes: 4 additions & 1 deletion
5
src/main/kotlin/io/github/stscoundrel/revalidator/repository/LogRepository.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,6 +1,9 @@ | ||
package io.github.stscoundrel.revalidator.repository | ||
|
||
import io.github.stscoundrel.revalidator.entities.Log | ||
import io.github.stscoundrel.revalidator.enums.DictionaryType | ||
import org.springframework.data.jpa.repository.JpaRepository | ||
|
||
interface LogRepository : JpaRepository<Log, Long> | ||
interface LogRepository : JpaRepository<Log, Long> { | ||
fun findByDictionaryType(dictionaryType: DictionaryType): List<Log> | ||
} |
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