Hide inactive merged services from service catalogue
This commit is contained in:
@@ -65,7 +65,9 @@ def get_category(db: Session, category_id: int) -> ServiceCategory | None:
|
||||
|
||||
|
||||
def list_catalogue_payload(db: Session, *, q: str = "", category_id: int | None = None, recurrence_type: str = "", engagement_type: str = "", page: int = 1, per_page: int = 20):
|
||||
query = select(ServiceCatalogue).options(
|
||||
query = select(ServiceCatalogue).where(
|
||||
ServiceCatalogue.is_active.is_(True)
|
||||
).options(
|
||||
selectinload(ServiceCatalogue.service_category),
|
||||
selectinload(ServiceCatalogue.default_task_templates),
|
||||
selectinload(ServiceCatalogue.due_date_rules),
|
||||
@@ -115,6 +117,7 @@ def list_firm_services_payload(db: Session, *, tenant_id: int, q: str = ""):
|
||||
.where(
|
||||
FirmServiceSelection.tenant_id == tenant_id,
|
||||
FirmServiceSelection.is_enabled.is_(True),
|
||||
ServiceCatalogue.is_active.is_(True),
|
||||
)
|
||||
)
|
||||
if q.strip():
|
||||
@@ -143,7 +146,10 @@ def list_disabled_catalogues(db: Session, *, tenant_id: int, q: str = ""):
|
||||
)
|
||||
)
|
||||
|
||||
query = select(ServiceCatalogue).where(~ServiceCatalogue.id.in_(enabled_subq)).options(
|
||||
query = select(ServiceCatalogue).where(
|
||||
ServiceCatalogue.is_active.is_(True),
|
||||
~ServiceCatalogue.id.in_(enabled_subq),
|
||||
).options(
|
||||
selectinload(ServiceCatalogue.service_category),
|
||||
selectinload(ServiceCatalogue.default_task_templates),
|
||||
selectinload(ServiceCatalogue.due_date_rules),
|
||||
|
||||
Reference in New Issue
Block a user