Skip to content

Commit

Permalink
refactor: (#711) nullable & null체크 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
zios0707 committed Aug 20, 2024
1 parent 463abed commit e2f84d5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ package team.aliens.dms.domain.auth.dto
data class SignInRequest(
val accountId: String,
val password: String,
val deviceToken: String
val deviceToken: String?
)
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,18 @@ class SignInUseCase(
)
val availableFeatures = schoolService.getAvailableFeaturesBySchoolId(user.schoolId)

if (notificationService.checkDeviceTokenByUserId(user.id))
notificationService.deleteDeviceTokenByUserId(user.id)

notificationService.saveDeviceToken(
DeviceToken(
userId = user.id,
schoolId = user.schoolId,
token = request.deviceToken
request.deviceToken?.let {
if (notificationService.checkDeviceTokenByUserId(user.id))
notificationService.deleteDeviceTokenByUserId(user.id)

notificationService.saveDeviceToken(
DeviceToken(
userId = user.id,
schoolId = user.schoolId,
token = request.deviceToken
)
)
)
}

return TokenFeatureResponse.of(tokenResponse, availableFeatures)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ data class SignInWebRequest(
@field:Size(min = 8, max = 20)
val password: String,

val deviceToken: String = "default"
val deviceToken: String?

)

0 comments on commit e2f84d5

Please sign in to comment.