Add landing page, referral system, usage quotas, search API management, and yearly pricing

- Separate workspace landing from login for better UX
- Referral system rewards both parties with Pro days
- Quota enforcement prevents abuse without breaking endpoints
- 7-day free trial with auto-downgrade on expiry
- Admin-managed search provider config (SearXNG, Bing)
- 15% discount on annual subscriptions
- MCP search server wrapping opencode search
- Fix discovery module field name mismatch causing 422
This commit is contained in:
TradeMate Dev
2026-05-26 11:40:13 +08:00
parent 52dba37f22
commit bed5c7abef
39 changed files with 1988 additions and 152 deletions
+6
View File
@@ -5,6 +5,7 @@ from app.database import get_db
from app.services.customer import CustomerService
from app.services.customer_health import CustomerHealthService
from app.services.import_service import import_service
from app.services.usage import UsageService
from app.services import export
from app.core.security import decode_token
from app.api.v1.deps import get_current_user_id
@@ -98,8 +99,13 @@ async def create_customer(
user_id: str = Depends(get_current_user_id),
db: AsyncSession = Depends(get_db),
):
usage = UsageService(db)
ok, msg = await usage.check_quota(user_id, "create_customer")
if not ok:
raise HTTPException(status_code=429, detail=msg)
service = CustomerService(db)
customer = await service.create_customer(user_id, data)
await usage.record_usage(user_id, "create_customer")
return customer