From f6234853e8d8c18dfb45fa3257dc78b61f02f513 Mon Sep 17 00:00:00 2001 From: "dmitriy.churmeev" Date: Sat, 4 Apr 2026 12:33:35 +0300 Subject: [PATCH] test value --- .../kotlin/com/test/rest/TestController.kt | 49 +++++++++---------- .../kotlin/com/test/service/TestService.kt | 4 +- 2 files changed, 26 insertions(+), 27 deletions(-) diff --git a/src/main/kotlin/com/test/rest/TestController.kt b/src/main/kotlin/com/test/rest/TestController.kt index fb58198..c77e711 100644 --- a/src/main/kotlin/com/test/rest/TestController.kt +++ b/src/main/kotlin/com/test/rest/TestController.kt @@ -21,30 +21,29 @@ open class TestController(private val testService: TestService) { //@PreAuthorize("hasRole('ADMIN')") //@PreAuthorize("hasRole('USER')") -// -// @PostMapping("/add") -// fun add(@RequestBody testModel: TestModel): TestModel { -// return testService.add(testModel) -// } -// -// @PutMapping("/update") -// fun users(@RequestBody testModel: TestModel): TestModel { -// return testService.update(testModel) -// } -// -// @GetMapping("/{id}") -// fun get(@PathVariable(value = "id") id: Long): TestModel { -// return testService.get(id)!! -// } -// -// @DeleteMapping("/{id}") -// fun delete(@RequestBody id: Long) { -// testService.remove(id) -// } -// -// @GetMapping("/") -// fun getAll(): List { -// return testService.getAll() -// } + @PostMapping("/add") + fun add(@RequestBody testModel: TestModel): TestModel { + return testService.add(testModel) + } + + @PutMapping("/update") + fun users(@RequestBody testModel: TestModel): TestModel { + return testService.update(testModel) + } + + @GetMapping("/{id}") + fun get(@PathVariable(value = "id") id: Long): TestModel { + return testService.get(id)!! + } + + @DeleteMapping("/{id}") + fun delete(@RequestBody id: Long) { + testService.remove(id) + } + + @GetMapping("/") + fun getAll(): List { + return testService.getAll() + } } \ No newline at end of file diff --git a/src/main/kotlin/com/test/service/TestService.kt b/src/main/kotlin/com/test/service/TestService.kt index 1da2cef..b60e9a2 100644 --- a/src/main/kotlin/com/test/service/TestService.kt +++ b/src/main/kotlin/com/test/service/TestService.kt @@ -3,11 +3,11 @@ package com.test.service import com.test.entities.TestEntity import com.test.model.TestModel import com.test.repository.TestEntityRepository -//import org.springframework.data.repository.findByIdOrNull +import org.springframework.data.repository.findByIdOrNull import org.springframework.stereotype.Service @Service -class TestService(private val testEntityRepository: TestEntityRepository) { +class TestService(){//private val testEntityRepository: TestEntityRepository) { // fun add(model: TestModel): TestModel { // var entity = testEntityRepository.save(TestEntity(null, model.key, model.value))