Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ProcesosAgilesUMSS/sansistore/llms.txt

Use this file to discover all available pages before exploring further.

SansiStore uses Cloud Firestore as its primary database — a NoSQL document store where data is organised into collections of documents. Each document is a map of typed fields. Some collections live at the top level of the database; others are subcollections nested directly beneath a parent document (e.g., inventory is a subcollection of each products document). The Firestore instance is hosted in southamerica-east1 and uses English names for all collections and fields.

Collections Overview

CollectionTypeDescription
usersTop-levelPlatform accounts and their roles
locationsTop-levelSaved delivery addresses per user
categoriesTop-levelProduct category taxonomy
productsTop-levelProduct catalogue entries
inventorySubcollection of productsStock levels per product
inventoryMovementsTop-levelAudit trail of every stock change
reviewsTop-levelBuyer product reviews
ordersTop-levelPurchase orders
orderItemsSubcollection of ordersLine items within an order
deliveriesTop-levelLast-mile delivery records
paymentsTop-levelPayment registrations and verifications
courierSessionsTop-levelDaily cash-collection sessions per courier
notificationsTop-levelIn-app notifications sent to users
settingsTop-levelPlatform-wide configuration
cartItemsTop-levelActive shopping cart items per user
favoritesTop-levelSaved / wishlisted products per user
accessLogsTop-levelLogin and access audit trail
sellerActivityLogsTop-levelSeller order-status change audit trail

Collection Schemas

users

Stores one document per registered user. The roles array drives all route guards and Firestore security rules.
FieldTypeDescription
uidstringFirebase Auth UID — matches the document ID
emailstringUser’s email address
displayNamestringFull display name from Google profile
phoneNumberstringContact phone number
rolesarray<string>Assigned roles: admin, vendedor, mensajero, operador_inv
institutionalIdstringUMSS institutional identifier
isActivebooleanWhether the account is currently active
createdBystringUID of the admin who created the account
createdAttimestampAccount creation timestamp

locations

Saved delivery addresses. Each document belongs to one user and can be marked as the default address for checkout.
FieldTypeDescription
locationIdstringDocument ID
userIdstringOwner’s Firebase Auth UID
labelstringHuman-readable label (e.g., “Casa”, “Oficina”)
typestringAddress type (e.g., home, work)
latnumberLatitude coordinate
lngnumberLongitude coordinate
isDefaultbooleanWhether this is the user’s default delivery address

categories

Top-level product categories managed by admins.
FieldTypeDescription
categoryIdstringDocument ID
namestringDisplay name of the category
activebooleanWhether the category is visible in the catalogue
createdBystringUID of the admin who created the category
createdAttimestampCreation timestamp

products

The core catalogue. Each product document has an inventory subcollection holding its stock record.
FieldTypeDescription
productIdstringDocument ID
categoryIdstringReference to the parent categories document
namestringProduct display name
slugstringURL-friendly identifier
descriptionstringFull product description
pricenumberBase price in local currency
imageUrlstringFirebase Storage URL for the product image
activebooleanWhether the product is listed in the catalogue
hasOfferbooleanWhether a promotional offer is currently active
offerPricenumberDiscounted price when hasOffer is true
soldCountnumberCumulative units sold (used for popularity sorting)
badgestringOptional label displayed on the product card (e.g., “Nuevo”, “Oferta”)
sourceUrlstringOptional external reference URL
Subcollection: products/{productId}/inventory — see inventory below.

inventory (subcollection of products)

One document per product, nested at products/{productId}/inventory/{productId}. Tracks real-time stock levels.
FieldTypeDescription
productIdstringMatches the parent product’s ID
stockTotalnumberTotal units ever received
stockAvailablenumberUnits available to sell right now
stockReservednumberUnits held against confirmed but undelivered orders
minStocknumberLow-stock threshold that triggers an alert
enabledbooleanWhether inventory tracking is active for this product

inventoryMovements

