Overview
This page documents all Firestore collections used in the Luis IT Repair application, including their structure, purpose, and usage patterns.Collections
autorizados
Purpose: Stores authorized users who can access the system. Access: Authenticated users only (read/write) Fields:- User authorization data
- Access permissions
servicios
Purpose: Manages repair service orders and their lifecycle. Access:- Read: Public (allows customers to check repair status)
- Write: Authenticated users only
folio: Unique service identifier (e.g., “IP-001”)clienteId: Reference to client inclientescollectionnombre,telefono,direccion: Customer contact informationtipoDispositivo: Device type (phone, laptop, etc.)marca,modelo: Device brand and modelnumeroSerie: Device serial numberomitirNumeroSerie: Boolean flag to skip serial numbertrabajo: Description of work to be performedprecioDespues: Boolean indicating if price is determined after diagnosisstatus: Current service status (e.g., “en_proceso”, “entregado”, “cancelado”)createdAt,updatedAt: Timestamps
The
servicios collection has public read access to allow customers to check their repair status without authentication.clientes
Purpose: Customer database with contact information and preferences. Access: Authenticated users only (read/write) Key Fields:nombre: Customer full namenombreNorm: Normalized name for searching (lowercase, no accents)nombreCompact: Compact name without spacestelefono: Phone numberdireccion: AddressnumeroSeriePreferido: Preferred serial number formatomitirNumeroSerie: Boolean to skip serial number requirementpuntos: Loyalty points balancecreatedAt,updatedAt: Timestamps
productos
Purpose: Inventory management for products and parts sold. Access: Authenticated users only (read/write) Key Fields:id: Product ID (stored within document)nombre: Product nameprecio: Sale pricestock: Current inventory quantitycodigo: Product code/SKU- Product metadata
ventas
Purpose: Sales transaction records from the POS system. Access: Authenticated users only (read/write) Key Fields:productos: Array of sold items with quantitiessubtotal: Subtotal amountiva: Tax amounttotal: Total sale amounttipoPago: Payment method (“efectivo”, “tarjeta”, “transferencia”)pagoDetalle: Breakdown for mixed paymentsefectivo: Cash amounttarjeta: Card amounttransferencia: Transfer amount
fechaKey: Date in YYYY-MM-DD format for daily aggregationtimestamp: Sale timestampclienteId: Optional customer reference
cortes_caja
Purpose: Daily cash register closing records. Access: Authenticated users only (read/write) Key Fields:fechaKey: Date key (YYYY-MM-DD)subtotal,iva,total: Daily totalsefectivo,tarjeta,transferencia,otros: Payment method breakdowntickets: Number of transactionsunidades: Total items soldtimestamp: Closing timestampempleadoId: Employee who performed the closing
folios
Purpose: Lookup index for service order folios (unique identifiers). Access: Authenticated users only (read/write) Key Fields:- Document ID: Folio key (e.g., “IP-001” stored as “IP-001”)
servicioId: Reference to document inservicioscollection- Metadata for quick folio lookup
servicios collection.
contadores_folio
Purpose: Maintains counters for generating sequential folio numbers. Access: Authenticated users only (read/write) Key Fields:- Document ID: Brand or category identifier
contador: Current counter value- Metadata for folio generation
egresos_diarios
Purpose: Daily expense tracking. Access: Authenticated users only (read/write) Key Fields:monto: Expense amountconcepto: Expense description/categoryfechaKey: Date key (YYYY-MM-DD)timestamp: Expense timestampempleadoId: Employee who recorded the expense
empleados
Purpose: Employee information and profiles. Access: Authenticated users only (read/write) Key Fields:- Employee personal information
- Role and permissions
- Activity tracking data
pos_mobile_scans
Purpose: Synchronization queue for mobile POS barcode scans. Access: Authenticated users only (read/write) Key Fields:- Scanned product data
- User ID
- Timestamp
- Sync status
This collection facilitates real-time synchronization between mobile barcode scanners and the desktop POS application.
Data Flow Example
Here’s how the collections work together in a typical repair service workflow:- Customer Check: Search
clientesby phone number - Create Service: Generate folio using
contadores_folio, create document inservicios, add entry tofoliosindex - Parts Sale: Update
productosinventory, createventasrecord - Daily Close: Query
ventasbyfechaKey, calculate totals, store incortes_caja - Status Tracking: Public users query
serviciosby folio to check repair status
Security Considerations
- Most collections require authentication for both read and write operations
- The
servicioscollection allows public reads to enable customer status lookups - All write operations require valid authentication tokens
- Security rules are defined in
firestore.rules
