Refactor authentication responses and notification handling#58
Merged
Conversation
Test Results96 tests 96 ✅ 1s ⏱️ Results for commit 3215c0a. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR unifies sign-in/up responses across providers and hardens notification generation/dispatch by adding active/inactive statuses, TTL expiration, catch-up dispatch handling, and related tests.
Changes:
- Replaces provider-specific auth response DTOs with
SignInUpResponse(userId, accessToken). - Adds
EXPIREDnotification status, active/inactive status grouping, and status-aware idempotency queries. - Adds TTL-based expiration during dispatch plus new/updated tests for metrics, TTL, and batch idempotency.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/main/kotlin/com/moa/controller/AuthController.kt |
Updates auth endpoints to return unified response DTO. |
src/main/kotlin/com/moa/service/AuthService.kt |
Returns unified response with userId and accessToken. |
src/main/kotlin/com/moa/service/dto/SignInUpResponse.kt |
Defines unified auth response DTO. |
src/main/kotlin/com/moa/service/dto/KakaoSignInUpResponse.kt |
Removes obsolete Kakao-specific DTO. |
src/main/kotlin/com/moa/entity/notification/NotificationStatus.kt |
Adds EXPIRED and active/inactive status sets. |
src/main/kotlin/com/moa/repository/NotificationLogRepository.kt |
Adds catch-up/status-aware notification lookup methods. |
src/main/kotlin/com/moa/service/notification/NotificationBatchService.kt |
Makes work notification generation type-specific and status-aware. |
src/main/kotlin/com/moa/service/notification/PaydayNotificationBatchService.kt |
Uses active statuses for payday idempotency. |
src/main/kotlin/com/moa/service/notification/NotificationDispatchService.kt |
Adds catch-up dispatch, TTL expiration, and expired metrics. |
src/main/kotlin/com/moa/service/notification/NotificationSyncService.kt |
Uses inactive status set when deciding regeneration. |
src/main/kotlin/com/moa/service/notification/NotificationTtlPolicy.kt |
Adds per-notification-type TTL policy. |
src/test/kotlin/com/moa/service/notification/NotificationTtlPolicyTest.kt |
Covers TTL boundary behavior. |
src/test/kotlin/com/moa/service/notification/NotificationBatchServiceIdempotencyTest.kt |
Adds idempotency coverage for active/inactive statuses. |
src/test/kotlin/com/moa/service/notification/NotificationBatchServiceHolidayTest.kt |
Updates fake repository behavior for status-aware lookup. |
src/test/kotlin/com/moa/service/notification/NotificationDispatchServiceMetricsTest.kt |
Updates dispatch metric tests for TTL/catch-up behavior. |
src/test/kotlin/com/moa/service/notification/NotificationDispatchIntegrationTest.kt |
Updates integration metric fixture to use PAYDAY. |
src/test/kotlin/com/moa/service/notification/PrometheusEndpointE2eTest.kt |
Updates Prometheus E2E fixture to use PAYDAY. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| @Test | ||
| fun `통합 - dispatch 호출 후 PrometheusMeterRegistry에 비즈니스 메트릭과 common tag가 함께 기록된다`() { | ||
| val today = LocalDate.now() |
| @Test | ||
| fun `E2E - dispatch 후 actuator prometheus 엔드포인트가 신규 메트릭을 텍스트로 노출한다`() { | ||
| // PAYDAY 는 TTL 정책상 당일 자정까지 not expired 이므로 시각 의존성을 줄이기 위해 사용. | ||
| val today = LocalDate.now() |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several important improvements to authentication response handling and notification processing. The authentication API is unified to return a single response type containing both user ID and access token, simplifying the interface for both Kakao and Apple sign-ins. In the notification system, the logic for generating and dispatching notifications is made more robust: it now distinguishes between active and inactive notification statuses, prevents duplicate notifications, and handles expired notifications more gracefully, including metrics for expired events.
Authentication response unification:
KakaoSignInUpResponseandAppleSignInUpResponseclasses are replaced with a unifiedSignInUpResponsethat includes bothuserIdandaccessToken. All related service and controller methods are updated to use this new response type. ([[1]](https://github.com/Nexters/moa-server/pull/58/files#diff-8f6ce1203df029607fffb88ab8d7e8d1189b2864660d84b2245d291182ae3150L3-R4),[[2]](https://github.com/Nexters/moa-server/pull/58/files#diff-adba3342f1b4fa54e4301b80cdeadfd71d65c8ce4fccaa1692a6d4b7a0080551L9-R11),[[3]](https://github.com/Nexters/moa-server/pull/58/files#diff-adba3342f1b4fa54e4301b80cdeadfd71d65c8ce4fccaa1692a6d4b7a0080551L25-R24),[[4]](https://github.com/Nexters/moa-server/pull/58/files#diff-adba3342f1b4fa54e4301b80cdeadfd71d65c8ce4fccaa1692a6d4b7a0080551L35-R36),[[5]](https://github.com/Nexters/moa-server/pull/58/files#diff-adba3342f1b4fa54e4301b80cdeadfd71d65c8ce4fccaa1692a6d4b7a0080551L53-R60),[[6]](https://github.com/Nexters/moa-server/pull/58/files#diff-adba3342f1b4fa54e4301b80cdeadfd71d65c8ce4fccaa1692a6d4b7a0080551L69-R72),[[7]](https://github.com/Nexters/moa-server/pull/58/files#diff-adba3342f1b4fa54e4301b80cdeadfd71d65c8ce4fccaa1692a6d4b7a0080551L87-R91),[[8]](https://github.com/Nexters/moa-server/pull/58/files#diff-82fdc2e0464b3bdd39998082fa710d183fde425915bd574489bad2ff42fd7ba8L22-R27),[[9]](https://github.com/Nexters/moa-server/pull/58/files#diff-7cde4cce11e50c4b1209766145865febff5ba063489108f5f8de6ee86d4be485L1-L5))Notification status handling and deduplication:
ACTIVE_STATUSESandINACTIVE_STATUSESinNotificationStatusto clearly distinguish between notifications that should prevent new ones from being created and those that allow regeneration. ([src/main/kotlin/com/moa/entity/notification/NotificationStatus.ktR3-R29](https://github.com/Nexters/moa-server/pull/58/files#diff-742d1eb2a5cb392027d4b721e6ce5c202c860ccfd923c0b9430bebea5c6bcf39R3-R29))[[1]](https://github.com/Nexters/moa-server/pull/58/files#diff-bcaeb4ec75b51e1ef6762e9d8bb7538ffa5bfc96909ea005b79e99d5667ff150R7),[[2]](https://github.com/Nexters/moa-server/pull/58/files#diff-bcaeb4ec75b51e1ef6762e9d8bb7538ffa5bfc96909ea005b79e99d5667ff150L37-R76),[[3]](https://github.com/Nexters/moa-server/pull/58/files#diff-bcaeb4ec75b51e1ef6762e9d8bb7538ffa5bfc96909ea005b79e99d5667ff150R88),[[4]](https://github.com/Nexters/moa-server/pull/58/files#diff-bcaeb4ec75b51e1ef6762e9d8bb7538ffa5bfc96909ea005b79e99d5667ff150R102-R120),[[5]](https://github.com/Nexters/moa-server/pull/58/files#diff-a663acfbc5241a91a734f9c1b574a4e4e09d2289911ad5b581c5ac0c301abc25L42-R53))[[1]](https://github.com/Nexters/moa-server/pull/58/files#diff-a663acfbc5241a91a734f9c1b574a4e4e09d2289911ad5b581c5ac0c301abc25R18-R22),[[2]](https://github.com/Nexters/moa-server/pull/58/files#diff-a663acfbc5241a91a734f9c1b574a4e4e09d2289911ad5b581c5ac0c301abc25L42-R53))Notification dispatch and expiration:
[[1]](https://github.com/Nexters/moa-server/pull/58/files#diff-71afcf80ed94a794e6ae8f9c091fc7f7a9dcbb67f0c91834fea11d0ec298958aR26),[[2]](https://github.com/Nexters/moa-server/pull/58/files#diff-71afcf80ed94a794e6ae8f9c091fc7f7a9dcbb67f0c91834fea11d0ec298958aR48-R104),[[3]](https://github.com/Nexters/moa-server/pull/58/files#diff-71afcf80ed94a794e6ae8f9c091fc7f7a9dcbb67f0c91834fea11d0ec298958aL107-R140),[[4]](https://github.com/Nexters/moa-server/pull/58/files#diff-71afcf80ed94a794e6ae8f9c091fc7f7a9dcbb67f0c91834fea11d0ec298958aR154))[[1]](https://github.com/Nexters/moa-server/pull/58/files#diff-71afcf80ed94a794e6ae8f9c091fc7f7a9dcbb67f0c91834fea11d0ec298958aR48-R104),[[2]](https://github.com/Nexters/moa-server/pull/58/files#diff-71afcf80ed94a794e6ae8f9c091fc7f7a9dcbb67f0c91834fea11d0ec298958aL107-R140),[[3]](https://github.com/Nexters/moa-server/pull/58/files#diff-71afcf80ed94a794e6ae8f9c091fc7f7a9dcbb67f0c91834fea11d0ec298958aR154))Consistency in notification sync logic:
INACTIVE_STATUSESset for determining when to regenerate notifications, ensuring consistency across the codebase. ([[1]](https://github.com/Nexters/moa-server/pull/58/files#diff-a4471b363cfe710951bc6d28225422f05ad7ecee6a6c66333f556309c40278f7L115-R115),[[2]](https://github.com/Nexters/moa-server/pull/58/files#diff-a4471b363cfe710951bc6d28225422f05ad7ecee6a6c66333f556309c40278f7L124-R124))