Commit Graph

16 Commits

Author SHA1 Message Date
b73f761308 Implement invitation system with server actions
- Add inviteUserToList: Create invitations with email validation and expiration
- Add getInvitations: Retrieve pending invitations for current user
- Add acceptInvitation: Accept invitation and create collaborator record
- Add declineInvitation: Decline and remove invitation
- Add getCollaborators: List all collaborators for a list
- Add updateCollaboratorPermission: Change collaborator permission level
- Add removeCollaborator: Revoke collaborator access
- Include proper authorization checks and error handling
- Add invitation expiration logic (7 days)
- Implement transaction for atomic invitation acceptance

Requirements: 5.1, 5.2, 5.3, 8.1, 8.5
2025-12-02 00:57:50 +00:00
a8962247fb Implement permission utilities (task 9)
- Created lib/permissions.ts with four utility functions:
  - canAccessList: Check if user can view a list
  - canEditList: Check if user can edit a list or its items
  - canDeleteList: Check if user can delete a list (owner only)
  - getPermission: Get user's permission level for a list
- Added comprehensive unit tests in lib/__tests__/permissions.test.ts
- All 24 tests passing
- Validates Requirements 4.3, 6.2, 6.3
2025-12-02 00:52:48 +00:00
0bb293e101 feat: implement list ownership and access control
- Modified createList to assign ownerId to authenticated user
- Updated getLists to filter by user access (owner or collaborator)
- Added ownership checks to updateList (owner or editor can update)
- Added ownership checks to deleteList (only owner can delete)
- Implemented access control for all item operations (create, update, delete, toggle)
- Updated getItem, searchItems, and getItemsByFilter to enforce access control
- Added dynamic rendering to pages that use authentication
- Cascade deletion already handled by database schema (onDelete: Cascade)

