Oasis Liquido’s Backend uses SQLite as its database engine, managed through Prisma ORM. The database file lives on disk at the path set by theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/FlasheyEstudi/Oasis-Liquido/llms.txt
Use this file to discover all available pages before exploring further.
DATABASE_URL environment variable, requiring no separate database server in development or single-server production deployments. Prisma generates a fully-typed client from the schema, which the Next.js API routes import directly. The schema organises its 16+ models into five domains: identity and role profiles, clinical workflows (clinics, appointments, prescriptions), pharmacy and inventory, sales and delivery logistics, and platform audit logging.
Core models
| Model | Key fields | Purpose |
|---|---|---|
User | id, email, passwordHash, name, role, isActive, emailVerified | Central identity record for every person in the system; role drives access control |
PatientProfile | userId, dateOfBirth, bloodType, allergies, medicalNotes | Medical details attached to users with role patient |
DoctorProfile | userId, clinicId, specialty, licenseNumber | Clinic assignment and credentials for users with role doctor |
Appointment | id, patientId, doctorId, clinicId, dateTime, durationMinutes, status, cancellationReason | Scheduled consultation between a patient and doctor at a clinic |
Prescription | id, patientId, doctorId, clinicId, appointmentId, status, qrCode, expirationDate, fulfilledPharmacyId | Doctor-issued medication order linked to an appointment; carries a unique QR code for pharmacy scanning |
PrescriptionLine | id, prescriptionId, medicineId, quantity, dosageInstructions, quantityFulfilled | Single medicine line within a prescription |
Pharmacy | id, name, address, latitude, longitude, deliveryFee, isActive | Physical pharmacy location that holds inventory and processes sales |
Medicine | id, name, genericName, dosageForm, concentration, requiresPrescription, isActive | Catalogue entry for a drug or medical product |
Inventory | id, pharmacyId, medicineId, quantity, minStock, unitPrice, batchNumber, expirationDate | Stock record for one medicine at one pharmacy; unique per (pharmacyId, medicineId) pair |
InventoryMovement | id, inventoryId, userId, type, quantityChange, reason | Immutable ledger entry recording every stock change (restock, sale, adjustment, in, out) |
Sale | id, pharmacyId, patientId, prescriptionId, appointmentId, isDelivery, deliveryAddress, totalAmount, status | Purchase transaction at a pharmacy or clinic; spawns a DeliveryOrder when isDelivery is true |
SaleItem | id, saleId, medicineId, quantity, unitPrice | Line item within a sale |
DeliveryOrder | id, saleId, pharmacyId, patientId, deliveryDriverId, status, pickupAddress, deliveryAddress, assignedAt, pickedUpAt, deliveredAt | End-to-end delivery job linked to a sale; driver location is tracked via DeliveryRoute |
DeliveryRoute | id, deliveryOrderId, driverLat, driverLng, recordedAt | GPS waypoint snapshot appended during active transit |
AuditLog | id, userId, action, entityType, entityId, details, ipAddress, userAgent | Append-only log of critical platform events; never updated or deleted |
RefreshToken | id, userId, tokenHash, expiresAt, revokedAt | Hashed refresh token stored server-side; revoked on logout or rotation |
DB setup commands
Set the DATABASE_URL environment variable
Prisma reads the database path from
DATABASE_URL. Create a .env file in the Backend directory or export the variable in your shell: