From 0fee8f98eec56d97fddce74df471cf8ce6d5a741 Mon Sep 17 00:00:00 2001 From: Vladik Date: Thu, 24 Oct 2024 15:19:07 +0300 Subject: [PATCH] updated: update entities and create file for enums --- src/main/java/com/chat/yourway/ChatYourWayApplication.java | 1 - src/main/java/com/chat/yourway/config/redis/RedisConfig.java | 2 +- .../java/com/chat/yourway/dto/common/EmailMessageInfoDto.java | 2 +- .../java/com/chat/yourway/dto/response/TopicResponseDto.java | 2 +- src/main/java/com/chat/yourway/model/Contact.java | 3 +-- .../java/com/chat/yourway/model/{email => }/EmailToken.java | 4 ++-- src/main/java/com/chat/yourway/model/Topic.java | 1 + .../chat/yourway/model/{email => enums}/EmailMessageType.java | 2 +- src/main/java/com/chat/yourway/model/{ => enums}/Role.java | 2 +- .../java/com/chat/yourway/model/{ => enums}/TopicScope.java | 2 +- .../java/com/chat/yourway/model/{token => redis}/Token.java | 2 +- .../com/chat/yourway/repository/jpa/EmailTokenRepository.java | 2 +- .../com/chat/yourway/repository/jpa/MessageRepository.java | 3 +-- .../java/com/chat/yourway/repository/jpa/TopicRepository.java | 2 +- .../chat/yourway/repository/redis/TokenRedisRepository.java | 2 +- src/main/java/com/chat/yourway/security/TokenService.java | 2 +- .../java/com/chat/yourway/service/ActivateAccountService.java | 4 ++-- .../java/com/chat/yourway/service/AuthenticationService.java | 2 +- .../java/com/chat/yourway/service/ChangePasswordService.java | 4 ++-- src/main/java/com/chat/yourway/service/ContactService.java | 2 +- .../com/chat/yourway/service/EmailMessageFactoryService.java | 2 +- .../java/com/chat/yourway/service/LastMessagesService.java | 3 +-- src/main/java/com/chat/yourway/service/MessageService.java | 2 +- .../java/com/chat/yourway/service/NotificationService.java | 2 +- src/main/java/com/chat/yourway/service/TopicService.java | 2 +- 25 files changed, 27 insertions(+), 30 deletions(-) rename src/main/java/com/chat/yourway/model/{email => }/EmailToken.java (84%) rename src/main/java/com/chat/yourway/model/{email => enums}/EmailMessageType.java (94%) rename src/main/java/com/chat/yourway/model/{ => enums}/Role.java (83%) rename src/main/java/com/chat/yourway/model/{ => enums}/TopicScope.java (60%) rename src/main/java/com/chat/yourway/model/{token => redis}/Token.java (93%) diff --git a/src/main/java/com/chat/yourway/ChatYourWayApplication.java b/src/main/java/com/chat/yourway/ChatYourWayApplication.java index 2c6dce36..ddb234d9 100644 --- a/src/main/java/com/chat/yourway/ChatYourWayApplication.java +++ b/src/main/java/com/chat/yourway/ChatYourWayApplication.java @@ -2,7 +2,6 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cache.annotation.EnableCaching; import org.springframework.scheduling.annotation.EnableAsync; @EnableAsync diff --git a/src/main/java/com/chat/yourway/config/redis/RedisConfig.java b/src/main/java/com/chat/yourway/config/redis/RedisConfig.java index 2d457769..774402a4 100644 --- a/src/main/java/com/chat/yourway/config/redis/RedisConfig.java +++ b/src/main/java/com/chat/yourway/config/redis/RedisConfig.java @@ -1,6 +1,6 @@ package com.chat.yourway.config.redis; -import com.chat.yourway.model.token.Token; +import com.chat.yourway.model.redis.Token; import lombok.RequiredArgsConstructor; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/src/main/java/com/chat/yourway/dto/common/EmailMessageInfoDto.java b/src/main/java/com/chat/yourway/dto/common/EmailMessageInfoDto.java index 089b0f53..2619b91b 100644 --- a/src/main/java/com/chat/yourway/dto/common/EmailMessageInfoDto.java +++ b/src/main/java/com/chat/yourway/dto/common/EmailMessageInfoDto.java @@ -1,6 +1,6 @@ package com.chat.yourway.dto.common; -import com.chat.yourway.model.email.EmailMessageType; +import com.chat.yourway.model.enums.EmailMessageType; import java.util.UUID; diff --git a/src/main/java/com/chat/yourway/dto/response/TopicResponseDto.java b/src/main/java/com/chat/yourway/dto/response/TopicResponseDto.java index 796f7765..e5679d3b 100644 --- a/src/main/java/com/chat/yourway/dto/response/TopicResponseDto.java +++ b/src/main/java/com/chat/yourway/dto/response/TopicResponseDto.java @@ -1,7 +1,7 @@ package com.chat.yourway.dto.response; import com.chat.yourway.dto.response.notification.LastMessageResponseDto; -import com.chat.yourway.model.TopicScope; +import com.chat.yourway.model.enums.TopicScope; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Schema; diff --git a/src/main/java/com/chat/yourway/model/Contact.java b/src/main/java/com/chat/yourway/model/Contact.java index 74ad1213..5383e344 100644 --- a/src/main/java/com/chat/yourway/model/Contact.java +++ b/src/main/java/com/chat/yourway/model/Contact.java @@ -1,9 +1,8 @@ package com.chat.yourway.model; +import com.chat.yourway.model.enums.Role; import jakarta.persistence.*; import lombok.*; -import org.springframework.security.core.GrantedAuthority; -import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import java.util.*; diff --git a/src/main/java/com/chat/yourway/model/email/EmailToken.java b/src/main/java/com/chat/yourway/model/EmailToken.java similarity index 84% rename from src/main/java/com/chat/yourway/model/email/EmailToken.java rename to src/main/java/com/chat/yourway/model/EmailToken.java index 546e2ace..a9aeb2d1 100644 --- a/src/main/java/com/chat/yourway/model/email/EmailToken.java +++ b/src/main/java/com/chat/yourway/model/EmailToken.java @@ -1,6 +1,6 @@ -package com.chat.yourway.model.email; +package com.chat.yourway.model; -import com.chat.yourway.model.Contact; +import com.chat.yourway.model.enums.EmailMessageType; import jakarta.persistence.*; import lombok.*; diff --git a/src/main/java/com/chat/yourway/model/Topic.java b/src/main/java/com/chat/yourway/model/Topic.java index c27da1ad..3d1c27ad 100644 --- a/src/main/java/com/chat/yourway/model/Topic.java +++ b/src/main/java/com/chat/yourway/model/Topic.java @@ -1,5 +1,6 @@ package com.chat.yourway.model; +import com.chat.yourway.model.enums.TopicScope; import jakarta.persistence.*; import java.time.LocalDateTime; diff --git a/src/main/java/com/chat/yourway/model/email/EmailMessageType.java b/src/main/java/com/chat/yourway/model/enums/EmailMessageType.java similarity index 94% rename from src/main/java/com/chat/yourway/model/email/EmailMessageType.java rename to src/main/java/com/chat/yourway/model/enums/EmailMessageType.java index ec8a12cb..6bb607a8 100644 --- a/src/main/java/com/chat/yourway/model/email/EmailMessageType.java +++ b/src/main/java/com/chat/yourway/model/enums/EmailMessageType.java @@ -1,4 +1,4 @@ -package com.chat.yourway.model.email; +package com.chat.yourway.model.enums; import lombok.Getter; import lombok.RequiredArgsConstructor; diff --git a/src/main/java/com/chat/yourway/model/Role.java b/src/main/java/com/chat/yourway/model/enums/Role.java similarity index 83% rename from src/main/java/com/chat/yourway/model/Role.java rename to src/main/java/com/chat/yourway/model/enums/Role.java index 9fc2b7fa..16a64a87 100644 --- a/src/main/java/com/chat/yourway/model/Role.java +++ b/src/main/java/com/chat/yourway/model/enums/Role.java @@ -1,4 +1,4 @@ -package com.chat.yourway.model; +package com.chat.yourway.model.enums; import org.springframework.security.core.GrantedAuthority; diff --git a/src/main/java/com/chat/yourway/model/TopicScope.java b/src/main/java/com/chat/yourway/model/enums/TopicScope.java similarity index 60% rename from src/main/java/com/chat/yourway/model/TopicScope.java rename to src/main/java/com/chat/yourway/model/enums/TopicScope.java index 1a7bbdb8..1719bbd6 100644 --- a/src/main/java/com/chat/yourway/model/TopicScope.java +++ b/src/main/java/com/chat/yourway/model/enums/TopicScope.java @@ -1,4 +1,4 @@ -package com.chat.yourway.model; +package com.chat.yourway.model.enums; public enum TopicScope { PUBLIC, diff --git a/src/main/java/com/chat/yourway/model/token/Token.java b/src/main/java/com/chat/yourway/model/redis/Token.java similarity index 93% rename from src/main/java/com/chat/yourway/model/token/Token.java rename to src/main/java/com/chat/yourway/model/redis/Token.java index 013dbadc..21e56ac2 100644 --- a/src/main/java/com/chat/yourway/model/token/Token.java +++ b/src/main/java/com/chat/yourway/model/redis/Token.java @@ -1,4 +1,4 @@ -package com.chat.yourway.model.token; +package com.chat.yourway.model.redis; import lombok.AllArgsConstructor; import lombok.Builder; diff --git a/src/main/java/com/chat/yourway/repository/jpa/EmailTokenRepository.java b/src/main/java/com/chat/yourway/repository/jpa/EmailTokenRepository.java index 35c7d88c..1ee185c9 100644 --- a/src/main/java/com/chat/yourway/repository/jpa/EmailTokenRepository.java +++ b/src/main/java/com/chat/yourway/repository/jpa/EmailTokenRepository.java @@ -1,6 +1,6 @@ package com.chat.yourway.repository.jpa; -import com.chat.yourway.model.email.EmailToken; +import com.chat.yourway.model.EmailToken; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; diff --git a/src/main/java/com/chat/yourway/repository/jpa/MessageRepository.java b/src/main/java/com/chat/yourway/repository/jpa/MessageRepository.java index 6dfe95b0..0c9343b1 100644 --- a/src/main/java/com/chat/yourway/repository/jpa/MessageRepository.java +++ b/src/main/java/com/chat/yourway/repository/jpa/MessageRepository.java @@ -1,14 +1,13 @@ package com.chat.yourway.repository.jpa; import com.chat.yourway.dto.response.notification.LastMessageResponseDto; -import com.chat.yourway.model.Contact; import com.chat.yourway.model.Message; import java.time.LocalDateTime; import java.util.List; import java.util.UUID; -import com.chat.yourway.model.TopicScope; +import com.chat.yourway.model.enums.TopicScope; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; diff --git a/src/main/java/com/chat/yourway/repository/jpa/TopicRepository.java b/src/main/java/com/chat/yourway/repository/jpa/TopicRepository.java index b6d7f9d5..52589ec9 100644 --- a/src/main/java/com/chat/yourway/repository/jpa/TopicRepository.java +++ b/src/main/java/com/chat/yourway/repository/jpa/TopicRepository.java @@ -6,7 +6,7 @@ import java.util.Optional; import java.util.UUID; -import com.chat.yourway.model.TopicScope; +import com.chat.yourway.model.enums.TopicScope; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; diff --git a/src/main/java/com/chat/yourway/repository/redis/TokenRedisRepository.java b/src/main/java/com/chat/yourway/repository/redis/TokenRedisRepository.java index cf04af60..3f591af7 100644 --- a/src/main/java/com/chat/yourway/repository/redis/TokenRedisRepository.java +++ b/src/main/java/com/chat/yourway/repository/redis/TokenRedisRepository.java @@ -1,6 +1,6 @@ package com.chat.yourway.repository.redis; -import com.chat.yourway.model.token.Token; +import com.chat.yourway.model.redis.Token; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; diff --git a/src/main/java/com/chat/yourway/security/TokenService.java b/src/main/java/com/chat/yourway/security/TokenService.java index 68a6ceae..d27badef 100644 --- a/src/main/java/com/chat/yourway/security/TokenService.java +++ b/src/main/java/com/chat/yourway/security/TokenService.java @@ -2,7 +2,7 @@ import com.chat.yourway.exception.TokenNotFoundException; import com.chat.yourway.model.Contact; -import com.chat.yourway.model.token.Token; +import com.chat.yourway.model.redis.Token; import com.chat.yourway.repository.redis.TokenRedisRepository; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; diff --git a/src/main/java/com/chat/yourway/service/ActivateAccountService.java b/src/main/java/com/chat/yourway/service/ActivateAccountService.java index 7158623c..b881b055 100644 --- a/src/main/java/com/chat/yourway/service/ActivateAccountService.java +++ b/src/main/java/com/chat/yourway/service/ActivateAccountService.java @@ -3,7 +3,7 @@ import com.chat.yourway.dto.common.EmailMessageInfoDto; import com.chat.yourway.exception.EmailTokenNotFoundException; import com.chat.yourway.model.Contact; -import com.chat.yourway.model.email.EmailToken; +import com.chat.yourway.model.EmailToken; import com.chat.yourway.repository.jpa.EmailTokenRepository; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -12,7 +12,7 @@ import java.util.UUID; -import static com.chat.yourway.model.email.EmailMessageType.ACTIVATE; +import static com.chat.yourway.model.enums.EmailMessageType.ACTIVATE; @Service @RequiredArgsConstructor diff --git a/src/main/java/com/chat/yourway/service/AuthenticationService.java b/src/main/java/com/chat/yourway/service/AuthenticationService.java index 61ffe6bc..15e1e0cc 100644 --- a/src/main/java/com/chat/yourway/service/AuthenticationService.java +++ b/src/main/java/com/chat/yourway/service/AuthenticationService.java @@ -7,7 +7,7 @@ import com.chat.yourway.dto.response.RegistrationResponseDto; import com.chat.yourway.exception.InvalidCredentialsException; import com.chat.yourway.exception.InvalidTokenException; -import com.chat.yourway.model.token.Token; +import com.chat.yourway.model.redis.Token; import com.chat.yourway.security.JwtService; import com.chat.yourway.security.LogoutService; import com.chat.yourway.security.TokenService; diff --git a/src/main/java/com/chat/yourway/service/ChangePasswordService.java b/src/main/java/com/chat/yourway/service/ChangePasswordService.java index b98106d6..73cab6f7 100644 --- a/src/main/java/com/chat/yourway/service/ChangePasswordService.java +++ b/src/main/java/com/chat/yourway/service/ChangePasswordService.java @@ -6,8 +6,8 @@ import com.chat.yourway.dto.request.RestorePasswordDto; import com.chat.yourway.exception.EmailTokenNotFoundException; import com.chat.yourway.model.Contact; -import com.chat.yourway.model.email.EmailMessageType; -import com.chat.yourway.model.email.EmailToken; +import com.chat.yourway.model.enums.EmailMessageType; +import com.chat.yourway.model.EmailToken; import com.chat.yourway.repository.jpa.EmailTokenRepository; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; diff --git a/src/main/java/com/chat/yourway/service/ContactService.java b/src/main/java/com/chat/yourway/service/ContactService.java index a6426b96..a429cf70 100644 --- a/src/main/java/com/chat/yourway/service/ContactService.java +++ b/src/main/java/com/chat/yourway/service/ContactService.java @@ -20,7 +20,7 @@ import java.util.List; import java.util.UUID; -import static com.chat.yourway.model.Role.USER; +import static com.chat.yourway.model.enums.Role.USER; @Service @Slf4j diff --git a/src/main/java/com/chat/yourway/service/EmailMessageFactoryService.java b/src/main/java/com/chat/yourway/service/EmailMessageFactoryService.java index 9b744935..7757a3f1 100644 --- a/src/main/java/com/chat/yourway/service/EmailMessageFactoryService.java +++ b/src/main/java/com/chat/yourway/service/EmailMessageFactoryService.java @@ -2,7 +2,7 @@ import com.chat.yourway.dto.common.EmailMessageDto; import com.chat.yourway.dto.common.EmailMessageInfoDto; -import com.chat.yourway.model.email.EmailMessageType; +import com.chat.yourway.model.enums.EmailMessageType; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; diff --git a/src/main/java/com/chat/yourway/service/LastMessagesService.java b/src/main/java/com/chat/yourway/service/LastMessagesService.java index f8e203fc..5394ccfd 100644 --- a/src/main/java/com/chat/yourway/service/LastMessagesService.java +++ b/src/main/java/com/chat/yourway/service/LastMessagesService.java @@ -1,10 +1,9 @@ package com.chat.yourway.service; import com.chat.yourway.dto.response.notification.LastMessageResponseDto; -import com.chat.yourway.model.TopicScope; +import com.chat.yourway.model.enums.TopicScope; import com.chat.yourway.repository.jpa.MessageRepository; import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import java.util.List; diff --git a/src/main/java/com/chat/yourway/service/MessageService.java b/src/main/java/com/chat/yourway/service/MessageService.java index 9dad1b79..cfc04a49 100644 --- a/src/main/java/com/chat/yourway/service/MessageService.java +++ b/src/main/java/com/chat/yourway/service/MessageService.java @@ -9,7 +9,7 @@ import com.chat.yourway.model.Contact; import com.chat.yourway.model.Message; import com.chat.yourway.model.Topic; -import com.chat.yourway.model.TopicScope; +import com.chat.yourway.model.enums.TopicScope; import com.chat.yourway.repository.jpa.MessageRepository; import jakarta.transaction.Transactional; import lombok.RequiredArgsConstructor; diff --git a/src/main/java/com/chat/yourway/service/NotificationService.java b/src/main/java/com/chat/yourway/service/NotificationService.java index d9669ad6..8b592234 100644 --- a/src/main/java/com/chat/yourway/service/NotificationService.java +++ b/src/main/java/com/chat/yourway/service/NotificationService.java @@ -9,7 +9,7 @@ import com.chat.yourway.model.Contact; import com.chat.yourway.model.Message; import com.chat.yourway.model.Topic; -import com.chat.yourway.model.TopicScope; +import com.chat.yourway.model.enums.TopicScope; import com.chat.yourway.model.redis.ContactOnline; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; diff --git a/src/main/java/com/chat/yourway/service/TopicService.java b/src/main/java/com/chat/yourway/service/TopicService.java index 26927740..4aa671bc 100644 --- a/src/main/java/com/chat/yourway/service/TopicService.java +++ b/src/main/java/com/chat/yourway/service/TopicService.java @@ -14,7 +14,7 @@ import com.chat.yourway.model.Contact; import com.chat.yourway.model.Tag; import com.chat.yourway.model.Topic; -import com.chat.yourway.model.TopicScope; +import com.chat.yourway.model.enums.TopicScope; import com.chat.yourway.repository.jpa.TagRepository; import com.chat.yourway.repository.jpa.TopicRepository; import lombok.extern.slf4j.Slf4j;