Skip to content

Commit

Permalink
refactor: change package structure for spot_references, change auth p…
Browse files Browse the repository at this point in the history
…ackage name
  • Loading branch information
ShulV committed Oct 29, 2023
1 parent 0c44436 commit 2aea04e
Show file tree
Hide file tree
Showing 37 changed files with 98 additions and 83 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.shulpov.spots_app.auth.auth_providers;
package com.shulpov.spots_app.auth_management.auth_providers;

import com.shulpov.spots_app.user.User;
import org.slf4j.Logger;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.shulpov.spots_app.auth.controllers;
package com.shulpov.spots_app.auth_management.controllers;

import com.shulpov.spots_app.auth.exceptions.RegisterErrorException;
import com.shulpov.spots_app.auth.requests.AuthenticationRequest;
import com.shulpov.spots_app.auth.requests.RegisterRequest;
import com.shulpov.spots_app.auth.responses.AuthenticationResponse;
import com.shulpov.spots_app.auth.responses.LogoutMessageResponse;
import com.shulpov.spots_app.auth.responses.RegisterErrorResponse;
import com.shulpov.spots_app.auth.responses.RegisterResponse;
import com.shulpov.spots_app.auth.services.AuthenticationService;
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.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.exceptions;
package com.shulpov.spots_app.auth_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.filters;
package com.shulpov.spots_app.auth_management.filters;

import com.shulpov.spots_app.auth.services.JwtService;
import com.shulpov.spots_app.auth_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.requests;
package com.shulpov.spots_app.auth_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.requests;
package com.shulpov.spots_app.auth_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.responses;
package com.shulpov.spots_app.auth_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.responses;
package com.shulpov.spots_app.auth_management.responses;

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

import com.shulpov.spots_app.responses.ValidationErrorResponse;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.*;

