Refactor backend to SQLModel; reset schema; add Company OS endpoints
This commit is contained in:
BIN
backend/app/schemas/__pycache__/hr.cpython-312.pyc
Normal file
BIN
backend/app/schemas/__pycache__/hr.cpython-312.pyc
Normal file
Binary file not shown.
BIN
backend/app/schemas/__pycache__/org.cpython-312.pyc
Normal file
BIN
backend/app/schemas/__pycache__/org.cpython-312.pyc
Normal file
Binary file not shown.
BIN
backend/app/schemas/__pycache__/projects.cpython-312.pyc
Normal file
BIN
backend/app/schemas/__pycache__/projects.cpython-312.pyc
Normal file
Binary file not shown.
Binary file not shown.
BIN
backend/app/schemas/__pycache__/work.cpython-312.pyc
Normal file
BIN
backend/app/schemas/__pycache__/work.cpython-312.pyc
Normal file
Binary file not shown.
24
backend/app/schemas/hr.py
Normal file
24
backend/app/schemas/hr.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from sqlmodel import SQLModel
|
||||
|
||||
|
||||
class HeadcountRequestCreate(SQLModel):
|
||||
department_id: int
|
||||
requested_by_manager_id: int
|
||||
role_title: str
|
||||
employee_type: str
|
||||
quantity: int = 1
|
||||
justification: str | None = None
|
||||
|
||||
|
||||
class HeadcountRequestUpdate(SQLModel):
|
||||
status: str | None = None
|
||||
justification: str | None = None
|
||||
|
||||
|
||||
class EmploymentActionCreate(SQLModel):
|
||||
employee_id: int
|
||||
issued_by_employee_id: int
|
||||
action_type: str
|
||||
notes: str | None = None
|
||||
31
backend/app/schemas/org.py
Normal file
31
backend/app/schemas/org.py
Normal file
@@ -0,0 +1,31 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from sqlmodel import SQLModel
|
||||
|
||||
|
||||
class DepartmentCreate(SQLModel):
|
||||
name: str
|
||||
head_employee_id: int | None = None
|
||||
|
||||
|
||||
class DepartmentUpdate(SQLModel):
|
||||
name: str | None = None
|
||||
head_employee_id: int | None = None
|
||||
|
||||
|
||||
class EmployeeCreate(SQLModel):
|
||||
name: str
|
||||
employee_type: str
|
||||
department_id: int | None = None
|
||||
manager_id: int | None = None
|
||||
title: str | None = None
|
||||
status: str = "active"
|
||||
|
||||
|
||||
class EmployeeUpdate(SQLModel):
|
||||
name: str | None = None
|
||||
employee_type: str | None = None
|
||||
department_id: int | None = None
|
||||
manager_id: int | None = None
|
||||
title: str | None = None
|
||||
status: str | None = None
|
||||
13
backend/app/schemas/projects.py
Normal file
13
backend/app/schemas/projects.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from sqlmodel import SQLModel
|
||||
|
||||
|
||||
class ProjectCreate(SQLModel):
|
||||
name: str
|
||||
status: str = "active"
|
||||
|
||||
|
||||
class ProjectUpdate(SQLModel):
|
||||
name: str | None = None
|
||||
status: str | None = None
|
||||
@@ -1,35 +0,0 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Literal
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
TaskStatus = Literal["todo", "doing", "done"]
|
||||
|
||||
|
||||
class TaskCreate(BaseModel):
|
||||
title: str = Field(min_length=1, max_length=200)
|
||||
description: str | None = None
|
||||
status: TaskStatus = "todo"
|
||||
assignee: str | None = None
|
||||
|
||||
|
||||
class TaskUpdate(BaseModel):
|
||||
title: str | None = Field(default=None, min_length=1, max_length=200)
|
||||
description: str | None = None
|
||||
status: TaskStatus | None = None
|
||||
assignee: str | None = None
|
||||
|
||||
|
||||
class TaskOut(BaseModel):
|
||||
id: int
|
||||
title: str
|
||||
description: str | None
|
||||
status: TaskStatus
|
||||
assignee: str | None
|
||||
created_at: datetime
|
||||
updated_at: datetime | None
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
27
backend/app/schemas/work.py
Normal file
27
backend/app/schemas/work.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from sqlmodel import SQLModel
|
||||
|
||||
|
||||
class TaskCreate(SQLModel):
|
||||
project_id: int
|
||||
title: str
|
||||
description: str | None = None
|
||||
status: str = "backlog"
|
||||
assignee_employee_id: int | None = None
|
||||
reviewer_employee_id: int | None = None
|
||||
created_by_employee_id: int | None = None
|
||||
|
||||
|
||||
class TaskUpdate(SQLModel):
|
||||
title: str | None = None
|
||||
description: str | None = None
|
||||
status: str | None = None
|
||||
assignee_employee_id: int | None = None
|
||||
reviewer_employee_id: int | None = None
|
||||
|
||||
|
||||
class TaskCommentCreate(SQLModel):
|
||||
task_id: int
|
||||
author_employee_id: int | None = None
|
||||
body: str
|
||||
Reference in New Issue
Block a user