feature: Added Transactions and major Order System Overhaul
This commit is contained in:
@@ -19,7 +19,7 @@ from firmware.router import router as firmware_router, ota_router
|
||||
from admin.router import router as admin_router
|
||||
from crm.router import router as crm_products_router
|
||||
from crm.customers_router import router as crm_customers_router
|
||||
from crm.orders_router import router as crm_orders_router
|
||||
from crm.orders_router import router as crm_orders_router, global_router as crm_orders_global_router
|
||||
from crm.comms_router import router as crm_comms_router
|
||||
from crm.media_router import router as crm_media_router
|
||||
from crm.nextcloud_router import router as crm_nextcloud_router
|
||||
@@ -64,6 +64,7 @@ app.include_router(admin_router)
|
||||
app.include_router(crm_products_router)
|
||||
app.include_router(crm_customers_router)
|
||||
app.include_router(crm_orders_router)
|
||||
app.include_router(crm_orders_global_router)
|
||||
app.include_router(crm_comms_router)
|
||||
app.include_router(crm_media_router)
|
||||
app.include_router(crm_nextcloud_router)
|
||||
@@ -88,6 +89,16 @@ async def email_sync_loop():
|
||||
print(f"[EMAIL SYNC] Error: {e}")
|
||||
|
||||
|
||||
async def crm_poll_loop():
|
||||
while True:
|
||||
await asyncio.sleep(24 * 60 * 60) # once per day
|
||||
try:
|
||||
from crm.service import poll_crm_customer_statuses
|
||||
poll_crm_customer_statuses()
|
||||
except Exception as e:
|
||||
print(f"[CRM POLL] Error: {e}")
|
||||
|
||||
|
||||
@app.on_event("startup")
|
||||
async def startup():
|
||||
init_firebase()
|
||||
@@ -96,6 +107,7 @@ async def startup():
|
||||
mqtt_manager.start(asyncio.get_event_loop())
|
||||
asyncio.create_task(db.purge_loop())
|
||||
asyncio.create_task(nextcloud_keepalive_loop())
|
||||
asyncio.create_task(crm_poll_loop())
|
||||
sync_accounts = [a for a in get_mail_accounts() if a.get("sync_inbound") and a.get("imap_host")]
|
||||
if sync_accounts:
|
||||
print(f"[EMAIL SYNC] IMAP configured for {len(sync_accounts)} account(s) - starting sync loop")
|
||||
|
||||
Reference in New Issue
Block a user