|
| 1 | +package com.turtletongtong.turtleconnect.festival.controller; |
| 2 | + |
| 3 | +import com.turtletongtong.turtleconnect.festival.dto.request.FestivalCreateRequest; |
| 4 | +import com.turtletongtong.turtleconnect.festival.dto.request.FestivalUpdateRequest; |
| 5 | +import com.turtletongtong.turtleconnect.festival.dto.response.FestivalResponse; |
| 6 | +import com.turtletongtong.turtleconnect.festival.service.FestivalService; |
| 7 | +import io.swagger.v3.oas.annotations.Operation; |
| 8 | +import io.swagger.v3.oas.annotations.tags.Tag; |
| 9 | +import lombok.RequiredArgsConstructor; |
| 10 | +import org.springframework.web.bind.annotation.*; |
| 11 | + |
| 12 | +import java.util.List; |
| 13 | + |
| 14 | +@RestController |
| 15 | +@RequiredArgsConstructor |
| 16 | +@RequestMapping("/api/admin/festivals") |
| 17 | +@Tag(name = "Admin - Festival", description = "관리자용 축제 관리 API") |
| 18 | +public class AdminFestivalController { |
| 19 | + |
| 20 | + private final FestivalService festivalService; |
| 21 | + |
| 22 | + @Operation(summary = "축제 생성") |
| 23 | + @PostMapping |
| 24 | + public FestivalResponse create(@RequestBody FestivalCreateRequest request) { |
| 25 | + return festivalService.createFestival(request); |
| 26 | + } |
| 27 | + |
| 28 | + @Operation(summary = "축제 수정") |
| 29 | + @PutMapping("/{id}") |
| 30 | + public FestivalResponse update( |
| 31 | + @PathVariable Long id, |
| 32 | + @RequestBody FestivalUpdateRequest request |
| 33 | + ) { |
| 34 | + return festivalService.updateFestival(id, request); |
| 35 | + } |
| 36 | + |
| 37 | + @Operation(summary = "축제 삭제") |
| 38 | + @DeleteMapping("/{id}") |
| 39 | + public void delete(@PathVariable Long id) { |
| 40 | + festivalService.deleteFestival(id); |
| 41 | + } |
| 42 | + |
| 43 | + @Operation(summary = "축제 목록 조회 (관리자용)") |
| 44 | + @GetMapping |
| 45 | + public List<FestivalResponse> getAll() { |
| 46 | + return festivalService.getAllFestivalsForAdmin(); |
| 47 | + } |
| 48 | + |
| 49 | + @Operation(summary = "축제 상세 조회 (관리자용)") |
| 50 | + @GetMapping("/{id}") |
| 51 | + public FestivalResponse get(@PathVariable Long id) { |
| 52 | + return festivalService.getFestival(id); |
| 53 | + } |
| 54 | + |
| 55 | + @Operation(summary = "축제 상태 토글 (ACTIVE <-> INACTIVE)") |
| 56 | + @PatchMapping("/{id}/toggle-status") |
| 57 | + public FestivalResponse toggleStatus(@PathVariable Long id) { |
| 58 | + return festivalService.toggleFestivalStatus(id); |
| 59 | + } |
| 60 | + |
| 61 | + @Operation(summary = "축제 패스권 할인 토글 (ON/OFF)") |
| 62 | + @PatchMapping("/{id}/toggle-discount") |
| 63 | + public FestivalResponse toggleDiscount(@PathVariable Long id) { |
| 64 | + return festivalService.toggleFestivalDiscount(id); |
| 65 | + } |
| 66 | +} |
0 commit comments