User Model
The User model represents a customer account in the LuxMart platform.
Structure
{
"id": 1,
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@example.com",
"phone": "+994501234567",
"profile_photo": "https://...",
"preferred_language": "AZERBAIJANI",
"role": "1",
"created": "2025-01-15T10:30:00Z"
}
Fields
| Field |
Type |
Description |
Notes |
id |
integer |
Unique identifier |
Auto-increment, primary key |
first_name |
string |
User's first name |
Required |
last_name |
string |
User's last name |
Required |
email |
string |
User's email address |
Required, unique, validated |
phone |
string |
User's phone number |
Required, validated format |
profile_photo |
string |
URL to profile photo |
Stored in S3, optional |
preferred_language |
string |
Preferred language code |
One of: "AZERBAIJANI", "ENGLISH", "SPANISH", "GERMAN" |
role |
string |
User role |
"1" = User, "2" = Admin |
is_active |
boolean |
Account activation status |
false until OTP verified |
is_deleted |
boolean |
Soft delete flag |
Default: false |
created |
datetime |
Account creation timestamp |
Auto-generated |
updated |
datetime |
Last update timestamp |
Auto-updated |
Internal Fields (Not Returned in API)
| Field |
Type |
Description |
password |
string |
Hashed password |
otp |
string |
One-time password for verification |
Role Values
"1" - User (regular customer)
"2" - Admin (administrator)
Preferred Language Values
"AZERBAIJANI" - Azerbaijani (az)
"ENGLISH" - English (en)
"SPANISH" - Spanish (es)
"GERMAN" - German (de)
Relationships
- UserTokenModel: One-to-many relationship with authentication tokens
- AddressModel: One-to-many relationship with shipping addresses
- ProductVariantBasketModel: One-to-many relationship with basket items
- ProductVariantWishlistModel: One-to-many relationship with wishlist items
- OrderModel: One-to-many relationship with orders
- PaymentModel: One-to-many relationship with payments
Notes
- Password is hashed using bcrypt before storage
- Email must be unique across all users
- Account must be activated (
is_active: true) to login
- Soft deleted users cannot login or be retrieved
- Profile photo is stored in AWS S3