Add Next.js admin panel and implement background worker jobs

- Add full Next.js admin panel with:
  - User, residence, task, contractor, document management
  - Notifications and notification preferences management
  - Subscriptions and auth token management
  - Dashboard with stats
  - Lookup tables management (categories, priorities, statuses, etc.)
  - Admin user management

- Implement background worker job handlers:
  - HandleTaskReminder: sends push notifications for tasks due within 24h
  - HandleOverdueReminder: sends push notifications for overdue tasks
  - HandleDailyDigest: sends daily summary of pending tasks
  - HandleSendEmail: processes email sending jobs
  - HandleSendPush: processes push notification jobs

- Make worker job schedules configurable via environment variables:
  - TASK_REMINDER_HOUR, TASK_REMINDER_MINUTE (default: 20:00 UTC)
  - OVERDUE_REMINDER_HOUR (default: 09:00 UTC)
  - DAILY_DIGEST_HOUR (default: 11:00 UTC)

🤖 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-27 23:35:00 -06:00
parent eed5c21586
commit 2817deee3c
129 changed files with 26838 additions and 693 deletions

View File

@@ -13,6 +13,7 @@ import (
"github.com/treytartt/mycrib-api/internal/config"
"github.com/treytartt/mycrib-api/internal/database"
"github.com/treytartt/mycrib-api/internal/push"
"github.com/treytartt/mycrib-api/internal/services"
"github.com/treytartt/mycrib-api/internal/worker/jobs"
"github.com/treytartt/mycrib-api/pkg/utils"
)
@@ -45,6 +46,13 @@ func main() {
log.Info().Str("url", cfg.Push.GorushURL).Msg("Gorush client initialized")
}
// Initialize email service (optional)
var emailService *services.EmailService
if cfg.Email.Host != "" {
emailService = services.NewEmailService(&cfg.Email)
log.Info().Str("host", cfg.Email.Host).Msg("Email service initialized")
}
// Parse Redis URL for Asynq
redisOpt, err := asynq.ParseRedisURI(cfg.Redis.URL)
if err != nil {
@@ -72,7 +80,7 @@ func main() {
)
// Create job handler
jobHandler := jobs.NewHandler(db, gorushClient, cfg)
jobHandler := jobs.NewHandler(db, gorushClient, emailService, cfg)
// Create Asynq mux and register handlers
mux := asynq.NewServeMux()