Start integrating the onboarding flow with backend 3
This commit is contained in:
@@ -9,7 +9,7 @@ from uuid import UUID
|
||||
import structlog
|
||||
|
||||
from app.core.database import get_db
|
||||
from shared.auth.decorators import get_current_user_dep, get_current_tenant_id_dep
|
||||
from shared.auth.decorators import get_current_user_dep
|
||||
|
||||
router = APIRouter(tags=["pos-config"])
|
||||
logger = structlog.get_logger()
|
||||
@@ -20,14 +20,10 @@ async def get_pos_configurations(
|
||||
tenant_id: UUID = Path(..., description="Tenant ID"),
|
||||
pos_system: Optional[str] = Query(None, description="Filter by POS system"),
|
||||
is_active: Optional[bool] = Query(None, description="Filter by active status"),
|
||||
current_tenant: str = Depends(get_current_tenant_id_dep),
|
||||
db=Depends(get_db)
|
||||
):
|
||||
"""Get POS configurations for a tenant"""
|
||||
try:
|
||||
# Verify tenant access
|
||||
if str(tenant_id) != current_tenant:
|
||||
raise HTTPException(status_code=403, detail="Access denied to this tenant")
|
||||
|
||||
# TODO: Implement configuration retrieval
|
||||
# This is a placeholder for the basic structure
|
||||
@@ -46,15 +42,11 @@ async def get_pos_configurations(
|
||||
async def create_pos_configuration(
|
||||
configuration_data: Dict[str, Any],
|
||||
tenant_id: UUID = Path(..., description="Tenant ID"),
|
||||
current_tenant: str = Depends(get_current_tenant_id_dep),
|
||||
current_user: Dict[str, Any] = Depends(get_current_user_dep),
|
||||
db=Depends(get_db)
|
||||
):
|
||||
"""Create a new POS configuration"""
|
||||
try:
|
||||
# Verify tenant access
|
||||
if str(tenant_id) != current_tenant:
|
||||
raise HTTPException(status_code=403, detail="Access denied to this tenant")
|
||||
|
||||
# TODO: Implement configuration creation
|
||||
logger.info("Creating POS configuration",
|
||||
@@ -73,14 +65,10 @@ async def create_pos_configuration(
|
||||
async def get_pos_configuration(
|
||||
tenant_id: UUID = Path(..., description="Tenant ID"),
|
||||
config_id: UUID = Path(..., description="Configuration ID"),
|
||||
current_tenant: str = Depends(get_current_tenant_id_dep),
|
||||
db=Depends(get_db)
|
||||
):
|
||||
"""Get a specific POS configuration"""
|
||||
try:
|
||||
# Verify tenant access
|
||||
if str(tenant_id) != current_tenant:
|
||||
raise HTTPException(status_code=403, detail="Access denied to this tenant")
|
||||
|
||||
# TODO: Implement configuration retrieval
|
||||
return {"message": "Configuration details", "id": str(config_id)}
|
||||
@@ -96,14 +84,10 @@ async def update_pos_configuration(
|
||||
configuration_data: Dict[str, Any],
|
||||
tenant_id: UUID = Path(..., description="Tenant ID"),
|
||||
config_id: UUID = Path(..., description="Configuration ID"),
|
||||
current_tenant: str = Depends(get_current_tenant_id_dep),
|
||||
db=Depends(get_db)
|
||||
):
|
||||
"""Update a POS configuration"""
|
||||
try:
|
||||
# Verify tenant access
|
||||
if str(tenant_id) != current_tenant:
|
||||
raise HTTPException(status_code=403, detail="Access denied to this tenant")
|
||||
|
||||
# TODO: Implement configuration update
|
||||
return {"message": "Configuration updated successfully"}
|
||||
@@ -118,14 +102,10 @@ async def update_pos_configuration(
|
||||
async def delete_pos_configuration(
|
||||
tenant_id: UUID = Path(..., description="Tenant ID"),
|
||||
config_id: UUID = Path(..., description="Configuration ID"),
|
||||
current_tenant: str = Depends(get_current_tenant_id_dep),
|
||||
db=Depends(get_db)
|
||||
):
|
||||
"""Delete a POS configuration"""
|
||||
try:
|
||||
# Verify tenant access
|
||||
if str(tenant_id) != current_tenant:
|
||||
raise HTTPException(status_code=403, detail="Access denied to this tenant")
|
||||
|
||||
# TODO: Implement configuration deletion
|
||||
return {"message": "Configuration deleted successfully"}
|
||||
@@ -140,14 +120,10 @@ async def delete_pos_configuration(
|
||||
async def test_pos_connection(
|
||||
tenant_id: UUID = Path(..., description="Tenant ID"),
|
||||
config_id: UUID = Path(..., description="Configuration ID"),
|
||||
current_tenant: str = Depends(get_current_tenant_id_dep),
|
||||
db=Depends(get_db)
|
||||
):
|
||||
"""Test connection to POS system"""
|
||||
try:
|
||||
# Verify tenant access
|
||||
if str(tenant_id) != current_tenant:
|
||||
raise HTTPException(status_code=403, detail="Access denied to this tenant")
|
||||
|
||||
# TODO: Implement connection testing
|
||||
return {
|
||||
|
||||
@@ -11,7 +11,7 @@ from datetime import datetime
|
||||
import structlog
|
||||
|
||||
from app.core.database import get_db
|
||||
from shared.auth.decorators import get_current_user_dep, get_current_tenant_id_dep
|
||||
from shared.auth.decorators import get_current_user_dep
|
||||
|
||||
router = APIRouter(tags=["sync"])
|
||||
logger = structlog.get_logger()
|
||||
@@ -22,15 +22,11 @@ async def trigger_sync(
|
||||
sync_request: Dict[str, Any] = Body(...),
|
||||
tenant_id: UUID = Path(..., description="Tenant ID"),
|
||||
config_id: UUID = Path(..., description="Configuration ID"),
|
||||
current_tenant: str = Depends(get_current_tenant_id_dep),
|
||||
current_user: Dict[str, Any] = Depends(get_current_user_dep),
|
||||
db=Depends(get_db)
|
||||
):
|
||||
"""Trigger manual synchronization with POS system"""
|
||||
try:
|
||||
# Verify tenant access
|
||||
if str(tenant_id) != current_tenant:
|
||||
raise HTTPException(status_code=403, detail="Access denied to this tenant")
|
||||
|
||||
sync_type = sync_request.get("sync_type", "incremental") # full, incremental
|
||||
data_types = sync_request.get("data_types", ["transactions"]) # transactions, products, customers
|
||||
@@ -68,14 +64,10 @@ async def get_sync_status(
|
||||
tenant_id: UUID = Path(..., description="Tenant ID"),
|
||||
config_id: UUID = Path(..., description="Configuration ID"),
|
||||
limit: int = Query(10, ge=1, le=100, description="Number of sync logs to return"),
|
||||
current_tenant: str = Depends(get_current_tenant_id_dep),
|
||||
db=Depends(get_db)
|
||||
):
|
||||
"""Get synchronization status and recent sync history"""
|
||||
try:
|
||||
# Verify tenant access
|
||||
if str(tenant_id) != current_tenant:
|
||||
raise HTTPException(status_code=403, detail="Access denied to this tenant")
|
||||
|
||||
# TODO: Get sync status from database
|
||||
# TODO: Get recent sync logs
|
||||
@@ -107,14 +99,10 @@ async def get_sync_logs(
|
||||
status: Optional[str] = Query(None, description="Filter by sync status"),
|
||||
sync_type: Optional[str] = Query(None, description="Filter by sync type"),
|
||||
data_type: Optional[str] = Query(None, description="Filter by data type"),
|
||||
current_tenant: str = Depends(get_current_tenant_id_dep),
|
||||
db=Depends(get_db)
|
||||
):
|
||||
"""Get detailed sync logs"""
|
||||
try:
|
||||
# Verify tenant access
|
||||
if str(tenant_id) != current_tenant:
|
||||
raise HTTPException(status_code=403, detail="Access denied to this tenant")
|
||||
|
||||
# TODO: Implement log retrieval with filters
|
||||
|
||||
@@ -140,14 +128,10 @@ async def get_pos_transactions(
|
||||
is_synced: Optional[bool] = Query(None, description="Filter by sync status"),
|
||||
limit: int = Query(50, ge=1, le=200, description="Number of transactions to return"),
|
||||
offset: int = Query(0, ge=0, description="Number of transactions to skip"),
|
||||
current_tenant: str = Depends(get_current_tenant_id_dep),
|
||||
db=Depends(get_db)
|
||||
):
|
||||
"""Get POS transactions for a tenant"""
|
||||
try:
|
||||
# Verify tenant access
|
||||
if str(tenant_id) != current_tenant:
|
||||
raise HTTPException(status_code=403, detail="Access denied to this tenant")
|
||||
|
||||
# TODO: Implement transaction retrieval with filters
|
||||
|
||||
@@ -176,14 +160,10 @@ async def sync_single_transaction(
|
||||
tenant_id: UUID = Path(..., description="Tenant ID"),
|
||||
transaction_id: UUID = Path(..., description="Transaction ID"),
|
||||
force: bool = Query(False, description="Force sync even if already synced"),
|
||||
current_tenant: str = Depends(get_current_tenant_id_dep),
|
||||
db=Depends(get_db)
|
||||
):
|
||||
"""Manually sync a single transaction to sales service"""
|
||||
try:
|
||||
# Verify tenant access
|
||||
if str(tenant_id) != current_tenant:
|
||||
raise HTTPException(status_code=403, detail="Access denied to this tenant")
|
||||
|
||||
# TODO: Implement single transaction sync
|
||||
|
||||
@@ -204,14 +184,10 @@ async def sync_single_transaction(
|
||||
async def get_sync_analytics(
|
||||
tenant_id: UUID = Path(..., description="Tenant ID"),
|
||||
days: int = Query(30, ge=1, le=365, description="Number of days to analyze"),
|
||||
current_tenant: str = Depends(get_current_tenant_id_dep),
|
||||
db=Depends(get_db)
|
||||
):
|
||||
"""Get sync performance analytics"""
|
||||
try:
|
||||
# Verify tenant access
|
||||
if str(tenant_id) != current_tenant:
|
||||
raise HTTPException(status_code=403, detail="Access denied to this tenant")
|
||||
|
||||
# TODO: Implement analytics calculation
|
||||
|
||||
@@ -244,15 +220,11 @@ async def get_sync_analytics(
|
||||
async def resync_failed_transactions(
|
||||
tenant_id: UUID = Path(..., description="Tenant ID"),
|
||||
days_back: int = Query(7, ge=1, le=90, description="How many days back to resync"),
|
||||
current_tenant: str = Depends(get_current_tenant_id_dep),
|
||||
current_user: Dict[str, Any] = Depends(get_current_user_dep),
|
||||
db=Depends(get_db)
|
||||
):
|
||||
"""Resync failed transactions from the specified time period"""
|
||||
try:
|
||||
# Verify tenant access
|
||||
if str(tenant_id) != current_tenant:
|
||||
raise HTTPException(status_code=403, detail="Access denied to this tenant")
|
||||
|
||||
logger.info("Resync failed transactions requested",
|
||||
tenant_id=tenant_id,
|
||||
|
||||
Reference in New Issue
Block a user