Skip to content

Commit

Permalink
refactor: change package structure for all
Browse files Browse the repository at this point in the history
  • Loading branch information
ShulV committed Oct 29, 2023
1 parent 2aea04e commit cf5609d
Show file tree
Hide file tree
Showing 74 changed files with 256 additions and 243 deletions.
6 changes: 1 addition & 5 deletions src/main/java/com/shulpov/spots_app/SpotsApplication.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
package com.shulpov.spots_app;

import com.shulpov.spots_app.user.UserRepository;
import org.modelmapper.ModelMapper;
import com.shulpov.spots_app.users.UserRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;

import java.net.*;
import java.util.Arrays;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.shulpov.spots_app.auth_management.auth_providers;
package com.shulpov.spots_app.authentication_management.auth_providers;

import com.shulpov.spots_app.user.User;
import com.shulpov.spots_app.users.models.User;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationProvider;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.shulpov.spots_app.auth_management.controllers;
package com.shulpov.spots_app.authentication_management.controllers;

import com.shulpov.spots_app.auth_management.exceptions.RegisterErrorException;
import com.shulpov.spots_app.auth_management.requests.AuthenticationRequest;
import com.shulpov.spots_app.auth_management.requests.RegisterRequest;
import com.shulpov.spots_app.auth_management.responses.AuthenticationResponse;
import com.shulpov.spots_app.auth_management.responses.LogoutMessageResponse;
import com.shulpov.spots_app.auth_management.responses.RegisterErrorResponse;
import com.shulpov.spots_app.auth_management.responses.RegisterResponse;
import com.shulpov.spots_app.auth_management.services.AuthenticationService;
import com.shulpov.spots_app.authentication_management.exceptions.RegisterErrorException;
import com.shulpov.spots_app.authentication_management.requests.AuthenticationRequest;
import com.shulpov.spots_app.authentication_management.requests.RegisterRequest;
import com.shulpov.spots_app.authentication_management.responses.AuthenticationResponse;
import com.shulpov.spots_app.authentication_management.responses.LogoutMessageResponse;
import com.shulpov.spots_app.authentication_management.responses.RegisterErrorResponse;
import com.shulpov.spots_app.authentication_management.responses.RegisterResponse;
import com.shulpov.spots_app.authentication_management.services.AuthenticationService;
import com.shulpov.spots_app.dto.FieldErrorDto;
import com.shulpov.spots_app.responses.ErrorMessageResponse;
import com.shulpov.spots_app.utils.DtoConverter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.shulpov.spots_app.auth_management.exceptions;
package com.shulpov.spots_app.authentication_management.exceptions;

import lombok.Getter;
import org.springframework.validation.FieldError;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.shulpov.spots_app.auth_management.filters;
package com.shulpov.spots_app.authentication_management.filters;

import com.shulpov.spots_app.auth_management.services.JwtService;
import com.shulpov.spots_app.authentication_management.services.JwtService;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.shulpov.spots_app.auth_management.requests;
package com.shulpov.spots_app.authentication_management.requests;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.shulpov.spots_app.auth_management.requests;
package com.shulpov.spots_app.authentication_management.requests;

import jakarta.validation.constraints.*;
import lombok.AllArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.shulpov.spots_app.auth_management.responses;
package com.shulpov.spots_app.authentication_management.responses;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.shulpov.spots_app.auth_management.responses;
package com.shulpov.spots_app.authentication_management.responses;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.shulpov.spots_app.auth_management.responses;
package com.shulpov.spots_app.authentication_management.responses;

import com.shulpov.spots_app.responses.ValidationErrorResponse;
import lombok.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.shulpov.spots_app.auth_management.responses;
package com.shulpov.spots_app.authentication_management.responses;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
package com.shulpov.spots_app.auth_management.services;
package com.shulpov.spots_app.authentication_management.services;

