diff --git a/app/api/v1/endpoints/project.py b/app/api/v1/endpoints/project.py index 7b3e3eac..b033164f 100644 --- a/app/api/v1/endpoints/project.py +++ b/app/api/v1/endpoints/project.py @@ -9,6 +9,8 @@ ProjectCreate, ProjectDetailPayload, ProjectDetailResponse, + ProjectDuplicationCheckResponse, + ProjectDuplicationStatus, ProjectResponse, ProjectsResponse, ProjectSummaryPayload, @@ -32,6 +34,17 @@ def create_project( return ProjectResponse(data=project) +@router.post("/duplicate", response_model=ProjectDuplicationCheckResponse) +def check_project_duplication( + *, + request_body: ProjectCreate, +) -> ProjectDuplicationCheckResponse: + + duplication_status = ProjectDuplicationStatus(is_duplicated=False) + + return ProjectDuplicationCheckResponse(data=duplication_status) + + @router.get("", response_model=ProjectsResponse) def get_projects( *, diff --git a/app/api/v1/schemas/project.py b/app/api/v1/schemas/project.py index 07761e51..de722904 100644 --- a/app/api/v1/schemas/project.py +++ b/app/api/v1/schemas/project.py @@ -16,6 +16,10 @@ def validate_length_of_project_name(cls, project_name: str) -> str: return project_name +class ProjectDuplicationStatus(BaseModel): + is_duplicated: bool = Field(..., description="Indicates if the project name is duplicated.") + + class ProjectSummaryPayload(ProjectCreate): model_config = ConfigDict(from_attributes=True) @@ -44,6 +48,10 @@ class ProjectResponse(ResponseItem): data: ProjectSummaryPayload +class ProjectDuplicationCheckResponse(ResponseItem): + data: ProjectDuplicationStatus + + class ProjectDetailResponse(ResponseItem): data: ProjectDetailPayload