-
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 #116 from dnd-side-project/feat/delete_device_token
[BLOOM-112] 디바이스 토큰 삭제 구현
- Loading branch information
Showing
6 changed files
with
36 additions
and
44 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
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
16 changes: 11 additions & 5 deletions
16
src/main/kotlin/dnd11th/blooming/api/service/user/DeviceTokenService.kt
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 |
---|---|---|
@@ -1,19 +1,25 @@ | ||
package dnd11th.blooming.api.service.user | ||
|
||
import dnd11th.blooming.domain.entity.devicetoken.DeviceToken | ||
import dnd11th.blooming.domain.entity.user.User | ||
import dnd11th.blooming.domain.repository.devicetoken.DeviceTokenRepository | ||
import dnd11th.blooming.domain.repository.user.UserRepository | ||
import org.springframework.stereotype.Service | ||
import org.springframework.transaction.annotation.Transactional | ||
|
||
@Service | ||
@Transactional | ||
class DeviceTokenService( | ||
private val deviceTokenRepository: DeviceTokenRepository, | ||
private val userRepository: UserRepository, | ||
) { | ||
fun saveToken( | ||
loginUser: User, | ||
token: String, | ||
) { | ||
val newToken = DeviceToken.create(loginUser, token) | ||
deviceTokenRepository.save(newToken) | ||
loginUser.updateDeviceToken(token) | ||
userRepository.save(loginUser) | ||
} | ||
|
||
fun invalidToken(loginUser: User) { | ||
loginUser.invalidDeviceToken() | ||
userRepository.save(loginUser) | ||
} | ||
} |
31 changes: 0 additions & 31 deletions
31
src/main/kotlin/dnd11th/blooming/domain/entity/devicetoken/DeviceToken.kt
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
8 changes: 0 additions & 8 deletions
8
src/main/kotlin/dnd11th/blooming/domain/repository/devicetoken/DeviceTokenRepository.kt
This file was deleted.
Oops, something went wrong.