Models
Info_schema.py
Defines a SQLAlchemy model for the OrderInfo table:
- order_info_id: Unique identifier for each order info entry.
- order_id: Foreign key referencing the 'order_id' in the 'orders' table.
- count_of_vendor: Stores the number of vendors.
- count_of_output_vendor: Stores the number of output vendors.
- price: Stores the price of an order.
- price2: Secondary price of an order.
- invalid_vendors: Stores the number of invalid vendors.
- duplicate_vendors: Stores the number of duplicate vendors.
- udyam_registered, udyog_registered, not_registered: Store the number of MSME-registered, udyog-registered, and non-registered vendors.
- active, strike_off, others: Store information related to struck-off vendors.
- active, inactive, cancelled: Store GST status information.
- updated_at: Timestamp for the last update.
- order: Relationship with the
Orderclass. - micro, small, medium, not_an_msme: Store counts of micro, small, medium, and non-MSME vendors.
Order_schema.py
Defines a SQLAlchemy model for the orders table:
- order_id: Uniquely identifies an order.
- input_file_url, output_file_url, invoice_file_url, invalid_file_url, fuzzy_file_url: URLs of associated files.
- date_of_creation, date_of_delivery, expected_date_of_delivery: Dates related to the order lifecycle.
- file_name, default_file_name: Names of associated files.
- status, payment_status: Status of the order and payment.
- type, sub_type: Type and sub-type of the order.
- is_mark_important, is_order_process_start, enable_order_download: Boolean flags indicating order processing states.
- updated_at: Last updated timestamp.
- user_id, org_id: IDs for the user and organization.
- payment_type: Type of payment made.
- order_info: Relationship with the
OrderInfotable.
Price_schema.py
Defines a SQLAlchemy model for the Contact Sales for Price table:
- id: Primary key, UUID string (max length: 100).
- user_id, org_id, type, sub_type: Metadata about the request (non-nullable).
- date_of_requested: Date/time of the request (default: current datetime).
- vendor_count_range, lower_price, price: Pricing details (non-nullable).
- price2: Optional secondary price.
- comment, sales_person_name: Additional context and user.
- payment_type: Type of payment (default: PREPAID).
- created_at, updated_at: Timestamps (default: current datetime).
- is_contact_sales, is_price_expired: Boolean flags indicating validity and expiration.
Base.py
Defines the base class Base for all SQLAlchemy models.
Django_db
Django_db_base.py
- Base configuration for Django DB.
- Imports environment variables from
.env. - Sets up the SQLAlchemy database engine.
- Defines
DjangoSessionLocalandDjango_Basefor DB interaction.
Django_db_models.py
Defines DB models using Django_Base.
User
- id: Primary key.
- email, username, first_name, last_name: User details (non-nullable).
- profile: Relationship to
UserProfile.
UserProfile
- id: Primary key.
- user_id: Foreign key to
User. - title, dob, address, phone_number, country, city, state, zip: Profile details.
- user: Relationship to
User.
Organization
- id: Primary key.
- is_active: Status flag.
- name: Organization name.
Django_db_service.py
- Service layer for DB interaction.
- Fetches and manipulates data using models from
django_db_models.py.