-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from Princess-in-silvertown/refactor/34
Refactor: 전반적인 코드 리포맷, 리팩토링
- Loading branch information
Showing
15 changed files
with
178 additions
and
263 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 0 additions & 35 deletions
35
src/main/java/slvtwn/khu/toyouserver/application/MemberService.java
This file was deleted.
Oops, something went wrong.
26 changes: 26 additions & 0 deletions
26
src/main/java/slvtwn/khu/toyouserver/application/SessionService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package slvtwn.khu.toyouserver.application; | ||
|
||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
import slvtwn.khu.toyouserver.common.ErrorType; | ||
import slvtwn.khu.toyouserver.domain.Session; | ||
import slvtwn.khu.toyouserver.domain.User; | ||
import slvtwn.khu.toyouserver.exception.ToyouException; | ||
import slvtwn.khu.toyouserver.persistance.SessionRepository; | ||
|
||
@Service | ||
@Transactional(readOnly = true) | ||
public class SessionService { | ||
|
||
private final SessionRepository sessionRepository; | ||
|
||
public SessionService(SessionRepository sessionRepository) { | ||
this.sessionRepository = sessionRepository; | ||
} | ||
|
||
public User findById(Long sessionId) { | ||
Session session = sessionRepository.findById(sessionId) | ||
.orElseThrow(() -> new ToyouException(ErrorType.UNAUTHORIZED_USER_ACCESS)); | ||
return session.getUser(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 0 additions & 26 deletions
26
src/main/java/slvtwn/khu/toyouserver/common/SessionUserService.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package slvtwn.khu.toyouserver.domain; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.FetchType; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.OneToOne; | ||
import jakarta.persistence.Table; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import slvtwn.khu.toyouserver.common.BaseTimeEntity; | ||
|
||
@Entity | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Getter | ||
public class Session extends BaseTimeEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@OneToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "user_id") | ||
private User user; | ||
|
||
// TODO ; 카드 | ||
|
||
public Session(Long id, User user) { | ||
this.id = id; | ||
this.user = user; | ||
} | ||
} |
31 changes: 0 additions & 31 deletions
31
src/main/java/slvtwn/khu/toyouserver/domain/SessionUser.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 5 additions & 2 deletions
7
.../toyouserver/domain/MemberRepository.java → ...userver/persistance/MemberRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
src/main/java/slvtwn/khu/toyouserver/persistance/SessionRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package slvtwn.khu.toyouserver.persistance; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import slvtwn.khu.toyouserver.domain.Session; | ||
|
||
public interface SessionRepository extends JpaRepository<Session, Long> { | ||
} |
10 changes: 0 additions & 10 deletions
10
src/main/java/slvtwn/khu/toyouserver/persistance/SessionUserRepository.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.