-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#26]Refactor: User에서 GitHub와 BaekJoon을 다른 도메인으로 분리
- Loading branch information
Showing
3 changed files
with
133 additions
and
98 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
src/main/java/bssm/db/bssmgit/domain/baekjoon/domain/BaekJoon.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,66 @@ | ||
package bssm.db.bssmgit.domain.baekjoon.domain; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import javax.persistence.*; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class BaekJoon { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column | ||
private String bojAuthId; | ||
|
||
@Column | ||
private String bojImg; | ||
|
||
@Column | ||
private String bojBio; | ||
|
||
@Column | ||
private String randomCode; | ||
|
||
@Column | ||
private String bojId; | ||
|
||
// solvedCount - 사용자가 푼 문제 수 | ||
@Column(length = 8) | ||
private Integer solvedCount; | ||
|
||
@Column(length = 64) | ||
private Integer rating; | ||
|
||
// tier - Bronze V를 1, Bronze IV를 2, ..., | ||
// Ruby I을 30, Master를 31로 표현하는 사용자 티어 | ||
@Column(length = 4) | ||
private Integer tier; | ||
|
||
// maxStreak - 최대 연속 문제 풀이일 수 | ||
@Column(length = 8) | ||
private Integer maxStreak; | ||
|
||
public void updateBojAuthId(String bojAuthId) { | ||
this.bojAuthId = bojAuthId; | ||
} | ||
|
||
public void updateRandomCode(String randomCode) { | ||
this.randomCode = randomCode; | ||
} | ||
|
||
public void updateUserBojInfo(String bojId, Integer solvedCount, Integer tier, Integer rating, Integer maxStreak, String bojImg, String bio) { | ||
this.bojId = bojId; | ||
this.solvedCount = solvedCount; | ||
this.tier = tier; | ||
this.rating = Math.toIntExact(rating); | ||
this.maxStreak = maxStreak; | ||
this.bojImg = bojImg; | ||
this.bojBio = bio; | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
src/main/java/bssm/db/bssmgit/domain/github/domain/GitHub.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,67 @@ | ||
package bssm.db.bssmgit.domain.github.domain; | ||
|
||
import bssm.db.bssmgit.domain.user.domain.type.Imaginary; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import javax.persistence.*; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class GitHub { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(length = 64) | ||
private String githubId; | ||
|
||
@Column(length = 8) | ||
private Integer commits; | ||
|
||
@Column(length = 1024) | ||
private String githubMsg; | ||
|
||
@Column | ||
private String githubImg; | ||
|
||
|
||
@Enumerated(EnumType.STRING) | ||
private Imaginary imaginary; | ||
|
||
@Column | ||
private Integer votingCount; | ||
|
||
public void updateGitId(String githubId) { | ||
this.githubId = githubId; | ||
} | ||
|
||
public void updateGitInfo(int commits, String bio, String githubImg) { | ||
this.commits = commits; | ||
this.githubMsg = bio; | ||
this.githubImg = githubImg; | ||
} | ||
|
||
public boolean hasNotGithubId() { | ||
return this.githubId == null; | ||
} | ||
|
||
public void initImaginary() { | ||
this.imaginary = Imaginary.REAL_NUMBER; | ||
} | ||
|
||
public void initVotingCount() { | ||
this.votingCount = 3; | ||
} | ||
|
||
public void updateImaginary() { | ||
this.imaginary = Imaginary.IMAGINARY_NUMBER; | ||
} | ||
|
||
public void reductionVotingCount() { | ||
this.votingCount--; | ||
} | ||
} |
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