import com.shulpov.spots_app.auth_management.exceptions.RegisterErrorException;
import com.shulpov.spots_app.auth_management.requests.AuthenticationRequest;
import com.shulpov.spots_app.auth_management.requests.RegisterRequest;
import com.shulpov.spots_app.auth_management.responses.AuthenticationResponse;
import com.shulpov.spots_app.auth_management.responses.LogoutMessageResponse;
import com.shulpov.spots_app.auth_management.responses.RegisterResponse;
import com.shulpov.spots_app.auth_management.token.Token;
import com.shulpov.spots_app.auth_management.token.TokenRepository;
import com.shulpov.spots_app.auth_management.token.TokenService;
import com.shulpov.spots_app.auth_management.token.TokenType;
import com.shulpov.spots_app.auth_management.validators.UserValidator;
import com.shulpov.spots_app.user.Role;
import com.shulpov.spots_app.user.User;
import com.shulpov.spots_app.user.UserRepository;
import com.shulpov.spots_app.authentication_management.exceptions.RegisterErrorException;
import com.shulpov.spots_app.authentication_management.requests.AuthenticationRequest;
import com.shulpov.spots_app.authentication_management.requests.RegisterRequest;
import com.shulpov.spots_app.authentication_management.responses.AuthenticationResponse;
import com.shulpov.spots_app.authentication_management.responses.LogoutMessageResponse;
import com.shulpov.spots_app.authentication_management.responses.RegisterResponse;
import com.shulpov.spots_app.authentication_management.tokens.Token;
import com.shulpov.spots_app.authentication_management.tokens.TokenRepository;
import com.shulpov.spots_app.authentication_management.tokens.TokenService;
import com.shulpov.spots_app.authentication_management.tokens.TokenType;
import com.shulpov.spots_app.authentication_management.validators.UserValidator;
import com.shulpov.spots_app.users.authorization.Role;
import com.shulpov.spots_app.users.models.User;
import com.shulpov.spots_app.users.UserRepository;
import io.jsonwebtoken.JwtException;
import lombok.RequiredArgsConstructor;
import org.springframework.security.authentication.AuthenticationManager;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.shulpov.spots_app.auth_management.services;
package com.shulpov.spots_app.authentication_management.services;

import io.jsonwebtoken.*;
import io.jsonwebtoken.io.Decoders;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.shulpov.spots_app.auth_management.token;
package com.shulpov.spots_app.authentication_management.tokens;

import com.shulpov.spots_app.user.User;
import com.shulpov.spots_app.users.models.User;
import jakarta.persistence.*;
import lombok.*;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.shulpov.spots_app.auth_management.token;
package com.shulpov.spots_app.authentication_management.tokens;

import com.shulpov.spots_app.user.User;
import com.shulpov.spots_app.users.models.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.shulpov.spots_app.auth_management.token;
package com.shulpov.spots_app.authentication_management.tokens;

import org.springframework.stereotype.Service;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.shulpov.spots_app.authentication_management.tokens;

