Phase 3 완료: 파일 처리 시스템 구축
✅ 주요 완성 기능: - 프로젝트 생성 API (project_name 필드 포함) - 엑셀 파일 업로드 및 파싱 시스템 - 자재 DB 저장 (2837개 자재 성공 저장) - 자재 조회 및 요약 통계 API - 외래키 관계 정상 동작 (projects -> files -> materials) 📊 테스트 결과: - MP7 PIPING PROJECT Rev.2 프로젝트 생성 - 00.MP7 PIPING R.2_BOM.XLS 파일 업로드 성공 - NIPPLE, PIPE 등 자재 분류 및 재질 추출 - ASTM A106, SCH 80, 1인치 사이즈 등 정확 파싱 🛠️ 기술 스택: - FastAPI + PostgreSQL + SQLAlchemy - pandas를 활용한 엑셀 파싱 - 외래키 제약조건 적용된 정규화 DB 설계
This commit is contained in:
@@ -1,36 +1,47 @@
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, Field
|
||||
from datetime import datetime
|
||||
from typing import Optional, List
|
||||
from decimal import Decimal
|
||||
|
||||
# 프로젝트 스키마
|
||||
# Project Schemas (project_name 추가)
|
||||
class ProjectBase(BaseModel):
|
||||
official_project_code: Optional[str] = None
|
||||
project_name: str
|
||||
client_name: Optional[str] = None
|
||||
design_project_code: Optional[str] = None
|
||||
design_project_name: Optional[str] = None
|
||||
description: Optional[str] = None
|
||||
notes: Optional[str] = None
|
||||
official_project_code: str = Field(..., description="공식 프로젝트 코드")
|
||||
project_name: str = Field(..., description="프로젝트명") # 추가
|
||||
design_project_code: Optional[str] = Field(None, description="설계 프로젝트 코드")
|
||||
is_code_matched: bool = Field(False, description="코드 매칭 여부")
|
||||
status: str = Field("active", description="프로젝트 상태")
|
||||
|
||||
class ProjectCreate(ProjectBase):
|
||||
pass
|
||||
|
||||
class ProjectUpdate(ProjectBase):
|
||||
project_name: Optional[str] = None
|
||||
|
||||
class Project(ProjectBase):
|
||||
class ProjectResponse(ProjectBase):
|
||||
id: int
|
||||
is_code_matched: bool
|
||||
status: str
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
updated_at: Optional[datetime] = None
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
# 응답 스키마
|
||||
class ProjectResponse(BaseModel):
|
||||
projects: List[Project]
|
||||
total: int
|
||||
# File Schemas (기존 유지)
|
||||
class FileResponse(BaseModel):
|
||||
id: int
|
||||
filename: str
|
||||
original_filename: str
|
||||
file_path: str
|
||||
project_id: int
|
||||
project_code: Optional[str] = None
|
||||
revision: str = "Rev.0"
|
||||
description: Optional[str] = None
|
||||
upload_date: datetime
|
||||
parsed_count: int = 0
|
||||
is_active: bool = True
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
class FileUploadResponse(BaseModel):
|
||||
success: bool
|
||||
message: str
|
||||
file_id: int
|
||||
filename: str
|
||||
parsed_materials_count: int
|
||||
file_path: str
|
||||
|
||||
Reference in New Issue
Block a user