Improve the production frontend
This commit is contained in:
@@ -23,7 +23,6 @@ class ProductionBaseRepository(BaseRepository):
|
||||
# Production data is more dynamic, shorter cache time (5 minutes)
|
||||
super().__init__(model, session, cache_ttl)
|
||||
|
||||
@transactional
|
||||
async def get_by_tenant_id(self, tenant_id: str, skip: int = 0, limit: int = 100) -> List:
|
||||
"""Get records by tenant ID"""
|
||||
if hasattr(self.model, 'tenant_id'):
|
||||
@@ -36,7 +35,6 @@ class ProductionBaseRepository(BaseRepository):
|
||||
)
|
||||
return await self.get_multi(skip=skip, limit=limit)
|
||||
|
||||
@transactional
|
||||
async def get_by_status(
|
||||
self,
|
||||
tenant_id: str,
|
||||
|
||||
@@ -26,7 +26,6 @@ class ProductionBatchRepository(ProductionBaseRepository, BatchCountProvider):
|
||||
# Production batches are dynamic, short cache time (5 minutes)
|
||||
super().__init__(ProductionBatch, session, cache_ttl)
|
||||
|
||||
@transactional
|
||||
async def create_batch(self, batch_data: Dict[str, Any]) -> ProductionBatch:
|
||||
"""Create a new production batch with validation"""
|
||||
try:
|
||||
@@ -84,7 +83,6 @@ class ProductionBatchRepository(ProductionBaseRepository, BatchCountProvider):
|
||||
logger.error("Error creating production batch", error=str(e))
|
||||
raise DatabaseError(f"Failed to create production batch: {str(e)}")
|
||||
|
||||
@transactional
|
||||
async def get_active_batches(self, tenant_id: str) -> List[ProductionBatch]:
|
||||
"""Get active production batches for a tenant"""
|
||||
try:
|
||||
@@ -113,7 +111,6 @@ class ProductionBatchRepository(ProductionBaseRepository, BatchCountProvider):
|
||||
logger.error("Error fetching active batches", error=str(e))
|
||||
raise DatabaseError(f"Failed to fetch active batches: {str(e)}")
|
||||
|
||||
@transactional
|
||||
async def get_batches_by_date_range(
|
||||
self,
|
||||
tenant_id: str,
|
||||
@@ -152,7 +149,6 @@ class ProductionBatchRepository(ProductionBaseRepository, BatchCountProvider):
|
||||
logger.error("Error fetching batches by date range", error=str(e))
|
||||
raise DatabaseError(f"Failed to fetch batches by date range: {str(e)}")
|
||||
|
||||
@transactional
|
||||
async def get_batches_by_product(
|
||||
self,
|
||||
tenant_id: str,
|
||||
@@ -182,7 +178,6 @@ class ProductionBatchRepository(ProductionBaseRepository, BatchCountProvider):
|
||||
logger.error("Error fetching batches by product", error=str(e))
|
||||
raise DatabaseError(f"Failed to fetch batches by product: {str(e)}")
|
||||
|
||||
@transactional
|
||||
async def update_batch_status(
|
||||
self,
|
||||
batch_id: UUID,
|
||||
@@ -240,7 +235,6 @@ class ProductionBatchRepository(ProductionBaseRepository, BatchCountProvider):
|
||||
logger.error("Error updating batch status", error=str(e))
|
||||
raise DatabaseError(f"Failed to update batch status: {str(e)}")
|
||||
|
||||
@transactional
|
||||
async def get_production_metrics(
|
||||
self,
|
||||
tenant_id: str,
|
||||
@@ -297,7 +291,6 @@ class ProductionBatchRepository(ProductionBaseRepository, BatchCountProvider):
|
||||
logger.error("Error calculating production metrics", error=str(e))
|
||||
raise DatabaseError(f"Failed to calculate production metrics: {str(e)}")
|
||||
|
||||
@transactional
|
||||
async def get_urgent_batches(self, tenant_id: str, hours_ahead: int = 4) -> List[ProductionBatch]:
|
||||
"""Get batches that need to start within the specified hours"""
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user