This document describes the domain objects, entities, DTOs (Data Transfer Objects), and their relationships within the Task Tracker application. The system follows a typical Spring Boot architecture with JPA entities, service layers, and RESTful APIs.
Location: com.example.tasktracker.entity.User
Purpose: Represents authenticated users in the system.
Attributes:
id: Long (Primary Key, Auto-generated)username: String (Unique, Required, Max 50 chars)password: String (Required, Encrypted)email: String (Unique, Required)enabled: Boolean (Default: true)accountNonExpired: Boolean (Default: true)accountNonLocked: Boolean (Default: true)credentialsNonExpired: Boolean (Default: true)role: String (Default: "USER", Max 20 chars)
Relationships:
- One-to-One with
Profile(User has one profile) - One-to-Many with
Task(User owns multiple tasks) - One-to-Many with
Tag(User owns multiple tags)
Security Features:
- Implements Spring Security UserDetails interface requirements
- Supports role-based access control
- Account status tracking (enabled, locked, expired)
Location: com.example.tasktracker.entity.Task
Purpose: Represents individual tasks/todos in the system.
Attributes:
id: Long (Primary Key, Auto-generated)title: String (Required, Non-blank)description: String (Optional)status: TaskStatus enum (Default: TODO)createdAt: LocalDateTime (Auto-generated)updatedAt: LocalDateTime (Auto-updated)
Relationships:
- Many-to-One with
User(Task belongs to one user) - Many-to-Many with
Tag(Task can have multiple tags, tags can be on multiple tasks)
Business Rules:
- Tasks are user-specific (multi-tenant by user)
- Automatic timestamp management (creation/update)
- Tag association through join table
task_tags
Location: com.example.tasktracker.entity.Tag
Purpose: Represents categorization labels for tasks.
Attributes:
id: Long (Primary Key, Auto-generated)name: String (Required, 1-50 chars)color: String (Hex color code, Default: "#3B82F6", Max 7 chars)createdAt: LocalDateTime (Auto-generated)updatedAt: LocalDateTime (Auto-updated)
Relationships:
- Many-to-One with
User(Tag belongs to one user) - Many-to-Many with
Task(Tag can be applied to multiple tasks)
Constraints:
- Unique constraint on (name, user_id) - users cannot have duplicate tag names
- Color validation for hex color codes
- User-scoped tags (multi-tenant by user)
Location: com.example.tasktracker.entity.Profile
Purpose: Extended user information and preferences.
Attributes:
id: Long (Primary Key, Auto-generated)firstName: String (Optional)lastName: String (Optional)email: String (Optional, may duplicate User.email for display)
Relationships:
- One-to-One with
User(Profile extends User information)
Usage:
- Stores additional user information beyond authentication data
- Allows for user profile management without affecting core auth data
Location: com.example.tasktracker.entity.TaskStatus
Purpose: Defines the possible states of a task.
Values:
TODO: Initial state for new tasksIN_PROGRESS: Task is being worked onDONE: Task has been completed
Usage:
- Used in Task entity to track task progression
- Supports typical Kanban-style workflow
Location: com.example.tasktracker.dto.TaskRequest
Purpose: Handles task creation and update requests.
Attributes:
title: String (Required, validated)description: String (Optional)status: TaskStatus (Default: TODO)tagIds: List<Long>(List of tag IDs to associate)
Location: com.example.tasktracker.dto.TagRequest
Purpose: Handles tag creation and update requests.
Location: com.example.tasktracker.dto.ProfileRequest
Purpose: Handles profile update requests.
Location: com.example.tasktracker.dto.LoginRequest, RegisterRequest
Purpose: Handle authentication requests.
Location: com.example.tasktracker.dto.TaskResponse
Purpose: Returns task data with associated tags.
Attributes:
id: Longtitle: Stringdescription: Stringstatus: TaskStatuscreatedAt: LocalDateTimeupdatedAt: LocalDateTimetags: List<TagResponse>(Associated tags)
Location: com.example.tasktracker.dto.TagResponse
Purpose: Returns tag data for client consumption.
Location: com.example.tasktracker.dto.ProfileResponse
Purpose: Returns user profile information.
Location: com.example.tasktracker.dto.AuthResponse
Purpose: Returns authentication results and user session data.
-
Unique Constraints:
users.username(globally unique)users.email(globally unique)(tags.name, tags.user_id)(unique per user)
-
Foreign Key Constraints:
profiles.user_id→users.idtasks.user_id→users.idtags.user_id→users.idtask_tags.task_id→tasks.idtask_tags.tag_id→tags.id
-
Cascade Rules:
- Tag associations: PERSIST, MERGE (no automatic deletion)
- User deletion would cascade to tasks, tags, and profile
- Creation: User creates task → Status: TODO
- Progress: User updates task → Status: IN_PROGRESS
- Completion: User completes task → Status: DONE
- Tag Management: Users can add/remove tags at any stage
- Deletion: User can delete their own tasks
- Creation: User creates tag with name and color
- Association: Tags can be associated with multiple tasks
- Modification: User can update tag name and color
- Deletion: User can delete tags (removes associations)
- Registration: Creates User + empty Profile
- Authentication: Login/logout with session management
- Profile Updates: Modify profile information independently
- Account Management: Enable/disable, role changes
TaskController → TaskService → TaskRepository
TagController → TagService → TagRepository
ProfileController → ProfileService → ProfileRepository
AuthController → AuthService → UserRepository
- Request DTOs → Entities (in Service layer)
- Entities → Response DTOs (in Service layer)
- Validation applied at DTO level (Jakarta Validation)
- Business Logic applied at Service level
- Repository Pattern: Data access abstraction
- Service Layer Pattern: Business logic encapsulation
- DTO Pattern: Data transfer and API contracts
- Entity Pattern: Domain model representation
- MVC Pattern: Web layer organization
- Dependency Injection: Spring's IoC container