Commit Graph

984 Commits

Author SHA1 Message Date
Knee Cola
2b6999d728 fix: update environment configuration for email worker 2025-12-30 12:46:11 +01:00
Knee Cola
6a1a5e0dca fix: update Mailgun API key and share link secret in environment configuration 2025-12-30 12:45:40 +01:00
Knee Cola
a901980a6f feat: implement email notification worker with Mailgun integration
- Add MongoDB connection module for database access
- Implement Mailgun email service for sending notifications
- Add shareChecksum utility for generating secure share links
- Implement three email sender functions:
  - Email verification requests (highest priority)
  - Rent due notifications (CET timezone)
  - Utility bills due notifications
- Create main email worker with budget-based email sending
- Add environment variables for configuration
- Install dependencies: mongodb, mailgun.js, form-data
- Update package.json description to reflect email worker purpose
- Add .env.example with all required configuration

The worker processes emails in priority order and respects a configurable
budget to prevent overwhelming the mail server. All database operations are
atomic and updates are performed immediately after each email send.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-30 12:27:32 +01:00
Knee Cola
33ab06e22e commit changes 2025-12-30 12:20:06 +01:00
Knee Cola
4a6896c910 docs: improve email-worker specification and add VerificationFailed status
- Fix spelling and grammar errors throughout email-worker.md
- Add DB structure and connection sections
- Add error handling for email send failures
- Add email subjects, sender information, and delivery details
- Add logging requirements section
- Add race condition handling guidelines
- Add email provider specification (Mailgun)
- Add EmailStatus.VerificationFailed enum value for failed verification emails

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-30 12:16:30 +01:00
Knee Cola
f8291f9f7b docs: add initial email-worker implementation specification
Add comprehensive specification document for email-worker service detailing:
  - Email verification request workflow
  - Rent due notification workflow
  - Utility bills due notification workflow
  - Email budget/throttling strategy (default: 10 emails per run)
  - Priority system (verification requests first)
  - Complete email templates with dynamic content
  - MongoDB integration requirements
2025-12-30 11:29:05 +01:00
Knee Cola
e9012ed231 (refactor) renames autoBillFwd > billFwdEnabled 2025-12-30 11:09:21 +01:00
Knee Cola
4906cc1990 (refactor) rename: rentDueNotification > rentDueNotificationEnabled 2025-12-30 10:45:48 +01:00
Knee Cola
3e4d8fb95c refactor: rename email-server-worker to email-worker
Rename directory from email-server-worker to email-worker for clarity and brevity. Update all references in CLAUDE.md documentation.
2025-12-30 10:33:59 +01:00
Knee Cola
9d6ad17452 chore: add development configuration files
Add .env with default development settings and .vscode debug configurations for easier local development.

- .env: Development environment variables (PORT, DEBUG, PULL_INTERVAL)
- .vscode/launch.json: Debug configurations for server and Jest tests
- .vscode/settings.json: Jest integration settings

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-30 09:05:31 +01:00
Knee Cola
25c2f09eef feat: add email-server-worker with clean template architecture
Add new email-server-worker project implementing a self-scheduling background worker pattern with HTTP monitoring. Removed all business-specific code from copied source, creating a clean, reusable template.

Key features:
- Self-scheduling worker loop with configurable interval
- Graceful shutdown support (Docker-compatible)
- Prometheus metrics collection
- Health check endpoints (/healthcheck, /metrics, /ping)
- Example worker template for easy customization
- Comprehensive architecture documentation in CLAUDE.md

The worker is now ready for email server implementation with no external dependencies on Evolution/MSSQL/ElasticSearch.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-30 09:03:58 +01:00
Knee Cola
7a526c5a85 Merge branch 'feature/email-confirm-unsubscribe' into develop 2025-12-29 23:31:25 +01:00
Knee Cola
f42366c00b feat: add git diff command to permissions in settings 2025-12-29 23:31:09 +01:00
Knee Cola
4dc2df4a12 security: add server-side validation for email status transitions
Implement strict validation to prevent unauthorized email status changes:
- Force status to Unverified when email address changes
- Only allow client to reset status to Unverified (via reset button)
- Block client from upgrading status (Unverified→Verified, etc.)
- All status upgrades must happen server-side via verification links

