The live state of the TradeScope operator platform — the 18-role access model, the new three-state permission matrix, CRM feature performance, and the full data model.
המצב החי של פלטפורמת המפעילים של TradeScope — מודל ההרשאות ב־18 תפקידים, מטריצת ההרשאות התלת־מצבית החדשה, ביצועי מודולי ה־CRM, ומודל הנתונים המלא.
f874b50 · migration 065
עודכן לאחרונה · 15 ביולי 2026 · בקאנד f874b50 · מיגרציה 065
The platform grew from 7 flat roles to the full forex-broker org taxonomy, with a reporting hierarchy and an org-chart view. Every endpoint gates on a permission slug, never on a role name — so a new role adapts navigation, routes, and the matrix editor automatically.
הפלטפורמה גדלה מ־7 תפקידים שטוחים למבנה הארגוני המלא של ברוקר פורקס, עם היררכיית דיווח ותצוגת עץ ארגוני. כל נקודת קצה נשלטת לפי הרשאה, לעולם לא לפי שם תפקיד — כך שתפקיד חדש מתאים אוטומטית את הניווט, המסלולים ועורך המטריצה.
| Department | מחלקה | Roles | תפקידים |
|---|---|---|---|
| Administration | ניהול־על | super_administrator · crm_administrator | |
| Sales chain | שרשרת מכירות | country_director · sales_director · sales_manager · team_leader · senior_sales_agent · sales_agent | |
| Retention | שימור | retention_manager · account_manager | |
| Growth | צמיחה | affiliate_manager · marketing_manager | |
| Risk & control | סיכון ובקרה | compliance_officer · finance_officer · risk_manager · qa_monitoring | |
| Support & audit | תמיכה וביקורת | customer_support · viewer_auditor |
The 5 legacy role strings (owner, admin, conversion_manager, agent, it_manager) are retained as working aliases — no live operator ever lost access. Global data scope is granted only to Super Administrator + CRM Administrator; everyone else sees their own manager_id subtree.
5 שמות התפקידים הישנים (owner, admin, conversion_manager, agent, it_manager) נשמרו ככינויים פעילים — אף מפעיל חי לא איבד גישה. גישה כלל־ארגונית לנתונים ניתנת רק ל־Super Administrator ול־CRM Administrator; כל השאר רואים את תת־העץ שלהם לפי manager_id.
Each cell in the owner-editable matrix is no longer on/off. It is one value on an ordered scope ladder, so a role can read a feed without being able to change it, or write only inside its own team.
כל תא במטריצה הניתנת לעריכה על ידי הבעלים כבר אינו כן/לא. הוא ערך אחד על סולם גישה מדורג, כך שתפקיד יכול לקרוא מסך בלי יכולת לשנות אותו, או לכתוב רק בתוך הצוות שלו.
Sample of the seeded defaults (owner-editable in /admin/roles):
דוגמה מברירות המחדל שהוזרעו (ניתנות לעריכה על ידי הבעלים ב־/admin/roles):
| Role | תפקיד | clients:view | clients:create | transactions:view | kyc:view |
|---|---|---|---|---|---|
| crm_administrator | Full | Full | Full | Full | |
| sales_manager | Full | Team | None | None | |
| sales_agent | Full | Team | None | None | |
| compliance_officer | View | None | View | View | |
| viewer_auditor | View | None | View | View |
The four new read-gates (Clients / Transactions / KYC / Recordings) are wired behind ENFORCE_VIEW_SLUGS, which ships off. With the flag off, live behaviour is byte-identical to before — no operator loses a feed. Turning it on is an explicit owner decision, after reviewing the matrix.
ארבעת שערי־הקריאה החדשים (לקוחות / עסקאות / KYC / הקלטות) מחווטים מאחורי ENFORCE_VIEW_SLUGS, שעולה כבוי. כשהדגל כבוי, ההתנהגות החיה זהה לחלוטין לקודם — אף מפעיל לא מאבד מסך. הדלקתו היא החלטה מפורשת של הבעלים, לאחר סקירת המטריצה.
The broker back-office is live across client management, money, calling, compliance, and trading. Status of the major modules:
מערך ה־Back-office של הברוקר פעיל לאורך ניהול לקוחות, כספים, חיוג, ציות ומסחר. סטטוס המודולים המרכזיים:
Full client records, phones directory, device/IP/VPN intelligence, stated-vs-verified identity checks, priority tiers, and a per-client risk cockpit (equity / margin / free / level with hedge-aware net exposure).
רשומות לקוח מלאות, ספריית טלפונים, מודיעין מכשיר/IP/VPN, בדיקות זהות מוצהרת מול מאומתת, דרגות עדיפות, ותא בקרת סיכון per-לקוח (הון / מרג'ין / פנוי / רמה עם חשיפה נטו מודעת־גידור).
Live visitor-presence board, follow-up watchlist for visitors who left before contact, conversion-manager Team view, and a native predictive dialer with daily number-health checks and a safety governor.
לוח נוכחות מבקרים חי, רשימת מעקב אחר מבקרים שעזבו לפני יצירת קשר, תצוגת Team למנהל המרות, וחייגן חיזוי מובנה עם בדיקות תקינות מספרים יומיות ומושל בטיחות.
Deposits/withdrawals ledger with approval gate, KYC document review with risk tiering, and sanctions/PEP screening seams. Compliance enforcement flags (ENFORCE_KYC_TIER, ENFORCE_CLIENT_AUTH) are staged dark, pending legal sign-off.
ספר הפקדות/משיכות עם שער אישור, סקירת מסמכי KYC עם דירוג סיכון, ותפרי סינון סנקציות/PEP. דגלי אכיפת הציות (ENFORCE_KYC_TIER, ENFORCE_CLIENT_AUTH) מוכנים חשוכים, ממתינים לאישור משפטי.
The AI opens and closes real book positions with honest quote-engine P&L, an event log, and a stop-all control. Real-broker execution (MT4/MT5/cTrader bridge) and a trading licence are the remaining gates before live money.
ה־AI פותח וסוגר פוזיציות אמיתיות בספר עם רווח/הפסד ממנוע ציטוט אמיתי, יומן אירועים, ובקרת עצירה מלאה. ביצוע מול ברוקר אמיתי (גשר MT4/MT5/cTrader) ורישיון מסחר הם השערים שנותרו לפני כסף אמיתי.
A detector engine watches every client for margin calls, stop-outs, equity drops, concentration, big deposits, unusual withdrawals, stale transactions, and inactivity — raising deduplicated alerts that auto-create prioritised rep tasks and bridge critical cases to escalations. Each client carries a composite risk score, an A–E rating, a churn likelihood, and behaviour flags, recomputed by a nightly job.
מנוע גלאים עוקב אחר כל לקוח למרג'ין קול, סטופ־אאוט, ירידות הון, ריכוזיות, הפקדות גדולות, משיכות חריגות, עסקאות תקועות וחוסר פעילות — ומעלה התראות ללא כפילות שיוצרות אוטומטית משימות נציג מתועדפות ומגשרות מקרים קריטיים לאסקלציות. כל לקוח נושא ציון סיכון מורכב, דירוג A–E, סבירות נטישה, ודגלי התנהגות, המחושבים מחדש במשימת לילה.
Fraud detectors flag multi-country logins, failed-login bursts, novel payment methods, and anonymous-network access. A real-time management dashboard rolls the whole book into live KPIs (deposits, volume, exposure, open alerts, rep performance, 14-day trends), all hierarchy-scoped. Every client has a unified timeline merging messages, calls, tasks, transactions, alerts, escalations, AI trades, and logins.
גלאי הונאה מסמנים כניסות ממדינות מרובות, מקבצי כניסות כושלות, אמצעי תשלום חדשים, וגישה מרשת אנונימית. לוח ניהול בזמן אמת מגלגל את כל הספר ל־KPI חיים (הפקדות, ווליום, חשיפה, התראות פתוחות, ביצועי נציגים, מגמות 14 יום), הכול בהיקף היררכי. לכל לקוח ציר זמן מאוחד המשלב הודעות, שיחות, משימות, עסקאות, התראות, אסקלציות, עסקאות AI, וכניסות.
A natural-language assistant answers rep questions with read-only tools scoped to the operator's own book, and an autonomous agent drafts messages, tasks, reminders, and CRM updates. Nothing customer-facing sends without a human approval click — the executor is reachable only from the approve endpoint. The provider is dual-seam: Gemini today, auto-preferring Claude the moment its key lands, with no code change.
עוזר בשפה טבעית עונה על שאלות נציגים עם כלי קריאה בלבד המוגבלים לספר של המפעיל, וסוכן אוטונומי מנסח הודעות, משימות, תזכורות, ועדכוני CRM. שום דבר מול הלקוח לא נשלח בלי קליק אישור אנושי — המבצע נגיש רק מנקודת האישור. הספק דו־תפרי: Gemini היום, ומעדיף אוטומטית את Claude ברגע שהמפתח שלו מגיע, ללא שינוי קוד.
Outbound CRM mail sends over the Resend HTTP API (:443). Render's free tier blocks outbound SMTP ports at the network level, so Gmail SMTP cannot connect from there; the stdlib SMTP path is kept as a dormant fallback for any future host that permits it, and send() prefers Resend whenever RESEND_API_KEY is set. Sender identity resolves per handling agent (migration 063): an agent with a stored, verified mailbox credential sends as their own address, so the client sees a real person and DKIM signs correctly. Without one, the send falls back to the shared noreply@ mailbox carrying the agent's display name and a Reply-To back to them. Every lookup is guarded and degrades one rung toward the company default, so personalisation can never turn a working email into a 500.
דואר CRM יוצא נשלח דרך Resend HTTP API (:443). השכבה החינמית של Render חוסמת פורטי SMTP יוצאים ברמת הרשת, ולכן Gmail SMTP לא מצליח להתחבר משם; נתיב ה־SMTP נשמר כגיבוי רדום עבור כל מארח עתידי שיאפשר זאת, ו־send() מעדיף את Resend בכל פעם ש־RESEND_API_KEY מוגדר. זהות השולח נפתרת לפי הסוכן המטפל (מיגרציה 063): סוכן עם אישורי תיבה מאומתים שמורים שולח מהכתובת שלו עצמו, כך שהלקוח רואה אדם אמיתי ו־DKIM חותם כראוי. בלעדיהם, השליחה נופלת לתיבת noreply@ המשותפת עם שם התצוגה של הסוכן ו־Reply-To חזרה אליו. כל שליפה מוגנת ויורדת שלב אחד לכיוון ברירת המחדל של החברה, כך שהתאמה אישית לעולם לא תהפוך אימייל תקין ל־500.
Migrations 064–065 add a brand layer: an agent sends as a permitted brand, and each client carries a default brand_id. Resolution precedence is explicit — a brand with its own verified mailbox authenticates as that mailbox and overrides the agent's, since "send as the brand" is the deliberate choice; a brand without one stamps its visible From over the shared transport; no brand at all delegates to the per-agent path above. Each brand also carries a company reference (director, address, regulation, registration, links) and a rebuttals library for reps. Ships behind BRANDS_ENABLED, which is off — with the flag off, brand resolution is a no-op and live behaviour is byte-identical to the per-agent design.
מיגרציות 064–065 מוסיפות שכבת מותג: סוכן שולח בשם מותג מורשה, וכל לקוח נושא brand_id ברירת מחדל. סדר העדיפויות מפורש — מותג עם תיבה מאומתת משלו מאמת מולה וגובר על זו של הסוכן, מכיוון ש"שלח בשם המותג" היא הבחירה המכוונת; מותג בלעדיה מטביע את כתובת ה־From הנראית שלו על גבי התעבורה המשותפת; היעדר מותג מאציל לנתיב הסוכן שלמעלה. כל מותג נושא גם מידע חברה (מנהל, כתובת, רגולציה, מספר רישום, קישורים) וספריית מענים לנציגים. נפרס מאחורי BRANDS_ENABLED, שנמצא כבוי — כשהדגל כבוי, פתרון המותג הוא no-op וההתנהגות החיה זהה לחלוטין לתכנון לפי סוכן.
Real ETF-style bond tickers (TLT, IEF, SHY, AGG, LQD) trade the same way as the existing stock class — fully wired through the signal engine, the CRM risk policy, and the trading terminal, with their own allocatable World in the trading plan alongside metals, currencies, and crypto.
טיקרי אג"ח בסגנון ETF אמיתיים (TLT, IEF, SHY, AGG, LQD) נסחרים באותו אופן כמו אפיק המניות הקיים — מחוברים במלואם דרך מנוע האותות, מדיניות הסיכון של ה־CRM, וטרמינל המסחר, עם עולם הקצאה משלהם בתוכנית המסחר לצד מתכות, מטבעות וקריפטו.
Clients can follow a master trader's positions, mirrored automatically at a fixed or proportional ratio. Every follower must give explicit digital consent in the client zone before mirroring starts — the subscription is refused otherwise, by design.
לקוחות יכולים לעקוב אחר פוזיציות של סוחר-מאסטר, המשוכפלות אוטומטית ביחס קבוע או פרופורציונלי. כל עוקב חייב לתת הסכמה דיגיטלית מפורשת באזור הלקוח לפני תחילת השכפול — אחרת המנוי נדחה, במכוון.
A chat assistant in the client zone answers account, transaction, KYC, ticket, and AI-trading questions using read-only tools scoped to that client's own identity. It refuses to give investment advice and offers a hand-off to a human instead; every conversation is logged for regulatory record-keeping.
עוזר צ'אט באזור הלקוח עונה על שאלות חשבון, עסקאות, KYC, פניות ומסחר AI, באמצעות כלי קריאה בלבד המוגבלים לזהות הלקוח עצמו. הוא מסרב לתת ייעוץ השקעות ומציע העברה לנציג אנושי במקום; כל שיחה נרשמת לצורכי תיעוד רגולטורי.
A dedicated cashier console runs deposits, withdrawals, and wallet transfers over a real double-entry ledger (hash-chained, append-only) that mirrors every legacy balance change and reconciles automatically. Withdrawals require dual (4-eyes) approval. The ledger is currently authoritative-in-shadow, running alongside the existing balances while a clean reconciliation record builds toward full cutover.
קונסולת קופה ייעודית מפעילה הפקדות, משיכות, והעברות ארנק דרך ספר חשבונות אמיתי בשיטת הכניסה הכפולה (משורשר בהאש, ללא מחיקה) המשקף כל שינוי יתרה קיים ומתאזן אוטומטית. משיכות דורשות אישור כפול (4 עיניים). הספר פועל כיום כ"צל" מוסמך, לצד היתרות הקיימות, בזמן שנבנה רקורד איזון נקי לקראת מעבר מלא.
A dedicated regulation console covers sanctions screening against a UN consolidated list mirror, AML risk scoring, a suspicious-transaction/MLRO workflow, a complaints register, an officer registry, a compliance calendar, monthly issued client statements, and data-subject export/erasure tools. Enforcement gates stay off pending the owner's licence data entry and legal sign-off.
קונסולת רגולציה ייעודית מכסה סינון סנקציות מול העתק רשימת האו"ם המאוחדת, ניקוד סיכון AML, תהליך עסקאות חשודות/MLRO, מרשם תלונות, מרשם בעלי תפקידים, לוח שנה רגולטורי, דוחות חודשיים ללקוחות, וכלי ייצוא/מחיקת נתונים. דגלי האכיפה נותרים כבויים עד להזנת נתוני הרישיון ואישור משפטי מבעל השליטה.
The admin home screen was redesigned around real 14-day KPI trend cards, a live WhatsApp/Telegram communications hub with quick reply, and a priority queue rendered as a real table with per-row next-action guidance.
מסך הבית לניהול עוצב מחדש סביב כרטיסי KPI עם מגמת 14 יום אמיתית, מרכז תקשורת חי לוואטסאפ/טלגרם עם תגובה מהירה, ותור עדיפויות המוצג כטבלה אמיתית עם הנחיית פעולה הבאה לכל שורה.
The live Supabase schema (70 tables). Relationships are application-level joins by id, client_id, or the shared identity / phone / email keys. Below are the core entities and how they connect, including the intelligence layer (migrations 051–060), the dealing desk (migrations 061–062), and the sender-identity layer (migrations 063–065).
סכמת ה־Supabase החיה (70 טבלאות). הקשרים הם joins ברמת האפליקציה לפי id, client_id, או מפתחות identity / טלפון / אימייל המשותפים. להלן הישויות המרכזיות וכיצד הן מתחברות, כולל שכבת האינטליגנציה (מיגרציות 051–060), שולחן הדילינג (מיגרציות 061–062), ושכבת זהות השולח (מיגרציות 063–065).
Relationships stay logical joins by shared keys — a deliberate choice for a fast-moving schema. The intelligence layer (migrations 051–060) keys on both identity (money / trading paths) and client_id (the CRM UUID), resolved in Python at write time, never SQL-joined. Critical client_alerts bridge to the existing escalations table without a schema change; agent_actions can only leave proposed through a human approval click. The dealing desk (migrations 061–062) adds a per-client / per-team risk policy that cascades, an immutable manager_actions audit log, and a nightly rollover_accruals swap ledger where a manager can skip, waive, or defer a night — deferred nights carry to close. Every desk command is scope-clamped in code to the manager's own subtree. The sender-identity layer (migrations 063–065) is keyed by operator_id and brand_id rather than the client keys: mailbox credentials are one-per-agent and one-per-brand (both PK-enforced), operator_brands is the many-to-many grant of which brands an agent may send as, and crm_clients.brand_id names the client's default brand. All five tables are currently empty — the layer is deployed but dark behind BRANDS_ENABLED.
הקשרים נשארים joins לוגיים לפי מפתחות משותפים — בחירה מכוונת לסכמה מתפתחת. שכבת האינטליגנציה (מיגרציות 051–060) ממופתחת גם ל־identity (נתיבי כספים / מסחר) וגם ל־client_id (ה־UUID של ה־CRM), שנפתרים ב־Python בזמן הכתיבה, לעולם לא ב־SQL join. התראות client_alerts קריטיות מתגשרות לטבלת escalations הקיימת ללא שינוי סכמה; agent_actions יכול לעזוב את מצב proposed רק דרך קליק אישור אנושי. שולחן הדילינג (מיגרציות 061–062) מוסיף פוליסת סיכון לכל לקוח / לכל צוות עם קסקדה, יומן ביקורת בלתי־ניתן־לשינוי manager_actions, ויומן swap לילי rollover_accruals שבו מנהל יכול לדלג, לוותר או לדחות לילה — לילות שנדחו נגבים בסגירה. כל פקודת שולחן חסומה בקוד לתת־עץ של המנהל בלבד. שכבת זהות השולח (מיגרציות 063–065) ממופתחת לפי operator_id ו־brand_id ולא לפי מפתחות הלקוח: אישורי תיבה הם אחד־לכל־סוכן ואחד־לכל־מותג (שניהם נאכפים ב־PK), operator_brands הוא הענקת ההרשאה רבים־לרבים של המותגים שסוכן רשאי לשלוח בשמם, ו־crm_clients.brand_id מציין את מותג ברירת המחדל של הלקוח. כל חמש הטבלאות ריקות כרגע — השכבה נפרסה אך חשוכה מאחורי BRANDS_ENABLED.
Decisions and hand-offs that need Ben before further enforcement. Nothing here blocks current live operation.
החלטות ומסירות הממתינות לבן לפני אכיפה נוספת. שום דבר כאן אינו חוסם את הפעילות החיה הנוכחית.
ENFORCE_VIEW_SLUGS is off. Flip it to make the four read-gates bite, after reviewing the matrix.ENFORCE_VIEW_SLUGS כבוי. הפעל אותו כדי שארבעת שערי־הקריאה ינשכו, לאחר סקירת המטריצה.BRANDS_ENABLED. All five brand tables are empty; brands must be seeded and agents granted before the flag means anything.BRANDS_ENABLED. כל חמש טבלאות המותגים ריקות; יש לזרוע מותגים ולהעניק הרשאות לסוכנים לפני שלדגל תהיה משמעות.operator_email_credentials (migration 063) is empty, so every send currently uses the shared sender. Agents need verified mailbox credentials stored before they send as themselves.operator_email_credentials (מיגרציה 063) ריקה, ולכן כל שליחה כרגע משתמשת בשולח המשותף. סוכנים צריכים אישורי תיבה מאומתים שמורים לפני שישלחו בשמם.ENFORCE_KYC_TIER / ENFORCE_CLIENT_AUTH stay dark until legal approves the tier limits and the client-auth enforcement.ENFORCE_KYC_TIER / ENFORCE_CLIENT_AUTH נשארים חשוכים עד שהמשפטית תאשר את מגבלות הדרגות ואת אכיפת אימות הלקוח.ENFORCE_SCOPED_READS and ENFORCE_RISK_POLICY are also off. Each is an independent owner decision, not a dependency of the others.ENFORCE_SCOPED_READS ו־ENFORCE_RISK_POLICY כבויים. כל אחד מהם החלטה עצמאית של הבעלים, לא תלות של האחרים.