-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAdminFAQController.java
More file actions
46 lines (39 loc) Β· 1.52 KB
/
AdminFAQController.java
File metadata and controls
46 lines (39 loc) Β· 1.52 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
34
35
36
37
38
39
40
41
42
43
44
45
46
package com.kt.controller.faq;
import org.springframework.http.HttpStatus;
import org.springframework.security.access.prepost.PreAuthorize;
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.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import com.kt.common.response.ApiResult;
import com.kt.dto.faq.FAQCreateRequest;
import com.kt.service.faq.FAQService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
@PreAuthorize("hasRole('ADMIN')")
@Tag(name = "Admin FAQ", description = "FAQ κ΄λ¦¬μμ© API")
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/admin/faqs")
public class AdminFAQController {
private final FAQService fAQService;
@PostMapping
@ResponseStatus(HttpStatus.CREATED)
@Operation(summary = "FAQ μμ±")
public ApiResult<Void> create(@RequestBody @Valid FAQCreateRequest request) throws Exception {
fAQService.create(request);
return ApiResult.ok();
}
@DeleteMapping("/{id}")
@ResponseStatus(HttpStatus.OK)
@Operation(summary = "FAQ μμ ")
public ApiResult<Void> delete(@PathVariable Long id) {
fAQService.delete(id);
return ApiResult.ok();
}
}