This prevents attackers from:
- Submitting new emails with fake "verified" status
- Bypassing email verification by modifying client requests
- Escalating email status without proper verification flow

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-29 23:21:49 +01:00
Knee Cola
fe98a63594 feat: add persistence for tenant email status field
- Add tenantEmailStatus hidden field to LocationEditForm
- Update locationActions to persist email status across all scopes
- Add reset button for unsubscribed email status
- Improve email status display with new/modified indicators
- Update translations for email status messages

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-29 23:05:57 +01:00
Knee Cola
b20d68405c refactor: improve email status display and messaging
LocationCard:
- Include email status in card info section display condition
- Remove emoji suffixes (icons already convey status visually)

LocationEditForm:
- Enable autoBillFwd and rentDueNotification toggles
- Only show email status when displayed email matches saved email
- Show unverified status when email is changed or for new emails
- Remove emoji suffixes from status messages
- Add left margin to status display

Messages (EN/HR):
- More descriptive email status messages in both languages
- LocationCard: "tenant email not verified" vs "Email not verified"
- LocationEditForm: Clearer explanations like "this e-mail address
  will need to be verified by the tenant"

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-29 21:58:02 +01:00
Knee Cola
fea0f48cec fix: include tenantEmail and tenantEmailStatus in fetchAllLocations projection
Added tenantEmail and tenantEmailStatus fields to the MongoDB projection
in fetchAllLocations() so LocationCard can display email status indicators.

Previously these fields were always undefined in LocationCard because they
weren't included in the aggregation pipeline's $project stage.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-29 21:11:07 +01:00
Knee Cola
db9c57472d feat: add email status check to verify page
Security Enhancement:
- Server-side validation of email status before allowing verification
- Only allow verifying emails in VerificationPending state
- Show "Action not possible" message for invalid states
- Extract and validate share-id on server side
- Return 404 for invalid share-ids or missing tenant emails

Implementation:
- Convert page.tsx to async server component
- Fetch location and check tenantEmailStatus
- Pass isPending prop to client component
- Add bilingual "not-allowed" translations (same as unsubscribe page)

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-29 20:54:14 +01:00
Knee Cola
ff6f8890c5 refactor: simplify unsubscribe "not-allowed" message
Make error message more generic and less specific:
- Change title from "Action Not Allowed" to "Action not possible"
- Simplify message to cover broader error cases
- Fix typo: "performe" → "performed"
- Apply same changes to Croatian version

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-29 20:44:58 +01:00
Knee Cola
5d1602df7f feat: add email verification check to unsubscribe page
Security Enhancement:
- Server-side validation of email status before allowing unsubscribe
- Only allow unsubscribing from verified emails
- Show "Action Not Allowed" message for unverified/unsubscribed emails
- Extract and validate share-id on server side
- Return 404 for invalid share-ids or missing tenant emails

Implementation:
- Convert page.tsx to async server component
- Fetch location and check tenantEmailStatus
- Pass isVerified prop to client component
- Add bilingual "not-allowed" translations

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-29 20:33:16 +01:00
Knee Cola
bc7b28e6e9 refactor: improve email verification/unsubscribe UI and messaging
UI Improvements:
- Add spacing (mb-3) to card titles
- Increase heading font size (text-lg) for better hierarchy

