43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
from sqlalchemy.orm import Session
|
|
from app.schemas.auth.tenant_schema import TenantCreate, TenantUpdate
|
|
from app.services.auth.tenant_service import TenantService
|
|
import uuid
|
|
from typing import Optional
|
|
|
|
class TenantController:
|
|
|
|
@staticmethod
|
|
def create_tenant(db: Session, tenant_data: TenantCreate):
|
|
return TenantService.create_tenant(db, tenant_data)
|
|
|
|
@staticmethod
|
|
def get_all_tenants(db: Session):
|
|
return TenantService.get_all_tenants(db)
|
|
|
|
@staticmethod
|
|
def get_tenant_by_id(db: Session, tenant_id: uuid.UUID):
|
|
return TenantService.get_tenant_by_id(db, tenant_id)
|
|
|
|
@staticmethod
|
|
def update_tenant(db: Session, tenant_id: uuid.UUID, tenant_data: TenantUpdate):
|
|
return TenantService.update_tenant(db, tenant_id, tenant_data)
|
|
|
|
@staticmethod
|
|
def delete_tenant(db: Session, tenant_id: uuid.UUID):
|
|
return TenantService.delete_tenant(db, tenant_id)
|
|
|
|
@staticmethod
|
|
def get_tenants_paginated(
|
|
db: Session,
|
|
page: int,
|
|
page_size: int,
|
|
search: Optional[str],
|
|
is_active: Optional[bool],
|
|
):
|
|
return TenantService.get_tenants_paginated(
|
|
db=db,
|
|
page=page,
|
|
page_size=page_size,
|
|
search=search,
|
|
is_active=is_active,
|
|
) |