refactor-architecture #27

Merged
rov merged 11 commits from refactor-architecture into main 2026-03-18 16:55:37 -03:00
28 changed files with 31 additions and 26 deletions
Showing only changes of commit 7d072b41d1 - Show all commits

View File

@ -162,7 +162,7 @@
<plugin> <plugin>
<groupId>com.diffplug.spotless</groupId> <groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId> <artifactId>spotless-maven-plugin</artifactId>
<version>2.46.1</version> <version>3.3.0</version>
<configuration> <configuration>
<java> <java>
<googleJavaFormat/> <googleJavaFormat/>

View File

@ -1,4 +1,4 @@
package com.magamochi.mangamochi.model.dto; package com.magamochi.mangamochi.common.dto;
import jakarta.annotation.Nullable; import jakarta.annotation.Nullable;
import java.time.Instant; import java.time.Instant;

View File

@ -1,4 +1,4 @@
package com.magamochi.mangamochi.model.dto; package com.magamochi.mangamochi.common.dto;
import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;

View File

@ -1,4 +1,4 @@
package com.magamochi.mangamochi.exception; package com.magamochi.mangamochi.common.exception;
public class ConflictException extends RuntimeException { public class ConflictException extends RuntimeException {
public ConflictException(String message) { public ConflictException(String message) {

View File

@ -1,6 +1,6 @@
package com.magamochi.mangamochi.exception; package com.magamochi.mangamochi.common.exception;
import com.magamochi.mangamochi.model.dto.ErrorResponseDTO; import com.magamochi.mangamochi.common.dto.ErrorResponseDTO;
import java.time.Instant; import java.time.Instant;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;

View File

@ -1,4 +1,4 @@
package com.magamochi.mangamochi.exception; package com.magamochi.mangamochi.common.exception;
public class NotFoundException extends RuntimeException { public class NotFoundException extends RuntimeException {
public NotFoundException(String message) { public NotFoundException(String message) {

View File

@ -1,4 +1,4 @@
package com.magamochi.mangamochi.exception; package com.magamochi.mangamochi.common.exception;
public class UnprocessableException extends RuntimeException { public class UnprocessableException extends RuntimeException {
public UnprocessableException(String message) { public UnprocessableException(String message) {

View File

@ -1,5 +1,6 @@
package com.magamochi.mangamochi.controller; package com.magamochi.mangamochi.controller;
import com.magamochi.mangamochi.common.dto.DefaultResponseDTO;
import com.magamochi.mangamochi.model.dto.*; import com.magamochi.mangamochi.model.dto.*;
import com.magamochi.mangamochi.service.UserService; import com.magamochi.mangamochi.service.UserService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;

View File

@ -1,6 +1,6 @@
package com.magamochi.mangamochi.controller; package com.magamochi.mangamochi.controller;
import com.magamochi.mangamochi.model.dto.DefaultResponseDTO; import com.magamochi.mangamochi.common.dto.DefaultResponseDTO;
import com.magamochi.mangamochi.model.dto.GenreDTO; import com.magamochi.mangamochi.model.dto.GenreDTO;
import com.magamochi.mangamochi.service.GenreService; import com.magamochi.mangamochi.service.GenreService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;

View File

@ -1,7 +1,7 @@
package com.magamochi.mangamochi.controller; package com.magamochi.mangamochi.controller;
import com.magamochi.mangamochi.client.NtfyClient; import com.magamochi.mangamochi.client.NtfyClient;
import com.magamochi.mangamochi.model.dto.DefaultResponseDTO; import com.magamochi.mangamochi.common.dto.DefaultResponseDTO;
import com.magamochi.mangamochi.model.dto.UpdateMangaDataCommand; import com.magamochi.mangamochi.model.dto.UpdateMangaDataCommand;
import com.magamochi.mangamochi.model.repository.UserRepository; import com.magamochi.mangamochi.model.repository.UserRepository;
import com.magamochi.mangamochi.queue.UpdateMangaDataProducer; import com.magamochi.mangamochi.queue.UpdateMangaDataProducer;

View File

@ -1,5 +1,6 @@
package com.magamochi.mangamochi.controller; package com.magamochi.mangamochi.controller;
import com.magamochi.mangamochi.common.dto.DefaultResponseDTO;
import com.magamochi.mangamochi.model.dto.*; import com.magamochi.mangamochi.model.dto.*;
import com.magamochi.mangamochi.model.enumeration.ArchiveFileType; import com.magamochi.mangamochi.model.enumeration.ArchiveFileType;
import com.magamochi.mangamochi.service.MangaChapterService; import com.magamochi.mangamochi.service.MangaChapterService;

View File

@ -1,5 +1,6 @@
package com.magamochi.mangamochi.controller; package com.magamochi.mangamochi.controller;
import com.magamochi.mangamochi.common.dto.DefaultResponseDTO;
import com.magamochi.mangamochi.model.dto.*; import com.magamochi.mangamochi.model.dto.*;
import com.magamochi.mangamochi.service.MangaService; import com.magamochi.mangamochi.service.MangaService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;

View File

@ -1,5 +1,6 @@
package com.magamochi.mangamochi.controller; package com.magamochi.mangamochi.controller;
import com.magamochi.mangamochi.common.dto.DefaultResponseDTO;
import com.magamochi.mangamochi.model.dto.*; import com.magamochi.mangamochi.model.dto.*;
import com.magamochi.mangamochi.service.MangaImportService; import com.magamochi.mangamochi.service.MangaImportService;
import com.magamochi.mangamochi.service.ProviderManualMangaImportService; import com.magamochi.mangamochi.service.ProviderManualMangaImportService;

View File

@ -1,6 +1,6 @@
package com.magamochi.mangamochi.controller; package com.magamochi.mangamochi.controller;
import com.magamochi.mangamochi.model.dto.DefaultResponseDTO; import com.magamochi.mangamochi.common.dto.DefaultResponseDTO;
import com.magamochi.mangamochi.model.dto.ImportReviewDTO; import com.magamochi.mangamochi.model.dto.ImportReviewDTO;
import com.magamochi.mangamochi.service.MangaImportReviewService; import com.magamochi.mangamochi.service.MangaImportReviewService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;

View File

@ -1,5 +1,6 @@
package com.magamochi.mangamochi.controller; package com.magamochi.mangamochi.controller;
import com.magamochi.mangamochi.common.dto.DefaultResponseDTO;
import com.magamochi.mangamochi.model.dto.*; import com.magamochi.mangamochi.model.dto.*;
import com.magamochi.mangamochi.service.ProviderService; import com.magamochi.mangamochi.service.ProviderService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;

View File

@ -1,6 +1,6 @@
package com.magamochi.mangamochi.controller; package com.magamochi.mangamochi.controller;
import com.magamochi.mangamochi.model.dto.DefaultResponseDTO; import com.magamochi.mangamochi.common.dto.DefaultResponseDTO;
import com.magamochi.mangamochi.service.UserFavoriteMangaService; import com.magamochi.mangamochi.service.UserFavoriteMangaService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;

View File

@ -1,6 +1,6 @@
package com.magamochi.mangamochi.service; package com.magamochi.mangamochi.service;
import com.magamochi.mangamochi.exception.NotFoundException; import com.magamochi.mangamochi.common.exception.NotFoundException;
import com.magamochi.mangamochi.model.entity.Language; import com.magamochi.mangamochi.model.entity.Language;
import com.magamochi.mangamochi.model.repository.LanguageRepository; import com.magamochi.mangamochi.model.repository.LanguageRepository;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;

View File

@ -1,7 +1,7 @@
package com.magamochi.mangamochi.service; package com.magamochi.mangamochi.service;
import com.google.common.util.concurrent.RateLimiter; import com.google.common.util.concurrent.RateLimiter;
import com.magamochi.mangamochi.exception.UnprocessableException; import com.magamochi.mangamochi.common.exception.UnprocessableException;
import com.magamochi.mangamochi.model.dto.MangaChapterArchiveDTO; import com.magamochi.mangamochi.model.dto.MangaChapterArchiveDTO;
import com.magamochi.mangamochi.model.dto.MangaChapterImagesDTO; import com.magamochi.mangamochi.model.dto.MangaChapterImagesDTO;
import com.magamochi.mangamochi.model.entity.MangaChapter; import com.magamochi.mangamochi.model.entity.MangaChapter;

View File

@ -4,7 +4,7 @@ import static java.util.Objects.isNull;
import com.google.common.util.concurrent.RateLimiter; import com.google.common.util.concurrent.RateLimiter;
import com.magamochi.mangamochi.client.JikanClient; import com.magamochi.mangamochi.client.JikanClient;
import com.magamochi.mangamochi.exception.NotFoundException; import com.magamochi.mangamochi.common.exception.NotFoundException;
import com.magamochi.mangamochi.model.dto.ImportReviewDTO; import com.magamochi.mangamochi.model.dto.ImportReviewDTO;
import com.magamochi.mangamochi.model.dto.UpdateMangaDataCommand; import com.magamochi.mangamochi.model.dto.UpdateMangaDataCommand;
import com.magamochi.mangamochi.model.entity.Manga; import com.magamochi.mangamochi.model.entity.Manga;

View File

@ -6,7 +6,7 @@ import static java.util.Objects.nonNull;
import com.google.common.util.concurrent.RateLimiter; import com.google.common.util.concurrent.RateLimiter;
import com.magamochi.mangamochi.client.AniListClient; import com.magamochi.mangamochi.client.AniListClient;
import com.magamochi.mangamochi.client.JikanClient; import com.magamochi.mangamochi.client.JikanClient;
import com.magamochi.mangamochi.exception.NotFoundException; import com.magamochi.mangamochi.common.exception.NotFoundException;
import com.magamochi.mangamochi.model.dto.ContentProviderMangaChapterResponseDTO; import com.magamochi.mangamochi.model.dto.ContentProviderMangaChapterResponseDTO;
import com.magamochi.mangamochi.model.entity.*; import com.magamochi.mangamochi.model.entity.*;
import com.magamochi.mangamochi.model.repository.*; import com.magamochi.mangamochi.model.repository.*;

View File

@ -3,7 +3,7 @@ package com.magamochi.mangamochi.service;
import static java.util.Objects.nonNull; import static java.util.Objects.nonNull;
import com.magamochi.mangamochi.client.NtfyClient; import com.magamochi.mangamochi.client.NtfyClient;
import com.magamochi.mangamochi.exception.NotFoundException; import com.magamochi.mangamochi.common.exception.NotFoundException;
import com.magamochi.mangamochi.model.dto.*; import com.magamochi.mangamochi.model.dto.*;
import com.magamochi.mangamochi.model.entity.Manga; import com.magamochi.mangamochi.model.entity.Manga;
import com.magamochi.mangamochi.model.entity.MangaChapter; import com.magamochi.mangamochi.model.entity.MangaChapter;
@ -13,7 +13,6 @@ import com.magamochi.mangamochi.model.repository.*;
import com.magamochi.mangamochi.model.specification.MangaSpecification; import com.magamochi.mangamochi.model.specification.MangaSpecification;
import com.magamochi.mangamochi.queue.MangaChapterDownloadProducer; import com.magamochi.mangamochi.queue.MangaChapterDownloadProducer;
import com.magamochi.mangamochi.service.providers.ContentProviderFactory; import com.magamochi.mangamochi.service.providers.ContentProviderFactory;
import java.net.*;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;

View File

@ -3,7 +3,7 @@ package com.magamochi.mangamochi.service;
import static java.util.Objects.isNull; import static java.util.Objects.isNull;
import static java.util.Objects.nonNull; import static java.util.Objects.nonNull;
import com.magamochi.mangamochi.exception.NotFoundException; import com.magamochi.mangamochi.common.exception.NotFoundException;
import com.magamochi.mangamochi.model.dto.ImportMangaResponseDTO; import com.magamochi.mangamochi.model.dto.ImportMangaResponseDTO;
import com.magamochi.mangamochi.model.dto.ImportRequestDTO; import com.magamochi.mangamochi.model.dto.ImportRequestDTO;
import com.magamochi.mangamochi.model.entity.*; import com.magamochi.mangamochi.model.entity.*;

View File

@ -1,6 +1,6 @@
package com.magamochi.mangamochi.service; package com.magamochi.mangamochi.service;
import com.magamochi.mangamochi.exception.NotFoundException; import com.magamochi.mangamochi.common.exception.NotFoundException;
import com.magamochi.mangamochi.model.entity.Manga; import com.magamochi.mangamochi.model.entity.Manga;
import com.magamochi.mangamochi.model.entity.UserFavoriteManga; import com.magamochi.mangamochi.model.entity.UserFavoriteManga;
import com.magamochi.mangamochi.model.repository.MangaRepository; import com.magamochi.mangamochi.model.repository.MangaRepository;

View File

@ -2,8 +2,8 @@ package com.magamochi.mangamochi.service;
import static java.util.Objects.isNull; import static java.util.Objects.isNull;
import com.magamochi.mangamochi.exception.ConflictException; import com.magamochi.mangamochi.common.exception.ConflictException;
import com.magamochi.mangamochi.exception.NotFoundException; import com.magamochi.mangamochi.common.exception.NotFoundException;
import com.magamochi.mangamochi.model.dto.AuthenticationRequestDTO; import com.magamochi.mangamochi.model.dto.AuthenticationRequestDTO;
import com.magamochi.mangamochi.model.dto.AuthenticationResponseDTO; import com.magamochi.mangamochi.model.dto.AuthenticationResponseDTO;
import com.magamochi.mangamochi.model.dto.RefreshTokenRequestDTO; import com.magamochi.mangamochi.model.dto.RefreshTokenRequestDTO;

View File

@ -2,7 +2,7 @@ package com.magamochi.mangamochi.service.providers.impl;
import static java.util.Objects.isNull; import static java.util.Objects.isNull;
import com.magamochi.mangamochi.exception.UnprocessableException; import com.magamochi.mangamochi.common.exception.UnprocessableException;
import com.magamochi.mangamochi.model.dto.ContentProviderMangaChapterResponseDTO; import com.magamochi.mangamochi.model.dto.ContentProviderMangaChapterResponseDTO;
import com.magamochi.mangamochi.model.entity.MangaProvider; import com.magamochi.mangamochi.model.entity.MangaProvider;
import com.magamochi.mangamochi.service.FlareService; import com.magamochi.mangamochi.service.FlareService;

View File

@ -4,7 +4,7 @@ import static java.util.Objects.isNull;
import com.google.common.util.concurrent.RateLimiter; import com.google.common.util.concurrent.RateLimiter;
import com.magamochi.mangamochi.client.MangaDexClient; import com.magamochi.mangamochi.client.MangaDexClient;
import com.magamochi.mangamochi.exception.UnprocessableException; import com.magamochi.mangamochi.common.exception.UnprocessableException;
import com.magamochi.mangamochi.model.dto.ContentProviderMangaChapterResponseDTO; import com.magamochi.mangamochi.model.dto.ContentProviderMangaChapterResponseDTO;
import com.magamochi.mangamochi.model.entity.MangaProvider; import com.magamochi.mangamochi.model.entity.MangaProvider;
import com.magamochi.mangamochi.service.providers.ContentProvider; import com.magamochi.mangamochi.service.providers.ContentProvider;

View File

@ -1,6 +1,6 @@
package com.magamochi.mangamochi.task; package com.magamochi.mangamochi.task;
import com.magamochi.mangamochi.exception.NotFoundException; import com.magamochi.mangamochi.common.exception.NotFoundException;
import com.magamochi.mangamochi.model.dto.MangaListUpdateCommand; import com.magamochi.mangamochi.model.dto.MangaListUpdateCommand;
import com.magamochi.mangamochi.model.repository.ProviderRepository; import com.magamochi.mangamochi.model.repository.ProviderRepository;
import com.magamochi.mangamochi.queue.UpdateMangaListProducer; import com.magamochi.mangamochi.queue.UpdateMangaListProducer;

View File

@ -13,7 +13,8 @@ $$
WHERE name = _target_provider_name; WHERE name = _target_provider_name;
IF _target_provider_id IS NULL THEN IF _target_provider_id IS NULL THEN
RAISE EXCEPTION 'Provider with name "%" not found.', _target_provider_name; RAISE NOTICE 'Provider with name "%" not found.', _target_provider_name;
RETURN;
END IF; END IF;
UPDATE providers SET status = 'INACTIVE' WHERE id = _target_provider_id; UPDATE providers SET status = 'INACTIVE' WHERE id = _target_provider_id;