Core Database Models
PharmaNet uses Prisma ORM to interact with a UUID-based PostgreSQL database hosted on Supabase, ensuring high data integrity and secure relationships.Profile (User) Model
The root model extending Supabase Auth’s user identity.id: UUID (Primary Key, matchesauth.users)email: User’s professional email addressrole: [admin, seller, dealer, customer]is_active: Boolean status for network participation
Seller & Dealer Models
Represents verified business entities on the network.id: UUID (Primary Key)user_id: Reference to the owner’s Profilestore_name: Registered business nameapproval_status: [pending, approved, rejected]business_license_url: Secure link to the uploaded verification documentrating: Aggregate seller trust metric (0-5)
Product & Category Models
The core pharmaceutical inventory management layer.Product: Stores medicine names, descriptions, pricing, and stock levels.Category: Hierarchical taxonomy for medicines (e.g., Antibiotics, Vitamins).Brand: Verified pharmaceutical manufacturers and manufacturers.is_boosted: Boolean flag for prioritized search visibility.
Variant & Combination Models
Handles complex pharmaceutical inventory variations.VariantOption: Pack sizes, concentrations, or dose formats.VariantCombination: The specific SKU-level inventory (price and stock for 10-tab vs 50-tab).
Communication & Order Models
Chat: Bidirectional channel between verified network members.Message: Secure text or file attachments (payment proofs).Order: Transaction record with order numbers and offline payment status.Payment: Manual verification of bank transfers and receipt uploads.
Enums & Logical Statuses
- Role:
admin,seller,dealer,customer - ApprovalStatus:
pending,approved,rejected - PaymentStatus:
pending,paid,refunded - OrderStatus:
pending,processing,shipped,delivered,cancelled
Relational Integrity
- Sellers own multiple Products.
- Products have multiple Variant Combinations.
- Orders are composed of multiple Order Items linked to specific Products.
- Chats involve multiple Participants (verified Profiles).