An append-only audit log of every stock entry, exit, adjustment, or incident. Written by inventory operators.
FieldTypeDescription
movementIdstringDocument ID
productIdstringReference to the affected product
operatorIdstringUID of the inventory operator who recorded the movement
typestringMovement type: entry, exit, adjustment, incident, etc.
reasonstringHuman-readable reason for the movement
quantitynumberNumber of units involved (positive for entries, negative for exits)
createdAttimestampWhen the movement was recorded

reviews

Buyer-submitted product reviews. Moderated by admins via the active flag.
FieldTypeDescription
reviewIdstringDocument ID
productIdstringReference to the reviewed product
authorNamestringDisplay name of the reviewer
ratingnumberStar rating (1–5)
commentstringReview text body
activebooleanWhether the review is publicly visible
createdAttimestampSubmission timestamp

orders

The central transaction record. One document per purchase, linking buyer, seller, payment, and delivery.
FieldTypeDescription
orderIdstringDocument ID
secretstringShort alphanumeric code used for delivery confirmation
buyerIdstringUID of the buyer
sellerIdstringUID of the seller managing the order
customerNamestringBuyer’s name at order time
customerPhonestringBuyer’s phone number at order time
addressstringDelivery address string
statusstringOrder lifecycle status (e.g., created, reserved, packaged, ready, failed)
incidentReasonstringReason text when the status reflects an incident or failure
totalnumberTotal order amount in local currency
locationIdstringReference to the buyer’s saved locations document
paymentStatusstringPayment state (e.g., pending, verified)
deliveryStatusstringDelivery state (e.g., assigned, in_transit, delivered)
deliveryIdstringReference to the associated deliveries document
paymentIdstringReference to the associated payments document
confirmedAttimestampWhen the order was confirmed by the seller
cancelledAttimestampWhen the order was cancelled (if applicable)
createdAttimestampOrder creation timestamp
updatedAttimestampLast modification timestamp
Subcollection: orders/{orderId}/orderItems — see orderItems below.

orderItems (subcollection of orders)

Line items within a single order. Stored as a subcollection at orders/{orderId}/orderItems/{itemId}.
FieldTypeDescription
itemIdstringDocument ID
productIdstringReference to the product at purchase time
productNamestringProduct name snapshotted at order time (preserved if the product is later edited)
unitPricenumberPrice per unit snapshotted at order time
quantitynumberNumber of units ordered
subtotalnumberunitPrice × quantity

deliveries

Tracks every last-mile delivery attempt from assignment through to outcome (delivered, failed, or reprogrammed).
FieldTypeDescription
deliveryIdstringDocument ID
orderIdstringReference to the associated order
courierIdstringUID of the assigned courier
statusstringDelivery status (e.g., assigned, picked_up, in_transit, delivered, failed, reprogrammed)
deliveryCodestringConfirmation code the buyer presents to the courier
attemptNumbernumberDelivery attempt counter (increments on reprogramming)
incidentReasonstringDescription of any incident during delivery
evidenceUrlstringFirebase Storage URL for delivery confirmation photo
failureReasonstringReason text if the delivery failed
amountCollectednumberCash amount collected on delivery (cash-on-delivery orders)
customerConfirmedbooleanWhether the customer confirmed receipt
customerConfirmedAttimestampWhen the customer confirmed receipt
assignedAttimestampWhen the courier was assigned
pickedUpAttimestampWhen the courier picked up the package
inTransitAttimestampWhen the courier marked the delivery in transit
deliveredAttimestampWhen the delivery was completed
failedAttimestampWhen the delivery was marked as failed
reprogrammedAttimestampWhen the delivery was reprogrammed
newDeliveryAttimestampScheduled date/time for the reprogrammed attempt
reprogramReasonstringReason for reprogramming the delivery
createdAttimestampRecord creation timestamp
updatedAttimestampLast modification timestamp

payments