Content Updates:
- Rebrand from "Evidencija Režija" to "rezije.app"
- Clarify success message: "subscribed to receive notifications"
- Improve opt-out description wording
- Fix Croatian grammar and phrasing
- Update unsubscribe page title for clarity

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-29 20:26:35 +01:00
Knee Cola
6eee14d0c3 feat: add email sending test script
Add sent-mail-tester.mjs for testing email functionality

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-29 19:49:28 +01:00
Knee Cola
db92d157c5 feat: create email-server-worker workspace
Initialize workspace for email server worker service
- Polls MongoDB for email status changes
- Sends verification and notification emails
- Updates email statuses
- Runs as standalone background worker

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-29 19:47:13 +01:00
Knee Cola
1666394435 feat: add mailgun-webhook to VSCode workspace
Add new mailgun-webhook folder to workspace configuration

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-29 19:06:22 +01:00
Knee Cola
8eb4aec3b7 fix: remove unused currentLocale variable in LocationCard
Remove unused import to resolve TypeScript warning [6133]

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-29 18:51:45 +01:00
Knee Cola
c81c182806 feat: create mailgun-webhook workspace
Initialize empty workspace for Mailgun webhook handler service
- Processes email verification and status updates
- Communicates with web-app via shared MongoDB
- Handles Mailgun webhook events

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-29 18:51:04 +01:00
Knee Cola
92ecd7f18e feat: add email status indicators to LocationEditForm
- Display all email statuses (Unverified, VerificationPending, Verified, Unsubscribed)
- Show appropriate icons and colors for each status
- Add bilingual translations for status labels
- Use UTF-8 emojis (⚠️   ✉️) alongside Heroicons
- Position indicator before tenantEmail-error div

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-29 18:35:27 +01:00
Knee Cola
8bed381f36 feat: add email status indicators to LocationCard
- Display email status when not Verified
- Show appropriate icons and colors for each status
- Add bilingual translations for status labels
- Use UTF-8 emojis (⚠️  ✉️) alongside Heroicons

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-29 18:33:37 +01:00
Knee Cola
0f06394984 feat: implement email unsubscribe page
- Create /email/unsubscribe/[id] route with page and component
- Add share-id validation and 404 on invalid links
- Add bilingual translations (English/Croatian)
- Implement unsubscribe UI with success/error states
- Call unsubscribeTenantEmail server action on button click

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-29 18:32:04 +01:00
Knee Cola
2bc7bcdc1e feat: implement email verification page
- Create /email/verify/[id] route with page and component
- Add share-id validation and 404 on invalid links
- Add bilingual translations (English/Croatian)
- Implement verification UI with success/error states
- Call verifyTenantEmail server action on button click

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-29 18:16:44 +01:00
Knee Cola
c1d3026f4b feat: implement email verification and unsubscribe DB logic
- Export EmailStatus enum from db-types.ts
- Add verifyTenantEmail server action
- Add unsubscribeTenantEmail server action
- Both actions update current and all subsequent matching locations
- Match criteria: userId, name, tenantEmail, yearMonth >= current
- Share-id validation using existing shareChecksum utilities

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-29 18:13:41 +01:00
Knee Cola
a51476d82b docs: clarify email verification implementation details
- Added DB integration details for external email system
- Clarified share-id validation (404 on invalid)
- Enhanced subsequent matching to include tenantEmail
- Specified exact UI placement for email status indicators
- Fixed typo: EmailStatus.Verifies → EmailStatus.Verified

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-29 18:01:10 +01:00
Knee Cola
1cafe33386 (prompt) written prompt for implementing e-mail confirmation and unsubscribe 2025-12-29 17:37:25 +01:00
Knee Cola
7a0370da9b (refactor) db-types: removed unused e-mail statuses 2025-12-29 17:36:51 +01:00
Knee Cola
ddf83fe0e5 (refactor) InfoBox: setting max width 2025-12-29 13:33:09 +01:00
Knee Cola
52662e0fb3 feat: add email status tracking for tenant emails
Add EmailStatus enum and tracking fields to BillingLocation to support
email delivery monitoring (bounces, complaints, unsubscribes).

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-27 10:41:46 +01:00
Knee Cola
96abb5fffe (refactor) moving sign-in button to more prominent place 2025-12-27 09:36:52 +01:00
Knee Cola
d031d84781 Merge branch 'feature/going-to-monorepo' into develop 2025-12-27 09:22:32 +01:00
Knee Cola
e8164596b9 refactor: move VS Code config and debug compose to web-app workspace
Update launch.json and tasks.json to use multi-root workspace folder syntax for correct path resolution.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-26 10:25:39 +01:00
Knee Cola
36accc3b30 refactor: create docker-stack workspace for deployment configs
Created dedicated workspace for Docker deployment configurations and scripts.
Improves organization by grouping all deployment-related files together.

