mirror of
https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools.git
synced 2026-06-17 23:09:35 +00:00
feat: Merge VoXc2/dealix models — APIKey + AppSetting + deployment guide
Merged from VoXc2/dealix repository: - api_key.py: APIKey model (hash, prefix, permissions, rate limit, expiry) + AppSetting model (key-value config with typed values) - Both adapted to TenantModel (multi-tenant) + added Arabic fields - Registered in models/__init__.py This closes the "API key management" gap from the gap analysis. Also includes production deployment guide with step-by-step instructions for going from code to live product (~283 SAR/month operating cost). https://claude.ai/code/session_01LsnvBa7HwF5hs99VZbgLGj
This commit is contained in:
parent
5012925912
commit
89bffbed40
@ -26,6 +26,7 @@ from app.models.advanced import TrustScore, Prospect, Scorecard, AIRehearsal
|
||||
from app.models.consent import PDPLConsent, PDPLConsentAudit, DataRequest
|
||||
from app.models.sequence import Sequence, SequenceStep, SequenceEnrollment, SequenceEvent
|
||||
from app.models.strategic_deal import CompanyProfile, StrategicDeal, DealMatch
|
||||
from app.models.api_key import APIKey, AppSetting
|
||||
|
||||
__all__ = [
|
||||
"BaseModel", "TenantModel", "Tenant", "User", "Lead", "Customer",
|
||||
|
||||
44
salesflow-saas/backend/app/models/api_key.py
Normal file
44
salesflow-saas/backend/app/models/api_key.py
Normal file
@ -0,0 +1,44 @@
|
||||
"""
|
||||
API Key Model — Dealix AI Revenue OS
|
||||
Manages API keys for external integrations and developer access.
|
||||
Adapted from VoXc2/dealix repository.
|
||||
"""
|
||||
from datetime import datetime
|
||||
from sqlalchemy import String, Boolean, DateTime, ForeignKey, Integer, Text
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from app.models.base import TenantModel
|
||||
|
||||
|
||||
class APIKey(TenantModel):
|
||||
__tablename__ = "api_keys"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True, index=True)
|
||||
name: Mapped[str] = mapped_column(String(100), nullable=False)
|
||||
name_ar: Mapped[str | None] = mapped_column(String(100))
|
||||
key_hash: Mapped[str] = mapped_column(String(255), unique=True, nullable=False)
|
||||
key_prefix: Mapped[str] = mapped_column(String(20), nullable=False)
|
||||
permissions: Mapped[str | None] = mapped_column(Text) # JSON: ["read_leads", "write_deals"]
|
||||
last_used_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True))
|
||||
request_count: Mapped[int] = mapped_column(Integer, default=0)
|
||||
rate_limit: Mapped[int] = mapped_column(Integer, default=1000) # per hour
|
||||
is_active: Mapped[bool] = mapped_column(Boolean, default=True)
|
||||
expires_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True))
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=datetime.utcnow)
|
||||
created_by: Mapped[int | None] = mapped_column(ForeignKey("users.id"))
|
||||
|
||||
|
||||
class AppSetting(TenantModel):
|
||||
__tablename__ = "app_settings"
|
||||
|
||||
key: Mapped[str] = mapped_column(String(100), primary_key=True)
|
||||
value: Mapped[str | None] = mapped_column(Text)
|
||||
value_type: Mapped[str] = mapped_column(String(20), default="string") # string, int, bool, json
|
||||
description: Mapped[str | None] = mapped_column(Text)
|
||||
description_ar: Mapped[str | None] = mapped_column(Text)
|
||||
is_public: Mapped[bool] = mapped_column(Boolean, default=False)
|
||||
updated_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True),
|
||||
default=datetime.utcnow,
|
||||
onupdate=datetime.utcnow,
|
||||
)
|
||||
Loading…
Reference in New Issue
Block a user