Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #61
Browse files Browse the repository at this point in the history
* feat(TempApi): 알림 테스트 전송용 API 구현
  • Loading branch information
zbqmgldjfh authored Feb 4, 2024
1 parent f335210 commit 359cb8f
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/main/kotlin/gdsc/plantory/plant/presentation/TempApi.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package gdsc.plantory.plant.presentation

import gdsc.plantory.event.Events
import gdsc.plantory.event.notification.WaterCycleEvent
import gdsc.plantory.event.notification.WaterCycleEvents
import gdsc.plantory.plant.presentation.dto.AlarmRequest
import io.swagger.v3.oas.annotations.Operation
import io.swagger.v3.oas.annotations.responses.ApiResponse
import io.swagger.v3.oas.annotations.tags.Tag
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@Tag(name = "Test Alarm", description = "테스트 알림 API")
@RestController
@RequestMapping("/api/v1/alarm")
class TempApi {

// TODO : 꼭 삭제할것
@Operation(summary = "알림 테스트 전송", description = "테스트 용도의 알림 전송 API")
@ApiResponse(responseCode = "200", description = "알림 전송 성공")
@PostMapping
fun AlarmApi(
@RequestBody request: AlarmRequest
): ResponseEntity<Unit> {
val event = WaterCycleEvent(request.deviceToken)
val events: List<WaterCycleEvent> = listOf(event)
Events.raise(WaterCycleEvents(events))

return ResponseEntity.ok().build()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package gdsc.plantory.plant.presentation.dto

data class AlarmRequest(
val deviceToken: String
) {
}

0 comments on commit 359cb8f

Please sign in to comment.