Tracks payment registration and verification for each order.
FieldTypeDescription
paymentIdstringDocument ID
orderIdstringReference to the associated order
amountnumberPayment amount
methodstringPayment method: EFECTIVO, QR, TRANSFERENCIA, or TARJETA
statusstringPayment status: pending, verified, or rejected
registeredBystringUID of who registered the payment (seller or courier)
verifiedBystringUID of who verified the payment (admin or seller)
registeredAttimestampWhen the payment was first recorded
verifiedAttimestampWhen the payment was verified
updatedAttimestampLast modification timestamp

courierSessions

Represents a courier’s daily cash-collection session, used for end-of-day reconciliation.
FieldTypeDescription
sessionIdstringDocument ID
courierIdstringUID of the courier
totalCollectednumberTotal cash collected during the session
deliveriesCountnumberNumber of deliveries completed in the session
expectedAmountnumberAmount expected based on confirmed deliveries
differenceAmountnumbertotalCollected − expectedAmount (positive = overage, negative = shortage)
statusstringSession status: open, closed, or validated
openedAttimestampWhen the session was opened
closedAttimestampWhen the courier closed the session
validatedBystringUID of the admin or seller who validated the session
validatedAttimestampWhen the session was validated
updatedAttimestampLast modification timestamp

notifications

In-app notifications pushed to users when order or delivery events occur.
FieldTypeDescription
notificationIdstringDocument ID
userIdstringUID of the recipient
orderIdstringAssociated order (if applicable)
typestringNotification category (e.g., order_confirmed, delivery_assigned)
titlestringShort notification headline
messagestringFull notification body text
readbooleanWhether the user has seen the notification
createdAttimestampCreation timestamp
updatedAttimestampLast modification timestamp

settings

Platform-wide configuration. Typically contains one or a small number of singleton documents.
FieldTypeDescription
documentIdstringDocument ID (e.g., global)
reservationTimeLimitnumberMinutes before a reserved order auto-expires if not confirmed

cartItems

Persists each user’s shopping cart to Firestore so it survives page refreshes and device switches.
FieldTypeDescription
cartItemIdstringDocument ID
userIdstringUID of the cart owner
productIdstringReference to the product
quantitynumberNumber of units in the cart
updatedAttimestampLast time this cart item was modified

favorites

Stores products a user has saved to their wishlist.
FieldTypeDescription
favoriteIdstringDocument ID
userIdstringUID of the user who saved the product
productIdstringReference to the saved product
createdAttimestampWhen the product was added to favorites

accessLogs

Append-only log of authentication events (logins, logouts, access attempts). Used by admins for security auditing.
FieldTypeDescription
logIdstringDocument ID
uidstringFirebase Auth UID of the actor
displayNamestringDisplay name at the time of the event
emailstringEmail at the time of the event
rolesarray<string>Roles held at the time of the event
actionstringEvent type (e.g., login, logout, access_denied)
statusstringOutcome: success or failure
timestamptimestampWhen the event occurred

sellerActivityLogs

Records every seller-initiated status change on an order, providing a full audit trail for dispute resolution.
FieldTypeDescription
sellerIdstringUID of the seller who performed the action
sellerNamestringSeller’s display name at the time of the action
sellerEmailstringSeller’s email at the time of the action
actionTypestringType of action performed (e.g., status_change, offer_applied)
orderIdstringReference to the affected order
previousStatusstringOrder status before the action
newStatusstringOrder status after the action
timestamptimestampWhen the action was performed

Firestore security rules — the current firestore.rules file applies a broad allow rule to all collections (except paymentActivityLogs) that expires on 2027-05-25. Before that date, proper per-collection, per-role rules should be implemented. The paymentActivityLogs collection already has strict rules: only admins can read, any authenticated user can create (subject to a strict schema validation), and updates/deletes are permanently denied. See Roles & Permissions for the hasRole() helper used in the rules.

Build docs developers (and LLMs) love