User

data class User(val userUid: String, val firstName: String, val lastName: String? = null, val email: String, val empCode: String? = null, val designation: String? = null, val prefix: String? = null, val externalLoginId: String? = null, val profilePicture: String? = null, val hourlyLaborCharge: Double? = null, val isActive: Boolean = true, val role: UserRole? = null, val contacts: List<UserContact> = emptyList(), val skills: List<UserSkillSet>?, val teams: List<Team>?, val createdAt: String, val updatedAt: String, val syncedAt: String? = null)

Domain model representing a User in the Zuper system.

Users are employees who can be assigned to jobs, manage customers, and perform various operations within the system.

Constructors

Link copied to clipboard
constructor(userUid: String, firstName: String, lastName: String? = null, email: String, empCode: String? = null, designation: String? = null, prefix: String? = null, externalLoginId: String? = null, profilePicture: String? = null, hourlyLaborCharge: Double? = null, isActive: Boolean = true, role: UserRole? = null, contacts: List<UserContact> = emptyList(), skills: List<UserSkillSet>?, teams: List<Team>?, createdAt: String, updatedAt: String, syncedAt: String? = null)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val designation: String? = null
Link copied to clipboard

Get the display name with prefix if available.

Link copied to clipboard
Link copied to clipboard
val empCode: String? = null
Link copied to clipboard
val externalLoginId: String? = null
Link copied to clipboard
Link copied to clipboard

Get the full display name of the user.

Link copied to clipboard
Link copied to clipboard
val isActive: Boolean = true
Link copied to clipboard
val lastName: String? = null
Link copied to clipboard
val prefix: String? = null
Link copied to clipboard

Get the primary contact number (mobile preferred).

Link copied to clipboard
val profilePicture: String? = null
Link copied to clipboard
val role: UserRole? = null
Link copied to clipboard
Link copied to clipboard
val syncedAt: String? = null
Link copied to clipboard
val teams: List<Team>?
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

Get contact by type.

Link copied to clipboard
fun hasAnyRole(vararg roleKeys: String): Boolean

Check if user has any of the specified roles.

Link copied to clipboard
fun hasRole(roleKey: String): Boolean

Check if user has a specific role.

Link copied to clipboard

Convert User domain model to ZyncCreatedByUser. This extension function can be reused across the codebase wherever User → ZyncCreatedByUser conversion is needed.