Commit Graph

34 Commits

Author SHA1 Message Date
richardtekula
883d3fa533 chore: Commit current state before refactoring
Includes deleted sql/ files, seeds, and documentation files.
Prepares master for refactoring branch.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 07:19:23 +01:00
richardtekula
95688be45b feat: Add pause/resume functionality to time tracking
Add pausedAt and pausedDuration columns to time_entries table.
New pause/resume endpoints with audit logging. Duration calculations
now correctly exclude paused time across start, stop, auto-stop,
and edit flows.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 07:15:57 +01:00
richardtekula
a0a6656a49 feat: Hotfix Part1 - Backend support for company postal code, service tiers, timesheet naming
- Add postal_code column to companies table
- Add pricing_tiers column to services table for tiered pricing
- Update timesheet upload to generate filename in format {firstname}-{lastname}-timesheet-{date}

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 07:46:50 +01:00
richardtekula
826fd467bc feat: Add farba field and company details to AI Kurzy module
- Add farba (color) field to kurzy schema and Zod validation
- Add company detail fields (firma_ico, firma_dic, firma_ic_dph, firma_sidlo) to ucastnici
- Remove console logs from ai-kurzy service
- Add SQL migration scripts for schema updates and data

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 14:27:03 +01:00
richardtekula
4089bb4be2 feat: AI Kurzy module, project/service documents, services SQL import
- Add AI Kurzy module with courses, participants, and registrations management
- Add project documents and service documents features
- Add service folders for document organization
- Add SQL import queries for services from firmy.slovensko.ai
- Update todo notifications and group messaging
- Various API improvements and bug fixes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 11:32:49 +01:00
richardtekula
d9f16ad0a6 feat: Group chat and push notifications
- Add group chat tables (chat_groups, chat_group_members, group_messages)
- Add push subscriptions table for web push notifications
- Add group service, controller, routes
- Add push service, controller, routes
- Integrate push notifications with todos, messages, group messages

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 07:27:13 +01:00
richardtekula
73a3c6bf95 hotfix: Security, performance, and code cleanup
- Remove hardcoded database password fallback
- Add encryption salt validation (min 32 chars)
- Separate EMAIL_ENCRYPTION_KEY from JWT_SECRET
- Fix command injection in status.service.js (use execFileSync)
- Remove unnecessary SQL injection regex middleware
- Create shared utilities (queryBuilder, pagination, emailAccountHelper)
- Fix N+1 query problems in contact and todo services
- Merge duplicate JMAP config functions
- Add database indexes migration
- Standardize error responses with error codes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 07:17:23 +01:00
richardtekula
0523087961 feat: Add email signature feature
- Add email_signatures table to schema
- Add email signature service, controller, routes
- Users can create/edit signature in Profile
- Toggle to include signature when sending email replies

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 19:11:51 +01:00
richardtekula
514b6c8a92 feat: Add services, company documents, company timesheet export
- Add services table and CRUD endpoints (/api/services)
- Add company documents upload/download functionality
- Add company timesheet XLSX export endpoint
- Remove admin requirement from event routes (all authenticated users can manage events)
- Add service validators

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 18:45:01 +01:00
richardtekula
47b68e672b feat: Member permissions, optional phone, public users endpoint
- Allow members to create todos, companies, projects
- Auto-assign creator to resources (companyUsers, projectUsers, todoUsers)
- Add public /api/users endpoint for all authenticated users
- Make phone field optional in personal contacts (schema + validation)
- Update todo routes to use checkTodoAccess for updates

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 07:08:42 +01:00
richardtekula
3e8cd7b6ce fix: Add description field to personal contacts
- Add description to Zod validation schema
- Add description to controller normalizePayload function

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 10:34:35 +01:00
richardtekula
2a9377ce3d feat: Add internal chat system and network access support
- Add messages table schema with soft delete support
- Add message service, controller and routes
- Update CORS to allow local network IPs
- Update server to listen on 0.0.0.0
- Fix cookie sameSite for local network development

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 10:13:14 +01:00
richardtekula
70fa080455 feat: Add user management APIs, status enum, enhanced notifications
- Add updateUser and resetUserPassword admin endpoints
- Change company status from boolean to enum (registered, lead, customer, inactive)
- Add 'important' event type to calendar validators and email templates
- Add 1-hour-before event notifications cron job
- Add 18:00 evening notifications for next-day events
- Add contact description field support
- Fix count() function usage in admin service
- Add SQL migrations for schema changes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 09:41:29 +01:00
richardtekula
3eb2f6ea02 feat: Replace Meetings with Calendar - events with types and assigned users
- Rename meetings table to events with type field (meeting/event)
- Add eventUsers junction table for user assignments
- Members see only events they're assigned to
- Calendar endpoint returns events + todos for month
- Add migration SQL for database changes

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-15 10:50:31 +01:00
richardtekula
f828af562d feat: Add dueDate (date+time) to notes and update reminders to datetime
- Add dueDate timestamp field to notes schema
- Update note validators to accept dueDate
- Update note service to handle dueDate in CRUD operations
- Fix company and project controllers to pass dueDate
- Fix route validations to include dueDate field

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 07:03:29 +01:00
richardtekula
8770a98db8 feat: Add company linking to personal contacts
- Add companyId column to personal_contacts table
- Update personal-contact service to include companyName in list
- Add getContactsByCompanyId function for company contacts endpoint
- Add GET /companies/:companyId/contacts endpoint
- Add companyId to contact validation schema

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-12 08:03:29 +01:00
richardtekula
8656fb1db0 feat: Add creator info, team management for companies, and member access control
- Add creator info (username) to companies, projects, and notes responses
- Add company_users table for team management on companies
- Add resourceAccessMiddleware for member access control
- Members can only see resources they are directly assigned to
- Companies, projects, and todos are now filtered by user assignments
- Add personal contacts feature

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-12 07:41:57 +01:00
richardtekula
918af3a843 add contacts to crm & display on dashboard 2025-12-08 10:36:43 +01:00
richardtekula
eb5582feb6 Add meetings feature with admin-only CRUD
- Add meetings table with timezone support
- Add meeting.service.js with timezone parsing (Europe/Bratislava)
- Add meeting.controller.js for CRUD operations
- Add meeting.routes.js with admin middleware for create/update/delete
- GET endpoints available for all authenticated users

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-05 08:17:23 +01:00
richardtekula
109cae1167 Security improvements, role in user creation, todo filters fix
- Remove better-auth dependency (unused)
- Update JWT secrets to stronger values
- Add ENCRYPTION_SALT env variable for password encryption
- Add role field to createUserSchema validator
- Accept role from body in admin.controller createUser
- Fix todo filters: add priority filter, handle completed param
- Remove .env.example (merged into .env)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 09:54:03 +01:00
richardtekula
ffaf916f5e Add dueDate to reminders, remove reminder from notes
Schema changes:
- Added dueDate field to companyReminders table
- Removed reminderDate and reminderSent from notes table

Backend changes:
- Updated company-reminder.service with dueDate handling
- Added getUpcomingReminders function for dashboard
- Simplified note.service (removed reminder logic)
- Updated validators and routes

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 11:21:54 +01:00
richardtekula
879709661e add email threads to companies 2025-11-25 15:00:30 +01:00
richardtekula
f4397bc0de Clean up duplicate schema definition
- Remove duplicate companyReminders table definition
- Add company isActive status feature
- Add company reminders feature

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-25 10:37:42 +01:00
richardtekula
d791de3834 Merge branch 'notif' - add company reminders feature 2025-11-25 10:28:22 +01:00
richardtekula
440585852d Add company reminders feature 2025-11-25 10:28:18 +01:00
richardtekula
9d5d42ee9f Add isActive column to companies table and update service 2025-11-25 10:01:04 +01:00
richardtekula
8fd8f991e8 Implement many-to-many TODO user assignments
- Create todo_users junction table for many-to-many relationship
- Add migration to create todo_users table and migrate existing data
- Update validators to accept assignedUserIds array instead of assignedTo
- Update todo service to handle multiple user assignments
- Fetch and return assigned users with each TODO

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 11:17:28 +01:00
richardtekula
7fd6b9e742 excel preview & file handling 2025-11-24 10:18:28 +01:00
richardtekula
540c1719d3 Add Time Tracking backend API
Implementovaný kompletný backend pre time tracking:
- Nová tabuľka time_entries s foreign keys na users, projects, todos, companies
- Service layer s business logikou pre CRUD operácie
- Controller pre všetky endpointy
- Validačné schémy pomocou Zod
- Routes s autentifikáciou a validáciou
- Endpointy:
  * POST /api/time-tracking/start - Spustenie timeru
  * POST /api/time-tracking/:id/stop - Zastavenie timeru
  * GET /api/time-tracking/running - Získanie bežiaceho záznamu
  * GET /api/time-tracking/month/:year/:month - Mesačné záznamy
  * GET /api/time-tracking/stats/monthly/:year/:month - Mesačné štatistiky
  * PATCH /api/time-tracking/:id - Aktualizácia záznamu
  * DELETE /api/time-tracking/:id - Zmazanie záznamu
- Podpora pre isEdited flag pri editácii
- Kalkulácia duration v minútach

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 06:41:39 +01:00
richardtekula
ca93b6f2d2 fix email issues, add company,project,todos 2025-11-21 13:56:02 +01:00
richardtekula
bb851639b8 Add Timesheets API with file upload and role-based access
Backend Features:
- Timesheets database table (id, userId, fileName, filePath, fileType, fileSize, year, month, timestamps)
- File upload with multer (memory storage, 10MB limit, PDF/Excel validation)
- Structured file storage: uploads/timesheets/{userId}/{year}/{month}/
- RESTful API endpoints:
  * POST /api/timesheets/upload - Upload timesheet
  * GET /api/timesheets/my - Get user's timesheets (with filters)
  * GET /api/timesheets/all - Get all timesheets (admin only)
  * GET /api/timesheets/:id/download - Download file
  * DELETE /api/timesheets/:id - Delete timesheet
- Role-based permissions: users access own files, admins access all
- Proper error handling and file cleanup on errors
- Database migration for timesheets table

Technical:
- Uses req.user.role for permission checks
- Automatic directory creation for user/year/month structure
- Blob URL cleanup and proper file handling
- Integration with existing auth middleware

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-21 08:35:30 +01:00
richardtekula
178b18baa5 Add debug logging for markContactEmailsAsRead and remove password change restriction 2025-11-20 08:00:14 +01:00
richardtekula
1e7c1eab90 option for more emails,fix jmap service,add table email accounts 2025-11-19 13:15:45 +01:00
richardtekula
da01d586fc initialize git, basic setup for crm 2025-11-18 13:53:28 +01:00