mirror of
https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools.git
synced 2026-06-18 15:29:36 +00:00
Phase 1 - Repo Hardening: - README.md, LICENSE, SECURITY.md, CONTRIBUTING.md - GitHub Actions repo-hygiene workflow - docs/: ARCHITECTURE, DATA-MODEL, API-MAP, AGENT-MAP, DEPLOYMENT-NOTES Phase 2 - Database Models (7 new): - Company, Contact, Call, Commission, Payout, Dispute, GuaranteeClaim - Consent, Complaint, Policy, KnowledgeArticle, SectorAsset - Updated models/__init__.py with all 32+ models Phase 3 - API Surfaces (16 new route files): - companies, contacts, calls, meetings, commissions, payouts - disputes, guarantees, consents, complaints, knowledge - sectors, presentations, supervisor, admin, health - Updated router.py with all 24 route groups Phase 4 - AI Prompt Registry (18 agent contracts): - Lead Qualification, Affiliate Recruitment Evaluator, Onboarding Coach - Outreach Writer, Arabic WhatsApp, English Conversation, Voice Call - Meeting Booking, Sector Strategist, Objection Handler - Proposal Drafter, QA Reviewer, Compliance Reviewer - Knowledge Retrieval, Revenue Attribution, Fraud Reviewer - Guarantee Claim Reviewer, Management Summary Phase 5 - Communication Templates: - 15 production templates (WhatsApp, email, voice, internal) - Arabic + English variants with variable interpolation Phase 6 - Compliance Center (7 legal docs): - Privacy policy, Terms of service, Refund policy - Commission policy, Affiliate rules, Consent policy, Data protection - All PDPL-compliant, Arabic Phase 7 - Celery Workers (fully implemented): - follow_up_tasks: automated lead follow-ups with workflow execution - message_tasks: WhatsApp/email/SMS with retry logic - notification_tasks: daily reports, meeting reminders, in-app notifications - affiliate_tasks: target checking, commission calculation, weekly reports, AI outreach Phase 8 - Knowledge Base OS (8 files): - Services overview, Pricing policy, Channel policy, Meeting policy - Identity rules, Escalation rules, Hiring path, Internal SOPs https://claude.ai/code/session_01KnJgK7RwyeCvRZTRThHtfU
66 lines
2.6 KiB
Python
66 lines
2.6 KiB
Python
import enum
|
|
from datetime import datetime, timezone
|
|
from sqlalchemy import Column, String, Float, Integer, Text, DateTime, Enum, ForeignKey
|
|
from sqlalchemy.dialects.postgresql import UUID
|
|
from sqlalchemy.orm import relationship
|
|
from app.models.base import TenantModel, BaseModel
|
|
|
|
|
|
class CommissionStatus(str, enum.Enum):
|
|
DRAFT = "draft"
|
|
PENDING = "pending"
|
|
APPROVED = "approved"
|
|
HELD = "held"
|
|
PAID = "paid"
|
|
REJECTED = "rejected"
|
|
DISPUTED = "disputed"
|
|
CLAWBACK = "clawback"
|
|
|
|
|
|
class PayoutStatus(str, enum.Enum):
|
|
PENDING = "pending"
|
|
PROCESSING = "processing"
|
|
PAID = "paid"
|
|
FAILED = "failed"
|
|
|
|
|
|
class Commission(TenantModel):
|
|
__tablename__ = "commissions"
|
|
|
|
affiliate_id = Column(UUID(as_uuid=True), ForeignKey("affiliate_marketers.id"), nullable=False, index=True)
|
|
deal_id = Column(UUID(as_uuid=True), ForeignKey("deals.id"), nullable=False, index=True)
|
|
payout_id = Column(UUID(as_uuid=True), ForeignKey("payouts.id"), nullable=True)
|
|
amount = Column(Float, nullable=False)
|
|
rate = Column(Float, nullable=False)
|
|
plan_type = Column(String(50), nullable=True)
|
|
status = Column(Enum(CommissionStatus), default=CommissionStatus.DRAFT, nullable=False)
|
|
approved_by = Column(UUID(as_uuid=True), ForeignKey("users.id"), nullable=True)
|
|
approved_at = Column(DateTime(timezone=True), nullable=True)
|
|
held_reason = Column(Text, nullable=True)
|
|
paid_at = Column(DateTime(timezone=True), nullable=True)
|
|
payment_reference = Column(String(100), nullable=True)
|
|
dispute_id = Column(UUID(as_uuid=True), ForeignKey("disputes.id"), nullable=True)
|
|
notes = Column(Text, nullable=True)
|
|
|
|
affiliate = relationship("AffiliateMarketer")
|
|
deal = relationship("Deal")
|
|
payout = relationship("Payout", back_populates="commissions")
|
|
approved_user = relationship("User", foreign_keys=[approved_by])
|
|
|
|
|
|
class Payout(BaseModel):
|
|
__tablename__ = "payouts"
|
|
|
|
affiliate_id = Column(UUID(as_uuid=True), ForeignKey("affiliate_marketers.id"), nullable=False, index=True)
|
|
total_amount = Column(Float, nullable=False)
|
|
commissions_count = Column(Integer, default=0)
|
|
status = Column(Enum(PayoutStatus), default=PayoutStatus.PENDING, nullable=False)
|
|
bank_name = Column(String(100), nullable=True)
|
|
bank_account = Column(String(50), nullable=True)
|
|
paid_at = Column(DateTime(timezone=True), nullable=True)
|
|
payment_reference = Column(String(100), nullable=True)
|
|
notes = Column(Text, nullable=True)
|
|
|
|
affiliate = relationship("AffiliateMarketer")
|
|
commissions = relationship("Commission", back_populates="payout")
|