Skip to content

Commit

Permalink
Merge branch 'main' into create-club-quest-by-crawled-places
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeniuus authored Aug 31, 2024
2 parents a4142ee + c0e6cf2 commit 128dd4e
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 1 deletion.
1 change: 1 addition & 0 deletions app-server/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ awsSdkVersion=2.17.292
guavaVersion=31.1-jre
sentryVersion=6.7.0
logbackJsonVersion=0.1.5
firebaseAdminVersion=9.3.0

# gradle config
org.gradle.jvmargs=-Xmx8g
Expand Down
17 changes: 17 additions & 0 deletions app-server/subprojects/api_specification/api/scc-api/api-spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,23 @@ paths:
- INVALID_NICKNAME : 닉네임이 유효하지 않을 때. e.g. 중복, 2글자 미만 등.
- INVALID_EMAIL : 이메일이 유효하지 않을 때. e.g. 중복, 이상한 형태 등.
/updatePushToken:
post:
summary: 유저의 push token 정보를 수정한다.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
pushToken:
type: string
required:
- pushToken
responses:
'200': {}

components:
# Reusable schemas (data models)
schemas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ class UserApplicationService(
AuthTokens(accessToken)
}

fun updatePushToken(
userId: String,
pushToken: String,
): User = transactionManager.doInTransaction {
val user = userRepository.findById(userId).get()
user.pushToken = pushToken
userRepository.save(user)
}

fun updateUserInfo(
userId: String,
nickname: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class User(
@Column(columnDefinition = "TEXT")
@Convert(converter = UserMobilityToolListToTextAttributeConverter::class)
val mobilityTools: MutableList<UserMobilityTool>,
var pushToken: String? = null,
val createdAt: Instant,
) {
private var deletedAt: Instant? = null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package club.staircrusher.user.infra.adapter.`in`.controller

import club.staircrusher.api.spec.dto.GetUserInfoResponseDto
import club.staircrusher.api.spec.dto.UpdatePushTokenPostRequest
import club.staircrusher.api.spec.dto.UpdateUserInfoPost200Response
import club.staircrusher.api.spec.dto.UpdateUserInfoPostRequest
import club.staircrusher.spring_web.security.app.SccAppAuthentication
Expand Down Expand Up @@ -31,7 +32,10 @@ class UserController(
"baf04e8e-0597-4926-b3b3-c3ecf9e3544e",
"19ef11a0-bc2e-4262-a55f-943aad394004",
"21468ced-cc68-44be-936e-a50d40ff5481",
"b68b714e-40a3-4e52-aff4-c8734181e1bb"
"b68b714e-40a3-4e52-aff4-c8734181e1bb",
"740289a3-7c16-4673-b204-58a8aef0e242",
"5cd204fe-57fa-42ff-8f77-d4b558c6761f",
"b23d1425-508b-4d18-b6e3-67bb9b5361cb",
)
val isNotProd = SccEnv.getEnv() != SccEnv.PROD
val featureFlags: List<String> =
Expand Down Expand Up @@ -60,6 +64,17 @@ class UserController(
)
}

@PostMapping("/updatePushToken")
fun updatePushToken(
@RequestBody request: UpdatePushTokenPostRequest,
authentication: SccAppAuthentication,
) {
userApplicationService.updatePushToken(
userId = authentication.principal,
pushToken = request.pushToken,
)
}

@PostMapping("/deleteUser")
fun deleteUser(authentication: SccAppAuthentication): ResponseEntity<Unit> {
userApplicationService.deleteUser(authentication.principal)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE scc_user ADD COLUMN push_token TEXT NULL;

0 comments on commit 128dd4e

Please sign in to comment.