refactor: rename GenreController to CatalogController and update package structure

This commit is contained in:
Rodrigo Verdiani 2026-03-17 20:00:16 -03:00
parent d845dc4d12
commit a6f01bba30
8 changed files with 22 additions and 18 deletions

View File

@ -1,25 +1,25 @@
package com.magamochi.controller; package com.magamochi.catalog.controller;
import com.magamochi.catalog.model.dto.GenreDTO;
import com.magamochi.catalog.service.GenreService;
import com.magamochi.common.dto.DefaultResponseDTO; import com.magamochi.common.dto.DefaultResponseDTO;
import com.magamochi.model.dto.GenreDTO;
import com.magamochi.service.GenreService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import java.util.List; import java.util.List;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@RestController @RestController
@RequestMapping("/genres") @RequestMapping("/catalog")
@RequiredArgsConstructor @RequiredArgsConstructor
public class GenreController { public class CatalogController {
private final GenreService genreService; private final GenreService genreService;
@Operation( @Operation(
summary = "Get a list of genres", summary = "Get a list of manga genres",
description = "Retrieve a list of genres.", description = "Retrieve a list of manga genres.",
tags = {"Genre"}, tags = {"Catalog"},
operationId = "getGenres") operationId = "getGenres")
@GetMapping @GetMapping("/genres")
public DefaultResponseDTO<List<GenreDTO>> getGenres() { public DefaultResponseDTO<List<GenreDTO>> getGenres() {
return DefaultResponseDTO.ok(genreService.getGenres()); return DefaultResponseDTO.ok(genreService.getGenres());
} }

View File

@ -1,6 +1,6 @@
package com.magamochi.model.dto; package com.magamochi.catalog.model.dto;
import com.magamochi.model.entity.Genre; import com.magamochi.catalog.model.entity.Genre;
import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;

View File

@ -1,5 +1,6 @@
package com.magamochi.model.entity; package com.magamochi.catalog.model.entity;
import com.magamochi.model.entity.MangaGenre;
import jakarta.persistence.*; import jakarta.persistence.*;
import java.util.List; import java.util.List;
import lombok.*; import lombok.*;

View File

@ -1,6 +1,6 @@
package com.magamochi.model.repository; package com.magamochi.catalog.model.repository;
import com.magamochi.model.entity.Genre; import com.magamochi.catalog.model.entity.Genre;
import java.util.Optional; import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;

View File

@ -1,7 +1,7 @@
package com.magamochi.service; package com.magamochi.catalog.service;
import com.magamochi.model.dto.GenreDTO; import com.magamochi.catalog.model.dto.GenreDTO;
import com.magamochi.model.repository.GenreRepository; import com.magamochi.catalog.model.repository.GenreRepository;
import java.util.List; import java.util.List;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;

View File

@ -1,5 +1,6 @@
package com.magamochi.model.entity; package com.magamochi.model.entity;
import com.magamochi.catalog.model.entity.Genre;
import jakarta.persistence.*; import jakarta.persistence.*;
import lombok.*; import lombok.*;

View File

@ -1,6 +1,6 @@
package com.magamochi.model.repository; package com.magamochi.model.repository;
import com.magamochi.model.entity.Genre; import com.magamochi.catalog.model.entity.Genre;
import com.magamochi.model.entity.Manga; import com.magamochi.model.entity.Manga;
import com.magamochi.model.entity.MangaGenre; import com.magamochi.model.entity.MangaGenre;
import java.util.Optional; import java.util.Optional;

View File

@ -4,6 +4,8 @@ import static java.util.Objects.isNull;
import static java.util.Objects.nonNull; import static java.util.Objects.nonNull;
import com.google.common.util.concurrent.RateLimiter; import com.google.common.util.concurrent.RateLimiter;
import com.magamochi.catalog.model.entity.Genre;
import com.magamochi.catalog.model.repository.GenreRepository;
import com.magamochi.client.AniListClient; import com.magamochi.client.AniListClient;
import com.magamochi.client.JikanClient; import com.magamochi.client.JikanClient;
import com.magamochi.common.exception.NotFoundException; import com.magamochi.common.exception.NotFoundException;