diff --git a/app-server/gradle.properties b/app-server/gradle.properties index 5a968507d..eeca2d270 100644 --- a/app-server/gradle.properties +++ b/app-server/gradle.properties @@ -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 diff --git a/app-server/subprojects/api_specification/api/scc-api/api-spec.yaml b/app-server/subprojects/api_specification/api/scc-api/api-spec.yaml index 9493252af..3a17a4d2c 100644 --- a/app-server/subprojects/api_specification/api/scc-api/api-spec.yaml +++ b/app-server/subprojects/api_specification/api/scc-api/api-spec.yaml @@ -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: diff --git a/app-server/subprojects/bounded_context/user/application/src/main/kotlin/club/staircrusher/user/application/port/in/UserApplicationService.kt b/app-server/subprojects/bounded_context/user/application/src/main/kotlin/club/staircrusher/user/application/port/in/UserApplicationService.kt index 54714613a..a1ac10526 100644 --- a/app-server/subprojects/bounded_context/user/application/src/main/kotlin/club/staircrusher/user/application/port/in/UserApplicationService.kt +++ b/app-server/subprojects/bounded_context/user/application/src/main/kotlin/club/staircrusher/user/application/port/in/UserApplicationService.kt @@ -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, diff --git a/app-server/subprojects/bounded_context/user/domain/src/main/kotlin/club/staircrusher/user/domain/model/User.kt b/app-server/subprojects/bounded_context/user/domain/src/main/kotlin/club/staircrusher/user/domain/model/User.kt index e98f22f29..e9ff563d8 100644 --- a/app-server/subprojects/bounded_context/user/domain/src/main/kotlin/club/staircrusher/user/domain/model/User.kt +++ b/app-server/subprojects/bounded_context/user/domain/src/main/kotlin/club/staircrusher/user/domain/model/User.kt @@ -20,6 +20,7 @@ class User( @Column(columnDefinition = "TEXT") @Convert(converter = UserMobilityToolListToTextAttributeConverter::class) val mobilityTools: MutableList, + var pushToken: String? = null, val createdAt: Instant, ) { private var deletedAt: Instant? = null diff --git a/app-server/subprojects/bounded_context/user/infra/src/main/kotlin/club/staircrusher/user/infra/adapter/in/controller/UserController.kt b/app-server/subprojects/bounded_context/user/infra/src/main/kotlin/club/staircrusher/user/infra/adapter/in/controller/UserController.kt index 0314fb66e..7ae9c167e 100644 --- a/app-server/subprojects/bounded_context/user/infra/src/main/kotlin/club/staircrusher/user/infra/adapter/in/controller/UserController.kt +++ b/app-server/subprojects/bounded_context/user/infra/src/main/kotlin/club/staircrusher/user/infra/adapter/in/controller/UserController.kt @@ -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 @@ -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 = @@ -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 { userApplicationService.deleteUser(authentication.principal) diff --git a/app-server/subprojects/cross_cutting_concern/infra/persistence_model/src/main/sqldelight/club/staircrusher/infra/persistence/sqldelight/migration/V31__add_push_token_column_to_user.sqm b/app-server/subprojects/cross_cutting_concern/infra/persistence_model/src/main/sqldelight/club/staircrusher/infra/persistence/sqldelight/migration/V31__add_push_token_column_to_user.sqm new file mode 100644 index 000000000..9d9b7ad66 --- /dev/null +++ b/app-server/subprojects/cross_cutting_concern/infra/persistence_model/src/main/sqldelight/club/staircrusher/infra/persistence/sqldelight/migration/V31__add_push_token_column_to_user.sqm @@ -0,0 +1 @@ +ALTER TABLE scc_user ADD COLUMN push_token TEXT NULL;