docs: update context documentation with project architecture and database routing details
All checks were successful
Deploy Beta (NATIVE) / deploy (push) Successful in 23s
All checks were successful
Deploy Beta (NATIVE) / deploy (push) Successful in 23s
This commit is contained in:
parent
6ccacf7ad3
commit
d30ded3842
1 changed files with 43 additions and 3 deletions
46
context.txt
46
context.txt
|
|
@ -1,8 +1,48 @@
|
|||
seller central backend : /home/vignesh/github/seller_central_backend
|
||||
customer site backend : /home/vignesh/github/customerwebsitebackend
|
||||
|
||||
clear the following things
|
||||
=========================================
|
||||
PROJECTS ARCHITECTURE & SYSTEM KNOWLEDGE
|
||||
=========================================
|
||||
|
||||
Sales Performance , Quick Tasks , Admin System Audit Logs check those things and make
|
||||
sure it is not using mock data or dummy data display the real data ,
|
||||
1. PROJECT REPOSITORIES
|
||||
-----------------------
|
||||
* CRM Backend: /home/vignesh/github/crmbackend (Django)
|
||||
* CRM Frontend: /home/vignesh/github/crmfrontend (React SPA)
|
||||
* Seller Central Backend: /home/vignesh/github/seller_central_backend (Django)
|
||||
* Customer Website Backend: /home/vignesh/github/customerwebsitebackend (Django)
|
||||
|
||||
2. DATABASE ARCHITECTURE (PostgreSQL on EC2)
|
||||
---------------------------------------------
|
||||
The system is divided into five distinct PostgreSQL databases on the server:
|
||||
* `crmmanagement`: Contains Django auth, admin logs, and CRM central AuditLogs (`crm_auditlog`).
|
||||
* `sellerprofile`: Contains seller profiles (`api_supplierprofile`) and credentials (`auth_user`).
|
||||
* `productprofile`: Contains approved product listings (`api_product`) and submissions (`product_submissions`).
|
||||
* `customerprofile`: Contains user wallets (`api_wallet` & `api_wallettransaction`).
|
||||
* `customerwebsite`: Contains customer registrations (`orders_customerprofile`), orders (`orders_order`), and credentials (`auth_user`).
|
||||
|
||||
3. CRM DATABASE ROUTING (`db_router.py`)
|
||||
----------------------------------------
|
||||
In `crmbackend/digihoxbackend/db_router.py`, models are mapped as follows:
|
||||
* `default` -> default database (`crmmanagement`)
|
||||
* `seller_models.SupplierProfile` -> `seller_db` (`sellerprofile` database)
|
||||
* `seller_models.Product` -> `product_db` (`productprofile` database)
|
||||
* `seller_models.Wallet`/`WalletTransaction` -> `customer_db` (`customerwebsite` database)
|
||||
* `customer_models.CustomerProfile`/`Order` -> `customer_db` (`customerwebsite` database)
|
||||
|
||||
4. IMPORTANT MODEL MAPPINGS (Unmanaged Proxy Models)
|
||||
------------------------------------------------------
|
||||
To align with the production databases, CRM models are mapped to the actual tables:
|
||||
* `SupplierProfile` (unmanaged) -> `api_supplierprofile`
|
||||
- Name and Email are mapped to properties fetching dynamically from `auth_user` table in `seller_db`.
|
||||
* `Product` (unmanaged) -> `api_product` (with column `title` mapped to property `name`).
|
||||
- Status/is_active write operations are bypassed during saves since table lacks status columns.
|
||||
* `CustomerProfile` (unmanaged) -> `orders_customerprofile`
|
||||
- Name and Email fetched dynamically from `auth_user` in `customer_db`.
|
||||
- Customer status property is mapped to the `is_active` flag in customer website database credentials.
|
||||
* `Order` (unmanaged) -> `orders_order`.
|
||||
|
||||
5. CUSTOMER ACTION ACTIONS
|
||||
--------------------------
|
||||
* Banning/suspending customers executes `UPDATE auth_user SET is_active = False` in the `customer_db` database to disable customer site logins. Reinstating sets `is_active = True`.
|
||||
* Removing a seller deletes the profile from `api_supplierprofile` and deletes the login user record from `auth_user` inside `seller_db`.
|
||||
|
|
|
|||
Loading…
Reference in a new issue