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:
@@ -4,6 +4,7 @@ from typing import Optional, List
|
||||
from app.database import get_db
|
||||
from app.services.product import ProductService
|
||||
from app.services import export
|
||||
from app.services.usage import UsageService
|
||||
from app.api.v1.deps import get_current_user_id
|
||||
from pydantic import BaseModel
|
||||
import io
|
||||
@@ -175,8 +176,13 @@ async def create_product(
|
||||
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_product")
|
||||
if not ok:
|
||||
raise HTTPException(status_code=429, detail=msg)
|
||||
service = ProductService(db)
|
||||
product = await service.create_product(user_id, data.dict())
|
||||
await usage.record_usage(user_id, "create_product")
|
||||
return product
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user