TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/interezante456-pixel/nuevo-proyecto-viernes/llms.txt
Use this file to discover all available pages before exploring further.
Cliente entity represents a customer who appears on a sale receipt. Every Venta must be linked to a client record; for anonymous walk-in purchases where no customer details are collected, the system automatically assigns the seeded Público General placeholder (ID = 1). Clients with a valid RUC are required when issuing a Factura. The entity is exposed through the AppDbContext.Clientes DbSet and holds a one-to-many relationship with Venta — a single customer may have an unlimited sale history.
Properties
Primary key. Auto-generated by the database using
DatabaseGeneratedOption.Identity. Annotated with [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]. ID 1 is reserved for the seeded Público General client and must never be deleted.The customer’s given name(s). Annotated with
[Required, StringLength(50)] — maximum 50 characters. Validated against the regex ^[a-zA-ZáéíóúÁÉÍÓÚñÑüÜ\s]+$: only Unicode letters (including Spanish accented characters) and whitespace are allowed; digits and special characters are rejected.The customer’s surname(s). Annotated with
[Required, StringLength(50)] — maximum 50 characters. Subject to the same letter-only regex as Nombres.Classifies the identity document number provided. Annotated with
[Required, StringLength(10)]. Accepted values are:"DNI"— Peruvian national identity card (8-digit number)."RUC"— Peruvian tax identification number (11-digit number starting with10or20).
NumeroDocumento to enforce the correct format at the UI level.The actual document number string. Annotated with
[Required, StringLength(11)] and validated by a [RegularExpression] — see Document Type Validation below. Maximum 11 characters (the length of a RUC).Peruvian mobile phone number. Annotated with
[Required, StringLength(9)] and validated by a [RegularExpression] — see Document Type Validation below. Exactly 9 characters in the stored form (no country code, no spaces).Optional email address. Annotated with
[StringLength(100)] — maximum 100 characters. May be null. Not used as a login credential (that role belongs to Usuario.CorreoUsuario).Optional physical address. Annotated with
[StringLength(200)] — maximum 200 characters. May be null. Printed on Factura receipts when present.Inverse navigation collection of all
Venta records associated with this client. Nullable — not loaded unless .Include(c => c.Ventas) is used. Useful for producing a customer purchase history report.Document Type Validation
Both identity document and phone number fields are validated using[RegularExpression] data annotations directly on the model, so they are enforced both client-side (via unobtrusive jQuery validation) and server-side (via ModelState.IsValid).
NumeroDocumento
| Format | Pattern | Example | Description | |
|---|---|---|---|---|
| DNI | ^\d{8}$ | 12345678 | Exactly 8 decimal digits. | |
| RUC | `^(10 | 20)\d$` | 20512345678 | Exactly 11 decimal digits, prefix must be 10 or 20. |
Telefono
- Starts with
9— mandatory for Peruvian mobile numbers. - Exactly 9 digits total —
9followed by 8 more decimal digits (9\d{8}). - No all-same-digit strings — the negative lookahead
(?!(\d)\1{8})rejects inputs where all 9 digits are identical (e.g.,999999999,911111111), preventing placeholder numbers from being accepted.
Default Client
A Público General client is seeded byAppDbContext.OnModelCreating and is always present in the database:
| Field | Seeded Value |
|---|---|
ID_Cliente | 1 |
Nombres | Público |
Apellidos | General |
TipoDocumento | DNI |
NumeroDocumento | 00000000 |
Telefono | 900000000 |
Correo | publico@general.com |
Direccion | Tienda Principal |
VentaController assigns Cliente_ID = 1 automatically. This ensures every Venta row satisfies the non-nullable foreign key constraint without requiring the cashier to register an anonymous customer each time.
Relationships
One-to-many relationship configured in A
AppDbContext.OnModelCreating:Cliente may appear on zero or more Venta records. Deleting a client that has associated sales is not permitted by default due to the foreign key constraint — deactivate the client or reassign their sales instead.