Overview
TheRegistro interface is the primary data model in the application, representing individual seafood dishes with their details and ingredients. Each registro contains information about a dish including its name, photo, and a list of observations (ingredients or notes).
The term “Registro” (Spanish for “record” or “entry”) is used throughout the app to represent menu items or dishes.
Interface Definition
The Registro interface is defined insrc/app/home/home.model.ts:
src/app/home/home.model.ts
Properties
Unique identifier for the registro. Used for routing, deletion, and fetching specific records.Example:
"1", "2", "3"Name of the seafood dish in Spanish.Examples:
"Ceviche de Pescado""Cóctel de Camarón""Tacos de Pescado"
URL to the dish’s photo. Can be from external image services like Unsplash or Bing.Example:
"https://images.unsplash.com/photo-1535399831218-d5bd36d1a6b3?auto=format&fit=crop&w=500&q=60"Array of observations, typically listing ingredients or preparation notes for the dish.Example:
["Pescado fresco", "Limón", "Cebolla morada", "Chile serrano"]Example Data
Here are real examples from the app’s service layer (src/app/home/home.service.ts):
Usage in Components
HomePage Component
TheRegistro interface is used in the HomePage component to display a list of all available dishes:
src/app/home/home.page.ts
DetalleRegistroPage Component
The detail page uses theRegistro interface to display individual dish information:
src/app/home/detalle-registro/detalle-registro.page.ts
registroId.
Service Methods
TheRegistrosServiceTs provides several methods for working with Registro objects:
Type Safety
Using TypeScript’s interface ensures type safety throughout the application:Common Patterns
Spreading for Immutability
The service uses the spread operator to maintain immutability:Filtering Arrays
Deleting a registro creates a new filtered array:The
addRegistro() method exists in the service but is not yet implemented.Related Documentation
RegistrosService
Learn about service methods for managing registros
HomePage
See how registros are displayed in the list view
DetalleRegistro
Explore the detail view for individual registros
Architecture
Understand how models fit into the app architecture