Skip to content

Commit b73e25a

Browse files
authored
release: 2.1.1 (#377)
2 parents 38cf307 + 2efcbf7 commit b73e25a

File tree

5 files changed

+12
-37
lines changed

5 files changed

+12
-37
lines changed

src/main/kotlin/org/gitanimals/render/app/AnimationFacade.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,12 @@ class AnimationFacade(
8080

8181
fun createNewUser(username: String): User {
8282
return runCatching {
83-
val githubUserResponse = githubOpenApi.getGithubUser(username)
8483
val contributionYears = contributionApi.getAllContributionYears(username)
8584
val contributionCountPerYear =
8685
contributionApi.getContributionCount(username, contributionYears)
8786

8887
userService.createNewUser(
8988
name = username,
90-
entryPoint = EntryPoint.GITHUB,
91-
authenticationId = githubUserResponse.id,
9289
contributions = contributionCountPerYear,
9390
)
9491
}.getOrElse {

src/main/kotlin/org/gitanimals/render/domain/User.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,6 @@ class User(
324324
fun newUser(
325325
name: String,
326326
contributions: Map<Int, Int>,
327-
entryPoint: EntryPoint,
328-
authenticationId: String
329327
): User {
330328
require(!nameConvention.containsMatchIn(name)) {
331329
throw IllegalArgumentException("Not supported word contained in \"${name}\"")
@@ -343,7 +341,6 @@ class User(
343341
visit = 1,
344342
version = 0,
345343
lastPersonaGivePoint = (totalContributionCount(contributions) % FOR_NEW_PERSONA_COUNT).toInt(),
346-
authInfo = UserAuthInfo(entryPoint, authenticationId),
347344
)
348345

349346
user.addField(FieldType.WHITE_FIELD)

src/main/kotlin/org/gitanimals/render/domain/UserService.kt

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -58,27 +58,14 @@ class UserService(
5858
@Transactional
5959
fun createNewUser(
6060
name: String,
61-
entryPoint: EntryPoint,
62-
authenticationId: String,
6361
contributions: Map<Int, Int>
6462
): User {
65-
val existsUser =
66-
userRepository.findByEntryPointAndAuthenticationId(entryPoint, authenticationId)
67-
?: return userRepository.save(
68-
User.newUser(
69-
name = name,
70-
contributions = contributions,
71-
entryPoint = entryPoint,
72-
authenticationId = authenticationId,
73-
)
74-
)
75-
76-
if (existsUser.getName() == name) {
77-
return existsUser
78-
}
79-
80-
existsUser.updateName(name)
81-
return existsUser
63+
return userRepository.save(
64+
User.newUser(
65+
name = name,
66+
contributions = contributions,
67+
)
68+
)
8269
}
8370

8471
@Retryable(retryFor = [ObjectOptimisticLockingFailureException::class], maxAttempts = 3)

src/test/kotlin/org/gitanimals/render/domain/UserServiceTest.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ internal class UserServiceTest(
5757
it("기존 user의 name을 새로운 유저의 name으로 변경한다.") {
5858
val response = userService.createNewUser(
5959
name = "world",
60-
entryPoint = EntryPoint.GITHUB,
61-
authenticationId = id.toString(),
6260
contributions = emptyMap(),
6361
)
6462

@@ -73,8 +71,6 @@ internal class UserServiceTest(
7371
val user = User.newUser(
7472
name = "devxb",
7573
contributions = mapOf(2025 to 1000),
76-
entryPoint = EntryPoint.GITHUB,
77-
authenticationId = "1",
7874
)
7975
}
8076
}

src/test/kotlin/org/gitanimals/render/domain/UserTest.kt

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ internal class UserTest(
4545
User.newUser(
4646
"$ALPHABET-${ALPHABET.lowercase()}01234567890",
4747
mutableMapOf(),
48-
EntryPoint.GITHUB,
49-
"1"
5048
)
5149
}
5250
}
@@ -55,7 +53,7 @@ internal class UserTest(
5553
context("이름에 [대문에, -, 소문자, 숫자]를 제외한 다른 문자가 들어올 경우") {
5654
it("IllegalArgumentException 을 던진다.") {
5755
shouldThrowWithMessage<IllegalArgumentException>("Not supported word contained in \"d안b\"") {
58-
User.newUser("d안b", mutableMapOf(), EntryPoint.GITHUB, "1")
56+
User.newUser("d안b", mutableMapOf())
5957
}
6058
}
6159
}
@@ -103,7 +101,7 @@ internal class UserTest(
103101

104102
describe("giveNewPersona 메소드는") {
105103
context("펫이 30마리가 넘을경우,") {
106-
val user = User.newUser("new-user", mutableMapOf(), EntryPoint.GITHUB, "1")
104+
val user = User.newUser("new-user", mutableMapOf())
107105

108106
it("visible false의 pet을 생성한다.") {
109107
repeat(99) {
@@ -118,7 +116,7 @@ internal class UserTest(
118116

119117
describe("giveBonusPersona 메소드는") {
120118
context("Bonus pet 목록에 등록된 pet의 이름이 주어질 경우,") {
121-
val user = User.newUser("new-user", mutableMapOf(), EntryPoint.GITHUB, "1")
119+
val user = User.newUser("new-user", mutableMapOf())
122120
val persona = PersonaType.PENGUIN
123121

124122
it("새로운 펫을 지급한다.") {
@@ -131,7 +129,7 @@ internal class UserTest(
131129

132130
describe("mergePersona 메소드는") {
133131
context("increasePersonaId와 deletePersonaId를 받아서,") {
134-
val user = User.newUser("devxb", mapOf(), EntryPoint.GITHUB, "1")
132+
val user = User.newUser("devxb", mapOf())
135133
user.updateContribution(30)
136134
user.giveNewPersona()
137135

@@ -148,7 +146,7 @@ internal class UserTest(
148146

149147
describe("deletePersona 메소드는") {
150148
context("personaId를 받으면,") {
151-
val user = User.newUser("devxb", mapOf(2025 to 1000), EntryPoint.GITHUB, "1")
149+
val user = User.newUser("devxb", mapOf(2025 to 1000))
152150
val personaId = user.personas[0].id
153151

154152
it("persona를 삭제하고 PersonaDeleted 이벤트를 발행한다.") {
@@ -159,7 +157,7 @@ internal class UserTest(
159157
}
160158

161159
context("persona 수가 하나라면") {
162-
val user = User.newUser("devxb", mapOf(), EntryPoint.GITHUB, "1")
160+
val user = User.newUser("devxb", mapOf())
163161
val personaId = user.personas[0].id
164162

165163
it("IllegalStateException을 던진다") {

0 commit comments

Comments
 (0)