@Data
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class RegisterErrorResponse extends ValidationErrorResponse {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.shulpov.spots_app.auth.responses;
package com.shulpov.spots_app.auth_management.responses;

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

import com.shulpov.spots_app.auth.exceptions.RegisterErrorException;
import com.shulpov.spots_app.auth.requests.AuthenticationRequest;
import com.shulpov.spots_app.auth.requests.RegisterRequest;
import com.shulpov.spots_app.auth.responses.AuthenticationResponse;
import com.shulpov.spots_app.auth.responses.LogoutMessageResponse;
import com.shulpov.spots_app.auth.responses.RegisterResponse;
import com.shulpov.spots_app.auth.token.Token;
import com.shulpov.spots_app.auth.token.TokenRepository;
import com.shulpov.spots_app.auth.token.TokenService;
import com.shulpov.spots_app.auth.token.TokenType;
import com.shulpov.spots_app.auth.validators.UserValidator;
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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.shulpov.spots_app.auth.services;
package com.shulpov.spots_app.auth_management.services;

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

import com.shulpov.spots_app.user.User;
import jakarta.persistence.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.shulpov.spots_app.auth.token;
package com.shulpov.spots_app.auth_management.token;

import com.shulpov.spots_app.user.User;
import org.springframework.data.jpa.repository.JpaRepository;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.shulpov.spots_app.auth.token;
package com.shulpov.spots_app.auth_management.token;

import org.springframework.stereotype.Service;

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

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

import com.shulpov.spots_app.services.UserService;
import com.shulpov.spots_app.user.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,7 +1,7 @@
package com.shulpov.spots_app.configs;

import com.shulpov.spots_app.auth.auth_providers.LoginPasswordAuthenticationProvider;
import com.shulpov.spots_app.auth.filters.JwtAuthenticationFilter;
import com.shulpov.spots_app.auth_management.auth_providers.LoginPasswordAuthenticationProvider;
import com.shulpov.spots_app.auth_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
3 changes: 3 additions & 0 deletions src/main/java/com/shulpov/spots_app/models/Spot.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package com.shulpov.spots_app.models;

import com.shulpov.spots_app.location.models.City;
import com.shulpov.spots_app.spot_references.models.SpaceType;
import com.shulpov.spots_app.spot_references.models.SportType;
import com.shulpov.spots_app.spot_references.models.SpotType;
import com.shulpov.spots_app.user.User;
import jakarta.persistence.*;

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

import com.shulpov.spots_app.dto.SpaceTypeDto;
import com.shulpov.spots_app.models.SpaceType;
import com.shulpov.spots_app.services.SpaceTypeService;
import com.shulpov.spots_app.spot_references.dto.SpaceTypeDto;
import com.shulpov.spots_app.spot_references.models.SpaceType;
import com.shulpov.spots_app.spot_references.services.SpaceTypeService;
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.controllers;
package com.shulpov.spots_app.spot_references.controllers;

import com.shulpov.spots_app.dto.SportTypeDto;
import com.shulpov.spots_app.models.SportType;
import com.shulpov.spots_app.services.SportTypeService;
import com.shulpov.spots_app.spot_references.dto.SportTypeDto;
import com.shulpov.spots_app.spot_references.models.SportType;
import com.shulpov.spots_app.spot_references.services.SportTypeService;
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.controllers;
package com.shulpov.spots_app.spot_references.controllers;

import com.shulpov.spots_app.dto.SpotTypeDto;
import com.shulpov.spots_app.models.SpotType;
import com.shulpov.spots_app.services.SpotTypeService;
import com.shulpov.spots_app.spot_references.dto.SpotTypeDto;
import com.shulpov.spots_app.spot_references.models.SpotType;
import com.shulpov.spots_app.spot_references.services.SpotTypeService;
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,4 +1,4 @@
package com.shulpov.spots_app.dto;
package com.shulpov.spots_app.spot_references.dto;

public class SpaceTypeDto {
private Integer id;
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.spot_references.dto;

public class SportTypeDto {
private Integer id;
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.spot_references.dto;

public class SpotTypeDto {

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.spot_references.models;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.shulpov.spots_app.models.Spot;
import jakarta.persistence.*;

import java.util.List;
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.spot_references.models;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.shulpov.spots_app.models.Spot;
import jakarta.persistence.*;

import java.util.List;
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.spot_references.models;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.shulpov.spots_app.models.Spot;
import jakarta.persistence.*;

import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.shulpov.spots_app.repo;
package com.shulpov.spots_app.spot_references.repo;

import com.shulpov.spots_app.models.SpaceType;
import com.shulpov.spots_app.spot_references.models.SpaceType;
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,6 +1,6 @@
package com.shulpov.spots_app.repo;
package com.shulpov.spots_app.spot_references.repo;

import com.shulpov.spots_app.models.SportType;
import com.shulpov.spots_app.spot_references.models.SportType;
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,6 +1,6 @@
package com.shulpov.spots_app.repo;
package com.shulpov.spots_app.spot_references.repo;

import com.shulpov.spots_app.models.SpotType;
import com.shulpov.spots_app.spot_references.models.SpotType;
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,7 +1,7 @@
package com.shulpov.spots_app.services;
package com.shulpov.spots_app.spot_references.services;

import com.shulpov.spots_app.models.SpaceType;
import com.shulpov.spots_app.repo.SpaceTypeRepo;
import com.shulpov.spots_app.spot_references.models.SpaceType;
import com.shulpov.spots_app.spot_references.repo.SpaceTypeRepo;
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,7 +1,7 @@
package com.shulpov.spots_app.services;
package com.shulpov.spots_app.spot_references.services;

import com.shulpov.spots_app.models.SportType;
import com.shulpov.spots_app.repo.SportTypeRepo;
import com.shulpov.spots_app.spot_references.models.SportType;
import com.shulpov.spots_app.spot_references.repo.SportTypeRepo;
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,7 +1,7 @@
package com.shulpov.spots_app.services;
package com.shulpov.spots_app.spot_references.services;

import com.shulpov.spots_app.models.SpotType;
import com.shulpov.spots_app.repo.SpotTypeRepo;
import com.shulpov.spots_app.spot_references.models.SpotType;
import com.shulpov.spots_app.spot_references.repo.SpotTypeRepo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/shulpov/spots_app/user/User.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.shulpov.spots_app.user;

import com.shulpov.spots_app.auth.token.Token;
import com.shulpov.spots_app.auth_management.token.Token;
import com.shulpov.spots_app.location.models.City;
import com.shulpov.spots_app.models.*;
import jakarta.persistence.*;
Expand Down
15 changes: 12 additions & 3 deletions src/main/java/com/shulpov/spots_app/utils/DtoConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
import com.shulpov.spots_app.location.models.Region;
import com.shulpov.spots_app.models.*;
import com.shulpov.spots_app.services.*;
import com.shulpov.spots_app.spot_references.dto.SpaceTypeDto;
import com.shulpov.spots_app.spot_references.dto.SportTypeDto;
import com.shulpov.spots_app.spot_references.dto.SpotTypeDto;
import com.shulpov.spots_app.spot_references.models.SpaceType;
import com.shulpov.spots_app.spot_references.models.SportType;
import com.shulpov.spots_app.spot_references.models.SpotType;
import com.shulpov.spots_app.spot_references.services.SpaceTypeService;
import com.shulpov.spots_app.spot_references.services.SportTypeService;
import com.shulpov.spots_app.spot_references.services.SpotTypeService;
import com.shulpov.spots_app.user.Role;
import com.shulpov.spots_app.user.User;
import org.modelmapper.ModelMapper;
Expand Down Expand Up @@ -38,11 +47,11 @@ public class DtoConverter {
/** Компонент маппинга классов */
private final ModelMapper modelMapper;
/** Сервис типов помещений */
private final SpaceTypeService spaceTypeService;
private final SpaceTypeService spaceTypeService;
/** Сервис типов спотов */
private final SpotTypeService spotTypeService;
private final SpotTypeService spotTypeService;
/** Сервис типов спорта */
private final SportTypeService sportTypeService;
private final SportTypeService sportTypeService;
/** Сервис управления данными между пользователями и спотами */
private final SpotUserService spotUserService;

Expand Down
6 changes: 3 additions & 3 deletions src/test/java/com/shulpov/spots_app/AuthTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.shulpov.spots_app.auth.responses.AuthenticationResponse;
import com.shulpov.spots_app.auth.token.Token;
import com.shulpov.spots_app.auth.token.TokenService;
import com.shulpov.spots_app.auth_management.responses.AuthenticationResponse;
import com.shulpov.spots_app.auth_management.token.Token;
import com.shulpov.spots_app.auth_management.token.TokenService;
import com.shulpov.spots_app.db_cleaner.DBCleaner;
import com.shulpov.spots_app.responses.ErrorMessageResponse;
import com.shulpov.spots_app.services.UserService;
Expand Down

0 comments on commit 2aea04e

Please sign in to comment.