File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed
src/main/kotlin/gogo/gogostage
domain/coupon/root/presentation Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ package gogo.gogostage.domain.coupon.root.presentation
2+
3+ import gogo.gogostage.domain.coupon.root.application.CouponService
4+ import gogo.gogostage.domain.coupon.root.application.dto.QueryCouponDto
5+ import gogo.gogostage.domain.coupon.root.application.dto.UseCouponDto
6+ import org.springframework.http.ResponseEntity
7+ import org.springframework.web.bind.annotation.GetMapping
8+ import org.springframework.web.bind.annotation.PostMapping
9+ import org.springframework.web.bind.annotation.RequestMapping
10+ import org.springframework.web.bind.annotation.RequestParam
11+ import org.springframework.web.bind.annotation.RestController
12+
13+ @RestController
14+ @RequestMapping(" /stage" )
15+ class CouponController (
16+ private val couponService : CouponService ,
17+ ) {
18+
19+ @GetMapping(" /coupon" )
20+ fun query (
21+ @RequestParam couponId : String ,
22+ ): ResponseEntity <QueryCouponDto > {
23+ val response = couponService.query(couponId)
24+ return ResponseEntity .ok(response)
25+ }
26+
27+ @PostMapping(" /coupon" )
28+ fun use (
29+ @RequestParam couponId : String ,
30+ ): ResponseEntity <UseCouponDto > {
31+ val response = couponService.use(couponId)
32+ return ResponseEntity .ok(response)
33+ }
34+
35+ }
Original file line number Diff line number Diff line change @@ -94,6 +94,10 @@ class SecurityConfig(
9494 // image
9595 httpRequests.requestMatchers(HttpMethod .POST , " /stage/image" ).hasAnyRole(Authority .USER .name, Authority .STAFF .name)
9696
97+ // coupon
98+ httpRequests.requestMatchers(HttpMethod .GET , " /stage/coupon" ).hasAnyRole(Authority .USER .name, Authority .STAFF .name)
99+ httpRequests.requestMatchers(HttpMethod .POST , " /stage/coupon" ).hasAnyRole(Authority .USER .name, Authority .STAFF .name)
100+
97101 // server to server
98102 httpRequests.requestMatchers(HttpMethod .GET , " /stage/api/point/{stage_id}" ).access { _, context -> hasIpAddress(context) }
99103 httpRequests.requestMatchers(HttpMethod .GET , " /stage/api/match/info" ).access { _, context -> hasIpAddress(context) }
You can’t perform that action at this time.
0 commit comments