## New Structure
- docker-stack/: Docker Compose files and deployment scripts
  - docker-compose-standalone.yaml
  - docker-compose-swarm.yml
  - docker-compose-debug.yml
  - deploy-standalone.sh
  - deploy-swarm.sh
  - README.md (deployment documentation)
  - package.json

## Changes
- Moved all docker-compose YAML files to docker-stack/
- Moved deploy scripts to docker-stack/
- Updated VS Code workspace to include docker-stack
- Updated documentation (README, CLAUDE.md)

## Deployment Workflow
1. Build: `cd web-app && ./build.sh 2.20.0`
2. Deploy: `cd docker-stack && ./deploy-standalone.sh 2.20.0`

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-25 13:21:46 +01:00
Knee Cola
b4424edd4e refactor: move Docker build files to web-app directory
Moved Dockerfile, build.sh, and .dockerignore to web-app/ for better
project encapsulation. Each project now contains its own build configuration.

## Changes
- Moved Dockerfile to web-app/ and simplified paths
- Moved build.sh to web-app/
- Moved .dockerignore to web-app/
- Updated Dockerfile to work from web-app/ context (no workspace references)
- Updated documentation for new build workflow

## Build Workflow
- Build: Run from web-app/ directory (`cd web-app && ./build.sh 2.20.0`)
- Deploy: Run from repository root (`./deploy-standalone.sh 2.20.0`)

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-25 12:31:15 +01:00
Knee Cola
362a49e3cd refactor: simplify to independent multi-project structure
Removed npm workspace configuration in favor of simple multi-project repository.
Each project (web-app, housekeeping) is now completely self-contained.

## Changes
- Removed root package.json and package-lock.json
- Added VS Code workspace file for better project organization
- Updated documentation to reflect independent project structure
- Each project manages its own dependencies without workspace linking

## Structure
- web-app/: Self-contained Next.js application
- housekeeping/: Self-contained DB maintenance scripts
- No workspace management or dependency sharing
- Monorepo is purely for Git organization

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-25 12:25:46 +01:00
Knee Cola
8685ac36b8 refactor: make workspaces fully self-contained
Removed shared dependencies from root package.json. Each workspace now
manages its own dependencies independently.

- Removed prettier from root devDependencies
- Removed prettier scripts from root (available in web-app workspace)
- Root package.json now only manages workspace configuration

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-25 12:19:13 +01:00
Knee Cola
57dcebd640 refactor: convert repository to monorepo with npm workspaces
Restructured the repository into a monorepo to better organize application code
and maintenance scripts.

## Workspace Structure
- web-app: Next.js application (all app code moved from root)
- housekeeping: Database backup and maintenance scripts

## Key Changes
- Moved all application code to web-app/ using git mv
- Moved database scripts to housekeeping/ workspace
- Updated Dockerfile for monorepo build process
- Updated docker-compose files (volume paths: ./web-app/etc/hosts/)
- Updated .gitignore for workspace-level node_modules
- Updated documentation (README.md, CLAUDE.md, CHANGELOG.md)

## Migration Impact
- Root package.json now manages workspaces
- Build commands delegate to web-app workspace
- All file history preserved via git mv
- Docker build process updated for workspace structure

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-25 12:13:04 +01:00
Knee Cola
321267a848 Merge branch 'hotfix/2.20.1' into develop 2025-12-24 23:55:58 +01:00
Knee Cola
c8659c15bb (bugfix) created optimized image versions 2025-12-24 23:55:50 +01:00
Knee Cola
3f007cba4a Merge branch 'release/2.20.0' into develop 2025-12-24 23:43:24 +01:00
Knee Cola
1bd755465a Merge branch 'release/2.20.0' 2025-12-24 23:43:24 +01:00
Knee Cola
d3f109ea4b chore: update version to 2.20.0 in package.json and package-lock.json 2025-12-24 23:43:17 +01:00
Knee Cola
2ad2978fd3 Merge branch 'feature/nova-naslovnica' into develop 2025-12-24 23:13:14 +01:00