Overview
The User model represents registered users in the Tambo360 platform. Each user can own multiple establishments (dairy farms) and authenticate to access the system.TypeScript Definition
Fields
Unique identifier for the user. Auto-generated UUID.Database: Primary key, UUID format
User’s email address. Must be unique across the system.Constraints: UniqueUsage: Used for authentication and account verification
User’s hashed password.Security: Should be hashed using bcrypt or similar before storageNote: Never returned in API responses
User’s full name or display name.Constraints: Maximum 50 characters (VARCHAR(50))
Indicates whether the user has verified their email address.Default:
falseUsage: Restricts access until email verification is completedTimestamp when the user account was created.Default: Current timestampFormat: ISO 8601 datetime string
Relationships
Example Response
Usage Notes
Authentication
- The
correoandcontrasenafields are used for user login - Password should be hashed with bcrypt before comparison
verificadostatus should be checked before granting full access
Security Considerations
- Never expose the
contrasenafield in API responses - Always exclude password from SELECT queries when returning user data
- Implement rate limiting on authentication endpoints
Email Verification Flow
- User registers with
verificado: false - Verification token is created in
tokensrelation - Email is sent with verification link
- Upon verification,
verificadois set totrue
