h-lab/src/main/java/com/hlab/yanalyst/web/WebController.java

122 lines
3.8 KiB
Java

package com.hlab.yanalyst.web;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class WebController {
private final com.hlab.yanalyst.domain.production.ProductionService productionService;
private final com.hlab.yanalyst.domain.channel.ChannelService channelService;
public WebController(com.hlab.yanalyst.domain.production.ProductionService productionService, com.hlab.yanalyst.domain.channel.ChannelService channelService) {
this.productionService = productionService;
this.channelService = channelService;
}
@GetMapping("/")
public String dashboard(Model model) {
model.addAttribute("currentPage", "dashboard");
return "dashboard";
}
@GetMapping("/channels")
public String channels(Model model) {
model.addAttribute("currentPage", "channels");
model.addAttribute("channels", channelService.getAllChannels());
return "channels";
}
@GetMapping("/videos")
public String videos(Model model) {
model.addAttribute("currentPage", "videos");
return "videos";
}
@GetMapping("/collection")
public String collection(Model model) {
model.addAttribute("currentPage", "collection");
return "collection";
}
@GetMapping("/board")
public String board(Model model) {
model.addAttribute("currentPage", "board");
return "board";
}
@GetMapping("/discover")
public String discover(Model model) {
model.addAttribute("currentPage", "discover");
return "discover";
}
@GetMapping("/my-channel")
public String myChannel(Model model) {
model.addAttribute("currentPage", "my-channel");
return "my_channel";
}
@GetMapping("/feed")
public String feed(Model model) {
model.addAttribute("currentPage", "feed");
model.addAttribute("feedTopic", "ENTERTAINMENT");
model.addAttribute("feedTitle", "소재 피드");
return "feed";
}
@GetMapping("/politics-feed")
public String politicsFeed(Model model) {
model.addAttribute("currentPage", "politics-feed");
model.addAttribute("feedTopic", "POLITICS");
model.addAttribute("feedTitle", "정치 피드");
return "feed";
}
@GetMapping("/shortform")
public String shortform(Model model) {
model.addAttribute("currentPage", "shortform");
return "shortform";
}
@GetMapping("/recommend")
public String recommend(Model model) {
model.addAttribute("currentPage", "recommend");
return "recommend";
}
@GetMapping("/rework/{id}")
public String rework(@org.springframework.web.bind.annotation.PathVariable Long id, Model model) {
model.addAttribute("currentPage", "collection");
model.addAttribute("videoId", id);
return "rework";
}
@GetMapping("/reply")
public String reply(Model model) {
model.addAttribute("currentPage", "reply");
return "reply";
}
@GetMapping("/comment-cards")
public String commentCards(Model model) {
model.addAttribute("currentPage", "comment-cards");
return "comment-cards";
}
@GetMapping("/production")
public String production(Model model) {
model.addAttribute("currentPage", "production");
model.addAttribute("historyList", productionService.getAllHistory());
return "production";
}
@GetMapping("/production/{id}")
public String productionDetail(@org.springframework.web.bind.annotation.PathVariable Long id, Model model) {
model.addAttribute("currentPage", "production");
model.addAttribute("history", productionService.getHistory(id));
return "production_detail";
}
}