Refactor backend to SQLModel; reset schema; add Company OS endpoints

This commit is contained in:
Abhimanyu Saharan
2026-02-01 23:16:56 +05:30
parent b37e7dd841
commit aa6b0c807b
56 changed files with 867 additions and 450 deletions

27
backend/app/models/org.py Normal file
View File

@@ -0,0 +1,27 @@
from __future__ import annotations
from typing import Optional
from sqlmodel import Field, SQLModel
class Department(SQLModel, table=True):
__tablename__ = "departments"
id: int | None = Field(default=None, primary_key=True)
name: str = Field(index=True, unique=True)
head_employee_id: int | None = Field(default=None, foreign_key="employees.id")
class Employee(SQLModel, table=True):
__tablename__ = "employees"
id: int | None = Field(default=None, primary_key=True)
name: str
employee_type: str # human | agent
department_id: int | None = Field(default=None, foreign_key="departments.id")
manager_id: int | None = Field(default=None, foreign_key="employees.id")
title: str | None = None
status: str = Field(default="active")