Improve the frontend and fix TODOs
This commit is contained in:
@@ -98,9 +98,11 @@ class SubscriptionLimitService:
|
||||
if subscription.max_locations == -1:
|
||||
return {"can_add": True, "reason": "Unlimited locations allowed"}
|
||||
|
||||
# Count current locations (this would need to be implemented based on your location model)
|
||||
# For now, we'll assume 1 location per tenant as default
|
||||
current_locations = 1 # TODO: Implement actual location count
|
||||
# Count current locations
|
||||
# Currently, each tenant has 1 location (their primary bakery location)
|
||||
# This is stored in tenant.address, tenant.city, tenant.postal_code
|
||||
# If multi-location support is added in the future, this would query a locations table
|
||||
current_locations = 1 # Each tenant has one primary location
|
||||
|
||||
can_add = current_locations < subscription.max_locations
|
||||
return {
|
||||
@@ -130,11 +132,10 @@ class SubscriptionLimitService:
|
||||
# Check if unlimited products (-1)
|
||||
if subscription.max_products == -1:
|
||||
return {"can_add": True, "reason": "Unlimited products allowed"}
|
||||
|
||||
# Count current products (this would need to be implemented based on your product model)
|
||||
# For now, we'll return a placeholder
|
||||
current_products = 0 # TODO: Implement actual product count
|
||||
|
||||
|
||||
# Count current products from inventory service
|
||||
current_products = await self._get_ingredient_count(tenant_id)
|
||||
|
||||
can_add = current_products < subscription.max_products
|
||||
return {
|
||||
"can_add": can_add,
|
||||
@@ -358,7 +359,7 @@ class SubscriptionLimitService:
|
||||
# Get current usage - Team & Organization
|
||||
members = await self.member_repo.get_tenant_members(tenant_id, active_only=True)
|
||||
current_users = len(members)
|
||||
current_locations = 1 # TODO: Implement actual location count from locations service
|
||||
current_locations = 1 # Each tenant has one primary location
|
||||
|
||||
# Get current usage - Products & Inventory
|
||||
current_products = await self._get_ingredient_count(tenant_id)
|
||||
|
||||
@@ -427,24 +427,24 @@ class EnhancedTenantService:
|
||||
)
|
||||
|
||||
async def get_team_members(
|
||||
self,
|
||||
tenant_id: str,
|
||||
self,
|
||||
tenant_id: str,
|
||||
user_id: str,
|
||||
active_only: bool = True
|
||||
) -> List[TenantMemberResponse]:
|
||||
"""Get all team members for a tenant"""
|
||||
|
||||
"""Get all team members for a tenant with enriched user information"""
|
||||
|
||||
try:
|
||||
async with self.database_manager.get_session() as session:
|
||||
# Initialize repositories with session
|
||||
await self._init_repositories(session)
|
||||
|
||||
|
||||
members = await self.member_repo.get_tenant_members(
|
||||
tenant_id, active_only=active_only
|
||||
tenant_id, active_only=active_only, include_user_info=True
|
||||
)
|
||||
|
||||
|
||||
return [TenantMemberResponse.from_orm(member) for member in members]
|
||||
|
||||
|
||||
except HTTPException:
|
||||
raise
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user