소형 건설업체(100억 미만)를 위한 AI 기반 토목공사 통합관리 플랫폼 Backend (FastAPI): - SQLAlchemy 모델 13개 (users, projects, wbs, tasks, daily_reports, reports, inspections, quality, weather, permits, rag, settings) - API 라우터 11개 (auth, projects, tasks, daily_reports, reports, inspections, weather, rag, kakao, permits, settings) - Services: Claude AI 래퍼, CPM Gantt 계산, 기상청 API, RAG(pgvector), 카카오 Skill API - Alembic 마이그레이션 (pgvector 포함) - pytest 테스트 (CPM, 날씨 경보) Frontend (Next.js 15): - 11개 페이지 (대시보드, 프로젝트, Gantt, 일보, 검측, 품질, 날씨, 인허가, RAG, 설정) - TanStack Query + Zustand + Tailwind CSS 인프라: - Docker Compose (PostgreSQL pgvector + backend + frontend) - 한국어 README 및 설치 가이드 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
32 lines
1.3 KiB
Python
32 lines
1.3 KiB
Python
import uuid
|
|
from sqlalchemy import String, Boolean, Enum as SAEnum
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
from sqlalchemy.dialects.postgresql import UUID
|
|
from app.core.database import Base
|
|
from app.models.base import TimestampMixin, UUIDMixin
|
|
import enum
|
|
|
|
|
|
class UserRole(str, enum.Enum):
|
|
ADMIN = "admin"
|
|
SITE_MANAGER = "site_manager"
|
|
SUPERVISOR = "supervisor"
|
|
WORKER = "worker"
|
|
|
|
|
|
class User(Base, UUIDMixin, TimestampMixin):
|
|
__tablename__ = "users"
|
|
|
|
email: Mapped[str] = mapped_column(String(255), unique=True, nullable=False, index=True)
|
|
hashed_password: Mapped[str] = mapped_column(String(255), nullable=False)
|
|
name: Mapped[str] = mapped_column(String(100), nullable=False)
|
|
role: Mapped[UserRole] = mapped_column(
|
|
SAEnum(UserRole, name="user_role"), default=UserRole.SITE_MANAGER, nullable=False
|
|
)
|
|
phone: Mapped[str | None] = mapped_column(String(20), nullable=True)
|
|
kakao_user_key: Mapped[str | None] = mapped_column(String(100), nullable=True, unique=True, index=True)
|
|
is_active: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False)
|
|
|
|
# relationships
|
|
owned_projects: Mapped[list["Project"]] = relationship("Project", back_populates="owner", foreign_keys="Project.owner_id")
|