Skip to content

Notification and file service#5

Merged
butvinm merged 23 commits intomasterfrom
notification-service
Dec 25, 2025
Merged

Notification and file service#5
butvinm merged 23 commits intomasterfrom
notification-service

Conversation

@butvinm
Copy link
Member

@butvinm butvinm commented Dec 22, 2025

No description provided.

butvinm and others added 9 commits December 22, 2025 14:23
Features:
- Add notification-service (reactive WebFlux + R2DBC) on port 8084
- Deploy 3 Kafka replicas in KRaft mode (no Zookeeper)
- Publish events from divination-service on spread/interpretation creation
- Consume events and create in-app notifications

Components added:
- shared-dto: SpreadCreatedEvent, InterpretationCreatedEvent, NotificationDto
- divination-service: KafkaProducerConfig, EventPublisher
- notification-service: Full microservice with REST API
- docker-compose: 3 Kafka brokers (kafka-1, kafka-2, kafka-3)

REST API endpoints:
- GET /api/v0.0.1/notifications - List user notifications
- GET /api/v0.0.1/notifications/unread-count - Get unread count
- PATCH /api/v0.0.1/notifications/{id}/read - Mark as read
- POST /api/v0.0.1/notifications/mark-all-read - Mark all as read

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add notification-service to microservices architecture table
- Add Kafka messaging to technology stack
- Add notification-service database schema
- Add notification-service API endpoints
- Add Kafka event-driven communication section
- Update Flyway history tables list

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Unit tests: NotificationMapper, NotificationService, EventConsumer (20 tests)
- Controller integration tests: NotificationController endpoints (13 tests)
- Kafka integration tests: EventConsumer with real Kafka (4 tests)
- E2E tests: Full notification flow (11 tests)
- EventPublisher integration tests for divination-service (3 tests)

Added test infrastructure:
- TestEntityFactory for notification entities
- TestKafkaConfig with conditional mock support
- application-test.yml and application-kafka-test.yml profiles
- NotificationServiceClient for E2E tests

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Switch from bitnami/kafka:3.7 to confluentinc/cp-kafka:7.7.0
  (Bitnami image no longer available)
- Add feign-hc5 dependency for HTTP PATCH method support
  (default HttpURLConnection doesn't support PATCH)
- Use InheritableThreadLocal for auth tokens so Awaitility threads
  can access them during polling
- Add notification-service URL to e2e test configuration

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
E2E tests now automatically rebuild containers and wait for health
checks before running. Added dockerComposeUp/Down Gradle tasks and
updated documentation to reflect new workflow and add notification-service.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions
Copy link

github-actions bot commented Dec 22, 2025

Code Coverage Report

Overall Project 73.83% -12.7% 🍏
Files changed 67.03% 🍏

Module Coverage
user-service 83.97% -0.64%
tarot-service 77.49% -0.96%
notification-service 75.66% -24.34% 🍏
divination-service 69.7% -13.48%
Files
Module File Coverage
user-service GlobalExceptionHandler.kt 68.24% -2.58%
tarot-service GlobalExceptionHandler.kt 24.8% -4.8%
notification-service KafkaConsumerConfig.kt 100% 🍏
WebSocketConfig.kt 100% 🍏
NotificationService.kt 100% 🍏
Exceptions.kt 100% 🍏
NotificationMapper.kt 100% 🍏
WebSocketSessionRegistry.kt 98.1% -1.9% 🍏
Notification.kt 97.73% -2.27% 🍏
NotificationController.kt 92% -8% 🍏
EventConsumer.kt 75.79% -24.21% 🍏
GlobalExceptionHandler.kt 63.64% -36.36% 🍏
NotificationBroadcaster.kt 31.19% -68.81%
NotificationServiceApplication.kt 23.08% -76.92%
NotificationWebSocketHandler.kt 7.75% -92.25%
divination-service KafkaProducerConfig.kt 100% 🍏
FileValidator.kt 100% 🍏
Exceptions.kt 100% 🍏
Interpretation.kt 94.37% -5.63% 🍏
EventPublisher.kt 80.82% -19.18% 🍏
DivinationService.kt 75.5% -19.57%
InterpretationMapper.kt 75% -25%
InterpretationController.kt 71.72% -28.28%
GlobalExceptionHandler.kt 50.17% -8.81%

butvinm and others added 14 commits December 23, 2025 02:05
E2E tests now use automated container management via Gradle task.
Added notification-service to coverage report.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Generic exception handlers were silently swallowing errors, making
production debugging impossible. Now all services consistently log
unexpected errors with full stack traces.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add WebSocket handler at /api/v0.0.1/notifications/ws
- Add WebSocketSessionRegistry for managing user sessions
- Add NotificationBroadcaster for pushing notifications to connected clients
- Integrate WebSocket broadcasting with Kafka event consumer
- Add gateway WebSocket route configuration
- Add E2E tests for WebSocket notification flow
- Update documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The tarot-service has a max page size of 50, but buildCardCache and
fetchCard were requesting all 78 cards at once, causing BAD_GATEWAY
errors. Changed to paginated fetching.

Also updated gateway-service.yml to use the new property path
spring.cloud.gateway.server.webflux.routes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implementation includes:
- New file-storage-service with MinIO backend
- FileStorageServiceClient Feign client
- FileValidator for extension/size validation (PNG/JPG, 2MB max)
- Interpretation entity with file_key field
- InterpretationDto with fileUrl field
- POST/DELETE endpoints for interpretation files
- Docker Compose with MinIO and file-storage-service

BREAKING: DivinationService constructor changed - tests need update

See PROGRESS.md for detailed status.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Added mocks for FileStorageServiceClient and FileValidator to match
the updated DivinationService constructor.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Added file-storage-service to microservices table
- Added file_key to interpretation table schema
- Added file upload/delete endpoints to divination-service API
- Added file-storage-service API endpoints
- Added MinIO environment variables
- Added File Storage section explaining the feature

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Create FileAttachmentE2ETest with 11 comprehensive tests covering
  upload, download, delete, validation, authorization, and cascade delete
- Fix Content-Length header not forwarded by gateway by making it optional
  and falling back to FilePart.headers().contentLength
- Update PROGRESS.md to mark all phases complete

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The Docker Compose stack with 3 Kafka brokers and 8 microservices
requires more than 10 minutes to build and start in CI environments.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@butvinm butvinm merged commit 3a23bed into master Dec 25, 2025
1 check passed
butvinm added a commit that referenced this pull request Jan 12, 2026
Reverts:
- a336d28 Refactor authorization, fix issues (#13)
- 3a23bed Notification and file service (#5)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
butvinm added a commit that referenced this pull request Jan 12, 2026
* Revert last two commits to return to lab3 state

Reverts:
- a336d28 Refactor authorization, fix issues (#13)
- 3a23bed Notification and file service (#5)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Update highload-config to lab3-compatible state

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Set config-server default-label to revert-to-lab3

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add highload-config management instructions to CLAUDE.md

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
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.

1 participant