-
Notifications
You must be signed in to change notification settings - Fork 1
629-devicetoken을 별도 테이블로 분리 #647
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
base: develop
Are you sure you want to change the base?
The head ref may contain hidden characters: "629-devicetoken\uC744-\uBCC4\uB3C4-\uD14C\uC774\uBE14\uB85C-\uBD84\uB9AC"
Changes from 20 commits
9d77953
e8e597a
2f604d7
a99c966
b1276a6
487a460
a8fe51b
2e1ff88
01cf305
6b203d3
061b8e6
1eeb05f
102b2db
5c0d4d1
c80ecca
d5d87c5
6a381d8
d81290a
205ad1e
aa1d5c4
966b13b
f64d872
1b65d2e
f97d122
ea5a484
4891799
6ee01da
8877904
1a08fcb
6c9759f
b923f90
24f571f
615a953
d854e10
728e5d0
9c6686d
0141290
cb0c70d
7f5408c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,10 @@ | ||
| package dsm.pick2024.domain.admin.presentation.dto.request | ||
|
|
||
| import dsm.pick2024.domain.devicetoken.enum.OSType | ||
|
|
||
| data class AdminLoginRequest( | ||
| val adminId: String, | ||
| val password: String, | ||
| val deviceToken: String? | ||
| val deviceToken: String?, | ||
| val os: OSType? | ||
| ) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package dsm.pick2024.domain.devicetoken.domain | ||
|
|
||
| import dsm.pick2024.domain.devicetoken.enum.OSType | ||
| import dsm.pick2024.global.annotation.Aggregate | ||
| import java.util.UUID | ||
|
|
||
| @Aggregate | ||
| data class AdminDeviceToken( | ||
| val id: UUID = UUID(0, 0), | ||
| val adminId: UUID, | ||
| val deviceToken: String, | ||
| val os: OSType | ||
| ) | ||
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package dsm.pick2024.domain.devicetoken.domain | ||
|
|
||
| import dsm.pick2024.domain.devicetoken.enum.OSType | ||
| import dsm.pick2024.global.annotation.Aggregate | ||
| import java.util.UUID | ||
|
|
||
| @Aggregate | ||
| data class UserDeviceToken( | ||
| val id: UUID = UUID(0, 0), | ||
| val userId: UUID, | ||
| val deviceToken: String, | ||
| val os: OSType | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| package dsm.pick2024.domain.devicetoken.entity | ||
|
|
||
| import dsm.pick2024.domain.devicetoken.enum.OSType | ||
| import dsm.pick2024.global.base.BaseUUIDEntity | ||
| import java.util.UUID | ||
| import javax.persistence.Column | ||
| import javax.persistence.Entity | ||
| import javax.persistence.EnumType | ||
| import javax.persistence.Enumerated | ||
|
|
||
| @Entity(name = "tbl_admin_device_token") | ||
| class AdminDeviceTokenJpaEntity( | ||
| id: UUID, | ||
|
|
||
| @Column(name = "admin_id", nullable = false) | ||
| val adminId: UUID, | ||
|
|
||
| @Column(name = "device_token", nullable = false) | ||
| val deviceToken: String, | ||
|
|
||
| @Enumerated(EnumType.STRING) | ||
| @Column(name = "os", nullable = false) | ||
| val os: OSType | ||
| ) : BaseUUIDEntity(id) | ||
|
Comment on lines
+12
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# First, let's find the relevant files
echo "=== Finding AdminDeviceToken related files ==="
fd "AdminDeviceToken" --type f --extension kt
echo "=== Checking for BaseUUIDEntity to understand parent class ==="
fd "BaseUUIDEntity" --type f --extension ktRepository: DSM-PICK/PiCK_CORE_SERVER Length of output: 928 🏁 Script executed: #!/bin/bash
# Check the main entity file
echo "=== AdminDeviceTokenJpaEntity content ==="
find . -name "AdminDeviceTokenJpaEntity.kt" -type f -exec cat {} \;
echo -e "\n=== Looking for unique constraints or database configuration ==="
# Search for `@Table` or `@Index` annotations related to AdminDeviceToken
rg -n "@Table|@Index|@UniqueConstraint" --type=kt | rg -i "admindevicetoken|admin_device"Repository: DSM-PICK/PiCK_CORE_SERVER Length of output: 886 🏁 Script executed: #!/bin/bash
# Search for repository and persistence adapter
echo "=== AdminDeviceTokenRepository ==="
find . -name "*AdminDeviceToken*Repository*" -type f -exec cat {} \;
echo -e "\n=== AdminDeviceTokenPersistenceAdapter ==="
find . -name "*AdminDeviceToken*Adapter*" -type f -exec cat {} \;Repository: DSM-PICK/PiCK_CORE_SERVER Length of output: 2202 🏁 Script executed: #!/bin/bash
# Search for SaveAdminDeviceTokenPort and related ports
echo "=== Port interfaces ==="
find . -name "*AdminDeviceToken*Port*" -type f -exec cat {} \;Repository: DSM-PICK/PiCK_CORE_SERVER Length of output: 692 🏁 Script executed: #!/bin/bash
# Search for token saving logic in login/authentication context
echo "=== Login service or use case handling token save ==="
rg -n "saveAdminDeviceToken|AdminDeviceToken|deviceToken" --type=kt -C 3 | head -100Repository: DSM-PICK/PiCK_CORE_SERVER Length of output: 166 🏁 Script executed: #!/bin/bash
cat $(find . -name "AdminDeviceTokenMapper.kt" -type f)Repository: DSM-PICK/PiCK_CORE_SERVER Length of output: 1387 🏁 Script executed: #!/bin/bash
# Also check the domain model
cat $(find . -name "AdminDeviceToken.kt" -path "*/domain/*" -type f)Repository: DSM-PICK/PiCK_CORE_SERVER Length of output: 382 🏁 Script executed: #!/bin/bash
# Check for any login/authentication code that saves tokens
rg -l "save.*AdminDeviceToken\|AdminDeviceTokenPort" --type=kotlinRepository: DSM-PICK/PiCK_CORE_SERVER Length of output: 51
현재 구현에는 심각한 결함이 있습니다:
필수 수정 사항:
🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| package dsm.pick2024.domain.devicetoken.entity | ||
|
|
||
| import dsm.pick2024.domain.devicetoken.enum.OSType | ||
| import dsm.pick2024.global.base.BaseUUIDEntity | ||
| import java.util.UUID | ||
| import javax.persistence.Column | ||
| import javax.persistence.Entity | ||
| import javax.persistence.EnumType | ||
| import javax.persistence.Enumerated | ||
|
|
||
| @Entity(name = "tbl_user_device_token") | ||
| class UserDeviceTokenJpaEntity( | ||
| id: UUID, | ||
|
|
||
| @Column(name = "user_id", nullable = false) | ||
| val userId: UUID, | ||
|
|
||
| @Column(name = "device_token") | ||
| val deviceToken: String, | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| @Enumerated(EnumType.STRING) | ||
| @Column(name = "os", nullable = false) | ||
| val os: OSType | ||
|
Comment on lines
+21
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: cd src/main/kotlin/dsm/pick2024/domain/devicetoken && find . -name "*.kt" -type fRepository: DSM-PICK/PiCK_CORE_SERVER Length of output: 759 🏁 Script executed: rg -n "nullable\s*=\s*(true|false)" --type=kotlin -B5 -A1 src/main/kotlin/dsm/pick2024/domain/devicetoken/Repository: DSM-PICK/PiCK_CORE_SERVER Length of output: 3153 🏁 Script executed: rg -n "class.*DeviceToken\|os\s*:\s*OSType\|osType" --type=kotlin src/main/kotlin/dsm/pick2024/domain/devicetoken/Repository: DSM-PICK/PiCK_CORE_SERVER Length of output: 51 🏁 Script executed: cat -n src/main/kotlin/dsm/pick2024/domain/devicetoken/domain/UserDeviceToken.ktRepository: DSM-PICK/PiCK_CORE_SERVER Length of output: 471 🏁 Script executed: cat -n src/main/kotlin/dsm/pick2024/domain/devicetoken/domain/AdminDeviceToken.ktRepository: DSM-PICK/PiCK_CORE_SERVER Length of output: 473 커밋 메시지와 실제 코드 구현이 불일치합니다. 커밋 메시지에서 "osType을 nullable하게 변경"이라고 명시했으나, UserDeviceTokenJpaEntity와 AdminDeviceTokenJpaEntity 모두에서 🤖 Prompt for AI Agents
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. entity 저장단계에서는 null인 애들은 저장이 되지 않고, 실제 값이 있는 애들만 저장이 되는 로직이라 이렇게 작성됨 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
저장 로직에서 null 값을 필터링하여 실제 값이 있는 경우만 저장하는 구조이므로, 엔티티 레벨에서는 커밋 메시지는 아마도 요청 DTO 레벨에서의 nullable 변경을 의미하는 것으로 보이며, 엔티티 제약 조건은 의도대로 non-nullable을 유지하고 있습니다. 👍
|
||
|
|
||
| ) : BaseUUIDEntity(id) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| package dsm.pick2024.domain.devicetoken.enum | ||
|
|
||
| enum class OSType { | ||
| AOS, | ||
| IOS, | ||
| ADMIN | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| package dsm.pick2024.domain.devicetoken.exception | ||
|
|
||
| import dsm.pick2024.global.error.exception.ErrorCode | ||
| import dsm.pick2024.global.error.exception.PickException | ||
|
|
||
| object EntityStateException : PickException( | ||
| ErrorCode.ENTITY_STATE_EXCEPTION | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| package dsm.pick2024.domain.devicetoken.mapper | ||
|
|
||
| import dsm.pick2024.domain.devicetoken.domain.AdminDeviceToken | ||
| import dsm.pick2024.domain.devicetoken.entity.AdminDeviceTokenJpaEntity | ||
| import dsm.pick2024.domain.devicetoken.exception.EntityStateException | ||
| import dsm.pick2024.global.base.GenericMapper | ||
| import org.springframework.stereotype.Component | ||
|
|
||
| @Component | ||
| class AdminDeviceTokenMapper : | ||
| GenericMapper<AdminDeviceTokenJpaEntity, AdminDeviceToken> { | ||
| override fun toEntity(domain: AdminDeviceToken) = domain.run { | ||
| AdminDeviceTokenJpaEntity( | ||
| id = id, | ||
| adminId = adminId, | ||
| deviceToken = deviceToken, | ||
| os = os | ||
| ) | ||
| } | ||
|
|
||
| override fun toDomain(entity: AdminDeviceTokenJpaEntity) = entity.run { | ||
| AdminDeviceToken( | ||
| id = id!!, | ||
| adminId = adminId, | ||
| deviceToken = deviceToken, | ||
| os = os | ||
| ) | ||
| } | ||
|
|
||
| fun updateEntity( | ||
| existingEntity: AdminDeviceTokenJpaEntity, | ||
| domain: AdminDeviceToken | ||
| ): AdminDeviceTokenJpaEntity { | ||
| return AdminDeviceTokenJpaEntity( | ||
| id = existingEntity.id ?: throw EntityStateException, | ||
|
||
| adminId = existingEntity.adminId, | ||
| deviceToken = existingEntity.deviceToken, | ||
| os = existingEntity.os | ||
| ) | ||
| } | ||
|
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
os를 nullable type으로 설정하신 이유가 있을까요? 저는 nullable이 아니어도 괜찮을 것 같습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
os의 경우 시뮬레이터에서 값을 넘겨줄 수 없다고 생각해서 저렇게 했던 것 같습니다.
수정하겠습니다