Issue #3: User Preferences - export format default - Add userPreferencesStore with localStorage persistence - Create Settings page with export format dropdown and theme toggle - SessionDetailPage now uses default export format from preferences Issue #5: Step Categories - database table and seed data - Migration 007: step_categories table with team scoping - Seed 10 default global categories (Citrix/VDI, AD, M365, etc.) - Full CRUD API at /api/v1/step-categories Issue #6: Step Library - database schema - Migration 008: step_library, step_ratings, step_usage_log tables - Support for decision/action/solution step types - Visibility levels: private, team, public - Rating aggregates and usage tracking Issue #7: Step Library - CRUD API endpoints - Full CRUD at /api/v1/steps with visibility filtering - Full-text search endpoint - Popular tags endpoint - Rating/review system with verified use tracking Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
58
backend/app/schemas/step_category.py
Normal file
58
backend/app/schemas/step_category.py
Normal file
@@ -0,0 +1,58 @@
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
from uuid import UUID
|
||||
from pydantic import BaseModel, Field
|
||||
import re
|
||||
|
||||
|
||||
def slugify(name: str) -> str:
|
||||
"""Convert a name to a URL-safe slug."""
|
||||
# Remove non-alphanumeric chars except spaces, convert to lowercase
|
||||
slug = re.sub(r'[^a-zA-Z0-9 ]', '', name.lower())
|
||||
# Replace spaces with hyphens
|
||||
slug = re.sub(r' +', '-', slug.strip())
|
||||
return slug
|
||||
|
||||
|
||||
class StepCategoryBase(BaseModel):
|
||||
name: str = Field(..., min_length=1, max_length=100)
|
||||
description: Optional[str] = None
|
||||
|
||||
|
||||
class StepCategoryCreate(StepCategoryBase):
|
||||
team_id: Optional[UUID] = Field(None, description="Team ID for team-specific category. NULL for global.")
|
||||
|
||||
|
||||
class StepCategoryUpdate(BaseModel):
|
||||
name: Optional[str] = Field(None, min_length=1, max_length=100)
|
||||
description: Optional[str] = None
|
||||
display_order: Optional[int] = None
|
||||
is_active: Optional[bool] = None
|
||||
|
||||
|
||||
class StepCategoryResponse(StepCategoryBase):
|
||||
id: UUID
|
||||
slug: str
|
||||
team_id: Optional[UUID] = None
|
||||
display_order: int
|
||||
is_active: bool
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
step_count: int = 0 # Computed field - count of steps in this category
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class StepCategoryListResponse(BaseModel):
|
||||
id: UUID
|
||||
name: str
|
||||
slug: str
|
||||
description: Optional[str] = None
|
||||
team_id: Optional[UUID] = None
|
||||
display_order: int
|
||||
is_active: bool
|
||||
step_count: int = 0
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
Reference in New Issue
Block a user