-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPubOrderCommandController.java
More file actions
33 lines (28 loc) · 1.36 KB
/
PubOrderCommandController.java
File metadata and controls
33 lines (28 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package kr.co.knuserver.presentation.pubOrder.controller;
import jakarta.validation.Valid;
import kr.co.knuserver.application.pubOrder.PubOrderCommandService;
import kr.co.knuserver.presentation.pubOrder.dto.PubOrderRequestDto;
import kr.co.knuserver.presentation.pubOrder.dto.PubOrderResponseDto;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
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;
@RestController
@RequestMapping("/admin/v1/pubOrder")
@RequiredArgsConstructor
public class PubOrderCommandController {
private final PubOrderCommandService pubOrderCommandService;
@PostMapping
public ResponseEntity<PubOrderResponseDto> createOrder(@Valid @RequestBody PubOrderRequestDto request) {
return ResponseEntity.ok().body(pubOrderCommandService.createOrder(request));
}
@DeleteMapping("/{pubOrderId}")
public ResponseEntity<Void> deleteOrder(@PathVariable("pubOrderId") Long pubOrderId) {
pubOrderCommandService.deleteOrder(pubOrderId);
return ResponseEntity.ok().build();
}
}