Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

랜덤 닉네임을 생성로직을 추가합니다. #16

Merged
merged 2 commits into from
Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.whatever.raisedragon.domain.user

object RandomWordsNickname {

internal val adjectives = listOf(
"강직한", "고요한", "고운", "기특한", "깜찍한", "근면한", "귀여운", "관대한",
"깔끔한", "꾸준한", "긍정적인", "겸손한", "검소한", "공손한", "기운찬",
"놀라운", "느긋한", "낙천적인", "낭만적인", "다정한", "당당한", "든든한",
"다재다능한", "또렷한", "다양한", "단호한", "대담한", "로맨틱한", "믿음직한",
"명랑한", "매력적인", "맑은", "멋진", "반듯한", "발랄한", "부드러운",
"빼어난", "부지런한", "산뜻한", "수려한", "순진무구한", "순한", "싱그러운",
"선한", "시원시원한", "사교적인", "섬세한", "사랑스러운", "성실한", "순수한", "소신있는",
"사려깊은", "소탈한", "상냥한", "생기있는", "솔직한", "신중한", "싹싹한", "어여쁜",
"예쁜", "용감한", "우아한", "위대한", "용기있는", "유능한", "유쾌한", "아름다운",
"여유로운", "적극적인", "정의로운", "정직한", "지혜로운", "자애로운", "자유로운", "지적인",
"진취적인", "청초한", "창의적인", "침착한", "차분한", "친숙한", "친절한", "쾌활한",
"화사한", "화끈한", "합리적인", "헌신적인"
)

internal val nouns = listOf(
"고양이", "강아지", "거북이", "토끼", "뱀", "사자", "호랑이", "표범", "치타", "하이에나",
"기린", "코끼리", "코뿔소", "하마", "악어", "펭귄", "부엉이", "올빼미", "곰",
"돼지", "소", "닭", "독수리", "타조", "고릴라", "오랑우탄", "침팬지", "원숭이",
"코알라", "캥거루", "고래", "상어", "칠면조", "직박구리", "쥐", "청설모", "메추라기", "앵무새", "삵",
"스라소니", "판다", "오소리", "오리", "거위", "백조", "두루미", "고슴도치", "두더지", "우파루파", "맹꽁이",
"너구리", "개구리", "두꺼비", "카멜레온", "이구아나", "노루", "제비", "까치", "고라니", "수달",
"당나귀", "순록", "염소", "공작", "바다표범", "들소", "박쥐", "참새", "물개", "바다사자", "살모사",
"구렁이", "얼룩말", "산양", "멧돼지", "카피바라", "도롱뇽", "북극곰", "퓨마", "미어캣", "코요테", "라마",
"딱따구리", "기러기", "비둘기", "스컹크", "돌고래", "까마귀", "매", "낙타", "여우", "사슴",
"늑대", "재규어", "알파카", "양", "다람쥐", "담비",
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.whatever.raisedragon.domain.user

import com.whatever.raisedragon.domain.BaseEntity
import jakarta.persistence.*
import kotlin.random.Random

@Table(name = "user")
@Entity
Expand Down Expand Up @@ -31,8 +32,11 @@ data class Nickname(
) {
companion object {
fun generateRandomNickname(): Nickname {
return Nickname("random nickname")
val randomAdjective = RandomWordsNickname.adjectives[Random.nextInt(RandomWordsNickname.adjectives.size)]
val randomNoun = RandomWordsNickname.nouns[Random.nextInt(RandomWordsNickname.nouns.size)]
return Nickname("$randomAdjective $randomNoun")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Collection.random() 확장함수 있을거에요

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 반영완료~!

}
}
}