# Default Asset Task Creation Implementation ## Overview This document describes the implementation of automatic default task creation for assets based on their category (Task 5.3). ## Requirements Implemented - **17.1**: Automatic task generation when assets are created based on asset category - **17.2**: Default task templates for each asset category (modeling, surfacing, rigging) - **17.3**: Customizable task creation options for coordinators - **17.4**: Default task naming conventions - **17.5**: API endpoint for retrieving default tasks by asset category - **17.6**: Proper task naming - **17.7**: Unassigned task creation ## Backend Implementation ### Default Task Templates Located in `backend/routers/assets.py`: ```python DEFAULT_ASSET_TASKS = { AssetCategory.CHARACTERS: ["modeling", "surfacing", "rigging"], AssetCategory.PROPS: ["modeling", "surfacing"], AssetCategory.SETS: ["modeling", "surfacing"], AssetCategory.VEHICLES: ["modeling", "surfacing", "rigging"] } ``` ### Key Functions #### `get_default_asset_task_types(category: AssetCategory) -> List[str]` Returns the default task types for a given asset category. #### `get_all_asset_task_types(project_id: int, db: Session) -> List[str]` Returns all task types (standard + custom) for assets in a project. #### `create_default_tasks_for_asset(asset: Asset, task_types: List[str], db: Session) -> List[Task]` Creates default tasks for an asset with proper naming conventions: - Task name format: `{asset_name} - {task_type.title()}` - Tasks are created with status `NOT_STARTED` - Tasks are left unassigned (assigned_user_id = None) ### API Endpoints #### `GET /assets/default-tasks/{category}` Returns default task types for an asset category. **Query Parameters:** - `project_id` (optional): Include custom task types for the project **Response:** ```json ["modeling", "surfacing", "rigging"] ``` #### `POST /assets/?project_id={project_id}` Creates a new asset with optional default tasks. **Request Body:** ```json { "name": "Hero Character", "category": "characters", "description": "Main character asset", "status": "not_started", "create_default_tasks": true, "selected_task_types": ["modeling", "surfacing", "rigging"] } ``` **Fields:** - `create_default_tasks` (boolean): Whether to create default tasks (default: true) - `selected_task_types` (array, optional): Specific task types to create. If not provided, uses category defaults. **Response:** ```json { "id": 1, "name": "Hero Character", "category": "characters", "status": "not_started", "project_id": 1, "task_count": 3, "created_at": "2024-01-01T00:00:00Z", "updated_at": "2024-01-01T00:00:00Z" } ``` ## Frontend Implementation ### AssetForm Component Located in `frontend/src/components/asset/AssetForm.vue` **Features:** 1. **Default Tasks Toggle**: Checkbox to enable/disable default task creation 2. **Task Preview**: Shows which tasks will be created based on category 3. **Custom Task Selection**: Allows coordinators to select specific tasks to create 4. **Confirmation Dialog**: Shows preview of tasks before creation **Key Sections:** ```vue