All checks were successful
Deploy Beta (NATIVE) / deploy (push) Successful in 22s
72 lines
4.7 KiB
Text
72 lines
4.7 KiB
Text
seller central backend : /home/vignesh/github/seller_central_backend
|
|
customer site backend : /home/vignesh/github/customerwebsitebackend
|
|
|
|
=========================================
|
|
PROJECTS ARCHITECTURE & SYSTEM KNOWLEDGE
|
|
=========================================
|
|
|
|
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`), plus product categories (`products_category`).
|
|
|
|
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)
|
|
* `customer_models.Category` -> `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`.
|
|
- Mapped document keys: `aadhar_file`, `pan_file`, `aadhar_s3_key`, `pan_s3_key`.
|
|
* `Product` (unmanaged) -> `api_product` (with column `title` mapped to property `name`).
|
|
- Contains status and visibility fields mapping to `status` and `is_active`.
|
|
* `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.
|
|
* `Category` (unmanaged) -> `products_category` (with self-referencing `parent` ForeignKey mapping to `parent_id` for hierarchical subcategories).
|
|
* `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`.
|
|
|
|
6. DYNAMIC CATEGORIES MANAGEMENT
|
|
---------------------------------
|
|
* Categories can be created as parent categories or mapped as nested subcategories under parent nodes dynamically.
|
|
* Products can be mapped under categories/subcategories using a selector dropdown in the details overlay.
|
|
* Mapped categorizations are stored in the product's `category` column (string-based matching for compatibility).
|
|
|
|
7. LIST PAGINATION & PAGINATION CONTROLS
|
|
-----------------------------------------
|
|
* Integrated list pagination controls on Products, Sellers, Customers, and System Audit Logs pages.
|
|
* Supports dynamic page size selectors (5, 10, 20, 50, 100) and resets the current page automatically when filters or search queries change.
|
|
|
|
8. KYC DOCUMENT PREVIEW & DOWNLOAD
|
|
-----------------------------------
|
|
* Direct S3 download links are retrieved.
|
|
* Dynamic document previews are rendered using the Google Docs PDF Viewer.
|
|
* Preview requests are routed through a secure, public backend endpoint:
|
|
`/api/crm/sellers/documents/preview/?file=<filename>`
|
|
- Bypass authorization checking (`AllowAny`) to let Google Docs engines fetch the document stream.
|
|
- Generates secure S3 presigned URLs dynamically using `boto3` under bucket `supplier-docs` and region `eu-central-1` (Frankfurt) and redirects there to display the live file.
|
|
- Automatically falls back to serving a mock locally generated PDF/PNG document if AWS is not configured.
|