mirror of
https://github.com/a-mayb3/Kanban_clone_backend.git
synced 2026-03-21 18:15:37 +01:00
moved pydantic models to misc/
This commit is contained in:
parent
6cd7bf8da2
commit
170446fcc2
4 changed files with 5 additions and 5 deletions
25
misc/projects.py
Normal file
25
misc/projects.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
from pydantic import BaseModel, ConfigDict
|
||||
from typing import List, Optional
|
||||
|
||||
from misc.tasks import TaskBase
|
||||
from misc.users import UserBase
|
||||
|
||||
class ProjectBase(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
name: str
|
||||
description: str
|
||||
tasks: List[TaskBase]
|
||||
users: List[UserBase]
|
||||
|
||||
class ProjectCreate(BaseModel):
|
||||
name: str
|
||||
description: Optional[str] = None
|
||||
tasks: List[TaskBase] = []
|
||||
user_ids: List[int] = []
|
||||
|
||||
class ProjectList(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
projects: List[ProjectBase]
|
||||
26
misc/tasks.py
Normal file
26
misc/tasks.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
from enum import Enum
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from typing import List, Annotated, Optional
|
||||
import models
|
||||
from database import SessionLocal, engine
|
||||
from sqlalchemy.orm import Session, joinedload
|
||||
|
||||
class TaskStatus(str, Enum):
|
||||
PENDING = "pending"
|
||||
IN_PROGRESS = "in_progress"
|
||||
COMPLETED = "completed"
|
||||
FAILED = "failed"
|
||||
STASHED = "stashed"
|
||||
|
||||
class TaskBase(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
title: str
|
||||
description: Optional[str] = None
|
||||
status: TaskStatus = TaskStatus.PENDING
|
||||
|
||||
class TaskList(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
tasks: List[TaskBase]
|
||||
14
misc/users.py
Normal file
14
misc/users.py
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
from pydantic import BaseModel, ConfigDict
|
||||
from typing import List
|
||||
|
||||
class UserBase(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
name: str
|
||||
email: str
|
||||
|
||||
class UserList(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
users: List[UserBase]
|
||||
Loading…
Add table
Add a link
Reference in a new issue