Skip to content

Refactor authentication responses and notification handling#58

Merged
subsub97 merged 2 commits into
mainfrom
refactor/notification-ttl-expired
May 30, 2026
Merged

Refactor authentication responses and notification handling#58
subsub97 merged 2 commits into
mainfrom
refactor/notification-ttl-expired

Conversation

@subsub97

Copy link
Copy Markdown
Collaborator

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:

  • The separate KakaoSignInUpResponse and AppleSignInUpResponse classes are replaced with a unified SignInUpResponse that includes both userId and accessToken. 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:

  • Introduces ACTIVE_STATUSES and INACTIVE_STATUSES in NotificationStatus to 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))
  • Updates notification generation logic to check for existing active notifications, preventing duplicate entries for the same user and date. ([[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))
  • Refactors repository queries and methods to support status-based lookups and filtering. ([[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:

  • Enhances the dispatch service to handle both current and overdue (catch-up) notifications, partition notifications by expiration, and update statuses and metrics accordingly. ([[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))
  • Adds metric tracking for expired notifications and ensures expired notifications are not dispatched. ([[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:

  • Updates sync logic to use the new INACTIVE_STATUSES set 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))

Copilot AI review requested due to automatic review settings May 30, 2026 04:24
@github-actions

Copy link
Copy Markdown

Test Results

96 tests   96 ✅  1s ⏱️
14 suites   0 💤
14 files     0 ❌

Results for commit 3215c0a.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 EXPIRED notification 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()
@subsub97 subsub97 merged commit e76a67a into main May 30, 2026
4 checks passed
@subsub97 subsub97 deleted the refactor/notification-ttl-expired branch May 30, 2026 04:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants