Commit Graph

43 Commits

Author SHA1 Message Date
richardtekula
dd15be93a9 feat: Add refresh token endpoint and remember me support
- Add POST /auth/refresh endpoint for token renewal
- Only set refresh token cookie when rememberMe is true
- Add rememberMe field to login validator schema

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 07:21:58 +01:00
richardtekula
284d905d18 feat: Add notes search endpoint for enhanced global search
- Add searchNotes service function with company/project info
- Add /notes/search endpoint for searching notes content
- Returns matching notes with linked company/project names

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 07:49:10 +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
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
d13442a979 fix: Accept null for all optional contact fields
lastName and secondaryEmail schemas now accept null values
sent from frontend, matching other optional fields pattern.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 10:20:50 +01:00
richardtekula
c1657ac37b fix: Allow empty string for phone in contact validation
The Zod schema was rejecting empty strings sent from the frontend.
Changed from z.string().optional().nullable() to z.union pattern
to properly handle "", null, and undefined values.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 10:07:46 +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
0585e51b25 feat: Add comprehensive audit logging system
- Add audit logging for contacts (link company, create company from contact)
- Add audit logging for notes (create, update, delete)
- Add audit logging for companies (update, user assign/remove, reminder CRUD)
- Add audit logging for projects (update, user assign/remove)
- Add audit logging for todos (update, uncomplete)
- Add audit logging for time entries (update, delete)
- Add audit logging for timesheets (upload, delete)
- Add audit logging for user deletion
- Add pagination and filters to audit logs API (userId, action, resource, dateFrom, dateTo)
- Add endpoints for distinct actions and resources

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-17 07:19:40 +01:00
richardtekula
548a8effdb feat: Add manual event notification endpoint for admins
- POST /api/events/:eventId/notify - send notifications from admin's email
- sendSingleEventNotification() uses admin's primary email account
- getSenderAccountByUserId() to get admin's email credentials

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 09:06:30 +01:00
richardtekula
2d6198b5f8 fix: Add admin-only protection to sensitive routes
- GET /admin/users now requires admin role
- GET /time-tracking/running-all now requires admin role
- GET /notes now requires admin role
- GET /audit-logs now requires admin role

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 08:39:21 +01:00
richardtekula
77754d0668 feat: Add daily event notification emails via cron job
- Add node-cron for scheduled tasks
- Create cron/calendar structure with:
  - email-template.js: HTML email template for event notifications
  - event-notifier.js: Logic to query tomorrow's events and send emails
  - index.js: Cron scheduler (runs daily at configurable time)
- Send notifications via JMAP using sender email from database
- Add admin endpoint POST /api/admin/trigger-notifications for testing
- Add env variables: NOTIFICATION_TIME, NOTIFICATION_SENDER_EMAIL

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 14:27:53 +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
6f4a31e9de Code quality improvements from code review
- Add admin-only authorization for company and projects CRUD operations
- Create requireAccountId middleware to eliminate code duplication
- Standardize error handling (use next(error) consistently)
- Change error messages to Slovak language

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-05 11:03:32 +01:00
richardtekula
03b7a215bb Add server status monitoring endpoint
- Add status.service.js with CPU, RAM, Disk, Backend stats
- RAM calculation matches htop (reads /proc/meminfo)
- Includes uploads folder size, DB table count
- Returns both system and backend (process) uptime

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-05 09:00:31 +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
a49bff56da Add audit logging for CRUD operations
- Extend audit.service.js with logging functions for projects, todos, companies, time tracking, and auth
- Create audit.controller.js for fetching recent audit logs with user info
- Create audit.routes.js with GET /api/audit-logs endpoint
- Add audit logging to project, todo, company, time-tracking, and auth controllers
- Log create/delete operations for projects, todos, companies
- Log timer start/stop for time tracking
- Log login/logout events

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 10:41:30 +01:00
richardtekula
7adb92503a Expose notes route and running timers endpoint 2025-12-04 07:41:31 +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
947d1d9b99 notification about emails in company card 2025-11-26 07:35:55 +01:00
richardtekula
879709661e add email threads to companies 2025-11-25 15:00:30 +01:00
richardtekula
cf4df9d314 add reminders notes and notification in sidebar 2025-11-25 11:29:03 +01:00
richardtekula
9d5d42ee9f Add isActive column to companies table and update service 2025-11-25 10:01:04 +01:00
richardtekula
31297ee9a9 refractoring & add timesheet service 2025-11-25 07:52:31 +01:00
richardtekula
125e30338a add many to one in todo, fix bugs, notification about todos 2025-11-24 11:30:25 +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
97f437c1c4 add searching, total unread message, create user 2025-11-19 08:45:37 +01:00
richardtekula
da01d586fc initialize git, basic setup for crm 2025-11-18 13:53:28 +01:00