Replace Gorush with direct APNs/FCM integration

- Add direct APNs client using sideshow/apns2 for iOS push
- Add direct FCM client using legacy HTTP API for Android push
- Remove Gorush dependency (no external push server needed)
- Update all services/handlers to use new push.Client
- Update config for APNS_PRODUCTION flag

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Trey t
2025-11-29 12:04:31 -06:00
parent c4118c8186
commit a15e847098
15 changed files with 649 additions and 257 deletions

View File

@@ -27,7 +27,7 @@ type Dependencies struct {
Config *config.Config
EmailService *services.EmailService
PDFService *services.PDFService
PushClient interface{} // *push.GorushClient - optional
PushClient *push.Client // Direct APNs/FCM client
StorageService *services.StorageService
}
@@ -66,14 +66,6 @@ func SetupRouter(deps *Dependencies) *gin.Engine {
notificationRepo := repositories.NewNotificationRepository(deps.DB)
subscriptionRepo := repositories.NewSubscriptionRepository(deps.DB)
// Initialize push client (optional)
var gorushClient *push.GorushClient
if deps.PushClient != nil {
if gc, ok := deps.PushClient.(*push.GorushClient); ok {
gorushClient = gc
}
}
// Initialize services
authService := services.NewAuthService(userRepo, cfg)
userService := services.NewUserService(userRepo)
@@ -82,7 +74,7 @@ func SetupRouter(deps *Dependencies) *gin.Engine {
taskService := services.NewTaskService(taskRepo, residenceRepo)
contractorService := services.NewContractorService(contractorRepo, residenceRepo)
documentService := services.NewDocumentService(documentRepo, residenceRepo)
notificationService := services.NewNotificationService(notificationRepo, gorushClient)
notificationService := services.NewNotificationService(notificationRepo, deps.PushClient)
// Wire up notification and email services to task service (for task completion notifications)
taskService.SetNotificationService(notificationService)
@@ -116,11 +108,7 @@ func SetupRouter(deps *Dependencies) *gin.Engine {
// Set up admin routes (separate auth system)
adminDeps := &admin.Dependencies{
EmailService: deps.EmailService,
}
if deps.PushClient != nil {
if gc, ok := deps.PushClient.(*push.GorushClient); ok {
adminDeps.PushClient = gc
}
PushClient: deps.PushClient,
}
admin.SetupRoutes(r, deps.DB, cfg, adminDeps)