backend/src/main/java/com/magamochi/content/controller/ContentController.java

45 lines
1.8 KiB
Java

package com.magamochi.content.controller;
import com.magamochi.common.model.dto.DefaultResponseDTO;
import com.magamochi.content.model.dto.MangaContentDTO;
import com.magamochi.content.service.ContentService;
import com.magamochi.model.dto.MangaContentImagesDTO;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.constraints.NotNull;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/content")
@RequiredArgsConstructor
public class ContentController {
private final ContentService contentService;
@Operation(
summary = "Get the content for a specific manga/content provider combination",
description = "Retrieve the content for a specific manga/content provider combination.",
tags = {"Content"},
operationId = "getMangaProviderContent")
@GetMapping("/{mangaContentProviderId}")
public DefaultResponseDTO<List<MangaContentDTO>> getMangaProviderContent(
@PathVariable @NotNull Long mangaContentProviderId) {
return DefaultResponseDTO.ok(contentService.getContent(mangaContentProviderId));
}
@Operation(
summary = "Get the content images for a specific manga/provider combination",
description =
"Retrieve a list of manga content images for a specific manga/provider combination.",
tags = {"Content"},
operationId = "getMangaContentImages")
@GetMapping("/{mangaContentId}/images")
public DefaultResponseDTO<MangaContentImagesDTO> getMangaContentImages(
@PathVariable Long mangaContentId) {
return DefaultResponseDTO.ok(contentService.getContentImages(mangaContentId));
}
}