public enum TokenType {
// BEARER,
REFRESH
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package com.shulpov.spots_app.auth_management.validators;
package com.shulpov.spots_app.authentication_management.validators;

import com.shulpov.spots_app.services.UserService;
import com.shulpov.spots_app.user.User;
import com.shulpov.spots_app.users.UserService;
import com.shulpov.spots_app.users.models.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.lang.NonNullApi;
import org.springframework.stereotype.Component;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.shulpov.spots_app.models;
package com.shulpov.spots_app.comments;

import com.shulpov.spots_app.user.User;
import com.shulpov.spots_app.spots.models.Spot;
import com.shulpov.spots_app.users.models.User;
import jakarta.persistence.*;
import jakarta.validation.constraints.Size;
import org.apache.logging.log4j.core.config.plugins.validation.constraints.NotBlank;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package com.shulpov.spots_app.controllers;
package com.shulpov.spots_app.comments;

import com.shulpov.spots_app.dto.CommentDto;
import com.shulpov.spots_app.models.Comment;
import com.shulpov.spots_app.user.User;
import com.shulpov.spots_app.services.CommentService;
import com.shulpov.spots_app.services.UserService;
import com.shulpov.spots_app.users.models.User;
import com.shulpov.spots_app.users.UserService;
import com.shulpov.spots_app.utils.DtoConverter;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.shulpov.spots_app.dto;
package com.shulpov.spots_app.comments;

import com.shulpov.spots_app.users.dto.UserWithoutSpotsDto;
import jakarta.validation.constraints.Size;
import org.apache.logging.log4j.core.config.plugins.validation.constraints.NotBlank;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.shulpov.spots_app.repo;
package com.shulpov.spots_app.comments;

import com.shulpov.spots_app.models.Comment;
import com.shulpov.spots_app.models.Spot;
import com.shulpov.spots_app.spots.models.Spot;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.shulpov.spots_app.services;
package com.shulpov.spots_app.comments;

import com.shulpov.spots_app.models.Comment;
import com.shulpov.spots_app.models.Spot;
import com.shulpov.spots_app.user.User;
import com.shulpov.spots_app.repo.CommentRepo;
import com.shulpov.spots_app.spots.models.Spot;
import com.shulpov.spots_app.spots.SpotService;
import com.shulpov.spots_app.users.models.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Lazy;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.shulpov.spots_app.configs;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.shulpov.spots_app.user.UserRepository;
import com.shulpov.spots_app.users.UserRepository;
import lombok.RequiredArgsConstructor;
import org.modelmapper.ModelMapper;
import org.slf4j.Logger;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.shulpov.spots_app.configs;

import com.shulpov.spots_app.auth_management.auth_providers.LoginPasswordAuthenticationProvider;
import com.shulpov.spots_app.auth_management.filters.JwtAuthenticationFilter;
import com.shulpov.spots_app.authentication_management.auth_providers.LoginPasswordAuthenticationProvider;
import com.shulpov.spots_app.authentication_management.filters.JwtAuthenticationFilter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.shulpov.spots_app.controllers;
package com.shulpov.spots_app.image_infos;

import com.shulpov.spots_app.models.ImageInfo;
import com.shulpov.spots_app.user.User;
import com.shulpov.spots_app.services.ImageInfoService;
import com.shulpov.spots_app.services.UserService;
import com.shulpov.spots_app.image_infos.models.ImageInfo;
import com.shulpov.spots_app.users.models.User;
import com.shulpov.spots_app.users.UserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.slf4j.Logger;
Expand Down Expand Up @@ -145,6 +144,7 @@ public ResponseEntity<Map<String, Object>> deleteUserImage(@PathVariable("id") L
}
logger.atInfo().log("/delete-user-image/{}: user doesn't exist or userHasImageWithId=false", id);
return new ResponseEntity<>(
//TODO обработать ошибку нормально, заменить ловлю обычного Exception
Map.of("message","image with id=" + id + " for user=" + user.get().getName() + " not found"),
HttpStatus.BAD_REQUEST);
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
package com.shulpov.spots_app.repo;
package com.shulpov.spots_app.image_infos;

import com.shulpov.spots_app.models.ImageInfo;
import com.shulpov.spots_app.models.Spot;
import com.shulpov.spots_app.image_infos.models.ImageInfo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ImageInfoRepo extends JpaRepository<ImageInfo, Long> {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.shulpov.spots_app.services;
package com.shulpov.spots_app.image_infos;

import com.shulpov.spots_app.file_manager.FileManager;
import com.shulpov.spots_app.models.ImageInfo;
import com.shulpov.spots_app.models.Spot;
import com.shulpov.spots_app.user.User;
import com.shulpov.spots_app.repo.ImageInfoRepo;
import com.shulpov.spots_app.utils.file_manager.FileManager;
import com.shulpov.spots_app.image_infos.models.ImageInfo;
import com.shulpov.spots_app.spots.models.Spot;
import com.shulpov.spots_app.spots.SpotService;
import com.shulpov.spots_app.users.models.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.shulpov.spots_app.dto;
package com.shulpov.spots_app.image_infos.dto;

import java.util.Date;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.shulpov.spots_app.models;
package com.shulpov.spots_app.image_infos.models;

import com.shulpov.spots_app.user.User;
import com.shulpov.spots_app.spots.models.Spot;
import com.shulpov.spots_app.users.models.User;
import jakarta.persistence.*;

import java.util.Date;
Expand Down
17 changes: 0 additions & 17 deletions src/main/java/com/shulpov/spots_app/location/repo/CityRepo.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.shulpov.spots_app.location.controllers;
package com.shulpov.spots_app.locations.controllers;

import com.shulpov.spots_app.location.dto.CityDto;
import com.shulpov.spots_app.location.models.City;
import com.shulpov.spots_app.location.services.CityService;
import com.shulpov.spots_app.locations.dto.CityDto;
import com.shulpov.spots_app.locations.models.City;
import com.shulpov.spots_app.locations.services.CityService;
import com.shulpov.spots_app.utils.DtoConverter;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.shulpov.spots_app.location.controllers;
package com.shulpov.spots_app.locations.controllers;

import com.shulpov.spots_app.location.dto.CountryDto;
import com.shulpov.spots_app.location.services.CountryService;
import com.shulpov.spots_app.locations.dto.CountryDto;
import com.shulpov.spots_app.locations.services.CountryService;
import com.shulpov.spots_app.utils.DtoConverter;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.shulpov.spots_app.location.controllers;
package com.shulpov.spots_app.locations.controllers;

import com.shulpov.spots_app.location.dto.RegionDto;
import com.shulpov.spots_app.location.models.Region;
import com.shulpov.spots_app.location.services.RegionService;
import com.shulpov.spots_app.locations.dto.RegionDto;
import com.shulpov.spots_app.locations.models.Region;
import com.shulpov.spots_app.locations.services.RegionService;
import com.shulpov.spots_app.utils.DtoConverter;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
Expand Down
Loading

0 comments on commit cf5609d

Please sign in to comment.