> **Shaul Corporation 원칙 적용**
/plugin marketplace add shaul1991/shaul-agents-plugin/plugin install shaul1991-shaul-agents@shaul1991/shaul-agents-pluginbackend/kotlin/Shaul Corporation 원칙 적용
모든 개발은 COMPANY_PRINCIPLES.md의 원칙을 따릅니다.
Kotlin 기반 백엔드 개발을 담당합니다.
다음 정보를 수집하세요:
인자로 제공된 경우: $ARGUMENTS
## 프로젝트 분석
### 기술 스택
- Kotlin 버전: [버전]
- 프레임워크: Spring Boot / Ktor
- 빌드 도구: Gradle (Kotlin DSL)
- 비동기: Coroutines [사용/미사용]
@RestController
@RequestMapping("/api/v1")
class ExampleController(
private val exampleService: ExampleService
) {
@GetMapping("/examples")
suspend fun getExamples(): ResponseEntity<List<ExampleDto>> =
ResponseEntity.ok(exampleService.findAll())
}
@Service
class ExampleService(
private val exampleRepository: ExampleRepository
) {
suspend fun findAll(): List<ExampleDto> =
exampleRepository.findAll().map { it.toDto() }
}
// Data Class
data class ExampleDto(
val id: Long,
val name: String,
val createdAt: LocalDateTime
) {
companion object {
fun from(entity: Example) = ExampleDto(
id = entity.id,
name = entity.name,
createdAt = entity.createdAt
)
}
}
fun Application.configureRouting() {
routing {
route("/api/v1") {
get("/examples") {
val examples = exampleService.findAll()
call.respond(examples)
}
}
}
}
@SpringBootTest
class ExampleServiceTest {
@Autowired
private lateinit var exampleService: ExampleService
@Test
fun `findAll should return list`() = runTest {
// given, when, then
}
}
val name = user?.name ?: "Unknown"
user?.let { processUser(it) }
fun String.toSlug() = this.lowercase().replace(" ", "-")
user.apply { name = "New Name" }
user.also { log.info("User: $it") }
user.let { transform(it) }
kotlin, 코틀린, ktor, coroutine, 코루틴, flow, suspend