Requirements: 4.1, 4.2, 4.3, 4.5
2025-12-02 00:48:47 +00:00
2ebda95207 feat: implement route protection middleware for authentication
- Created Next.js middleware for authentication checks
- Protected main routes (/, /list/*, /profile/*, /invitations/*)
- Redirect unauthenticated users to login with callback URL
- Handle session validation and expiration
- Allow access to auth pages for unauthenticated users
- Redirect authenticated users away from login/register pages
- Added comprehensive middleware tests
- Validates Requirements 3.3, 3.5

Task: 7. Implement route protection middleware
2025-12-02 00:43:30 +00:00
895ceba55f Implement session management (Task 5)
- Configure JWT session strategy with 30-day expiration
- Implement session validation middleware for route protection
- Create logout functionality with session termination
- Handle session expiration automatically via JWT
- Add session helper functions (getCurrentSession, isAuthenticated)
- Protect routes: /, /list/*, /profile/*, /invitations/*
- Redirect unauthenticated users to login with callback URL
- Requirements: 2.4, 2.5, 3.1, 3.2, 3.4
2025-12-02 00:39:04 +00:00
211ed50503 Implement authentication functionality with login server action
- Created loginUser server action with credential validation
- Implemented password verification using bcrypt (via NextAuth authorize)
- Session creation on successful login handled by NextAuth
- Invalid credentials handled with appropriate error messages
- Added comprehensive unit tests for login functionality
- All tests passing (11/11)

Requirements: 2.1, 2.2
2025-12-02 00:36:03 +00:00
70121982a0 feat: implement user registration functionality
- Created registerUser server action with email/password validation
- Implemented password hashing with bcrypt (10 rounds)
- Added email uniqueness check to prevent duplicate registrations
- Created session after successful registration using NextAuth
- Added comprehensive validation for email format and password length (min 8 chars)
- Added email and password validation utilities to lib/validation.ts
- Removed PrismaAdapter from auth.ts (using JWT sessions only)
- Added vitest testing framework and configuration
- Created comprehensive unit tests for registration functionality
- All tests passing (6/6)

Requirements covered: 1.1, 1.2, 1.3, 1.4, 1.5
2025-12-02 00:03:23 +00:00
87f91ecbe0 feat: implement performance optimizations
- Add database indexes for frequently queried fields (listId, completed, priority, dueDate, createdAt)
- Add compound indexes for common query patterns (listId+completed, listId+priority)
- Implement pagination support in getItemsByFilter with configurable page size (default 50)
- Optimize components with React.memo (ItemCard, ListCard, FilterPanel, SearchBar, SearchResults, EmptyState)
- Configure Next.js for better bundle optimization:
  - Enable optimizePackageImports for lucide-react
  - Enable SWC minification
  - Remove console logs in production (except errors/warnings)
  - Optimize images with AVIF/WebP formats
  - Enable compression
  - Disable production source maps for smaller bundles
- Loading states already implemented to prevent layout shift

Task 18 complete - all performance optimizations implemented
2025-12-01 21:29:50 +00:00
796bde22e7 feat: Add comprehensive input validation
- Created lib/validation.ts with validation utilities for all form inputs
- Added validation for list titles, item titles, colors, dates, tags, descriptions, and notes
- Implemented inline validation with real-time error feedback in ListForm
- Enhanced ItemForm with comprehensive validation for all fields
- Updated InlineItemCreate with validation
- Added input sanitization to prevent XSS attacks
- Updated server actions to use validation utilities
- Added maxLength attributes to prevent excessive input
- Improved accessibility with aria-invalid and aria-describedby attributes
- Added visual feedback for validation errors with red borders
- Validates Requirements 1.1 and 2.1
2025-12-01 21:26:26 +00:00
12ce70e495 Implement comprehensive error handling
- Add try-catch blocks to all server actions with retry logic
- Implement exponential backoff retry mechanism for database operations
- Add input validation to all server actions
- Create ErrorBoundary component for React error handling
- Add page-level error handlers (error.tsx, global-error.tsx)
- Add route-specific error pages for list and item routes
- Enhance database connection with graceful error handling
- Add user-friendly error messages throughout the application
- Implement proper error logging for debugging

Task: 16. Implement error handling
Requirements: All (error handling is cross-cutting)
2025-12-01 21:18:57 +00:00
9726f3a9e1 feat: implement offline synchronization with mutation queue and background sync
- Created useOfflineSync hook for connectivity detection and sync management
- Implemented localStorage-based mutation queue for offline operations
- Added background sync support in service worker
- Created OfflineIndicator component to show connection status
- Added offline-aware action wrappers for seamless offline/online transitions
- Implemented conflict handling with retry logic (up to 3 retries)
- Auto-sync when connection is restored
- Validates Requirements 4.5
2025-12-01 20:34:21 +00:00
282a0295ec feat: implement item detail page and form components
- Created ItemForm component with fields for all metadata (priority, due date, tags, notes)
- Created ItemDetail component to display all item information
- Built /list/[id]/item/[itemId] page for viewing full item details
- Built /list/[id]/item/[itemId]/edit page for editing items
- Added form validation for item inputs (title required, length limits)
- Created DeleteItemButton and ToggleItemButton helper components
- Enhanced createItem action to support full metadata on creation
- Added getItem action to fetch individual items with list data

Requirements: 1.1, 1.2, 5.1, 5.2, 5.3, 5.4
2025-12-01 19:16:37 +00:00
3aedfb0954 Implement filtering and sorting functionality
- Add getItemsByFilter server action with support for:
  - Priority filtering (low, medium, high)
  - Completed status filtering
  - Tag filtering with compound AND logic
  - Due date range filtering
  - Sorting by createdAt, dueDate, priority, and title
  - Ascending and descending sort order
- Handle null due dates in sorting (placed at end)
- Implement compound filter logic with AND conditions
- Requirements: 6.1, 6.2, 6.3, 6.5
2025-12-01 19:13:44 +00:00
6626a26160 Implement search functionality - Add searchItems server action with list-scoped and global search - Add highlightText utility function for search result highlighting - Search across title, description, notes, and tags fields - Requirements: 8.1, 8.2, 8.5 2025-12-01 19:04:37 +00:00
dcb1ce929f feat: implement core server actions for enhanced task operations
- Add updateItem server action with support for all metadata fields (title, description, completed, priority, dueDate, tags, notes)
- Add deleteItem server action with proper revalidation
- Add deleteList server action with cascade behavior (handled by Prisma schema)
- Add updateList server action for renaming and color updates

Requirements: 1.2, 1.3, 2.4, 2.5
2025-12-01 19:00:21 +00:00
0cfcd05921 Connect app to MySQL database at 192.168.4.20 2025-12-01 18:45:48 +00:00