Files
rengine/shared/models/project.py
T
Yogesh OjhaandClaude Opus 5 2cb8d73280 style: strip explanatory comments across the codebase
The comment rule in CLAUDE.md is one line maximum, never narration: no
multi-line blocks, no module-header explainers, no sentences that explain or
justify the code to the reader. The tree had drifted a long way from it, and
most of the drift is mine.

Removed:
  232  lines of multi-line comment blocks
  203  single-line comments that argued instead of stating
  154  comments joined by so/because/otherwise/rather-than
  143  narrating comments in the frontend
  112  test docstrings (the test name already says what it asserts)
   25  test module docstrings and 25 decorative section dividers

Collapsed:
  324  multi-line docstrings to one factual line
  271  one-line docstrings that had a justifying clause bolted on

Kept: functional directives, section dividers, short field labels, alembic
revision headers, and the eight FastAPI route docstrings that render in /docs.
Where a fact was load-bearing it is in CLAUDE.md, which is where it belongs.

284 python tests and 34 frontend tests pass, ruff and ruff-format clean across
ten packages, svelte-check 0 errors, prettier and eslint clean, app.main imports.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013dKUV96WkQQETZBMoAG98C
2026-09-11 14:11:23 +05:30

48 lines
1.2 KiB
Python

import uuid
from datetime import datetime
from functools import partial
from pydantic import BaseModel, field_validator
from sqlmodel import Field, SQLModel
from shared.utils.datetime import utc_now
from shared.utils.validation import clean_name
class ProjectBase(SQLModel):
name: str = Field(max_length=50)
class Project(ProjectBase, table=True):
__tablename__ = "projects"
id: uuid.UUID = Field(default_factory=uuid.uuid4, primary_key=True)
slug: str = Field(max_length=100, unique=True, index=True)
description: str | None = Field(default=None, max_length=1000)
label: str | None = Field(default=None, max_length=50)
is_active: bool = Field(default=True)
created_at: datetime = Field(default_factory=utc_now)
created_by: uuid.UUID = Field(foreign_key="users.id")
class ProjectCreate(ProjectBase):
description: str | None = None
label: str | None = None
_validate_name = field_validator("name")(partial(clean_name, max_len=50))
class ProjectRead(ProjectBase):
id: uuid.UUID
slug: str
description: str | None = None
label: str | None = None
is_active: bool
created_at: datetime
created_by: uuid.UUID
class ProjectSummary(BaseModel):
project: ProjectRead
stats: dict[str, int]